summaryrefslogtreecommitdiff
path: root/src/tests/edje
diff options
context:
space:
mode:
authorJee-Yong Um <jc9.um@samsung.com>2015-12-16 14:53:59 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-12-16 14:56:39 +0900
commit395ed14f63ac7f96847c7a950ebc3a1f3a8360c6 (patch)
tree2af0c72266301f26f25916a974009fbc7616eb45 /src/tests/edje
parentc46ab1d864ba274fd1950a87e5d7559eb42fe5e2 (diff)
edje: add size_class test case
Summary: add edje size_class APIs' test case Reviewers: jpeg Reviewed By: jpeg Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D3391
Diffstat (limited to 'src/tests/edje')
-rw-r--r--src/tests/edje/data/test_size_class.edc24
-rw-r--r--src/tests/edje/edje_test_edje.c55
2 files changed, 79 insertions, 0 deletions
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}