summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Makefile_Edje.am8
-rw-r--r--src/tests/edje/data/test_size_class.edc24
-rw-r--r--src/tests/edje/edje_test_edje.c55
3 files changed, 85 insertions, 2 deletions
diff --git a/src/Makefile_Edje.am b/src/Makefile_Edje.am
index 1e5059f082..ca0eefc463 100644
--- a/src/Makefile_Edje.am
+++ b/src/Makefile_Edje.am
@@ -255,6 +255,7 @@ tests/edje/data/test_parens.edc \
255tests/edje/data/test_masking.edc \ 255tests/edje/data/test_masking.edc \
256tests/edje/data/test_filters.edc \ 256tests/edje/data/test_filters.edc \
257tests/edje/data/test_snapshot.edc \ 257tests/edje/data/test_snapshot.edc \
258tests/edje/data/test_size_class.edc \
258tests/edje/data/filter.lua 259tests/edje/data/filter.lua
259 260
260 261
@@ -297,6 +298,7 @@ EDJE_DATA_FILES = tests/edje/data/test_layout.edc \
297 tests/edje/data/test_masking.edc \ 298 tests/edje/data/test_masking.edc \
298 tests/edje/data/test_filters.edc \ 299 tests/edje/data/test_filters.edc \
299 tests/edje/data/test_snapshot.edc \ 300 tests/edje/data/test_snapshot.edc \
301 tests/edje/data/test_size_class.edc \
300 tests/edje/data/filter.lua 302 tests/edje/data/filter.lua
301 303
302edjedatafilesdir = $(datadir)/edje/data 304edjedatafilesdir = $(datadir)/edje/data
@@ -305,14 +307,16 @@ edjedatafiles_DATA = tests/edje/data/test_layout.edj \
305 tests/edje/data/test_parens.edj \ 307 tests/edje/data/test_parens.edj \
306 tests/edje/data/test_masking.edj \ 308 tests/edje/data/test_masking.edj \
307 tests/edje/data/test_filters.edj \ 309 tests/edje/data/test_filters.edj \
308 tests/edje/data/test_snapshot.edj 310 tests/edje/data/test_snapshot.edj \
311 tests/edje/data/test_size_class.edj
309 312
310CLEANFILES += tests/edje/data/test_layout.edj \ 313CLEANFILES += tests/edje/data/test_layout.edj \
311 tests/edje/data/complex_layout.edj \ 314 tests/edje/data/complex_layout.edj \
312 tests/edje/data/test_parens.edj \ 315 tests/edje/data/test_parens.edj \
313 tests/edje/data/test_masking.edj \ 316 tests/edje/data/test_masking.edj \
314 tests/edje/data/test_filters.edj \ 317 tests/edje/data/test_filters.edj \
315 tests/edje/data/test_snapshot.edj 318 tests/edje/data/test_snapshot.edj \
319 tests/edje/data/test_size_class.edj
316 320
317endif 321endif
318 322
diff --git a/src/tests/edje/data/test_size_class.edc b/src/tests/edje/data/test_size_class.edc
new file mode 100644
index 0000000000..1baf831d8a
--- /dev/null
+++ b/src/tests/edje/data/test_size_class.edc
@@ -0,0 +1,24 @@
1collections {
2 group { name: "test_group";
3 parts {
4 part { name: "background";
5 type: RECT;
6 description { state: "default" 0.0;
7 color: 33 32 32 255;
8 rel1.relative: 0 0;
9 rel2.relative: 1 1;
10 max: 200 200;
11 }
12 }
13 part { name: "rect";
14 type: RECT;
15 description { state: "default" 0.0;
16 rel1.relative: 0.5 0.5;
17 rel2.relative: 0.5 0.5;
18 min: 50 50;
19 size_class: "rect_size";
20 }
21 }
22 }
23 }
24}
diff --git a/src/tests/edje/edje_test_edje.c b/src/tests/edje/edje_test_edje.c
index 631abeaa57..536de1db44 100644
--- a/src/tests/edje/edje_test_edje.c
+++ b/src/tests/edje/edje_test_edje.c
@@ -273,6 +273,60 @@ START_TEST(edje_test_snapshot)
273} 273}
274END_TEST 274END_TEST
275 275
276START_TEST(edje_test_size_class)
277{
278 int minw, minh, minw2, minh2;
279 Evas *evas = EDJE_TEST_INIT_EVAS();
280 Eina_List *l;
281 Eina_Stringshare *name;
282 Evas_Object *obj, *obj2;
283 Eina_Bool b;
284
285 obj = edje_object_add(evas);
286 fail_unless(edje_object_file_set(obj, test_layout_get("test_size_class.edj"), "test_group"));
287
288 obj2 = edje_object_add(evas);
289 fail_unless(edje_object_file_set(obj2, test_layout_get("test_size_class.edj"), "test_group"));
290
291 evas_object_resize(obj, 200, 200);
292 evas_object_resize(obj2, 200, 200);
293
294 /* check predefined min size of rect part by edc */
295 edje_object_part_geometry_get(obj, "rect", NULL, NULL, &minw, &minh);
296 fail_if(minw != 50 || minh != 50);
297
298 /* check that edje_size_class_set works */
299 b = edje_size_class_set("rect_size", 100, 100, -1, -1);
300 edje_object_part_geometry_get(obj, "rect", NULL, NULL, &minw, &minh);
301 edje_object_part_geometry_get(obj2, "rect", NULL, NULL, &minw2, &minh2);
302 fail_if(!b || minw != 100 || minh != 100 || minw2 != 100 || minh2 != 100);
303
304 /* check that edje_size_class_get works */
305 b = edje_size_class_get("rect_size", &minw, &minh, NULL, NULL);
306 fail_if(!b || minw != 100 || minh != 100);
307
308 /* check that edje_size_class_list works */
309 l = edje_size_class_list();
310 EINA_LIST_FREE(l, name)
311 {
312 fail_if(strcmp(name, "rect_size"));
313 eina_stringshare_del(name);
314 }
315
316 /* check that edje_object_size_class_set works */
317 b = edje_object_size_class_set(obj, "rect_size", 150, 150, -1, -1);
318 edje_object_part_geometry_get(obj, "rect", NULL, NULL, &minw, &minh);
319 edje_object_part_geometry_get(obj2, "rect", NULL, NULL, &minw2, &minh2);
320 fail_if(!b || minw != 150 || minh != 150 || minw2 != 100 || minh2 != 100);
321
322 /* check that edje_object_size_class_get works */
323 b = edje_object_size_class_get(obj, "rect_size", &minw, &minh, NULL, NULL);
324 fail_if(!b || minw != 150 || minh != 150);
325
326 EDJE_TEST_FREE_EVAS();
327}
328END_TEST
329
276void edje_test_edje(TCase *tc) 330void edje_test_edje(TCase *tc)
277{ 331{
278 tcase_add_test(tc, edje_test_edje_init); 332 tcase_add_test(tc, edje_test_edje_init);
@@ -284,4 +338,5 @@ void edje_test_edje(TCase *tc)
284 tcase_add_test(tc, edje_test_masking); 338 tcase_add_test(tc, edje_test_masking);
285 tcase_add_test(tc, edje_test_filters); 339 tcase_add_test(tc, edje_test_filters);
286 tcase_add_test(tc, edje_test_snapshot); 340 tcase_add_test(tc, edje_test_snapshot);
341 tcase_add_test(tc, edje_test_size_class);
287} 342}