Changeset 46a47c0 in mainline for uspace/lib/ui/test/window.c
- Timestamp:
- 2023-01-16T20:34:01Z (2 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b0ae23f
- Parents:
- b3eeae5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.