Changeset 913add60 in mainline for uspace/srv/hid/display/test
- Timestamp:
- 2022-10-31T10:53:53Z (3 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1b92d4b
- Parents:
- 7cc30e9
- git-author:
- Jiri Svoboda <jiri@…> (2022-10-30 10:53:48)
- git-committer:
- Jiri Svoboda <jiri@…> (2022-10-31 10:53:53)
- Location:
- uspace/srv/hid/display/test
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/test/display.c
r7cc30e9 r913add60 1 1 /* 2 * Copyright (c) 20 19Jiri Svoboda2 * Copyright (c) 2022 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 36 36 #include "../seat.h" 37 37 #include "../window.h" 38 #include "../wmclient.h" 38 39 39 40 PCUT_INIT; … … 47 48 }; 48 49 50 static void test_ds_wmev_pending(void *); 51 52 static ds_wmclient_cb_t test_ds_wmclient_cb = { 53 .ev_pending = test_ds_wmev_pending 54 }; 55 49 56 static void test_ds_ev_pending(void *arg) 50 57 { … … 53 60 } 54 61 62 static void test_ds_wmev_pending(void *arg) 63 { 64 bool *called_cb = (bool *) arg; 65 *called_cb = true; 66 } 67 55 68 /** Display creation and destruction. */ 56 69 PCUT_TEST(display_create_destroy) … … 86 99 87 100 ds_client_destroy(client); 101 ds_display_destroy(disp); 102 } 103 104 /** Basic WM client operation. */ 105 PCUT_TEST(display_wmclient) 106 { 107 ds_display_t *disp; 108 ds_wmclient_t *wmclient; 109 ds_wmclient_t *c0, *c1; 110 errno_t rc; 111 112 rc = ds_display_create(NULL, df_none, &disp); 113 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 114 115 rc = ds_wmclient_create(disp, &test_ds_wmclient_cb, NULL, &wmclient); 116 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 117 118 c0 = ds_display_first_wmclient(disp); 119 PCUT_ASSERT_EQUALS(c0, wmclient); 120 121 c1 = ds_display_next_wmclient(c0); 122 PCUT_ASSERT_NULL(c1); 123 124 ds_wmclient_destroy(wmclient); 88 125 ds_display_destroy(disp); 89 126 } … … 150 187 wnd = ds_display_find_window(disp, w0->id + 1); 151 188 PCUT_ASSERT_NULL(wnd); 189 190 ds_window_destroy(w0); 191 ds_window_destroy(w1); 192 ds_seat_destroy(seat); 193 ds_client_destroy(client); 194 ds_display_destroy(disp); 195 } 196 197 /** Test ds_display_window_to_top() */ 198 PCUT_TEST(display_window_to_top) 199 { 200 ds_display_t *disp; 201 ds_client_t *client; 202 ds_seat_t *seat; 203 ds_window_t *w0; 204 ds_window_t *w1; 205 display_wnd_params_t params; 206 bool called_cb = false; 207 errno_t rc; 208 209 rc = ds_display_create(NULL, df_none, &disp); 210 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 211 212 rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client); 213 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 214 215 rc = ds_seat_create(disp, &seat); 216 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 217 218 display_wnd_params_init(¶ms); 219 params.rect.p0.x = params.rect.p0.y = 0; 220 params.rect.p1.x = params.rect.p1.y = 100; 221 222 rc = ds_window_create(client, ¶ms, &w0); 223 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 224 225 rc = ds_window_create(client, ¶ms, &w1); 226 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 227 228 PCUT_ASSERT_EQUALS(w1, ds_display_first_window(disp)); 229 ds_display_window_to_top(w0); 230 PCUT_ASSERT_EQUALS(w0, ds_display_first_window(disp)); 152 231 153 232 ds_window_destroy(w0); -
uspace/srv/hid/display/test/main.c
r7cc30e9 r913add60 37 37 PCUT_IMPORT(seat); 38 38 PCUT_IMPORT(window); 39 PCUT_IMPORT(wmclient); 39 40 40 41 PCUT_MAIN(); -
uspace/srv/hid/display/test/window.c
r7cc30e9 r913add60 51 51 }; 52 52 53 /** Test creating and destroying window */ 54 PCUT_TEST(create_destroy) 55 { 56 ds_display_t *disp; 57 ds_client_t *client; 58 ds_seat_t *seat; 59 ds_window_t *wnd; 60 display_wnd_params_t params; 61 errno_t rc; 62 63 rc = ds_display_create(NULL, df_none, &disp); 64 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 65 66 rc = ds_client_create(disp, NULL, NULL, &client); 67 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 68 69 rc = ds_seat_create(disp, &seat); 70 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 71 72 display_wnd_params_init(¶ms); 73 params.rect.p0.x = params.rect.p0.y = 0; 74 params.rect.p1.x = params.rect.p1.y = 10; 75 76 rc = ds_window_create(client, ¶ms, &wnd); 77 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 78 79 ds_window_destroy(wnd); 80 ds_seat_destroy(seat); 81 ds_client_destroy(client); 82 ds_display_destroy(disp); 83 } 84 85 /** Test ds_window_bring_to_top() brings window to top */ 86 PCUT_TEST(bring_to_top) 87 { 88 ds_display_t *disp; 89 ds_client_t *client; 90 ds_seat_t *seat; 91 ds_window_t *w1; 92 ds_window_t *w2; 93 display_wnd_params_t params; 94 errno_t rc; 95 96 rc = ds_display_create(NULL, df_none, &disp); 97 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 98 99 rc = ds_client_create(disp, NULL, NULL, &client); 100 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 101 102 rc = ds_seat_create(disp, &seat); 103 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 104 105 display_wnd_params_init(¶ms); 106 params.rect.p0.x = params.rect.p0.y = 0; 107 params.rect.p1.x = params.rect.p1.y = 10; 108 109 rc = ds_window_create(client, ¶ms, &w1); 110 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 111 112 rc = ds_window_create(client, ¶ms, &w2); 113 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 114 115 /* w2 should be on the top */ 116 PCUT_ASSERT_EQUALS(w2, ds_display_first_window(disp)); 117 118 /* Bring w1 to top */ 119 ds_window_bring_to_top(w1); 120 121 /* Now w1 should be on the top */ 122 PCUT_ASSERT_EQUALS(w1, ds_display_first_window(disp)); 123 124 ds_window_destroy(w1); 125 ds_window_destroy(w2); 126 ds_seat_destroy(seat); 127 ds_client_destroy(client); 128 ds_display_destroy(disp); 129 } 130 53 131 /** Test ds_window_resize(). */ 54 132 PCUT_TEST(window_resize)
Note:
See TracChangeset
for help on using the changeset viewer.
