Changeset 913add60 in mainline for uspace/srv/hid/display/test/display.c
- Timestamp:
- 2022-10-31T10:53:53Z (2 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)
- File:
-
- 1 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);
Note:
See TracChangeset
for help on using the changeset viewer.