summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Willmann <d.willmann@samsung.com>2013-06-27 17:53:48 +0100
committerDaniel Willmann <d.willmann@samsung.com>2013-06-28 14:25:30 +0100
commit7927c0f9fa742c6b57e97ce3ad348633db369844 (patch)
treeddb0509129db5a8aaa55b7cb78b9e5eb9bcf61d3 /src
parentdb29fbb2865e730f57a183f32a8095952e9372e8 (diff)
edje_test: Test geometry of a more complex layout
It seems someone thought it was fun to have rel2.offset behave differently than rel1.offset... A rel2.offset of 0 actually means the size is increased by one pixel. Acocunt for that in the tests. Signed-off-by: Daniel Willmann <d.willmann@samsung.com>
Diffstat (limited to 'src')
-rw-r--r--src/Makefile_Edje.am11
-rw-r--r--src/tests/edje/data/complex_layout.edc97
-rw-r--r--src/tests/edje/edje_test_edje.c53
3 files changed, 157 insertions, 4 deletions
diff --git a/src/Makefile_Edje.am b/src/Makefile_Edje.am
index f33cd7c652..6c1daf939e 100644
--- a/src/Makefile_Edje.am
+++ b/src/Makefile_Edje.am
@@ -236,15 +236,18 @@ $(EDJE_COMMON_CPPFLAGS) \
236tests_edje_edje_suite_LDADD = @CHECK_LIBS@ $(USE_EDJE_BIN_LIBS) 236tests_edje_edje_suite_LDADD = @CHECK_LIBS@ $(USE_EDJE_BIN_LIBS)
237tests_edje_edje_suite_DEPENDENCIES = @USE_EDJE_INTERNAL_LIBS@ 237tests_edje_edje_suite_DEPENDENCIES = @USE_EDJE_INTERNAL_LIBS@
238 238
239tests/edje/data/test_layout.edj: tests/edje/data/test_layout.edc bin/edje/edje_cc${EXEEXT} 239tests/edje/data/%.edj: tests/edje/data/%.edc bin/edje/edje_cc${EXEEXT}
240 @$(MKDIR_P) tests/edje/data 240 @$(MKDIR_P) tests/edje/data
241 $(AM_V_EDJ)$(EDJE_CC) $(EDJE_CC_FLAGS) -id $(srcdir)/tests/edje/data $< $@ 241 $(AM_V_EDJ)$(EDJE_CC) $(EDJE_CC_FLAGS) -id $(srcdir)/tests/edje/data $< $@
242 242
243EDJE_DATA_FILES = tests/edje/data/test_layout.edc 243EDJE_DATA_FILES = tests/edje/data/test_layout.edc \
244 tests/edje/data/complex_layout.edc
244 245
245edjedatafilesdir = $(datadir)/edje/data 246edjedatafilesdir = $(datadir)/edje/data
246edjedatafiles_DATA = tests/edje/data/test_layout.edj 247edjedatafiles_DATA = tests/edje/data/test_layout.edj \
247CLEANFILES += tests/edje/data/test_layout.edj 248 tests/edje/data/complex_layout.edj
249CLEANFILES += tests/edje/data/test_layout.edj \
250 tests/edje/data/complex_layout.edj
248 251
249endif 252endif
250 253
diff --git a/src/tests/edje/data/complex_layout.edc b/src/tests/edje/data/complex_layout.edc
new file mode 100644
index 0000000000..656c7e3c61
--- /dev/null
+++ b/src/tests/edje/data/complex_layout.edc
@@ -0,0 +1,97 @@
1collections {
2 group {
3 name: "test_group";
4
5 parts {
6 part {
7 name: "background";
8 type: RECT;
9 mouse_events: 0;
10
11 description {
12 state: "default" 0.0;
13 color: 0 0 0 0;
14
15 rel1 {
16 relative: 0.0 0.0;
17 offset: 0 0;
18 }
19 rel2 {
20 relative: 1.0 1.0;
21 offset: -1 -1;
22 }
23 }
24 }
25 part {
26 name: "background2";
27 type: RECT;
28 mouse_events: 0;
29
30 description {
31 state: "default" 0.0;
32 color: 0 0 0 0;
33
34 rel1 {
35 relative: 0.0 0.0;
36 offset: 1 1;
37 }
38 rel2 {
39 relative: 1.0 1.0;
40 offset: 0 0;
41 }
42 }
43 }
44 part {
45 name: "ul";
46 type: RECT;
47
48 description {
49 state: "default" 0.0;
50
51 rel1 {
52 relative: 0.0 0.0;
53 offset: 5 5;
54 }
55 rel2 {
56 relative: 0.5 0.5;
57 offset: -2 -2;
58 }
59 }
60 }
61 part {
62 name: "ur";
63 type: RECT;
64
65 description {
66 state: "default" 0.0;
67
68 rel1 {
69 relative: 0.5 0.0;
70 offset: 2 5;
71 }
72 rel2 {
73 relative: 1.0 0.5;
74 offset: -5 -2;
75 }
76 }
77 }
78 part {
79 name: "l";
80 type: RECT;
81
82 description {
83 state: "default" 0.0;
84
85 rel1 {
86 relative: 0.0 0.5;
87 offset: 5 2;
88 }
89 rel2 {
90 relative: 1.0 1.0;
91 offset: -5 -5;
92 }
93 }
94 }
95 }
96 }
97}
diff --git a/src/tests/edje/edje_test_edje.c b/src/tests/edje/edje_test_edje.c
index 2cca72bd87..9f7fa991a3 100644
--- a/src/tests/edje/edje_test_edje.c
+++ b/src/tests/edje/edje_test_edje.c
@@ -84,6 +84,8 @@ START_TEST(edje_test_simple_layout_geometry)
84 obj = edje_object_add(evas); 84 obj = edje_object_add(evas);
85 fail_unless(edje_object_file_set(obj, test_layout_get("test_layout.edj"), "test_group")); 85 fail_unless(edje_object_file_set(obj, test_layout_get("test_layout.edj"), "test_group"));
86 86
87 /* rel1.relative: 0.0 0.0;
88 * rel2.relative: 1.0 1.0; */
87 evas_object_resize(obj, 1000, 1000); 89 evas_object_resize(obj, 1000, 1000);
88 edje_object_part_geometry_get(obj, "background", &x, &y, &w, &h); 90 edje_object_part_geometry_get(obj, "background", &x, &y, &w, &h);
89 91
@@ -100,10 +102,61 @@ START_TEST(edje_test_simple_layout_geometry)
100} 102}
101END_TEST 103END_TEST
102 104
105START_TEST(edje_test_complex_layout)
106{
107 int x, y, w, h;
108 Evas *evas = EDJE_TEST_INIT_EVAS();
109 Evas_Object *obj;
110
111 obj = edje_object_add(evas);
112 fail_unless(edje_object_file_set(obj, test_layout_get("complex_layout.edj"), "test_group"));
113 evas_object_resize(obj, 1000, 1000);
114
115 /* Apparently rel2 offsets are retarded and you have to introduce off-by-one
116 * madness (rel2.offset: -1 -1; acts like there is zero offset...)
117 * Take that into account when checking w and h */
118
119 /* rel1.relative: 0.0 0.0; rel1.offset: 0 0;
120 * rel2.relative: 1.0 1.0; rel2.offset -1 -1; */
121 edje_object_part_geometry_get(obj, "background", &x, &y, &w, &h);
122 fail_if(x != 0 || y != 0);
123 fail_if(w != 1000-1 + 1 || h != 1000-1 + 1);
124
125 /* rel1.relative: 0.0 0.0; rel1.offset: 1 1;
126 * rel2.relative: 1.0 1.0; rel2.offset 0 0; */
127 edje_object_part_geometry_get(obj, "background2", &x, &y, &w, &h);
128 fail_if(x != 1 || y != 1);
129 fail_if(w != 1000-1 + 1 || h != 1000-1 + 1);
130
131 /* rel1.relative: 0.0 0.0; rel1.offset: 5 5;
132 * rel2.relative: 0.5 0.5; rel2.offset -2 -2; */
133 edje_object_part_geometry_get(obj, "ul", &x, &y, &w, &h);
134 fail_if(x != 5 || y != 5);
135 fail_if(w != 500-5-2 + 1 || h != 500-5-2 + 1);
136
137 /* rel1.relative: 0.5 0.0; rel1.offset: 2 5;
138 * rel2.relative: 1.0 0.5; rel2.offset -5 -2; */
139 edje_object_part_geometry_get(obj, "ur", &x, &y, &w, &h);
140 fail_if(x != 500+2 || y != 5);
141 fail_if(w != 500-5-2 + 1 || h != 500-5-2 + 1);
142
143 /* rel1.relative: 0.0 0.5; rel1.offset: 5 2;
144 * rel2.relative: 1.0 1.0; rel2.offset -5 -5; */
145 edje_object_part_geometry_get(obj, "l", &x, &y, &w, &h);
146 fail_if(x != 5 || y != 500+2);
147 fail_if(w != 1000-5-5 + 1 || h != 500-5-2 + 1);
148
149
150
151 EDJE_TEST_FREE_EVAS();
152}
153END_TEST
154
103void edje_test_edje(TCase *tc) 155void edje_test_edje(TCase *tc)
104{ 156{
105 tcase_add_test(tc, edje_test_edje_init); 157 tcase_add_test(tc, edje_test_edje_init);
106 tcase_add_test(tc,edje_test_load_simple_layout); 158 tcase_add_test(tc,edje_test_load_simple_layout);
107 tcase_add_test(tc, edje_test_edje_load); 159 tcase_add_test(tc, edje_test_edje_load);
108 tcase_add_test(tc, edje_test_simple_layout_geometry); 160 tcase_add_test(tc, edje_test_simple_layout_geometry);
161 tcase_add_test(tc, edje_test_complex_layout);
109} 162}