test: Add a logic to check a size of Check
authorWonki Kim <wonki_.kim@samsung.com>
Sat, 21 Sep 2019 04:28:24 +0000 (04:28 +0000)
committerJongmin Lee <jm105.lee@samsung.com>
Mon, 23 Sep 2019 21:32:19 +0000 (06:32 +0900)
If I pack a check without any api calls into a box,
then it doesn't have the hint_min size which is defined on check edc.
I guess there are problems on sizing logic currently, so this patch helps people
to test the problem.

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D10038

src/bin/elementary/test_check.c
src/tests/elementary/elm_test_check.c

index 9633f14..40ca00d 100644 (file)
@@ -117,6 +117,10 @@ test_check(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_inf
 
    ck = elm_check_add(win);
    elm_box_pack_end(bx, ck);
+   evas_object_show(ck);
+
+   ck = elm_check_add(win);
+   elm_box_pack_end(bx, ck);
    elm_object_text_set(ck, "text is visible when check state is true.");
    elm_check_state_set(ck, EINA_TRUE);
    evas_object_show(ck);
index 74af40f..4881aaa 100644 (file)
@@ -6,6 +6,32 @@
 #include <Elementary.h>
 #include "elm_suite.h"
 
+EFL_START_TEST(elm_test_check_size)
+{
+   Evas_Object *win, *check, *box;
+   int width, height;
+
+   win = elm_win_util_standard_add("check", "Check");
+
+   box = elm_box_add(win);
+   evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   elm_win_resize_object_add(win, box);
+   evas_object_show(box);
+
+   check = elm_check_add(box);
+   elm_box_pack_end(box, check);
+   evas_object_show(check);
+
+   evas_object_show(win);
+
+   get_me_to_those_events(check);
+
+   evas_object_size_hint_min_get(check, &width, &height);
+   ck_assert_int_gt(width, 0);
+   ck_assert_int_gt(height, 0);
+}
+EFL_END_TEST
+
 EFL_START_TEST(elm_test_check_legacy_type_check)
 {
    Evas_Object *win, *check;
@@ -122,6 +148,7 @@ EFL_END_TEST
 
 void elm_test_check(TCase *tc)
 {
+   tcase_add_test(tc, elm_test_check_size);
    tcase_add_test(tc, elm_test_check_legacy_type_check);
    tcase_add_test(tc, elm_test_check_onoff_text);
    tcase_add_test(tc, elm_test_check_state);