Changeset b2d1df3 in mainline for uspace/srv/hid/display/test/display.c
- Timestamp:
- 2019-11-06T13:20:41Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 648e2ac
- Parents:
- be15256
- git-author:
- Jiri Svoboda <jiri@…> (2019-10-03 18:20:38)
- git-committer:
- Jiri Svoboda <jiri@…> (2019-11-06 13:20:41)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/test/display.c
rbe15256 rb2d1df3 34 34 #include "../client.h" 35 35 #include "../display.h" 36 #include "../window.h" 36 37 37 38 PCUT_INIT; … … 47 48 static void test_ds_ev_pending(void *arg) 48 49 { 50 bool *called_cb = (bool *) arg; 49 51 printf("test_ds_ev_pending\n"); 52 *called_cb = true; 53 50 54 } 51 52 55 53 56 /** Display creation and destruction. */ … … 87 90 } 88 91 92 /** Test ds_display_find_window(). */ 93 PCUT_TEST(display_find_window) 94 { 95 ds_display_t *disp; 96 ds_client_t *client; 97 ds_window_t *w0; 98 ds_window_t *w1; 99 ds_window_t *wnd; 100 errno_t rc; 101 102 rc = ds_display_create(NULL, &disp); 103 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 104 105 rc = ds_client_create(disp, &test_ds_client_cb, NULL, &client); 106 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 107 108 rc = ds_window_create(client, &w0); 109 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 110 111 rc = ds_window_create(client, &w1); 112 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 113 114 wnd = ds_display_find_window(disp, w0->id); 115 PCUT_ASSERT_EQUALS(w0, wnd); 116 117 wnd = ds_display_find_window(disp, w1->id); 118 PCUT_ASSERT_EQUALS(w1, wnd); 119 120 wnd = ds_display_find_window(disp, 0); 121 PCUT_ASSERT_NULL(wnd); 122 123 wnd = ds_display_find_window(disp, w1->id + 1); 124 PCUT_ASSERT_NULL(wnd); 125 126 ds_window_delete(w0); 127 ds_window_delete(w1); 128 ds_client_destroy(client); 129 ds_display_destroy(disp); 130 } 131 132 /** Test ds_display_post_kbd_event(). */ 133 PCUT_TEST(display_post_kbd_event) 134 { 135 ds_display_t *disp; 136 ds_client_t *client; 137 ds_window_t *wnd; 138 kbd_event_t event; 139 bool called_cb = NULL; 140 errno_t rc; 141 142 rc = ds_display_create(NULL, &disp); 143 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 144 145 rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client); 146 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 147 148 rc = ds_window_create(client, &wnd); 149 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 150 151 event.type = KEY_PRESS; 152 event.key = KC_ENTER; 153 event.mods = 0; 154 event.c = L'\0'; 155 156 PCUT_ASSERT_FALSE(called_cb); 157 158 rc = ds_display_post_kbd_event(disp, &event); 159 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 160 PCUT_ASSERT_TRUE(called_cb); 161 162 ds_window_delete(wnd); 163 ds_client_destroy(client); 164 ds_display_destroy(disp); 165 } 166 89 167 PCUT_EXPORT(display);
Note:
See TracChangeset
for help on using the changeset viewer.