Changes in / [37d0dd4:1b7b7af] in mainline
- Location:
- uspace
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/calculator/calculator.c
r37d0dd4 r1b7b7af 945 945 ui_entry_set_rect(display, &calc.geom.entry_rect); 946 946 ui_entry_set_halign(display, gfx_halign_right); 947 ui_entry_set_read_only(display, true);948 947 949 948 rc = ui_fixed_add(fixed, ui_entry_ctl(display)); -
uspace/app/uidemo/uidemo.c
r37d0dd4 r1b7b7af 433 433 } 434 434 435 /* FIXME: Auto layout */ 436 if (ui_is_textmode(ui)) { 437 rect.p0.x = 20; 438 rect.p0.y = 4; 439 rect.p1.x = 60; 440 rect.p1.y = 5; 441 } else { 442 rect.p0.x = 15; 443 rect.p0.y = 53; 444 rect.p1.x = 205; 445 rect.p1.y = 78; 446 } 447 435 rect.p0.x = 15; 436 rect.p0.y = 53; 437 rect.p1.x = 205; 438 rect.p1.y = 78; 448 439 ui_entry_set_rect(demo.entry, &rect); 449 440 ui_entry_set_halign(demo.entry, gfx_halign_center); … … 461 452 } 462 453 463 /* FIXME: Auto layout */ 464 if (ui_is_textmode(ui)) { 465 rect.p0.x = 20; 466 rect.p0.y = 6; 467 rect.p1.x = 60; 468 rect.p1.y = 7; 469 } else { 470 rect.p0.x = 60; 471 rect.p0.y = 88; 472 rect.p1.x = 160; 473 rect.p1.y = 101; 474 } 475 454 rect.p0.x = 60; 455 rect.p0.y = 88; 456 rect.p1.x = 160; 457 rect.p1.y = 101; 476 458 ui_label_set_rect(demo.label, &rect); 477 459 ui_label_set_halign(demo.label, gfx_halign_center); … … 491 473 ui_pbutton_set_cb(demo.pb1, &pbutton_cb, (void *) &demo); 492 474 493 /* FIXME: Auto layout */ 494 if (ui_is_textmode(ui)) { 495 rect.p0.x = 20; 496 rect.p0.y = 8; 497 rect.p1.x = 30; 498 rect.p1.y = 9; 499 } else { 500 rect.p0.x = 15; 501 rect.p0.y = 111; 502 rect.p1.x = 105; 503 rect.p1.y = 139; 504 } 505 475 rect.p0.x = 15; 476 rect.p0.y = 111; 477 rect.p1.x = 105; 478 rect.p1.y = 139; 506 479 ui_pbutton_set_rect(demo.pb1, &rect); 507 480 … … 522 495 ui_pbutton_set_cb(demo.pb2, &pbutton_cb, (void *) &demo); 523 496 524 if (ui_is_textmode(ui)) { 525 rect.p0.x = 50; 526 rect.p0.y = 8; 527 rect.p1.x = 60; 528 rect.p1.y = 9; 529 } else { 530 rect.p0.x = 115; 531 rect.p0.y = 111; 532 rect.p1.x = 205; 533 rect.p1.y = 139; 534 } 535 497 rect.p0.x = 115; 498 rect.p0.y = 111; 499 rect.p1.x = 205; 500 rect.p1.y = 139; 536 501 ui_pbutton_set_rect(demo.pb2, &rect); 537 502 -
uspace/lib/ui/include/types/ui/control.h
r37d0dd4 r1b7b7af 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2020 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 38 38 39 39 #include <errno.h> 40 #include <io/kbd_event.h>41 40 #include <io/pos_event.h> 42 41 #include <types/ui/event.h> … … 51 50 /** Paint */ 52 51 errno_t (*paint)(void *); 53 /** Keyboard event */54 ui_evclaim_t (*kbd_event)(void *, kbd_event_t *);55 52 /** Position event */ 56 53 ui_evclaim_t (*pos_event)(void *, pos_event_t *); -
uspace/lib/ui/include/ui/control.h
r37d0dd4 r1b7b7af 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2020 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 38 38 39 39 #include <errno.h> 40 #include <io/kbd_event.h>41 40 #include <io/pos_event.h> 42 41 #include <types/ui/control.h> … … 47 46 extern void ui_control_destroy(ui_control_t *); 48 47 extern errno_t ui_control_paint(ui_control_t *); 49 extern ui_evclaim_t ui_control_kbd_event(ui_control_t *, kbd_event_t *);50 48 extern ui_evclaim_t ui_control_pos_event(ui_control_t *, pos_event_t *); 51 49 extern void ui_control_unfocus(ui_control_t *); -
uspace/lib/ui/include/ui/entry.h
r37d0dd4 r1b7b7af 50 50 extern void ui_entry_set_rect(ui_entry_t *, gfx_rect_t *); 51 51 extern void ui_entry_set_halign(ui_entry_t *, gfx_halign_t); 52 extern void ui_entry_set_read_only(ui_entry_t *, bool);53 52 extern errno_t ui_entry_set_text(ui_entry_t *, const char *); 54 53 extern errno_t ui_entry_paint(ui_entry_t *); 55 extern ui_evclaim_t ui_entry_kbd_event(ui_entry_t *, kbd_event_t *);56 extern ui_evclaim_t ui_entry_pos_event(ui_entry_t *, pos_event_t *);57 54 58 55 #endif -
uspace/lib/ui/include/ui/fixed.h
r37d0dd4 r1b7b7af 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2020 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 49 49 extern void ui_fixed_remove(ui_fixed_t *, ui_control_t *); 50 50 extern errno_t ui_fixed_paint(ui_fixed_t *); 51 extern ui_evclaim_t ui_fixed_kbd_event(ui_fixed_t *, kbd_event_t *);52 51 extern ui_evclaim_t ui_fixed_pos_event(ui_fixed_t *, pos_event_t *); 53 52 extern void ui_fixed_unfocus(ui_fixed_t *); -
uspace/lib/ui/include/ui/window.h
r37d0dd4 r1b7b7af 40 40 #include <gfx/context.h> 41 41 #include <gfx/coord.h> 42 #include <io/kbd_event.h>43 42 #include <io/pos_event.h> 44 43 #include <types/ui/control.h> … … 63 62 extern void ui_window_set_ctl_cursor(ui_window_t *, ui_stock_cursor_t); 64 63 extern errno_t ui_window_paint(ui_window_t *); 65 extern void ui_window_def_kbd(ui_window_t *, kbd_event_t *);66 64 extern errno_t ui_window_def_paint(ui_window_t *); 67 65 extern void ui_window_def_pos(ui_window_t *, pos_event_t *); -
uspace/lib/ui/private/entry.h
r37d0dd4 r1b7b7af 54 54 /** Horizontal alignment */ 55 55 gfx_halign_t halign; 56 /** Text entry is read-only */57 bool read_only;58 56 /** Text */ 59 57 char *text; 60 58 /** Pointer is currently inside */ 61 59 bool pointer_inside; 62 /** Entry is activated */63 bool active;64 60 }; 65 66 extern errno_t ui_entry_insert_str(ui_entry_t *, const char *);67 extern void ui_entry_backspace(ui_entry_t *);68 extern ui_evclaim_t ui_entry_key_press_unmod(ui_entry_t *, kbd_event_t *);69 61 70 62 #endif -
uspace/lib/ui/src/control.c
r37d0dd4 r1b7b7af 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2020 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 35 35 36 36 #include <errno.h> 37 #include <io/kbd_event.h>38 37 #include <io/pos_event.h> 39 38 #include <stdlib.h> … … 92 91 } 93 92 94 /** Deliver keyboard event to UI control.95 *96 * @param control Control97 * @param kbd_event Keyboard event98 * @return @c ui_claimed iff the event is claimed99 */100 ui_evclaim_t ui_control_kbd_event(ui_control_t *control, kbd_event_t *event)101 {102 if (control->ops->kbd_event != NULL)103 return control->ops->kbd_event(control->ext, event);104 else105 return ui_unclaimed;106 }107 108 93 /** Paint UI control. 109 94 * -
uspace/lib/ui/src/entry.c
r37d0dd4 r1b7b7af 53 53 static void ui_entry_ctl_destroy(void *); 54 54 static errno_t ui_entry_ctl_paint(void *); 55 static ui_evclaim_t ui_entry_ctl_kbd_event(void *, kbd_event_t *);56 55 static ui_evclaim_t ui_entry_ctl_pos_event(void *, pos_event_t *); 57 56 … … 67 66 .destroy = ui_entry_ctl_destroy, 68 67 .paint = ui_entry_ctl_paint, 69 .kbd_event = ui_entry_ctl_kbd_event,70 68 .pos_event = ui_entry_ctl_pos_event 71 69 }; … … 150 148 } 151 149 152 /** Set text entry read-only flag.153 *154 * @param entry Text entry155 * @param read_only True iff entry is to be read-only.156 */157 void ui_entry_set_read_only(ui_entry_t *entry, bool read_only)158 {159 entry->read_only = read_only;160 }161 162 150 /** Set entry text. 163 151 * … … 192 180 gfx_coord_t hpad; 193 181 gfx_coord_t vpad; 194 gfx_coord_t width;195 182 gfx_rect_t inside; 196 183 errno_t rc; … … 225 212 goto error; 226 213 227 width = gfx_text_width(res->font, entry->text);228 229 214 switch (entry->halign) { 230 215 case gfx_halign_left: … … 233 218 break; 234 219 case gfx_halign_center: 235 pos.x = (inside.p0.x + inside.p1.x) / 2 - width / 2;220 pos.x = (inside.p0.x + inside.p1.x) / 2; 236 221 break; 237 222 case gfx_halign_right: 238 pos.x = inside.p1.x - hpad - 1 - width;223 pos.x = inside.p1.x - hpad - 1; 239 224 break; 240 225 } … … 244 229 gfx_text_fmt_init(&fmt); 245 230 fmt.color = res->entry_fg_color; 246 fmt.halign = gfx_halign_left;231 fmt.halign = entry->halign; 247 232 fmt.valign = gfx_valign_top; 248 233 249 rc = gfx_set_clip_rect(res->gc, &inside);250 if (rc != EOK)251 goto error;252 253 234 rc = gfx_puttext(res->font, &pos, &fmt, entry->text); 254 if (rc != EOK) {255 (void) gfx_set_clip_rect(res->gc, NULL);256 goto error;257 }258 259 if (entry->active) {260 /* Cursor */261 pos.x += width;262 263 rc = gfx_puttext(res->font, &pos, &fmt, "_");264 if (rc != EOK) {265 (void) gfx_set_clip_rect(res->gc, NULL);266 goto error;267 }268 }269 270 rc = gfx_set_clip_rect(res->gc, NULL);271 235 if (rc != EOK) 272 236 goto error; … … 304 268 } 305 269 306 /** Insert string at cursor position. 307 * 308 * @param entry Text entry 309 * @param str String 310 * @return EOK on success, ENOMEM if out of memory 311 */ 312 errno_t ui_entry_insert_str(ui_entry_t *entry, const char *str) 313 { 314 char *newtext; 315 char *oldtext; 316 int rc; 317 318 rc = asprintf(&newtext, "%s%s", entry->text, str); 319 if (rc < 0) 320 return ENOMEM; 321 322 oldtext = entry->text; 323 entry->text = newtext; 324 free(oldtext); 325 ui_entry_paint(entry); 326 327 return EOK; 328 } 329 330 /** Delete character before cursor. 331 * 332 * @param entry Text entry 333 */ 334 void ui_entry_backspace(ui_entry_t *entry) 335 { 336 size_t off; 337 338 off = str_size(entry->text); 339 (void) str_decode_reverse(entry->text, &off, 340 str_size(entry->text)); 341 entry->text[off] = '\0'; 342 ui_entry_paint(entry); 343 } 344 345 /** Handle text entry key press without modifiers. 346 * 347 * @param entry Text entry 348 * @param kbd_event Keyboard event 349 * @return @c ui_claimed iff the event is claimed 350 */ 351 ui_evclaim_t ui_entry_key_press_unmod(ui_entry_t *entry, kbd_event_t *event) 352 { 353 assert(event->type == KEY_PRESS); 354 355 if (event->key == KC_BACKSPACE) 356 ui_entry_backspace(entry); 357 358 if (event->key == KC_ESCAPE) { 359 entry->active = false; 360 (void) ui_entry_paint(entry); 361 } 362 363 return ui_claimed; 364 } 365 366 /** Handle text entry keyboard event. 367 * 368 * @param entry Text entry 369 * @param kbd_event Keyboard event 370 * @return @c ui_claimed iff the event is claimed 371 */ 372 ui_evclaim_t ui_entry_kbd_event(ui_entry_t *entry, kbd_event_t *event) 373 { 374 char buf[STR_BOUNDS(1) + 1]; 375 size_t off; 376 errno_t rc; 377 378 if (!entry->active) 379 return ui_unclaimed; 380 381 if (event->type == KEY_PRESS && event->c >= ' ') { 382 off = 0; 383 rc = chr_encode(event->c, buf, &off, sizeof(buf)); 384 if (rc == EOK) { 385 buf[off] = '\0'; 386 (void) ui_entry_insert_str(entry, buf); 387 } 388 } 389 390 if (event->type == KEY_PRESS && 391 (event->mods & (KM_CTRL | KM_ALT | KM_SHIFT)) == 0) 392 return ui_entry_key_press_unmod(entry, event); 393 394 return ui_claimed; 395 } 396 397 /** Handle text entry position event. 398 * 399 * @param entry Text entry 270 /** Handle text entry control position event. 271 * 272 * @param arg Argument (ui_entry_t *) 400 273 * @param pos_event Position event 401 274 * @return @c ui_claimed iff the event is claimed 402 275 */ 403 ui_evclaim_t ui_entry_pos_event(ui_entry_t *entry, pos_event_t *event) 404 { 276 ui_evclaim_t ui_entry_ctl_pos_event(void *arg, pos_event_t *event) 277 { 278 ui_entry_t *entry = (ui_entry_t *) arg; 405 279 gfx_coord2_t pos; 406 407 if (entry->read_only)408 return ui_unclaimed;409 280 410 281 if (event->type == POS_UPDATE) { … … 427 298 } 428 299 429 if (event->type == POS_PRESS) {430 pos.x = event->hpos;431 pos.y = event->vpos;432 433 if (gfx_pix_inside_rect(&pos, &entry->rect)) {434 if (!entry->active) {435 entry->active = true;436 (void) ui_entry_paint(entry);437 }438 439 return ui_claimed;440 } else {441 if (entry->active) {442 entry->active = false;443 (void) ui_entry_paint(entry);444 }445 }446 }447 448 300 return ui_unclaimed; 449 301 } 450 302 451 /** Handle text entry control keyboard event.452 *453 * @param arg Argument (ui_entry_t *)454 * @param kbd_event Keyboard event455 * @return @c ui_claimed iff the event is claimed456 */457 static ui_evclaim_t ui_entry_ctl_kbd_event(void *arg, kbd_event_t *event)458 {459 ui_entry_t *entry = (ui_entry_t *) arg;460 461 return ui_entry_kbd_event(entry, event);462 }463 464 /** Handle text entry control position event.465 *466 * @param arg Argument (ui_entry_t *)467 * @param pos_event Position event468 * @return @c ui_claimed iff the event is claimed469 */470 static ui_evclaim_t ui_entry_ctl_pos_event(void *arg, pos_event_t *event)471 {472 ui_entry_t *entry = (ui_entry_t *) arg;473 474 return ui_entry_pos_event(entry, event);475 }476 477 303 /** @} 478 304 */ -
uspace/lib/ui/src/fixed.c
r37d0dd4 r1b7b7af 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2020 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 46 46 static void ui_fixed_ctl_destroy(void *); 47 47 static errno_t ui_fixed_ctl_paint(void *); 48 static ui_evclaim_t ui_fixed_ctl_kbd_event(void *, kbd_event_t *);49 48 static ui_evclaim_t ui_fixed_ctl_pos_event(void *, pos_event_t *); 50 49 static void ui_fixed_ctl_unfocus(void *); … … 54 53 .destroy = ui_fixed_ctl_destroy, 55 54 .paint = ui_fixed_ctl_paint, 56 .kbd_event = ui_fixed_ctl_kbd_event,57 55 .pos_event = ui_fixed_ctl_pos_event, 58 56 .unfocus = ui_fixed_ctl_unfocus … … 213 211 } 214 212 215 /** Handle fixed layout keyboard event.216 *217 * @param fixed Fixed layout218 * @param kbd_event Keyboard event219 * @return @c ui_claimed iff the event is claimed220 */221 ui_evclaim_t ui_fixed_kbd_event(ui_fixed_t *fixed, kbd_event_t *event)222 {223 ui_fixed_elem_t *elem;224 ui_evclaim_t claimed;225 226 elem = ui_fixed_first(fixed);227 while (elem != NULL) {228 claimed = ui_control_kbd_event(elem->control, event);229 if (claimed == ui_claimed)230 return ui_claimed;231 232 elem = ui_fixed_next(elem);233 }234 235 return ui_unclaimed;236 }237 238 213 /** Handle fixed layout position event. 239 214 * … … 298 273 } 299 274 300 /** Handle fixed layout control keyboard event.301 *302 * @param arg Argument (ui_fixed_t *)303 * @param kbd_event Keyboard event304 * @return @c ui_claimed iff the event is claimed305 */306 ui_evclaim_t ui_fixed_ctl_kbd_event(void *arg, kbd_event_t *event)307 {308 ui_fixed_t *fixed = (ui_fixed_t *) arg;309 310 return ui_fixed_kbd_event(fixed, event);311 }312 313 275 /** Handle fixed layout control position event. 314 276 * -
uspace/lib/ui/src/window.c
r37d0dd4 r1b7b7af 871 871 if (window->cb != NULL && window->cb->kbd != NULL) 872 872 window->cb->kbd(window, window->arg, kbd); 873 else874 return ui_window_def_kbd(window, kbd);875 873 } 876 874 … … 909 907 else 910 908 return ui_window_def_unfocus(window); 911 }912 913 /** Default window keyboard event routine.914 *915 * @param window Window916 */917 void ui_window_def_kbd(ui_window_t *window, kbd_event_t *kbd)918 {919 if (window->control != NULL)920 ui_control_kbd_event(window->control, kbd);921 909 } 922 910 -
uspace/lib/ui/test/control.c
r37d0dd4 r1b7b7af 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2020 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 29 29 #include <errno.h> 30 30 #include <mem.h> 31 #include <io/kbd_event.h>32 31 #include <io/pos_event.h> 33 32 #include <pcut/pcut.h> … … 42 41 static void test_ctl_destroy(void *); 43 42 static errno_t test_ctl_paint(void *); 44 static ui_evclaim_t test_ctl_kbd_event(void *, kbd_event_t *);45 43 static ui_evclaim_t test_ctl_pos_event(void *, pos_event_t *); 46 44 static void test_ctl_unfocus(void *); … … 49 47 .destroy = test_ctl_destroy, 50 48 .paint = test_ctl_paint, 51 .kbd_event = test_ctl_kbd_event,52 49 .pos_event = test_ctl_pos_event, 53 50 .unfocus = test_ctl_unfocus … … 67 64 bool paint; 68 65 69 /** @c true iff kbd_event was called */70 bool kbd;71 /** Keyboard event that was sent */72 kbd_event_t kevent;73 74 66 /** @c true iff pos_event was called */ 75 67 bool pos; … … 142 134 PCUT_ASSERT_ERRNO_VAL(resp.rc, rc); 143 135 PCUT_ASSERT_TRUE(resp.paint); 144 145 ui_control_delete(control);146 }147 148 /** Test sending keyboard event to control */149 PCUT_TEST(kbd_event)150 {151 ui_control_t *control = NULL;152 test_resp_t resp;153 kbd_event_t event;154 ui_evclaim_t claim;155 errno_t rc;156 157 rc = ui_control_new(&test_ctl_ops, &resp, &control);158 PCUT_ASSERT_ERRNO_VAL(EOK, rc);159 PCUT_ASSERT_NOT_NULL(control);160 161 resp.claim = ui_claimed;162 resp.kbd = false;163 event.type = KEY_PRESS;164 event.key = KC_2;165 event.mods = KM_LSHIFT;166 event.c = '@';167 168 claim = ui_control_kbd_event(control, &event);169 PCUT_ASSERT_EQUALS(resp.claim, claim);170 PCUT_ASSERT_TRUE(resp.kbd);171 PCUT_ASSERT_EQUALS(resp.kevent.type, event.type);172 PCUT_ASSERT_INT_EQUALS(resp.kevent.key, event.key);173 PCUT_ASSERT_INT_EQUALS(resp.kevent.mods, event.mods);174 PCUT_ASSERT_INT_EQUALS(resp.kevent.c, event.c);175 136 176 137 ui_control_delete(control); … … 244 205 } 245 206 246 static ui_evclaim_t test_ctl_kbd_event(void *arg, kbd_event_t *event)247 {248 test_resp_t *resp = (test_resp_t *) arg;249 250 resp->kbd = true;251 resp->kevent = *event;252 253 return resp->claim;254 }255 256 207 static ui_evclaim_t test_ctl_pos_event(void *arg, pos_event_t *event) 257 208 { -
uspace/lib/ui/test/entry.c
r37d0dd4 r1b7b7af 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.