diff options
author | Vivek Ellur <vivek.ellur@samsung.com> | 2015-05-26 18:31:55 +0200 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2015-05-27 00:31:06 +0200 |
commit | 331068b84a9f2adb1bed55d2c44278315a8de061 (patch) | |
tree | dbf2e531ae4c1dcc9cb250e277aa6b2a80e0b1f3 | |
parent | 4cb4a8c70af20f08175fa043722e2cec710605c8 (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>
-rw-r--r-- | src/Makefile_Eina.am | 3 | ||||
-rw-r--r-- | src/tests/eina/eina_suite.c | 1 | ||||
-rw-r--r-- | src/tests/eina/eina_suite.h | 1 | ||||
-rw-r--r-- | src/tests/eina/eina_test_quad.c | 64 |
4 files changed, 68 insertions, 1 deletions
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 \ | |||
309 | tests/eina/eina_test_trash.c \ | 309 | tests/eina/eina_test_trash.c \ |
310 | tests/eina/eina_test_lock.c \ | 310 | tests/eina/eina_test_lock.c \ |
311 | tests/eina/eina_test_xattr.c \ | 311 | tests/eina/eina_test_xattr.c \ |
312 | tests/eina/eina_test_crc.c | 312 | tests/eina/eina_test_crc.c \ |
313 | tests/eina/eina_test_quad.c | ||
313 | # tests/eina/eina_test_model.c | 314 | # tests/eina/eina_test_model.c |
314 | 315 | ||
315 | 316 | ||
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[] = { | |||
80 | { "Xattr", eina_test_xattr }, | 80 | { "Xattr", eina_test_xattr }, |
81 | #endif | 81 | #endif |
82 | {"Crc", eina_test_crc }, | 82 | {"Crc", eina_test_crc }, |
83 | {"Quad", eina_test_quad }, | ||
83 | { NULL, NULL } | 84 | { NULL, NULL } |
84 | }; | 85 | }; |
85 | 86 | ||
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); | |||
65 | void eina_test_trash(TCase *tc); | 65 | void eina_test_trash(TCase *tc); |
66 | void eina_test_xattr(TCase *tc); | 66 | void eina_test_xattr(TCase *tc); |
67 | void eina_test_crc(TCase *tc); | 67 | void eina_test_crc(TCase *tc); |
68 | void eina_test_quad(TCase *tc); | ||
68 | 69 | ||
69 | #endif /* EINA_SUITE_H_ */ | 70 | #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 @@ | |||
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 | |||
11 | START_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 | } | ||
58 | END_TEST | ||
59 | |||
60 | void | ||
61 | eina_test_quad(TCase *tc) | ||
62 | { | ||
63 | tcase_add_test(tc, eina_quad_simple); | ||
64 | } | ||