Ignore:
File:
1 edited

Legend:

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

    r266ec54 rafcf704  
    3434PCUT_TEST_SUITE(coord);
    3535
    36 /** gfx_coord_div_rneg rounds towards negative numbers */
    37 PCUT_TEST(coord_div_rneg)
    38 {
    39         PCUT_ASSERT_INT_EQUALS(-3, gfx_coord_div_rneg(-7, 3));
    40         PCUT_ASSERT_INT_EQUALS(-2, gfx_coord_div_rneg(-6, 3));
    41         PCUT_ASSERT_INT_EQUALS(-2, gfx_coord_div_rneg(-5, 3));
    42         PCUT_ASSERT_INT_EQUALS(-2, gfx_coord_div_rneg(-4, 3));
    43         PCUT_ASSERT_INT_EQUALS(-1, gfx_coord_div_rneg(-3, 3));
    44         PCUT_ASSERT_INT_EQUALS(-1, gfx_coord_div_rneg(-2, 3));
    45         PCUT_ASSERT_INT_EQUALS(-1, gfx_coord_div_rneg(-1, 3));
    46         PCUT_ASSERT_INT_EQUALS(0, gfx_coord_div_rneg(0, 3));
    47         PCUT_ASSERT_INT_EQUALS(0, gfx_coord_div_rneg(1, 3));
    48         PCUT_ASSERT_INT_EQUALS(0, gfx_coord_div_rneg(2, 3));
    49         PCUT_ASSERT_INT_EQUALS(1, gfx_coord_div_rneg(3, 3));
    50         PCUT_ASSERT_INT_EQUALS(1, gfx_coord_div_rneg(4, 3));
    51         PCUT_ASSERT_INT_EQUALS(1, gfx_coord_div_rneg(5, 3));
    52         PCUT_ASSERT_INT_EQUALS(2, gfx_coord_div_rneg(6, 3));
    53 }
    54 
    5536/** gfx_coord2_add should add two coordinate vectors */
    5637PCUT_TEST(coord2_add)
     
    597578}
    598579
    599 /** Center rectangle on rectangle */
    600 PCUT_TEST(rect_ctr_on_rect)
    601 {
    602         gfx_rect_t a;
    603         gfx_rect_t b;
    604         gfx_rect_t dest;
    605 
    606         /* Dimensions: 20 x 20 */
    607         b.p0.x = 10;
    608         b.p0.y = 20;
    609         b.p1.x = 30;
    610         b.p1.y = 40;
    611 
    612         /* Dimensions: 20 x 20 */
    613         a.p0.x = 100;
    614         a.p0.y = 200;
    615         a.p1.x = 120;
    616         a.p1.y = 220;
    617 
    618         /* Centering rectangle of same size should give us the same rectangle */
    619         gfx_rect_ctr_on_rect(&a, &b, &dest);
    620         PCUT_ASSERT_INT_EQUALS(b.p0.x, dest.p0.x);
    621         PCUT_ASSERT_INT_EQUALS(b.p0.y, dest.p0.y);
    622         PCUT_ASSERT_INT_EQUALS(b.p1.x, dest.p1.x);
    623         PCUT_ASSERT_INT_EQUALS(b.p1.y, dest.p1.y);
    624 
    625         /* Dimensions: 10 x 10 */
    626         a.p0.x = 100;
    627         a.p0.y = 200;
    628         a.p1.x = 110;
    629         a.p1.y = 210;
    630 
    631         gfx_rect_ctr_on_rect(&a, &b, &dest);
    632         PCUT_ASSERT_INT_EQUALS(15, dest.p0.x);
    633         PCUT_ASSERT_INT_EQUALS(25, dest.p0.y);
    634         PCUT_ASSERT_INT_EQUALS(25, dest.p1.x);
    635         PCUT_ASSERT_INT_EQUALS(35, dest.p1.y);
    636 }
    637 
    638580/** Sort span points that are already sorted should produde indentical points */
    639581PCUT_TEST(rect_points_sort_sorted)
Note: See TracChangeset for help on using the changeset viewer.