Improve win dialog test to also include a test for standard_win
authorDave Andreoli <dave@gurumeditation.it>
Sun, 4 Jan 2015 14:38:37 +0000 (15:38 +0100)
committerDave Andreoli <dave@gurumeditation.it>
Sun, 4 Jan 2015 14:38:51 +0000 (15:38 +0100)
src/bin/test.c
src/bin/test_win_dialog.c

index 6647729..eeec24a 100644 (file)
@@ -530,7 +530,7 @@ add_tests:
    ADD_TEST(NULL, "Window / Background", "Window Socket", test_win_socket);
    ADD_TEST(NULL, "Window / Background", "Window Plug", test_win_plug);
    ADD_TEST(NULL, "Window / Background", "Window WM Rotation", test_win_wm_rotation);
-   ADD_TEST(NULL, "Window / Background", "Window Dialog", test_win_dialog);
+   ADD_TEST(NULL, "Window / Background", "Window Standard/Dialog", test_win_dialog);
 
    //------------------------------//
    ADD_TEST(NULL, "Images", "Icon", test_icon);
index a82915a..aa155b1 100644 (file)
@@ -3,22 +3,46 @@
 #endif
 #include <Elementary.h>
 
+
+
 void
-test_win_dialog(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+_bt_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
 {
-   Evas_Object *win, *bt;
+   Evas_Object *dia, *lb;
    Evas_Object *parent = data;
 
-   win = elm_win_util_dialog_add(parent, "window-dia", "Dialog Window");
+   dia = elm_win_util_dialog_add(parent, "window-dia", "A Dialog Window");
+   elm_win_autodel_set(dia, EINA_TRUE);
+
+   lb = elm_label_add(dia);
+   elm_object_text_set(lb, "This is a Dialog Window");
+   evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   elm_win_resize_object_add(dia, lb);
+   evas_object_show(lb);
+
+   evas_object_resize(dia, 200, 150);
+   evas_object_show(dia);
+}
+
+void
+test_win_dialog(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+   Evas_Object *win, *box, *bt;
+
+   win = elm_win_util_standard_add("window-dia", "A Standard Window");
    elm_win_autodel_set(win, EINA_TRUE);
 
+   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);
+   
    bt = elm_button_add(win);
-   elm_object_text_set(bt, "This is a dialog window");
-   evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
-   evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-   elm_win_resize_object_add(win, bt);
+   elm_object_text_set(bt, "Create a new dialog");
+   evas_object_smart_callback_add(bt, "clicked", _bt_clicked_cb, win);
+   elm_box_pack_end(box, bt);
    evas_object_show(bt);
 
-   evas_object_resize(win, 320, 160);
+   evas_object_resize(win, 400, 400);
    evas_object_show(win);
 }