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


Ignore:
Timestamp:
2020-02-21T10:50:48Z (4 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
265989d
Parents:
6c2aba3
git-author:
Jiri Svoboda <jiri@…> (2020-02-19 19:38:03)
git-committer:
Jiri Svoboda <jiri@…> (2020-02-21 10:50:48)
Message:

Support absolute movement events from input device

File:
1 edited

Legend:

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

    r6c2aba3 r1388f7f0  
    131131}
    132132
     133/** gfx_coord2_project projects pixel from one rectangle to another  */
     134PCUT_TEST(coord2_project)
     135{
     136        gfx_coord2_t a, d;
     137        gfx_rect_t srect, drect;
     138
     139        srect.p0.x = 10;
     140        srect.p0.y = 10;
     141        srect.p1.x = 20 + 1;
     142        srect.p1.y = 20 + 1;
     143
     144        drect.p0.x = 100;
     145        drect.p0.y = 100;
     146        drect.p1.x = 200 + 1;
     147        drect.p1.y = 200 + 1;
     148
     149        a.x = 10;
     150        a.y = 10;
     151        gfx_coord2_project(&a, &srect, &drect, &d);
     152        PCUT_ASSERT_INT_EQUALS(100, d.x);
     153        PCUT_ASSERT_INT_EQUALS(100, d.y);
     154
     155        a.x = 15;
     156        a.y = 15;
     157        gfx_coord2_project(&a, &srect, &drect, &d);
     158        PCUT_ASSERT_INT_EQUALS(150, d.x);
     159        PCUT_ASSERT_INT_EQUALS(150, d.y);
     160
     161        a.x = 12;
     162        a.y = 16;
     163        gfx_coord2_project(&a, &srect, &drect, &d);
     164        PCUT_ASSERT_INT_EQUALS(120, d.x);
     165        PCUT_ASSERT_INT_EQUALS(160, d.y);
     166
     167        a.x = 20;
     168        a.y = 20;
     169        gfx_coord2_project(&a, &srect, &drect, &d);
     170        PCUT_ASSERT_INT_EQUALS(200, d.x);
     171        PCUT_ASSERT_INT_EQUALS(200, d.y);
     172}
     173
    133174/** gfx_rect_translate should translate rectangle */
    134175PCUT_TEST(rect_translate)
Note: See TracChangeset for help on using the changeset viewer.