aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Guyomarc'h <jean@guyomarch.bzh>2016-07-03 12:00:33 +0200
committerJean Guyomarc'h <jean@guyomarch.bzh>2016-07-03 21:40:03 +0200
commit9622146c3d5ae6cc8f7810136f569575c17c4ec0 (patch)
tree98a99d2d200b98f339ec4b59c431d155e542840f
parentelementary: release genlist item classes when done (diff)
downloadefl-9622146c3d5ae6cc8f7810136f569575c17c4ec0.tar.gz
elementary: add test for edje external combobox
-rw-r--r--data/elementary/objects/test_external.edc36
-rw-r--r--src/bin/elementary/test.c2
-rw-r--r--src/bin/elementary/test_external.c75
3 files changed, 113 insertions, 0 deletions
diff --git a/data/elementary/objects/test_external.edc b/data/elementary/objects/test_external.edc
index 27802f4047..3a77ef06a1 100644
--- a/data/elementary/objects/test_external.edc
+++ b/data/elementary/objects/test_external.edc
@@ -1177,4 +1177,40 @@ embryo script and from C code.";
}
}
+
+ group { name: "external/combobox";
+ parts {
+ COMMON_EXTERNAL_UNDER
+ part { name: "combobox"; type: EXTERNAL;
+ source: "elm/combobox";
+ clip_to: "clip";
+ description { state: "default" 0.0;
+ rel2.relative: 1.0 0.0;
+ align: 0.5 0.0;
+ params {
+ string: "guide" "Widgets";
+ }
+ }
+ }
+ part { name: "info"; type: TEXT;
+ clip_to: "clip";
+ description { state: "default" 0.;
+ rel1 {
+ to: "combobox";
+ relative: 0.0 1.0;
+ }
+ text {
+ text: "";
+ font: "Sans";
+ size: 24;
+ align: 0.5 1.0;
+ }
+ }
+ }
+ COMMON_EXTERNAL_OVER
+ }
+ programs {
+ COMMON_EXTERNAL_PROGRAM
+ }
+ }
}
diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c
index f40de25af3..b884129bbe 100644
--- a/src/bin/elementary/test.c
+++ b/src/bin/elementary/test.c
@@ -264,6 +264,7 @@ void test_external_scroller(void *data, Evas_Object *obj, void *event_info);
void test_external_pbar(void *data, Evas_Object *obj, void *event_info);
void test_external_video(void *data, Evas_Object *obj, void *event_info);
void test_external_icon(void *data, Evas_Object *obj, void *event_info);
+void test_external_combobox(void *data, Evas_Object *obj, void *event_info);
void test_config(void *data, Evas_Object *obj, void *event_info);
void test_video(void *data, Evas_Object *obj, void *event_info);
void test_eio(void *data, Evas_Object *obj, void *event_info);
@@ -680,6 +681,7 @@ add_tests:
ADD_TEST(NULL, "Edje External", "ExtSlider", test_external_slider);
ADD_TEST(NULL, "Edje External", "ExtVideo", test_external_video);
ADD_TEST(NULL, "Edje External", "ExtIcon", test_external_icon);
+ ADD_TEST(NULL, "Edje External", "ExtCombobox", test_external_combobox);
//------------------------------//
ADD_TEST(NULL, "Toolbars", "Toolbar", test_toolbar);
diff --git a/src/bin/elementary/test_external.c b/src/bin/elementary/test_external.c
index 902458cbf7..cbd0c0774a 100644
--- a/src/bin/elementary/test_external.c
+++ b/src/bin/elementary/test_external.c
@@ -202,3 +202,78 @@ test_external_icon(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e
evas_object_resize(win, 320, 400);
evas_object_show(win);
}
+
+static char *
+text_get_cb(void *data,
+ Evas_Object *obj EINA_UNUSED,
+ const char *part EINA_UNUSED)
+{
+ return strdup(data);
+}
+
+static void
+action_cb(void *data,
+ Evas_Object *obj EINA_UNUSED,
+ void *info)
+{
+ Evas_Object *const lay = data;
+ Elm_Object_Item *const item = info;
+
+ elm_layout_text_set(lay, "info", elm_object_item_data_get(item));
+}
+
+static void
+_cb_pressed_cb(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *info)
+{
+ const char *txt;
+
+ txt = elm_object_item_text_get(info);
+ elm_object_text_set(obj, txt);
+ elm_combobox_hover_end(obj);
+ elm_entry_cursor_end_set(obj);
+}
+
+void
+test_external_combobox(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *ly, *cb, *edj;
+ char buf[PATH_MAX];
+ Elm_Genlist_Item_Class *itc;
+ const char *info[] = {
+ "Label", "Button", "Combobox", "Icon", "Scroller", "Layout",
+ "Naviframe", "Bubble"
+ };
+ const unsigned int size = EINA_C_ARRAY_LENGTH(info);
+ unsigned int i;
+
+ win = elm_win_util_standard_add("ext_combobox", "Edje External Combobox");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ ly = elm_layout_add(win);
+ snprintf(buf, sizeof(buf), "%s/objects/test_external.edj", elm_app_data_dir_get());
+ elm_layout_file_set(ly, buf, "external/combobox");
+ evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, ly);
+ evas_object_show(ly);
+
+ itc = elm_genlist_item_class_new();
+ itc->item_style = "default";
+ itc->func.text_get = text_get_cb;
+
+ edj = elm_layout_edje_get(ly);
+ cb = edje_object_part_external_object_get(edj, "combobox");
+ evas_object_smart_callback_add(cb, "item,pressed", _cb_pressed_cb, NULL);
+
+ for (i = 0; i < size; i++)
+ {
+ elm_genlist_item_append(cb, itc, info[i], NULL,
+ ELM_GENLIST_ITEM_NONE, action_cb, ly);
+ }
+
+ elm_genlist_item_class_free(itc);
+
+ evas_object_resize(win, 320, 400);
+ evas_object_show(win);
+}