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 \ tests/edje/data/test_masking.edc \ tests/edje/data/test_filters.edc \ tests/edje/data/test_snapshot.edc \ +tests/edje/data/test_size_class.edc \ tests/edje/data/filter.lua @@ -297,6 +298,7 @@ EDJE_DATA_FILES = tests/edje/data/test_layout.edc \ tests/edje/data/test_masking.edc \ tests/edje/data/test_filters.edc \ tests/edje/data/test_snapshot.edc \ + tests/edje/data/test_size_class.edc \ tests/edje/data/filter.lua edjedatafilesdir = $(datadir)/edje/data @@ -305,14 +307,16 @@ edjedatafiles_DATA = tests/edje/data/test_layout.edj \ tests/edje/data/test_parens.edj \ tests/edje/data/test_masking.edj \ tests/edje/data/test_filters.edj \ - tests/edje/data/test_snapshot.edj + tests/edje/data/test_snapshot.edj \ + tests/edje/data/test_size_class.edj CLEANFILES += tests/edje/data/test_layout.edj \ tests/edje/data/complex_layout.edj \ tests/edje/data/test_parens.edj \ tests/edje/data/test_masking.edj \ tests/edje/data/test_filters.edj \ - tests/edje/data/test_snapshot.edj + tests/edje/data/test_snapshot.edj \ + tests/edje/data/test_size_class.edj endif 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 @@ +collections { + group { name: "test_group"; + parts { + part { name: "background"; + type: RECT; + description { state: "default" 0.0; + color: 33 32 32 255; + rel1.relative: 0 0; + rel2.relative: 1 1; + max: 200 200; + } + } + part { name: "rect"; + type: RECT; + description { state: "default" 0.0; + rel1.relative: 0.5 0.5; + rel2.relative: 0.5 0.5; + min: 50 50; + size_class: "rect_size"; + } + } + } + } +} 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) } END_TEST +START_TEST(edje_test_size_class) +{ + int minw, minh, minw2, minh2; + Evas *evas = EDJE_TEST_INIT_EVAS(); + Eina_List *l; + Eina_Stringshare *name; + Evas_Object *obj, *obj2; + Eina_Bool b; + + obj = edje_object_add(evas); + fail_unless(edje_object_file_set(obj, test_layout_get("test_size_class.edj"), "test_group")); + + obj2 = edje_object_add(evas); + fail_unless(edje_object_file_set(obj2, test_layout_get("test_size_class.edj"), "test_group")); + + evas_object_resize(obj, 200, 200); + evas_object_resize(obj2, 200, 200); + + /* check predefined min size of rect part by edc */ + edje_object_part_geometry_get(obj, "rect", NULL, NULL, &minw, &minh); + fail_if(minw != 50 || minh != 50); + + /* check that edje_size_class_set works */ + b = edje_size_class_set("rect_size", 100, 100, -1, -1); + edje_object_part_geometry_get(obj, "rect", NULL, NULL, &minw, &minh); + edje_object_part_geometry_get(obj2, "rect", NULL, NULL, &minw2, &minh2); + fail_if(!b || minw != 100 || minh != 100 || minw2 != 100 || minh2 != 100); + + /* check that edje_size_class_get works */ + b = edje_size_class_get("rect_size", &minw, &minh, NULL, NULL); + fail_if(!b || minw != 100 || minh != 100); + + /* check that edje_size_class_list works */ + l = edje_size_class_list(); + EINA_LIST_FREE(l, name) + { + fail_if(strcmp(name, "rect_size")); + eina_stringshare_del(name); + } + + /* check that edje_object_size_class_set works */ + b = edje_object_size_class_set(obj, "rect_size", 150, 150, -1, -1); + edje_object_part_geometry_get(obj, "rect", NULL, NULL, &minw, &minh); + edje_object_part_geometry_get(obj2, "rect", NULL, NULL, &minw2, &minh2); + fail_if(!b || minw != 150 || minh != 150 || minw2 != 100 || minh2 != 100); + + /* check that edje_object_size_class_get works */ + b = edje_object_size_class_get(obj, "rect_size", &minw, &minh, NULL, NULL); + fail_if(!b || minw != 150 || minh != 150); + + EDJE_TEST_FREE_EVAS(); +} +END_TEST + void edje_test_edje(TCase *tc) { tcase_add_test(tc, edje_test_edje_init); @@ -284,4 +338,5 @@ void edje_test_edje(TCase *tc) tcase_add_test(tc, edje_test_masking); tcase_add_test(tc, edje_test_filters); tcase_add_test(tc, edje_test_snapshot); + tcase_add_test(tc, edje_test_size_class); }