summaryrefslogtreecommitdiff
path: root/src/tests/eina/eina_test_quad.c
diff options
context:
space:
mode:
authorVivek Ellur <vivek.ellur@samsung.com>2015-05-26 18:31:55 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-05-27 00:31:06 +0200
commit331068b84a9f2adb1bed55d2c44278315a8de061 (patch)
treedbf2e531ae4c1dcc9cb250e277aa6b2a80e0b1f3 /src/tests/eina/eina_test_quad.c
parent4cb4a8c70af20f08175fa043722e2cec710605c8 (diff)
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.ellur@samsung.com> Reviewers: cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2551 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to '')
-rw-r--r--src/tests/eina/eina_test_quad.c64
1 files changed, 64 insertions, 0 deletions
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 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <assert.h>
6#include <stdio.h>
7
8#include "eina_suite.h"
9#include "Eina.h"
10
11START_TEST(eina_quad_simple)
12{
13 Eina_Rectangle r1;
14 Eina_Quad r2;
15 double x0, x1, x2, x3;
16 double y0, y1, y2, y3;
17
18 fail_if(!eina_init());
19
20 eina_quad_coords_set(&r2,
21 0.0, 5.0,
22 5.0, 0.0,
23 10.0, 5.0,
24 5.0, 10.0);
25
26 eina_quad_coords_get(&r2,
27 &x0, &y0,
28 &x1, &y1,
29 &x2, &y2,
30 &x3, &y3);
31 fail_if (r2.x0 != 0.0 || r2.y0 != 5.0
32 || r2.x1 != 5.0 || r2.y1 != 0.0
33 || r2.x2 != 10.0 || r2.y2 != 5.0
34 || r2.x3 != 5.0 || r2.y3 != 10.0);
35
36 eina_quad_rectangle_to(&r2, &r1);
37 fail_if (r1.x != 0 || r1.y != 0
38 || r1.w != 10 || r1.h != 10);
39
40 eina_quad_coords_set(&r2,
41 0.0, 0.0,
42 0.0, 0.0,
43 0.0, 0.0,
44 0.0, 0.0);
45 eina_quad_rectangle_to(&r2, &r1);
46 fail_if (r1.x != 0 || r1.y != 0
47 || r1.w != 0 || r1.h != 0);
48
49 EINA_RECTANGLE_SET(&r1, 5, 10, 20, 30);
50 eina_quad_rectangle_from(&r2, &r1);
51 fail_if (r2.x0 != 5.0 || r2.y0 != 10.0
52 || r2.x1 != 25.0 || r2.y1 != 10.0
53 || r2.x2 != 25.0 || r2.y2 != 40.0
54 || r2.x3 != 5.0 || r2.y3 != 40.0);
55
56 eina_shutdown();
57}
58END_TEST
59
60void
61eina_test_quad(TCase *tc)
62{
63 tcase_add_test(tc, eina_quad_simple);
64}