elementary: add test for external icons
authorJean Guyomarc'h <jean@guyomarch.bzh>
Sun, 26 Jun 2016 21:06:22 +0000 (23:06 +0200)
committerJean Guyomarc'h <jean@guyomarch.bzh>
Sun, 26 Jun 2016 21:11:59 +0000 (23:11 +0200)
The ExtIcon elementary test shows how edje external icons
can be used.

data/elementary/objects/test_external.edc
src/bin/elementary/test.c
src/bin/elementary/test_external.c

index e30464e..27802f4 100644 (file)
@@ -1028,4 +1028,153 @@ embryo script and from C code.";
          }
       }
    }
+   group { name: "external/icon";
+      parts {
+         COMMON_EXTERNAL_UNDER
+         part { name: "icon_1"; type: EXTERNAL;
+            source: "elm/icon";
+            clip_to: "clip";
+            description { state: "default" 0.0;
+               align: 0.0 0.0;
+               min: 64 64;
+               max: 64 64;
+               fixed: 1 1;
+               params {
+                  string: "icon" "apps";
+                  bool: "smooth" 1;
+               }
+               map {
+                  on: 1;
+                  smooth: 1;
+                  rotation.center: "icon_1";
+               }
+            }
+            description { state: "rotate" 0.0;
+               inherit: "default" 0.0;
+               map.rotation.z: 360.0;
+            }
+         }
+         part { name: "icon_3_bg"; type: RECT;
+            clip_to: "clip";
+            description { state: "default" 0.0;
+               color: 255 0 0 127;
+               rel1.relative: 0.0 0.5;
+               rel2.relative: 0.5 1.0;
+            }
+            description { state: "anim" 0.0;
+               inherit: "default" 0.0;
+               rel1.relative: 0.5 0.5;
+               rel2.relative: 0.5 0.5;
+            }
+         }
+         part { name: "icon_3"; type: EXTERNAL;
+            source: "elm/icon";
+            clip_to: "clip";
+            description { state: "default" 0.0;
+               rel.to: "icon_3_bg";
+               params {
+                  string: "icon" "refresh";
+                  bool: "scale up" 0;
+                  bool: "scale down" 0;
+               }
+            }
+         }
+         part { name: "info3"; type: TEXT;
+            description { state: "default" 0.0;
+               clip_to: "clip";
+               rel1.relative: 0.0 0.9;
+               text {
+                  text: "ScaleUp:0 ScaleDown:0";
+                  size: 10;
+                  align: 0.0 1.0;
+               }
+            }
+         }
+         part { name: "icon_2"; type: EXTERNAL;
+            source: "elm/icon";
+            clip_to: "clip";
+            description { state: "default" 0.0;
+               rel1.relative: 0.9 0.9;
+               align: 0.0 0.0;
+               params {
+                  string: "icon" "clock";
+                  bool: "scale up" 1;
+                  bool: "scale down" 1;
+               }
+            }
+            description { state: "anim" 0.0;
+               inherit: "default" 0.0;
+               rel1.relative: 0.2 0.2;
+            }
+         }
+         part { name: "info2"; type: TEXT;
+            description { state: "default" 0.0;
+               clip_to: "clip";
+               rel1.relative: 0.5 0.9;
+               text {
+                  align: 1.0 1.0;
+                  text: "ScaleUp:1 ScaleDown:1";
+                  size: 10;
+               }
+            }
+         }
+         part { name: "icon_4"; type: EXTERNAL;
+            source: "elm/icon";
+            clip_to: "clip";
+            description { state: "default" 0.0;
+               rel1.relative: 0.5 0.0;
+               rel2.relative: 1.0 0.5;
+               params {
+                  string: "icon" "starred";
+               }
+            }
+         }
+         COMMON_EXTERNAL_OVER
+      }
+
+      programs {
+         COMMON_EXTERNAL_PROGRAM
+         program { signal: "elm_test,animations,start"; source: "elm_test";
+            after: "rotate_icon1";
+            after: "animate_icon2";
+            after: "animate_icon3";
+         }
+         program { name: "rotate_icon1";
+            action: STATE_SET "rotate" 0.0;
+            target: "icon_1";
+            transition: LINEAR 2.0;
+            after: "loop_rotate";
+         }
+         program { name: "loop_rotate";
+            action: STATE_SET "default" 0.0;
+            target: "icon_1";
+            after: "rotate_icon1";
+         }
+         program { name: "animate_icon2";
+            action: STATE_SET "anim" 0.0;
+            transition: ACCELERATE 4.0;
+            target: "icon_2";
+            after: "loop_animate";
+         }
+         program { name: "loop_animate";
+            action: STATE_SET "default" 0.0;
+            transition: DECELERATE 4.0;
+            target: "icon_2";
+            after: "animate_icon2";
+         }
+         program { name: "animate_icon3";
+            action: STATE_SET "anim" 0.0;
+            transition: ACCELERATE 4.0;
+            target: "icon_3_bg";
+            after: "loop_animate3";
+         }
+         program { name: "loop_animate3";
+            action: STATE_SET "default" 0.0;
+            transition: DECELERATE 4.0;
+            target: "icon_3_bg";
+            after: "animate_icon3";
+         }
+
+      }
+   }
 }
index 0543c33..9cdc7b0 100644 (file)
@@ -262,6 +262,7 @@ void test_external_slider(void *data, Evas_Object *obj, void *event_info);
 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_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);
@@ -677,6 +678,7 @@ add_tests:
    ADD_TEST(NULL, "Edje External", "ExtScroller", test_external_scroller);
    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, "Toolbars", "Toolbar", test_toolbar);
index 768185a..902458c 100644 (file)
@@ -180,3 +180,25 @@ test_external_video(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *
    evas_object_resize(win, 320, 400);
    evas_object_show(win);
 }
+
+void
+test_external_icon(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+   Evas_Object *win, *ly;
+   char buf[PATH_MAX];
+
+   win = elm_win_util_standard_add("ext_icon", "Edje External Icon");
+   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/icon");
+   evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   elm_win_resize_object_add(win, ly);
+   evas_object_show(ly);
+
+   elm_layout_signal_emit(ly, "elm_test,animations,start", "elm_test");
+
+   evas_object_resize(win, 320, 400);
+   evas_object_show(win);
+}