Changeset b3825aa in mainline
- Timestamp:
- 2020-03-16T12:23:20Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b5c7cee
- Parents:
- 9b502dd
- git-author:
- Jiri Svoboda <jiri@…> (2020-03-15 19:23:15)
- git-committer:
- Jiri Svoboda <jiri@…> (2020-03-16 12:23:20)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/test/window.c
r9b502dd rb3825aa 331 331 display_wnd_params_t params; 332 332 gfx_coord2_t dresize; 333 gfx_coord2_t dresizen; 334 gfx_coord2_t dresizeb; 335 gfx_coord2_t dresizebn; 333 336 gfx_rect_t nrect; 334 337 errno_t rc; … … 343 346 params.rect.p0.x = 10; 344 347 params.rect.p0.y = 11; 345 params.rect.p1.x = 20; 346 params.rect.p1.y = 21; 348 params.rect.p1.x = 30; 349 params.rect.p1.y = 31; 350 params.min_size.x = 2; 351 params.min_size.y = 3; 347 352 348 353 rc = ds_window_create(client, ¶ms, &wnd); … … 350 355 351 356 wnd->state = dsw_resizing; 357 352 358 dresize.x = 5; 353 359 dresize.y = 6; 354 360 361 dresizen.x = -5; 362 dresizen.y = -6; 363 364 dresizeb.x = 50; 365 dresizeb.y = 60; 366 367 dresizebn.x = -50; 368 dresizebn.y = -60; 369 370 /* Resize top */ 355 371 wnd->rsztype = display_wr_top; 372 356 373 ds_window_calc_resize(wnd, &dresize, &nrect); 357 374 PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x); 358 375 PCUT_ASSERT_INT_EQUALS(17, nrect.p0.y); 359 PCUT_ASSERT_INT_EQUALS(20, nrect.p1.x); 360 PCUT_ASSERT_INT_EQUALS(21, nrect.p1.y); 361 376 PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x); 377 PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y); 378 379 ds_window_calc_resize(wnd, &dresizen, &nrect); 380 PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x); 381 PCUT_ASSERT_INT_EQUALS(5, nrect.p0.y); 382 PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x); 383 PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y); 384 385 ds_window_calc_resize(wnd, &dresizeb, &nrect); 386 PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x); 387 PCUT_ASSERT_INT_EQUALS(28, nrect.p0.y); 388 PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x); 389 PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y); 390 391 ds_window_calc_resize(wnd, &dresizebn, &nrect); 392 PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x); 393 PCUT_ASSERT_INT_EQUALS(-49, nrect.p0.y); 394 PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x); 395 PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y); 396 397 /* Resize top left */ 362 398 wnd->rsztype = display_wr_top_left; 399 363 400 ds_window_calc_resize(wnd, &dresize, &nrect); 364 401 PCUT_ASSERT_INT_EQUALS(15, nrect.p0.x); 365 402 PCUT_ASSERT_INT_EQUALS(17, nrect.p0.y); 366 PCUT_ASSERT_INT_EQUALS(20, nrect.p1.x); 367 PCUT_ASSERT_INT_EQUALS(21, nrect.p1.y); 368 403 PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x); 404 PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y); 405 406 ds_window_calc_resize(wnd, &dresizen, &nrect); 407 PCUT_ASSERT_INT_EQUALS(5, nrect.p0.x); 408 PCUT_ASSERT_INT_EQUALS(5, nrect.p0.y); 409 PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x); 410 PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y); 411 412 ds_window_calc_resize(wnd, &dresizeb, &nrect); 413 PCUT_ASSERT_INT_EQUALS(28, nrect.p0.x); 414 PCUT_ASSERT_INT_EQUALS(28, nrect.p0.y); 415 PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x); 416 PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y); 417 418 ds_window_calc_resize(wnd, &dresizebn, &nrect); 419 PCUT_ASSERT_INT_EQUALS(-40, nrect.p0.x); 420 PCUT_ASSERT_INT_EQUALS(-49, nrect.p0.y); 421 PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x); 422 PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y); 423 424 /* Resize left */ 369 425 wnd->rsztype = display_wr_left; 426 370 427 ds_window_calc_resize(wnd, &dresize, &nrect); 371 428 PCUT_ASSERT_INT_EQUALS(15, nrect.p0.x); 372 429 PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y); 373 PCUT_ASSERT_INT_EQUALS(20, nrect.p1.x); 374 PCUT_ASSERT_INT_EQUALS(21, nrect.p1.y); 375 430 PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x); 431 PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y); 432 433 ds_window_calc_resize(wnd, &dresizen, &nrect); 434 PCUT_ASSERT_INT_EQUALS(5, nrect.p0.x); 435 PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y); 436 PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x); 437 PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y); 438 439 ds_window_calc_resize(wnd, &dresizeb, &nrect); 440 PCUT_ASSERT_INT_EQUALS(28, nrect.p0.x); 441 PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y); 442 PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x); 443 PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y); 444 445 ds_window_calc_resize(wnd, &dresizebn, &nrect); 446 PCUT_ASSERT_INT_EQUALS(-40, nrect.p0.x); 447 PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y); 448 PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x); 449 PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y); 450 451 /* Resize bottom left */ 376 452 wnd->rsztype = display_wr_bottom_left; 453 377 454 ds_window_calc_resize(wnd, &dresize, &nrect); 378 455 PCUT_ASSERT_INT_EQUALS(15, nrect.p0.x); 379 456 PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y); 380 PCUT_ASSERT_INT_EQUALS(20, nrect.p1.x); 381 PCUT_ASSERT_INT_EQUALS(27, nrect.p1.y); 382 457 PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x); 458 PCUT_ASSERT_INT_EQUALS(37, nrect.p1.y); 459 460 ds_window_calc_resize(wnd, &dresizen, &nrect); 461 PCUT_ASSERT_INT_EQUALS(5, nrect.p0.x); 462 PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y); 463 PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x); 464 PCUT_ASSERT_INT_EQUALS(25, nrect.p1.y); 465 466 ds_window_calc_resize(wnd, &dresizeb, &nrect); 467 PCUT_ASSERT_INT_EQUALS(28, nrect.p0.x); 468 PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y); 469 PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x); 470 PCUT_ASSERT_INT_EQUALS(91, nrect.p1.y); 471 472 ds_window_calc_resize(wnd, &dresizebn, &nrect); 473 PCUT_ASSERT_INT_EQUALS(-40, nrect.p0.x); 474 PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y); 475 PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x); 476 PCUT_ASSERT_INT_EQUALS(14, nrect.p1.y); 477 478 /* Resize bottom */ 383 479 wnd->rsztype = display_wr_bottom; 384 ds_window_calc_resize(wnd, &dresize, &nrect); 385 PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x); 386 PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y); 387 PCUT_ASSERT_INT_EQUALS(20, nrect.p1.x); 388 PCUT_ASSERT_INT_EQUALS(27, nrect.p1.y); 389 480 481 ds_window_calc_resize(wnd, &dresize, &nrect); 482 PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x); 483 PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y); 484 PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x); 485 PCUT_ASSERT_INT_EQUALS(37, nrect.p1.y); 486 487 ds_window_calc_resize(wnd, &dresizen, &nrect); 488 PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x); 489 PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y); 490 PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x); 491 PCUT_ASSERT_INT_EQUALS(25, nrect.p1.y); 492 493 ds_window_calc_resize(wnd, &dresizeb, &nrect); 494 PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x); 495 PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y); 496 PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x); 497 PCUT_ASSERT_INT_EQUALS(91, nrect.p1.y); 498 499 ds_window_calc_resize(wnd, &dresizebn, &nrect); 500 PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x); 501 PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y); 502 PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x); 503 PCUT_ASSERT_INT_EQUALS(14, nrect.p1.y); 504 505 /* Resize bottom right */ 390 506 wnd->rsztype = display_wr_bottom_right; 391 ds_window_calc_resize(wnd, &dresize, &nrect); 507 508 ds_window_calc_resize(wnd, &dresize, &nrect); 509 PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x); 510 PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y); 511 PCUT_ASSERT_INT_EQUALS(35, nrect.p1.x); 512 PCUT_ASSERT_INT_EQUALS(37, nrect.p1.y); 513 514 ds_window_calc_resize(wnd, &dresizen, &nrect); 392 515 PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x); 393 516 PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y); 394 517 PCUT_ASSERT_INT_EQUALS(25, nrect.p1.x); 395 PCUT_ASSERT_INT_EQUALS(27, nrect.p1.y); 396 518 PCUT_ASSERT_INT_EQUALS(25, nrect.p1.y); 519 520 ds_window_calc_resize(wnd, &dresizeb, &nrect); 521 PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x); 522 PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y); 523 PCUT_ASSERT_INT_EQUALS(80, nrect.p1.x); 524 PCUT_ASSERT_INT_EQUALS(91, nrect.p1.y); 525 526 ds_window_calc_resize(wnd, &dresizebn, &nrect); 527 PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x); 528 PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y); 529 PCUT_ASSERT_INT_EQUALS(12, nrect.p1.x); 530 PCUT_ASSERT_INT_EQUALS(14, nrect.p1.y); 531 532 /* Resize right */ 397 533 wnd->rsztype = display_wr_right; 398 ds_window_calc_resize(wnd, &dresize, &nrect); 534 535 ds_window_calc_resize(wnd, &dresize, &nrect); 536 PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x); 537 PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y); 538 PCUT_ASSERT_INT_EQUALS(35, nrect.p1.x); 539 PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y); 540 541 ds_window_calc_resize(wnd, &dresizen, &nrect); 399 542 PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x); 400 543 PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y); 401 544 PCUT_ASSERT_INT_EQUALS(25, nrect.p1.x); 402 PCUT_ASSERT_INT_EQUALS(21, nrect.p1.y); 403 545 PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y); 546 547 ds_window_calc_resize(wnd, &dresizeb, &nrect); 548 PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x); 549 PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y); 550 PCUT_ASSERT_INT_EQUALS(80, nrect.p1.x); 551 PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y); 552 553 ds_window_calc_resize(wnd, &dresizebn, &nrect); 554 PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x); 555 PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y); 556 PCUT_ASSERT_INT_EQUALS(12, nrect.p1.x); 557 PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y); 558 559 /* Resize top right */ 404 560 wnd->rsztype = display_wr_top_right; 561 405 562 ds_window_calc_resize(wnd, &dresize, &nrect); 406 563 PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x); 407 564 PCUT_ASSERT_INT_EQUALS(17, nrect.p0.y); 565 PCUT_ASSERT_INT_EQUALS(35, nrect.p1.x); 566 PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y); 567 568 ds_window_calc_resize(wnd, &dresizen, &nrect); 569 PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x); 570 PCUT_ASSERT_INT_EQUALS(5, nrect.p0.y); 408 571 PCUT_ASSERT_INT_EQUALS(25, nrect.p1.x); 409 PCUT_ASSERT_INT_EQUALS(21, nrect.p1.y); 572 PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y); 573 574 ds_window_calc_resize(wnd, &dresizeb, &nrect); 575 PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x); 576 PCUT_ASSERT_INT_EQUALS(28, nrect.p0.y); 577 PCUT_ASSERT_INT_EQUALS(80, nrect.p1.x); 578 PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y); 579 580 ds_window_calc_resize(wnd, &dresizebn, &nrect); 581 PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x); 582 PCUT_ASSERT_INT_EQUALS(-49, nrect.p0.y); 583 PCUT_ASSERT_INT_EQUALS(12, nrect.p1.x); 584 PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y); 410 585 411 586 ds_window_destroy(wnd);
Note:
See TracChangeset
for help on using the changeset viewer.