diff --git a/src/Makefile_Eina.am b/src/Makefile_Eina.am index 3a181b68a3..532c051a95 100644 --- a/src/Makefile_Eina.am +++ b/src/Makefile_Eina.am @@ -309,7 +309,8 @@ tests/eina/eina_test_tmpstr.c \ tests/eina/eina_test_trash.c \ tests/eina/eina_test_lock.c \ tests/eina/eina_test_xattr.c \ -tests/eina/eina_test_crc.c +tests/eina/eina_test_crc.c \ +tests/eina/eina_test_quad.c # tests/eina/eina_test_model.c diff --git a/src/tests/eina/eina_suite.c b/src/tests/eina/eina_suite.c index 1a08480f7f..17706cf483 100644 --- a/src/tests/eina/eina_suite.c +++ b/src/tests/eina/eina_suite.c @@ -80,6 +80,7 @@ static const Eina_Test_Case etc[] = { { "Xattr", eina_test_xattr }, #endif {"Crc", eina_test_crc }, + {"Quad", eina_test_quad }, { NULL, NULL } }; diff --git a/src/tests/eina/eina_suite.h b/src/tests/eina/eina_suite.h index 63d76cdce1..9f3df3a81a 100644 --- a/src/tests/eina/eina_suite.h +++ b/src/tests/eina/eina_suite.h @@ -65,5 +65,6 @@ void eina_test_abi(TCase *tc); void eina_test_trash(TCase *tc); void eina_test_xattr(TCase *tc); void eina_test_crc(TCase *tc); +void eina_test_quad(TCase *tc); #endif /* EINA_SUITE_H_ */ diff --git a/src/tests/eina/eina_test_quad.c b/src/tests/eina/eina_test_quad.c new file mode 100644 index 0000000000..eb1638f4a2 --- /dev/null +++ b/src/tests/eina/eina_test_quad.c @@ -0,0 +1,64 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include + +#include "eina_suite.h" +#include "Eina.h" + +START_TEST(eina_quad_simple) +{ + Eina_Rectangle r1; + Eina_Quad r2; + double x0, x1, x2, x3; + double y0, y1, y2, y3; + + fail_if(!eina_init()); + + eina_quad_coords_set(&r2, + 0.0, 5.0, + 5.0, 0.0, + 10.0, 5.0, + 5.0, 10.0); + + eina_quad_coords_get(&r2, + &x0, &y0, + &x1, &y1, + &x2, &y2, + &x3, &y3); + fail_if (r2.x0 != 0.0 || r2.y0 != 5.0 + || r2.x1 != 5.0 || r2.y1 != 0.0 + || r2.x2 != 10.0 || r2.y2 != 5.0 + || r2.x3 != 5.0 || r2.y3 != 10.0); + + eina_quad_rectangle_to(&r2, &r1); + fail_if (r1.x != 0 || r1.y != 0 + || r1.w != 10 || r1.h != 10); + + eina_quad_coords_set(&r2, + 0.0, 0.0, + 0.0, 0.0, + 0.0, 0.0, + 0.0, 0.0); + eina_quad_rectangle_to(&r2, &r1); + fail_if (r1.x != 0 || r1.y != 0 + || r1.w != 0 || r1.h != 0); + + EINA_RECTANGLE_SET(&r1, 5, 10, 20, 30); + eina_quad_rectangle_from(&r2, &r1); + fail_if (r2.x0 != 5.0 || r2.y0 != 10.0 + || r2.x1 != 25.0 || r2.y1 != 10.0 + || r2.x2 != 25.0 || r2.y2 != 40.0 + || r2.x3 != 5.0 || r2.y3 != 40.0); + + eina_shutdown(); +} +END_TEST + +void +eina_test_quad(TCase *tc) +{ + tcase_add_test(tc, eina_quad_simple); +}