Changeset afcf704 in mainline for uspace/lib/gfx/test/coord.c


Ignore:
Timestamp:
2020-06-14T22:23:34Z (4 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c45d8696
Parents:
28f8f6f2
Message:

Allow GUI direct access to window buffer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/gfx/test/coord.c

    r28f8f6f2 rafcf704  
    775775}
    776776
     777/** gfx_rect_is_inside is true for rectangle strictly inside */
     778PCUT_TEST(rect_is_inside_strict)
     779{
     780        gfx_rect_t a;
     781        gfx_rect_t b;
     782
     783        a.p0.x = 2;
     784        a.p0.y = 3;
     785        a.p1.x = 4;
     786        a.p1.y = 5;
     787
     788        b.p0.x = 1;
     789        b.p0.y = 2;
     790        b.p1.x = 5;
     791        b.p1.y = 6;
     792
     793        PCUT_ASSERT_TRUE(gfx_rect_is_inside(&a, &b));
     794}
     795
     796/** gfx_rect_is_inside is true for two equal rectangles */
     797PCUT_TEST(rect_is_inside_same)
     798{
     799        gfx_rect_t a;
     800        gfx_rect_t b;
     801
     802        a.p0.x = 1;
     803        a.p0.y = 2;
     804        a.p1.x = 3;
     805        a.p1.y = 4;
     806
     807        b.p0.x = 1;
     808        b.p0.y = 2;
     809        b.p1.x = 3;
     810        b.p1.y = 4;
     811
     812        PCUT_ASSERT_TRUE(gfx_rect_is_inside(&a, &b));
     813}
     814
     815/** gfx_rect_is_inside is false for @c a.p0 outside */
     816PCUT_TEST(rect_is_inside_p0_outside)
     817{
     818        gfx_rect_t a;
     819        gfx_rect_t b;
     820
     821        a.p0.x = 0;
     822        a.p0.y = 2;
     823        a.p1.x = 3;
     824        a.p1.y = 4;
     825
     826        b.p0.x = 1;
     827        b.p0.y = 2;
     828        b.p1.x = 3;
     829        b.p1.y = 4;
     830
     831        PCUT_ASSERT_FALSE(gfx_rect_is_inside(&a, &b));
     832
     833        a.p0.x = 1;
     834        a.p0.y = 1;
     835        a.p1.x = 3;
     836        a.p1.y = 4;
     837
     838        b.p0.x = 1;
     839        b.p0.y = 2;
     840        b.p1.x = 3;
     841        b.p1.y = 4;
     842
     843        PCUT_ASSERT_FALSE(gfx_rect_is_inside(&a, &b));
     844}
     845
     846/** gfx_rect_is_inside is false for @c a.p1 outside */
     847PCUT_TEST(rect_is_inside_p1_outside)
     848{
     849        gfx_rect_t a;
     850        gfx_rect_t b;
     851
     852        a.p0.x = 1;
     853        a.p0.y = 2;
     854        a.p1.x = 4;
     855        a.p1.y = 4;
     856
     857        b.p0.x = 1;
     858        b.p0.y = 2;
     859        b.p1.x = 3;
     860        b.p1.y = 4;
     861
     862        PCUT_ASSERT_FALSE(gfx_rect_is_inside(&a, &b));
     863
     864        a.p0.x = 1;
     865        a.p0.y = 2;
     866        a.p1.x = 3;
     867        a.p1.y = 5;
     868
     869        b.p0.x = 1;
     870        b.p0.y = 2;
     871        b.p1.x = 3;
     872        b.p1.y = 4;
     873
     874        PCUT_ASSERT_FALSE(gfx_rect_is_inside(&a, &b));
     875}
     876
    777877/** gfx_pix_inside_rect for  */
    778878PCUT_TEST(pix_inside_rect)
Note: See TracChangeset for help on using the changeset viewer.