Elementary Cursor Test: add layout tests
authorbdilly <bdilly@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 1 Nov 2011 21:13:04 +0000 (21:13 +0000)
committerbdilly <bdilly@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 1 Nov 2011 21:13:04 +0000 (21:13 +0000)
Looks like some stuff is broken regarding layout cursors.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@64617 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

data/objects/cursors.edc
src/bin/test.c
src/bin/test_cursor.c

index a943037..9f66763 100644 (file)
@@ -77,4 +77,150 @@ collections {
          }
       }
    }
+
+   group { name: "test/layout/events";
+      parts {
+         part { name: "events";
+            type: RECT;
+            mouse_events: 1;
+            description { state: "default" 0.0;
+               color: 0 255 0 255;
+               rel2.relative: 0.5 1;
+            }
+         }
+         part { name: "noevents";
+            type: RECT;
+            mouse_events: 0;
+            description { state: "default" 0.0;
+               color: 200 255 200 255;
+               rel1.relative: 0.5 0;
+            }
+         }
+      }
+   }
+
+   group { name: "test/layout/noevents";
+      parts {
+         part { name: "base";
+            type: RECT;
+            mouse_events: 0;
+            description { state: "default" 0.0;
+               color: 255 255 255 255;
+            }
+         }
+         part { name: "top-left";
+            type: RECT;
+            mouse_events: 1;
+            description { state: "default" 0.0;
+               rel1.relative: 0.1 0.1;
+               rel2.relative: 0.5 0.5;
+               color: 0 0 255 255;
+            }
+         }
+         part { name: "top-right";
+            type: RECT;
+            mouse_events: 1;
+            description { state: "default" 0.0;
+               rel1.relative: 0.5 0.1;
+               rel2.relative: 0.9 0.5;
+               color: 0 255 255 255;
+            }
+         }
+         part { name: "bottom-left";
+            type: RECT;
+            mouse_events: 0;
+            description { state: "default" 0.0;
+               rel1.relative: 0.1 0.5;
+               rel2.relative: 0.5 0.9;
+               color: 255 0 255 255;
+            }
+         }
+         part { name: "bottom-right";
+            type: RECT;
+            mouse_events: 0;
+            description { state: "default" 0.0;
+               rel1.relative: 0.5 0.5;
+               rel2.relative: 0.9 0.9;
+               color: 255 255 0 255;
+            }
+         }
+      }
+   }
+
+   group { name: "test/layout/parts";
+      alias: "test/layout/parts2";
+      parts {
+         part { name: "base";
+            type: RECT;
+            mouse_events: 1;
+            description { state: "default" 0.0;
+               color: 0 0 0 255;
+            }
+         }
+         part { name: "top-left";
+            type: RECT;
+            mouse_events: 1;
+            description { state: "default" 0.0;
+               rel1.relative: 0.1 0.1;
+               rel2.relative: 0.5 0.5;
+               color: 0 0 255 255;
+            }
+         }
+         part { name: "top-right";
+            type: RECT;
+            mouse_events: 1;
+            description { state: "default" 0.0;
+               rel1.relative: 0.5 0.1;
+               rel2.relative: 0.9 0.5;
+               color: 0 255 255 255;
+            }
+         }
+         part { name: "bottom-left";
+            type: RECT;
+            mouse_events: 0;
+            description { state: "default" 0.0;
+               rel1.relative: 0.1 0.5;
+               rel2.relative: 0.5 0.9;
+               color: 255 0 255 255;
+            }
+         }
+         part { name: "bottom-right";
+            type: RECT;
+            mouse_events: 0;
+            description { state: "default" 0.0;
+               rel1.relative: 0.5 0.5;
+               rel2.relative: 0.9 0.9;
+               color: 255 255 0 255;
+            }
+         }
+      }
+   }
+
+   group { name: "test/layout/swallow";
+      parts {
+         part { name: "base";
+            type: RECT;
+            mouse_events: 1;
+            description { state: "default" 0.0;
+               color: 255 255 255 255;
+            }
+         }
+         part { name: "swallow1";
+            type: SWALLOW;
+            mouse_events: 1;
+            description { state: "default" 0.0;
+               rel1.relative: 0.1 0.1;
+               rel2.relative: 0.9 0.5;
+            }
+         }
+         part { name: "swallow2";
+            type: SWALLOW;
+            mouse_events: 1;
+            description { state: "default" 0.0;
+               rel1.relative: 0.1 0.5;
+               rel2.relative: 0.9 0.9;
+            }
+         }
+      }
+   }
 }
