summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinwoo Kim <cinoo.kim@samsung.com>2021-10-18 09:10:17 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2021-10-18 09:10:17 +0100
commit24c4fbb99eded6ba85ba8dd436fba720b3193f42 (patch)
tree60f254146cadcaf886eb62be84e286367f288e7f
parent5d13df5f7ac1d8160c7878ec9c5cc71702160e5d (diff)
tests: enhance evas_map testHEADmaster
Reviewers: raster, Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D12296
Diffstat (limited to '')
-rw-r--r--src/tests/evas/evas_test_map.c68
1 files changed, 67 insertions, 1 deletions
diff --git a/src/tests/evas/evas_test_map.c b/src/tests/evas/evas_test_map.c
index 68435d1d6b..9e1b9ddc78 100644
--- a/src/tests/evas/evas_test_map.c
+++ b/src/tests/evas/evas_test_map.c
@@ -12,12 +12,15 @@
12#include <Ecore.h> 12#include <Ecore.h>
13 13
14#include "evas_suite.h" 14#include "evas_suite.h"
15#include "evas_tests_helpers.h"
15 16
16EFL_START_TEST(evas_object_map_api) 17EFL_START_TEST(evas_object_map_api)
17{ 18{
18 Evas_Coord x, y, z; 19 Evas_Coord x, y, z;
19 Evas_Map *map = evas_map_new(4); 20 int r, g, b, a;
21 Evas_Map *map;
20 22
23 map = evas_map_new(4);
21 ck_assert_int_eq(evas_map_count_get(map), 4); 24 ck_assert_int_eq(evas_map_count_get(map), 4);
22 25
23 evas_map_alpha_set(map, EINA_TRUE); 26 evas_map_alpha_set(map, EINA_TRUE);
@@ -53,10 +56,73 @@ EFL_START_TEST(evas_object_map_api)
53 evas_map_point_coord_set(map, 3, 100, 110, 120); 56 evas_map_point_coord_set(map, 3, 100, 110, 120);
54 evas_map_point_coord_get(map, 3, &x, &y, &z); 57 evas_map_point_coord_get(map, 3, &x, &y, &z);
55 ck_assert((x == 100) && (y == 110) && (z == 120)); 58 ck_assert((x == 100) && (y == 110) && (z == 120));
59
60 evas_map_point_color_set(map, 0, 0, 0, 0, 255);
61 evas_map_point_color_get(map, 0, &r, &g, &b, &a);
62 ck_assert((r == 0) && (g == 0) && (b == 0) && (a == 255));
63
64 evas_map_point_color_set(map, 1, 255, 0, 0, 255);
65 evas_map_point_color_get(map, 1, &r, &g, &b, &a);
66 ck_assert((r == 255) && (g == 0) && (b == 0) && (a == 255));
67
68 evas_map_point_color_set(map, 2, 255, 255, 0, 255);
69 evas_map_point_color_get(map, 2, &r, &g, &b, &a);
70 ck_assert((r == 255) && (g == 255) && (b == 0) && (a == 255));
71
72 evas_map_point_color_set(map, 3, 255, 255, 255, 255);
73 evas_map_point_color_get(map, 3, &r, &g, &b, &a);
74 ck_assert((r == 255) && (g == 255) && (b == 255) && (a == 255));
75
76 evas_map_free(map);
77}
78EFL_END_TEST
79
80EFL_START_TEST(evas_object_map_rect)
81{
82 Evas *e;
83 Evas_Object *rect;
84 Evas_Map *map;
85 Evas_Coord x, y, z;
86 double u, v;
87
88 e = _setup_evas();
89 rect = evas_object_rectangle_add(e);
90 evas_object_resize(rect, 100, 100);
91
92 map = evas_map_new(4);
93 evas_map_util_points_populate_from_object(map, rect);
94
95 evas_map_point_coord_get(map, 0, &x, &y, &z);
96 ck_assert((x == 0) && (y == 0) && (z == 0));
97
98 evas_map_point_coord_get(map, 1, &x, &y, &z);
99 ck_assert((x == 100) && (y == 0) && (z == 0));
100
101 evas_map_point_coord_get(map, 2, &x, &y, &z);
102 ck_assert((x == 100) && (y == 100) && (z == 0));
103
104 evas_map_point_coord_get(map, 3, &x, &y, &z);
105 ck_assert((x == 0) && (y == 100) && (z == 0));
106
107 evas_map_point_image_uv_get(map, 0, &u, &v);
108 ck_assert((u == 0) && (v == 0));
109
110 evas_map_point_image_uv_get(map, 1, &u, &v);
111 ck_assert((u == 100) && (v == 0));
112
113 evas_map_point_image_uv_get(map, 2, &u, &v);
114 ck_assert((u == 100) && (v == 100));
115
116 evas_map_point_image_uv_get(map, 3, &u, &v);
117 ck_assert((u == 0) && (v == 100));
118
119 evas_map_free(map);
120 evas_free(e);
56} 121}
57EFL_END_TEST 122EFL_END_TEST
58 123
59void evas_test_map(TCase *tc) 124void evas_test_map(TCase *tc)
60{ 125{
61 tcase_add_test(tc, evas_object_map_api); 126 tcase_add_test(tc, evas_object_map_api);
127 tcase_add_test(tc, evas_object_map_rect);
62} 128}