Changeset b4b4dafe in mainline for uspace/srv/hid/display/test/client.c
- Timestamp:
- 2021-06-03T14:02:59Z (3 years ago)
- Children:
- 2e6394e
- Parents:
- 6baab83
- git-author:
- Jiri Svoboda <jiri@…> (2021-06-02 17:00:03)
- git-committer:
- Jiri Svoboda <jiri@…> (2021-06-03 14:02:59)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/test/client.c
r6baab83 rb4b4dafe 1 1 /* 2 * Copyright (c) 20 19Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 34 34 #include "../client.h" 35 35 #include "../display.h" 36 #include "../seat.h" 36 37 #include "../window.h" 37 38 … … 78 79 ds_display_t *disp; 79 80 ds_client_t *client; 81 ds_seat_t *seat; 80 82 ds_window_t *w0; 81 83 ds_window_t *w1; 82 84 ds_window_t *wnd; 83 85 display_wnd_params_t params; 84 errno_t rc; 85 86 rc = ds_display_create(NULL, df_none, &disp); 87 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 88 89 rc = ds_client_create(disp, &test_ds_client_cb, NULL, &client); 86 bool called_cb = NULL; 87 errno_t rc; 88 89 rc = ds_display_create(NULL, df_none, &disp); 90 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 91 92 rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client); 93 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 94 95 rc = ds_seat_create(disp, &seat); 90 96 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 91 97 … … 114 120 ds_window_destroy(w0); 115 121 ds_window_destroy(w1); 122 ds_seat_destroy(seat); 116 123 ds_client_destroy(client); 117 124 ds_display_destroy(disp); … … 123 130 ds_display_t *disp; 124 131 ds_client_t *client; 132 ds_seat_t *seat; 125 133 ds_window_t *w0; 126 134 ds_window_t *w1; 127 135 ds_window_t *wnd; 128 136 display_wnd_params_t params; 129 errno_t rc; 130 131 rc = ds_display_create(NULL, df_none, &disp); 132 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 133 134 rc = ds_client_create(disp, &test_ds_client_cb, NULL, &client); 137 bool called_cb = NULL; 138 errno_t rc; 139 140 rc = ds_display_create(NULL, df_none, &disp); 141 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 142 143 rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client); 144 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 145 146 rc = ds_seat_create(disp, &seat); 135 147 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 136 148 … … 156 168 ds_window_destroy(w0); 157 169 ds_window_destroy(w1); 170 ds_seat_destroy(seat); 158 171 ds_client_destroy(client); 159 172 ds_display_destroy(disp); … … 165 178 ds_display_t *disp; 166 179 ds_client_t *client; 180 ds_seat_t *seat; 167 181 ds_window_t *wnd; 168 182 display_wnd_params_t params; … … 178 192 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 179 193 180 display_wnd_params_init(¶ms); 181 params.rect.p0.x = params.rect.p0.y = 0; 182 params.rect.p1.x = params.rect.p1.y = 1; 183 184 rc = ds_window_create(client, ¶ms, &wnd); 185 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 186 187 PCUT_ASSERT_FALSE(called_cb); 194 rc = ds_seat_create(disp, &seat); 195 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 196 197 display_wnd_params_init(¶ms); 198 params.rect.p0.x = params.rect.p0.y = 0; 199 params.rect.p1.x = params.rect.p1.y = 1; 200 201 rc = ds_window_create(client, ¶ms, &wnd); 202 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 203 204 /* New window gets focused event */ 205 PCUT_ASSERT_TRUE(called_cb); 206 207 rc = ds_client_get_event(client, &rwindow, &revent); 208 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 209 210 called_cb = false; 188 211 189 212 rc = ds_client_get_event(client, &rwindow, &revent); … … 203 226 204 227 ds_window_destroy(wnd); 228 ds_seat_destroy(seat); 205 229 ds_client_destroy(client); 206 230 ds_display_destroy(disp); … … 212 236 ds_display_t *disp; 213 237 ds_client_t *client; 238 ds_seat_t *seat; 214 239 ds_window_t *wnd; 215 240 display_wnd_params_t params; … … 225 250 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 226 251 227 display_wnd_params_init(¶ms); 228 params.rect.p0.x = params.rect.p0.y = 0; 229 params.rect.p1.x = params.rect.p1.y = 1; 230 231 rc = ds_window_create(client, ¶ms, &wnd); 232 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 233 234 PCUT_ASSERT_FALSE(called_cb); 252 rc = ds_seat_create(disp, &seat); 253 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 254 255 display_wnd_params_init(¶ms); 256 params.rect.p0.x = params.rect.p0.y = 0; 257 params.rect.p1.x = params.rect.p1.y = 1; 258 259 rc = ds_window_create(client, ¶ms, &wnd); 260 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 261 262 /* New window gets focused event */ 263 PCUT_ASSERT_TRUE(called_cb); 264 265 rc = ds_client_get_event(client, &rwindow, &revent); 266 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 267 268 called_cb = false; 235 269 236 270 rc = ds_client_get_event(client, &rwindow, &revent); … … 250 284 251 285 ds_window_destroy(wnd); 286 ds_seat_destroy(seat); 252 287 ds_client_destroy(client); 253 288 ds_display_destroy(disp); … … 259 294 ds_display_t *disp; 260 295 ds_client_t *client; 296 ds_seat_t *seat; 261 297 ds_window_t *wnd; 262 298 display_wnd_params_t params; … … 273 309 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 274 310 275 display_wnd_params_init(¶ms); 276 params.rect.p0.x = params.rect.p0.y = 0; 277 params.rect.p1.x = params.rect.p1.y = 1; 278 279 rc = ds_window_create(client, ¶ms, &wnd); 280 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 311 rc = ds_seat_create(disp, &seat); 312 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 313 314 display_wnd_params_init(¶ms); 315 params.rect.p0.x = params.rect.p0.y = 0; 316 params.rect.p1.x = params.rect.p1.y = 1; 317 318 rc = ds_window_create(client, ¶ms, &wnd); 319 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 320 321 /* New window gets focused event */ 322 PCUT_ASSERT_TRUE(called_cb); 323 324 rc = ds_client_get_event(client, &rwindow, &revent); 325 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 326 327 called_cb = false; 328 329 rc = ds_client_get_event(client, &rwindow, &revent); 330 PCUT_ASSERT_ERRNO_VAL(ENOENT, rc); 281 331 282 332 event.type = KEY_PRESS; … … 284 334 event.mods = 0; 285 335 event.c = L'\0'; 286 287 PCUT_ASSERT_FALSE(called_cb);288 289 rc = ds_client_get_event(client, &rwindow, &revent);290 PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);291 336 292 337 rc = ds_client_post_kbd_event(client, wnd, &event); … … 307 352 308 353 ds_window_destroy(wnd); 354 ds_seat_destroy(seat); 309 355 ds_client_destroy(client); 310 356 ds_display_destroy(disp); … … 316 362 ds_display_t *disp; 317 363 ds_client_t *client; 364 ds_seat_t *seat; 318 365 ds_window_t *wnd; 319 366 display_wnd_params_t params; … … 330 377 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 331 378 332 display_wnd_params_init(¶ms); 333 params.rect.p0.x = params.rect.p0.y = 0; 334 params.rect.p1.x = params.rect.p1.y = 1; 335 336 rc = ds_window_create(client, ¶ms, &wnd); 337 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 379 rc = ds_seat_create(disp, &seat); 380 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 381 382 display_wnd_params_init(¶ms); 383 params.rect.p0.x = params.rect.p0.y = 0; 384 params.rect.p1.x = params.rect.p1.y = 1; 385 386 rc = ds_window_create(client, ¶ms, &wnd); 387 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 388 389 /* New window gets focused event */ 390 PCUT_ASSERT_TRUE(called_cb); 391 392 rc = ds_client_get_event(client, &rwindow, &revent); 393 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 394 395 called_cb = false; 396 397 PCUT_ASSERT_FALSE(called_cb); 398 399 rc = ds_client_get_event(client, &rwindow, &revent); 400 PCUT_ASSERT_ERRNO_VAL(ENOENT, rc); 338 401 339 402 event.type = POS_PRESS; 340 403 event.hpos = 1; 341 404 event.vpos = 2; 342 343 PCUT_ASSERT_FALSE(called_cb);344 345 rc = ds_client_get_event(client, &rwindow, &revent);346 PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);347 405 348 406 rc = ds_client_post_pos_event(client, wnd, &event); … … 362 420 363 421 ds_window_destroy(wnd); 422 ds_seat_destroy(seat); 364 423 ds_client_destroy(client); 365 424 ds_display_destroy(disp); … … 371 430 ds_display_t *disp; 372 431 ds_client_t *client; 432 ds_seat_t *seat; 373 433 ds_window_t *wnd; 374 434 display_wnd_params_t params; … … 385 445 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 386 446 387 display_wnd_params_init(¶ms); 388 params.rect.p0.x = params.rect.p0.y = 0; 389 params.rect.p1.x = params.rect.p1.y = 1; 390 391 rc = ds_window_create(client, ¶ms, &wnd); 392 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 447 rc = ds_seat_create(disp, &seat); 448 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 449 450 display_wnd_params_init(¶ms); 451 params.rect.p0.x = params.rect.p0.y = 0; 452 params.rect.p1.x = params.rect.p1.y = 1; 453 454 rc = ds_window_create(client, ¶ms, &wnd); 455 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 456 457 /* New window gets focused event */ 458 PCUT_ASSERT_TRUE(called_cb); 459 460 rc = ds_client_get_event(client, &rwindow, &revent); 461 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 462 463 called_cb = false; 464 465 PCUT_ASSERT_FALSE(called_cb); 466 467 rc = ds_client_get_event(client, &rwindow, &revent); 468 PCUT_ASSERT_ERRNO_VAL(ENOENT, rc); 393 469 394 470 rect.p0.x = 1; … … 396 472 rect.p1.x = 3; 397 473 rect.p1.y = 4; 398 399 PCUT_ASSERT_FALSE(called_cb);400 401 rc = ds_client_get_event(client, &rwindow, &revent);402 PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);403 474 404 475 rc = ds_client_post_resize_event(client, wnd, &rect); … … 419 490 420 491 ds_window_destroy(wnd); 492 ds_seat_destroy(seat); 421 493 ds_client_destroy(client); 422 494 ds_display_destroy(disp); … … 428 500 ds_display_t *disp; 429 501 ds_client_t *client; 502 ds_seat_t *seat; 430 503 ds_window_t *wnd; 431 504 display_wnd_params_t params; … … 441 514 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 442 515 443 display_wnd_params_init(¶ms); 444 params.rect.p0.x = params.rect.p0.y = 0; 445 params.rect.p1.x = params.rect.p1.y = 1; 446 447 rc = ds_window_create(client, ¶ms, &wnd); 448 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 449 450 PCUT_ASSERT_FALSE(called_cb); 516 rc = ds_seat_create(disp, &seat); 517 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 518 519 display_wnd_params_init(¶ms); 520 params.rect.p0.x = params.rect.p0.y = 0; 521 params.rect.p1.x = params.rect.p1.y = 1; 522 523 rc = ds_window_create(client, ¶ms, &wnd); 524 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 525 526 /* New window gets focused event */ 527 PCUT_ASSERT_TRUE(called_cb); 528 529 rc = ds_client_get_event(client, &rwindow, &revent); 530 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 531 532 called_cb = false; 451 533 452 534 rc = ds_client_get_event(client, &rwindow, &revent); … … 466 548 467 549 ds_window_destroy(wnd); 550 ds_seat_destroy(seat); 468 551 ds_client_destroy(client); 469 552 ds_display_destroy(disp); … … 479 562 ds_display_t *disp; 480 563 ds_client_t *client; 564 ds_seat_t *seat; 481 565 ds_window_t *wnd; 482 566 display_wnd_params_t params; … … 489 573 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 490 574 491 display_wnd_params_init(¶ms); 492 params.rect.p0.x = params.rect.p0.y = 0; 493 params.rect.p1.x = params.rect.p1.y = 1; 494 495 rc = ds_window_create(client, ¶ms, &wnd); 496 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 497 575 rc = ds_seat_create(disp, &seat); 576 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 577 578 display_wnd_params_init(¶ms); 579 params.rect.p0.x = params.rect.p0.y = 0; 580 params.rect.p1.x = params.rect.p1.y = 1; 581 582 rc = ds_window_create(client, ¶ms, &wnd); 583 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 584 585 ds_seat_destroy(seat); 498 586 ds_client_destroy(client); 499 587 ds_display_destroy(disp);
Note:
See TracChangeset
for help on using the changeset viewer.