Changeset 46a47c0 in mainline for uspace/lib/ui/test
- Timestamp:
- 2023-01-16T20:34:01Z (3 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b0ae23f
- Parents:
- b3eeae5
- Location:
- uspace/lib/ui/test
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/test/control.c
rb3eeae5 r46a47c0 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 44 44 static ui_evclaim_t test_ctl_kbd_event(void *, kbd_event_t *); 45 45 static ui_evclaim_t test_ctl_pos_event(void *, pos_event_t *); 46 static void test_ctl_unfocus(void * );46 static void test_ctl_unfocus(void *, unsigned); 47 47 48 48 static ui_control_ops_t test_ctl_ops = { … … 79 79 /** @c true iff unfocus was called */ 80 80 bool unfocus; 81 /** Number of remaining foci that was sent */ 82 unsigned unfocus_nfocus; 81 83 } test_resp_t; 82 84 … … 223 225 resp.unfocus = false; 224 226 225 ui_control_unfocus(control );227 ui_control_unfocus(control, 42); 226 228 PCUT_ASSERT_TRUE(resp.unfocus); 229 PCUT_ASSERT_INT_EQUALS(42, resp.unfocus_nfocus); 227 230 228 231 ui_control_delete(control); … … 264 267 } 265 268 266 static void test_ctl_unfocus(void *arg )269 static void test_ctl_unfocus(void *arg, unsigned nfocus) 267 270 { 268 271 test_resp_t *resp = (test_resp_t *) arg; 269 272 270 273 resp->unfocus = true; 274 resp->unfocus_nfocus = nfocus; 271 275 } 272 276 -
uspace/lib/ui/test/fixed.c
rb3eeae5 r46a47c0 1 1 /* 2 * Copyright (c) 202 0Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 41 41 static errno_t test_ctl_paint(void *); 42 42 static ui_evclaim_t test_ctl_pos_event(void *, pos_event_t *); 43 static void test_ctl_unfocus(void * );43 static void test_ctl_unfocus(void *, unsigned); 44 44 45 45 static ui_control_ops_t test_ctl_ops = { … … 66 66 /** @c true iff unfocus was called */ 67 67 bool unfocus; 68 /** Number of remaining foci */ 69 unsigned unfocus_nfocus; 68 70 } test_resp_t; 69 71 … … 253 255 resp.unfocus = false; 254 256 255 ui_fixed_unfocus(fixed );257 ui_fixed_unfocus(fixed, 42); 256 258 PCUT_ASSERT_TRUE(resp.unfocus); 259 PCUT_ASSERT_INT_EQUALS(42, resp.unfocus_nfocus); 257 260 258 261 ui_fixed_destroy(fixed); … … 284 287 } 285 288 286 static void test_ctl_unfocus(void *arg )289 static void test_ctl_unfocus(void *arg, unsigned nfocus) 287 290 { 288 291 test_resp_t *resp = (test_resp_t *) arg; 289 292 290 293 resp->unfocus = true; 294 resp->unfocus_nfocus = nfocus; 291 295 } 292 296 -
uspace/lib/ui/test/popup.c
rb3eeae5 r46a47c0 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 64 64 static errno_t test_ctl_paint(void *); 65 65 static ui_evclaim_t test_ctl_pos_event(void *, pos_event_t *); 66 static void test_ctl_unfocus(void * );66 static void test_ctl_unfocus(void *, unsigned); 67 67 68 68 static ui_control_ops_t test_ctl_ops = { … … 91 91 pos_event_t pos_event; 92 92 bool unfocus; 93 unsigned unfocus_nfocus; 93 94 } test_ctl_resp_t; 94 95 … … 341 342 } 342 343 343 static void test_ctl_unfocus(void *arg )344 static void test_ctl_unfocus(void *arg, unsigned nfocus) 344 345 { 345 346 test_ctl_resp_t *resp = (test_ctl_resp_t *) arg; 346 347 347 348 resp->unfocus = true; 349 resp->unfocus_nfocus = nfocus; 348 350 } 349 351 -
uspace/lib/ui/test/window.c
rb3eeae5 r46a47c0 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 49 49 static void test_window_unmaximize(ui_window_t *, void *); 50 50 static void test_window_close(ui_window_t *, void *); 51 static void test_window_focus(ui_window_t *, void * );51 static void test_window_focus(ui_window_t *, void *, unsigned); 52 52 static void test_window_kbd(ui_window_t *, void *, kbd_event_t *); 53 53 static errno_t test_window_paint(ui_window_t *, void *); 54 54 static void test_window_pos(ui_window_t *, void *, pos_event_t *); 55 static void test_window_unfocus(ui_window_t *, void * );55 static void test_window_unfocus(ui_window_t *, void *, unsigned); 56 56 57 57 static ui_window_cb_t test_window_cb = { … … 72 72 static errno_t test_ctl_paint(void *); 73 73 static ui_evclaim_t test_ctl_pos_event(void *, pos_event_t *); 74 static void test_ctl_unfocus(void * );74 static void test_ctl_unfocus(void *, unsigned); 75 75 76 76 static ui_control_ops_t test_ctl_ops = { … … 87 87 bool close; 88 88 bool focus; 89 unsigned focus_nfocus; 89 90 bool kbd; 90 91 kbd_event_t kbd_event; … … 93 94 pos_event_t pos_event; 94 95 bool unfocus; 96 unsigned unfocus_nfocus; 95 97 } test_cb_resp_t; 96 98 … … 102 104 pos_event_t pos_event; 103 105 bool unfocus; 106 unsigned unfocus_nfocus; 104 107 } test_ctl_resp_t; 105 108 … … 530 533 resp.unfocus = false; 531 534 532 ui_window_def_unfocus(window );535 ui_window_def_unfocus(window, 42); 533 536 PCUT_ASSERT_TRUE(resp.unfocus); 537 PCUT_ASSERT_INT_EQUALS(42, resp.unfocus_nfocus); 534 538 535 539 /* Need to remove first because we didn't implement the destructor */ … … 704 708 705 709 /* Focus callback with no callbacks set */ 706 ui_window_send_focus(window );710 ui_window_send_focus(window, 42); 707 711 708 712 /* Focus callback with focus callback not implemented */ 709 713 ui_window_set_cb(window, &dummy_window_cb, NULL); 710 ui_window_send_focus(window );714 ui_window_send_focus(window, 42); 711 715 712 716 /* Focus callback with real callback set */ 713 717 resp.focus = false; 714 718 ui_window_set_cb(window, &test_window_cb, &resp); 715 ui_window_send_focus(window );719 ui_window_send_focus(window, 42); 716 720 PCUT_ASSERT_TRUE(resp.focus); 721 PCUT_ASSERT_INT_EQUALS(42, resp.focus_nfocus); 717 722 718 723 ui_window_destroy(window); … … 872 877 873 878 /* Unfocus callback with no callbacks set */ 874 ui_window_send_unfocus(window );879 ui_window_send_unfocus(window, 42); 875 880 876 881 /* Unfocus callback with unfocus callback not implemented */ 877 882 ui_window_set_cb(window, &dummy_window_cb, NULL); 878 ui_window_send_unfocus(window );883 ui_window_send_unfocus(window, 42); 879 884 880 885 /* Unfocus callback with real callback set */ 881 886 resp.close = false; 882 887 ui_window_set_cb(window, &test_window_cb, &resp); 883 ui_window_send_unfocus(window );888 ui_window_send_unfocus(window, 42); 884 889 PCUT_ASSERT_TRUE(resp.unfocus); 890 PCUT_ASSERT_INT_EQUALS(42, resp.unfocus_nfocus); 885 891 886 892 ui_window_destroy(window); … … 916 922 } 917 923 918 static void test_window_focus(ui_window_t *window, void *arg )924 static void test_window_focus(ui_window_t *window, void *arg, unsigned nfocus) 919 925 { 920 926 test_cb_resp_t *resp = (test_cb_resp_t *) arg; 921 927 922 928 resp->focus = true; 929 resp->focus_nfocus = nfocus; 923 930 } 924 931 … … 949 956 } 950 957 951 static void test_window_unfocus(ui_window_t *window, void *arg )958 static void test_window_unfocus(ui_window_t *window, void *arg, unsigned nfocus) 952 959 { 953 960 test_cb_resp_t *resp = (test_cb_resp_t *) arg; 954 961 955 962 resp->unfocus = true; 963 resp->unfocus_nfocus = nfocus; 956 964 } 957 965 … … 974 982 } 975 983 976 static void test_ctl_unfocus(void *arg )984 static void test_ctl_unfocus(void *arg, unsigned nfocus) 977 985 { 978 986 test_ctl_resp_t *resp = (test_ctl_resp_t *) arg; 979 987 980 988 resp->unfocus = true; 989 resp->unfocus_nfocus = nfocus; 981 990 } 982 991
Note:
See TracChangeset
for help on using the changeset viewer.