summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVivek Ellur <vivek.ellur@samsung.com>2015-06-25 15:35:33 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-06-25 17:21:09 +0200
commit70e5687f6c43ffd3a66de592e625ff59c15909b6 (patch)
treee1c98980baa3f26653a138ab7c639fc2814c3638
parent22094b6a275032027f3a3ef84d36ad4ab4c708a2 (diff)
eina: add test cases for eina matrix map and transform functions
Summary: Added test cases for matrix map and transform functions Signed-off-by: Vivek Ellur <vivek.ellur@samsung.com> Reviewers: stefan_schmidt, cedric Reviewed By: stefan_schmidt, cedric Subscribers: stefan_schmidt, cedric Differential Revision: https://phab.enlightenment.org/D2758 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--src/tests/eina/eina_test_matrix.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/tests/eina/eina_test_matrix.c b/src/tests/eina/eina_test_matrix.c
index ed7c7ef532..af1e005c78 100644
--- a/src/tests/eina/eina_test_matrix.c
+++ b/src/tests/eina/eina_test_matrix.c
@@ -366,6 +366,58 @@ START_TEST(eina_matrix3_f16p16)
366} 366}
367END_TEST 367END_TEST
368 368
369START_TEST(eina_matrix3_map_transform)
370{
371 double x = 2, y = 3, x1, y1;
372 Eina_Matrix3 m;
373 Eina_Rectangle r;
374 Eina_Quad q;
375 Eina_Bool ret;
376
377 eina_init();
378
379 eina_matrix3_values_set(&m,
380 0, 1, 0,
381 1, 0, 0,
382 0, 0, 1);
383
384 eina_matrix3_point_transform(&m,
385 x, y,
386 &x1, &y1);
387 fail_if(x1 != 3 || y1 != 2);
388
389 EINA_RECTANGLE_SET(&r, 0, 0, 3, 4);
390 eina_matrix3_rectangle_transform(&m, &r, &q);
391
392 fail_if(q.x0 != 0 || q.y0 != 0 ||
393 q.x1 != 0 || q.y1 != 3 ||
394 q.x2 != 4 || q.y2 != 3 ||
395 q.x3 != 4 || q.y3 != 0);
396
397 eina_quad_coords_set(&q,
398 0.0, 0.0,
399 3.0, 0.0,
400 3.0, 3.0,
401 0.0, 3.0);
402 ret = eina_matrix3_square_quad_map(&m, &q);
403 fail_if(ret != EINA_TRUE);
404
405 fail_if(m.xx != 3 || m.xy != 0 || m.xz != 0 ||
406 m.yx != 0 || m.yy != 3 || m.yz != 0 ||
407 m.zx != 0 || m.zy != 0 || m.zz != 1);
408
409 ret = eina_matrix3_quad_square_map(&m, &q);
410 fail_if(ret != EINA_TRUE);
411
412 fail_if(q.x0 != 0 || q.y0 != 0 ||
413 q.x1 != 3 || q.y1 != 0 ||
414 q.x2 != 3 || q.y2 != 3 ||
415 q.x3 != 0 || q.y3 != 3);
416
417 eina_shutdown();
418}
419END_TEST
420
369void 421void
370eina_test_matrix(TCase *tc) 422eina_test_matrix(TCase *tc)
371{ 423{
@@ -374,4 +426,5 @@ eina_test_matrix(TCase *tc)
374 tcase_add_test(tc, eina_matrix3); 426 tcase_add_test(tc, eina_matrix3);
375 tcase_add_test(tc, eina_matrix3_operations); 427 tcase_add_test(tc, eina_matrix3_operations);
376 tcase_add_test(tc, eina_matrix3_f16p16); 428 tcase_add_test(tc, eina_matrix3_f16p16);
429 tcase_add_test(tc, eina_matrix3_map_transform);
377} 430}