Changes in uspace/lib/ui/test/entry.c [7481ee19:db3895d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/test/entry.c
r7481ee19 rdb3895d 119 119 } 120 120 121 /** Set entry read only flag sets internal field */122 PCUT_TEST(set_read_only)123 {124 ui_entry_t *entry;125 errno_t rc;126 127 rc = ui_entry_create(NULL, "Hello", &entry);128 PCUT_ASSERT_ERRNO_VAL(EOK, rc);129 130 ui_entry_set_read_only(entry, true);131 PCUT_ASSERT_TRUE(entry->read_only);132 ui_entry_set_read_only(entry, false);133 PCUT_ASSERT_FALSE(entry->read_only);134 135 ui_entry_destroy(entry);136 }137 138 121 /** Set text entry rectangle sets internal field */ 139 122 PCUT_TEST(set_text) … … 190 173 } 191 174 192 /** ui_entry_insert_str() inserts string at cursor. */193 PCUT_TEST(insert_str)194 {195 errno_t rc;196 ui_t *ui = NULL;197 ui_window_t *window = NULL;198 ui_wnd_params_t params;199 ui_entry_t *entry;200 201 rc = ui_create_disp(NULL, &ui);202 PCUT_ASSERT_ERRNO_VAL(EOK, rc);203 204 ui_wnd_params_init(¶ms);205 params.caption = "Hello";206 207 rc = ui_window_create(ui, ¶ms, &window);208 PCUT_ASSERT_ERRNO_VAL(EOK, rc);209 PCUT_ASSERT_NOT_NULL(window);210 211 rc = ui_entry_create(window, "A", &entry);212 PCUT_ASSERT_ERRNO_VAL(EOK, rc);213 214 PCUT_ASSERT_STR_EQUALS("A", entry->text);215 216 rc = ui_entry_insert_str(entry, "B");217 PCUT_ASSERT_ERRNO_VAL(EOK, rc);218 219 PCUT_ASSERT_STR_EQUALS("AB", entry->text);220 221 rc = ui_entry_insert_str(entry, "CD");222 PCUT_ASSERT_ERRNO_VAL(EOK, rc);223 224 PCUT_ASSERT_STR_EQUALS("ABCD", entry->text);225 226 ui_entry_destroy(entry);227 ui_window_destroy(window);228 ui_destroy(ui);229 }230 231 /** ui_entry_backspace() deletes character before cursor. */232 PCUT_TEST(backspace)233 {234 errno_t rc;235 ui_t *ui = NULL;236 ui_window_t *window = NULL;237 ui_wnd_params_t params;238 ui_entry_t *entry;239 240 rc = ui_create_disp(NULL, &ui);241 PCUT_ASSERT_ERRNO_VAL(EOK, rc);242 243 ui_wnd_params_init(¶ms);244 params.caption = "Hello";245 246 rc = ui_window_create(ui, ¶ms, &window);247 PCUT_ASSERT_ERRNO_VAL(EOK, rc);248 PCUT_ASSERT_NOT_NULL(window);249 250 rc = ui_entry_create(window, "ABC", &entry);251 PCUT_ASSERT_ERRNO_VAL(EOK, rc);252 253 PCUT_ASSERT_STR_EQUALS("ABC", entry->text);254 255 ui_entry_backspace(entry);256 PCUT_ASSERT_STR_EQUALS("AB", entry->text);257 258 ui_entry_backspace(entry);259 PCUT_ASSERT_STR_EQUALS("A", entry->text);260 261 ui_entry_backspace(entry);262 PCUT_ASSERT_STR_EQUALS("", entry->text);263 264 ui_entry_backspace(entry);265 PCUT_ASSERT_STR_EQUALS("", entry->text);266 267 ui_entry_destroy(entry);268 ui_window_destroy(window);269 ui_destroy(ui);270 }271 272 175 PCUT_EXPORT(entry);
Note:
See TracChangeset
for help on using the changeset viewer.