index 95fe971..6fb32a1 100644 (file)
@@ -127,6 +127,7 @@ void test_tooltip2(void *data, Evas_Object *obj, void *event_info);
 void test_cursor(void *data, Evas_Object *obj, void *event_info);
 void test_cursor2(void *data, Evas_Object *obj, void *event_info);
 void test_cursor3(void *data, Evas_Object *obj, void *event_info);
+void test_cursor4(void *data, Evas_Object *obj, void *event_info);
 void test_focus(void *data, Evas_Object *obj, void *event_info);
 void test_focus2(void *data, Evas_Object *obj, void *event_info);
 void test_focus3(void *data, Evas_Object *obj, void *event_info);
@@ -415,6 +416,7 @@ add_tests:
    ADD_TEST("Cursor", test_cursor);
    ADD_TEST("Cursor 2", test_cursor2);
    ADD_TEST("Cursor 3", test_cursor3);
+   ADD_TEST("Cursor Layout", test_cursor4);
    ADD_TEST("Focus", test_focus);
    ADD_TEST("Focus 2", test_focus2);
    ADD_TEST("Focus 3", test_focus3);
index 17b6302..1cc40e7 100644 (file)
@@ -395,4 +395,73 @@ test_cursor3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_inf
    evas_object_show(win);
 }
 
+void
+test_cursor4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+   Evas_Object *win, *bg, *bx, *ly, *bt;
+   char buf[PATH_MAX];
+
+   win = elm_win_add(NULL, "cursor layout", ELM_WIN_BASIC);
+   elm_win_title_set(win, "Cursor Layout");
+   elm_win_autodel_set(win, EINA_TRUE);
+
+   snprintf(buf, sizeof(buf), "%s/objects/cursors.edj", elm_app_data_dir_get());
+
+   bg = elm_bg_add(win);
+   elm_win_resize_object_add(win, bg);
+   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   evas_object_show(bg);
+
+   bx = elm_box_add(win);
+   evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   elm_win_resize_object_add(win, bx);
+   evas_object_show(bx);
+
+   ly = elm_layout_add(win);
+   elm_layout_file_set(ly, buf, "test/layout/events");
+   evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
+   elm_object_cursor_set(ly, ELM_CURSOR_HAND1);
+   elm_box_pack_end(bx, ly);
+   evas_object_show(ly);
+
+   ly = elm_layout_add(win);
+   elm_layout_file_set(ly, buf, "test/layout/noevents");
+   evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
+   elm_object_cursor_set(ly, ELM_CURSOR_XTERM);
+   elm_layout_part_cursor_set(ly, "top-left", ELM_CURSOR_CROSS);
+   elm_layout_part_cursor_set(ly, "bottom-left", ELM_CURSOR_PIRATE);
+   elm_box_pack_end(bx, ly);
+   evas_object_show(ly);
+
+   ly = elm_layout_add(win);
+   elm_layout_file_set(ly, buf, "test/layout/parts2");
+   evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
+   elm_layout_part_cursor_set(ly, "top-left", ELM_CURSOR_CROSS);
+   elm_layout_part_cursor_set(ly, "bottom-left", ELM_CURSOR_PIRATE);
+   elm_layout_file_set(ly, buf, "test/layout/parts");
+   elm_box_pack_end(bx, ly);
+   evas_object_show(ly);
+
+   ly = elm_layout_add(win);
+   evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
+   elm_layout_file_set(ly, buf, "test/layout/swallow");
+   bt = elm_button_add(win);
+   elm_object_text_set(bt, "Cursor over obj");
+   elm_object_content_part_set(ly, "swallow1", bt);
+   elm_object_cursor_set(bt, ELM_CURSOR_PIRATE);
+   bt = elm_button_add(win);
+   elm_object_text_set(bt, "Cursor over part");
+   elm_object_content_part_set(ly, "swallow2", bt);
+   elm_layout_part_cursor_set(ly, "swallow2", ELM_CURSOR_PIRATE);
+   elm_box_pack_end(bx, ly);
+   evas_object_show(ly);
+
+   evas_object_resize(win, 320, 480);
+   evas_object_show(win);
+}
+
 #endif