Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ui/test/ui.c

    rf7a90df r252d03c  
    3535PCUT_TEST_SUITE(ui);
    3636
    37 /** Create and destroy UI */
    38 PCUT_TEST(create_destroy)
     37/** Create and destroy UI with display */
     38PCUT_TEST(create_disp_destroy)
    3939{
    4040        ui_t *ui = NULL;
     
    4949}
    5050
     51/** Create and destroy UI with console */
     52PCUT_TEST(create_cons_destroy)
     53{
     54        ui_t *ui = NULL;
     55        errno_t rc;
     56
     57        rc = ui_create_cons(NULL, &ui);
     58        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     59        PCUT_ASSERT_NOT_NULL(ui);
     60        PCUT_ASSERT_NULL(ui->console);
     61
     62        ui_destroy(ui);
     63}
     64
    5165/** ui_destroy() can take NULL argument (no-op) */
    5266PCUT_TEST(destroy_null)
     
    5569}
    5670
     71/** ui_run() / ui_quit() */
     72PCUT_TEST(run_quit)
     73{
     74        ui_t *ui = NULL;
     75        errno_t rc;
     76
     77        rc = ui_create_disp(NULL, &ui);
     78        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     79        PCUT_ASSERT_NOT_NULL(ui);
     80
     81        /* Set exit flag */
     82        ui_quit(ui);
     83
     84        /* ui_run() should return immediately */
     85        ui_run(ui);
     86
     87        ui_destroy(ui);
     88}
     89
     90/** ui_paint() */
     91PCUT_TEST(paint)
     92{
     93        ui_t *ui = NULL;
     94        errno_t rc;
     95
     96        rc = ui_create_cons(NULL, &ui);
     97        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     98        PCUT_ASSERT_NOT_NULL(ui);
     99
     100        /* In absence of windows ui_paint() should just return EOK */
     101        rc = ui_paint(ui);
     102        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     103
     104        ui_destroy(ui);
     105}
     106
     107/** ui_is_textmode() */
     108PCUT_TEST(is_textmode)
     109{
     110        ui_t *ui = NULL;
     111        errno_t rc;
     112
     113        rc = ui_create_disp((display_t *)(-1), &ui);
     114        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     115        PCUT_ASSERT_NOT_NULL(ui);
     116
     117        PCUT_ASSERT_FALSE(ui_is_textmode(ui));
     118
     119        ui_destroy(ui);
     120
     121        rc = ui_create_cons((console_ctrl_t *)(-1), &ui);
     122        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     123        PCUT_ASSERT_NOT_NULL(ui);
     124
     125        PCUT_ASSERT_TRUE(ui_is_textmode(ui));
     126
     127        ui_destroy(ui);
     128}
     129
     130/** ui_is_fullscreen() */
     131PCUT_TEST(is_fullscreen)
     132{
     133        ui_t *ui = NULL;
     134        errno_t rc;
     135
     136        rc = ui_create_disp((display_t *)(-1), &ui);
     137        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     138        PCUT_ASSERT_NOT_NULL(ui);
     139
     140        PCUT_ASSERT_FALSE(ui_is_fullscreen(ui));
     141
     142        ui_destroy(ui);
     143
     144        rc = ui_create_cons((console_ctrl_t *)(-1), &ui);
     145        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     146        PCUT_ASSERT_NOT_NULL(ui);
     147
     148        PCUT_ASSERT_TRUE(ui_is_fullscreen(ui));
     149
     150        ui_destroy(ui);
     151}
     152
    57153PCUT_EXPORT(ui);
Note: See TracChangeset for help on using the changeset viewer.