cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=331068b84a9f2adb1bed55d2c44278315a8de061

commit 331068b84a9f2adb1bed55d2c44278315a8de061
Author: Vivek Ellur <vivek.el...@samsung.com>
Date:   Tue May 26 18:31:55 2015 +0200

    eina: add test cases for various APIs in eina_quad module.
    
    Summary:
    Added test cases for all the APIs in einq_quad module
    
    Signed-off-by: Vivek Ellur <vivek.el...@samsung.com>
    
    Reviewers: cedric
    
    Subscribers: cedric
    
    Differential Revision: https://phab.enlightenment.org/D2551
    
    Signed-off-by: Cedric BAIL <ced...@osg.samsung.com>
---
 src/Makefile_Eina.am            |  3 +-
 src/tests/eina/eina_suite.c     |  1 +
 src/tests/eina/eina_suite.h     |  1 +
 src/tests/eina/eina_test_quad.c | 64 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 68 insertions(+), 1 deletion(-)

diff --git a/src/Makefile_Eina.am b/src/Makefile_Eina.am
index 3a181b6..532c051 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 1a08480..17706cf 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 63d76cd..9f3df3a 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 0000000..eb1638f
--- /dev/null
+++ b/src/tests/eina/eina_test_quad.c
@@ -0,0 +1,64 @@
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <assert.h>
+#include <stdio.h>
+
+#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);
+}

-- 


Reply via email to