Changes in uspace/lib/ui/test/ui.c [983052c:f7a90df] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/test/ui.c
r983052c rf7a90df 1 1 /* 2 * Copyright (c) 202 3Jiri Svoboda2 * Copyright (c) 2020 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 35 35 PCUT_TEST_SUITE(ui); 36 36 37 /** Create and destroy UI with display*/38 PCUT_TEST(create_d isp_destroy)37 /** Create and destroy UI */ 38 PCUT_TEST(create_destroy) 39 39 { 40 40 ui_t *ui = NULL; … … 49 49 } 50 50 51 /** Create and destroy UI with console */52 PCUT_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 65 51 /** ui_destroy() can take NULL argument (no-op) */ 66 52 PCUT_TEST(destroy_null) … … 69 55 } 70 56 71 /** ui_suspend() / ui_resume() do nothing if we don't have a console,72 * ui_is_suspended() returns suspend status73 */74 PCUT_TEST(suspend_resume)75 {76 ui_t *ui = NULL;77 errno_t rc;78 79 rc = ui_create_disp(NULL, &ui);80 PCUT_ASSERT_ERRNO_VAL(EOK, rc);81 PCUT_ASSERT_NOT_NULL(ui);82 83 PCUT_ASSERT_FALSE(ui_is_suspended(ui));84 85 rc = ui_suspend(ui);86 PCUT_ASSERT_ERRNO_VAL(EOK, rc);87 88 PCUT_ASSERT_TRUE(ui_is_suspended(ui));89 90 rc = ui_resume(ui);91 PCUT_ASSERT_ERRNO_VAL(EOK, rc);92 93 PCUT_ASSERT_FALSE(ui_is_suspended(ui));94 95 ui_destroy(ui);96 }97 98 /** ui_run() / ui_quit() */99 PCUT_TEST(run_quit)100 {101 ui_t *ui = NULL;102 errno_t rc;103 104 rc = ui_create_disp(NULL, &ui);105 PCUT_ASSERT_ERRNO_VAL(EOK, rc);106 PCUT_ASSERT_NOT_NULL(ui);107 108 /* Set exit flag */109 ui_quit(ui);110 111 /* ui_run() should return immediately */112 ui_run(ui);113 114 ui_destroy(ui);115 }116 117 /** ui_paint() */118 PCUT_TEST(paint)119 {120 ui_t *ui = NULL;121 errno_t rc;122 123 rc = ui_create_cons(NULL, &ui);124 PCUT_ASSERT_ERRNO_VAL(EOK, rc);125 PCUT_ASSERT_NOT_NULL(ui);126 127 /* In absence of windows ui_paint() should just return EOK */128 rc = ui_paint(ui);129 PCUT_ASSERT_ERRNO_VAL(EOK, rc);130 131 ui_destroy(ui);132 }133 134 /** ui_is_textmode() */135 PCUT_TEST(is_textmode)136 {137 ui_t *ui = NULL;138 errno_t rc;139 140 rc = ui_create_disp((display_t *)(-1), &ui);141 PCUT_ASSERT_ERRNO_VAL(EOK, rc);142 PCUT_ASSERT_NOT_NULL(ui);143 144 PCUT_ASSERT_FALSE(ui_is_textmode(ui));145 146 ui_destroy(ui);147 148 rc = ui_create_cons((console_ctrl_t *)(-1), &ui);149 PCUT_ASSERT_ERRNO_VAL(EOK, rc);150 PCUT_ASSERT_NOT_NULL(ui);151 152 PCUT_ASSERT_TRUE(ui_is_textmode(ui));153 154 ui_destroy(ui);155 }156 157 /** ui_is_fullscreen() */158 PCUT_TEST(is_fullscreen)159 {160 ui_t *ui = NULL;161 errno_t rc;162 163 rc = ui_create_disp((display_t *)(-1), &ui);164 PCUT_ASSERT_ERRNO_VAL(EOK, rc);165 PCUT_ASSERT_NOT_NULL(ui);166 167 PCUT_ASSERT_FALSE(ui_is_fullscreen(ui));168 169 ui_destroy(ui);170 171 rc = ui_create_cons((console_ctrl_t *)(-1), &ui);172 PCUT_ASSERT_ERRNO_VAL(EOK, rc);173 PCUT_ASSERT_NOT_NULL(ui);174 175 PCUT_ASSERT_TRUE(ui_is_fullscreen(ui));176 177 ui_destroy(ui);178 }179 180 /** ui_is_get_rect() */181 PCUT_TEST(get_rect)182 {183 ui_t *ui = NULL;184 gfx_rect_t rect;185 errno_t rc;186 187 rc = ui_create_disp(NULL, &ui);188 PCUT_ASSERT_ERRNO_VAL(EOK, rc);189 PCUT_ASSERT_NOT_NULL(ui);190 191 /* This won't work without a display service */192 rc = ui_get_rect(ui, &rect);193 PCUT_ASSERT_ERRNO_VAL(ENOTSUP, rc);194 195 ui_destroy(ui);196 }197 198 /** ui_lock(), ui_unlock() */199 PCUT_TEST(lock_unlock)200 {201 ui_t *ui = NULL;202 errno_t rc;203 204 rc = ui_create_disp((display_t *)(-1), &ui);205 PCUT_ASSERT_ERRNO_VAL(EOK, rc);206 PCUT_ASSERT_NOT_NULL(ui);207 208 ui_lock(ui);209 ui_unlock(ui);210 211 ui_destroy(ui);212 }213 214 57 PCUT_EXPORT(ui);
Note:
See TracChangeset
for help on using the changeset viewer.