summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-05-30 13:15:43 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-05-31 09:19:26 -0400
commit73874100192ebdb55bbf4c2fc8cd6648c2dd7afd (patch)
treeb5968d304ace14fad5f92f07902d00f2d1e24354
parent1b4ce987a7dc36ba8b6f5be54a2f41c30e29a2d5 (diff)
elm_test: add smart object mask test to existing masking test
Summary: this adds another masking functionality using a layout object to the test when the toggle mask button is clicked enough times Depends on D8849 Reviewers: cedric Reviewed By: cedric Subscribers: cedric Tags: #efl Differential Revision: https://phab.enlightenment.org/D8850
-rw-r--r--data/elementary/objects/test_masking.edc24
-rw-r--r--src/bin/elementary/test_evas_mask.c34
2 files changed, 50 insertions, 8 deletions
diff --git a/data/elementary/objects/test_masking.edc b/data/elementary/objects/test_masking.edc
index 4a1beabb76..4d8e8ed6cc 100644
--- a/data/elementary/objects/test_masking.edc
+++ b/data/elementary/objects/test_masking.edc
@@ -13,6 +13,18 @@ collections {
13 } 13 }
14 } 14 }
15 } 15 }
16 group { "image";
17 parts {
18 image { "mask";
19 desc { "default";
20 image {
21 normal: "roundedrect.png";
22 border: 22 22 22 22;
23 }
24 }
25 }
26 }
27 }
16 group { "masking"; 28 group { "masking";
17 parts { 29 parts {
18 rect { "clip"; norender; } 30 rect { "clip"; norender; }
@@ -25,10 +37,16 @@ collections {
25 } 37 }
26 } 38 }
27 } 39 }
40 swallow { "mask2";
41 norender;
42 }
28 swallow { "content"; 43 swallow { "content";
29 desc { "default"; 44 desc { "default";
30 clip_to: "mask"; 45 clip_to: "mask";
31 } 46 }
47 desc { "smartclip";
48 clip: "mask2";
49 }
32 desc { "unclipped"; 50 desc { "unclipped";
33 clip_to: "clip"; 51 clip_to: "clip";
34 } 52 }
@@ -47,6 +65,12 @@ collections {
47 action: STATE_SET "default"; 65 action: STATE_SET "default";
48 target: "content"; 66 target: "content";
49 } 67 }
68 program {
69 signal: "smartclip";
70 source: "*";
71 action: STATE_SET "smartclip";
72 target: "content";
73 }
50 } 74 }
51 } 75 }
52 group { "text"; 76 group { "text";
diff --git a/src/bin/elementary/test_evas_mask.c b/src/bin/elementary/test_evas_mask.c
index ed18d0fdc9..05d3933bcc 100644
--- a/src/bin/elementary/test_evas_mask.c
+++ b/src/bin/elementary/test_evas_mask.c
@@ -61,20 +61,31 @@ _gl_del(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED)
61} 61}
62 62
63static void 63static void
64_toggle_mask(void *data, const Efl_Event *ev EINA_UNUSED) 64_toggle_mask(void *data, const Efl_Event *ev)
65{ 65{
66 Eo *ly = data; 66 Eo *ly = data;
67 const char *clip = efl_key_data_get(ly, "clip");
68 const char *text;
67 69
68 if (!efl_key_data_get(ly, "unclipped")) 70 if (eina_streq(clip, "image"))
69 { 71 {
70 elm_layout_signal_emit(ly, "unclip", "elm_test"); 72 elm_layout_signal_emit(ly, "unclip", "elm_test");
71 efl_key_data_set(ly, "unclipped", "yup"); 73 efl_key_data_set(ly, "clip", NULL);
74 text = "Toggle mask (none)";
72 } 75 }
73 else 76 else if (eina_streq(clip, "smart"))
74 { 77 {
75 elm_layout_signal_emit(ly, "clip", "elm_test"); 78 elm_layout_signal_emit(ly, "clip", "elm_test");
76 efl_key_data_set(ly, "unclipped", NULL); 79 efl_key_data_set(ly, "clip", "image");
80 text = "Toggle mask (image)";
81 }
82 else
83 {
84 elm_layout_signal_emit(ly, "smartclip", "elm_test");
85 efl_key_data_set(ly, "clip", "smart");
86 text = "Toggle mask (smart)";
77 } 87 }
88 efl_text_set(ev->object, text);
78} 89}
79 90
80static void 91static void
@@ -101,7 +112,7 @@ _rotate_win(void *data, const Efl_Event *ev EINA_UNUSED)
101void 112void
102test_evas_mask(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 113test_evas_mask(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
103{ 114{
104 Eo *win, *box, *o, *gl, *ly, *box2; 115 Eo *win, *box, *o, *gl, *ly, *smart_mask, *box2;
105 Elm_Genlist_Item_Class *itc; 116 Elm_Genlist_Item_Class *itc;
106 char buf[PATH_MAX]; 117 char buf[PATH_MAX];
107 118
@@ -121,9 +132,16 @@ test_evas_mask(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event
121 snprintf(buf, sizeof(buf), "%s/objects/test_masking.edj", elm_app_data_dir_get()); 132 snprintf(buf, sizeof(buf), "%s/objects/test_masking.edj", elm_app_data_dir_get());
122 ly = efl_add(EFL_UI_LAYOUT_CLASS, win, 133 ly = efl_add(EFL_UI_LAYOUT_CLASS, win,
123 efl_file_set(efl_added, buf), 134 efl_file_set(efl_added, buf),
124 efl_file_key_set(efl_added, "masking")); 135 efl_file_key_set(efl_added, "masking"),
136 efl_key_data_set(efl_added, "clip", "image"));
125 efl_pack(box, ly); 137 efl_pack(box, ly);
126 138
139 // FIXME: layout EO API
140 smart_mask = efl_add(EFL_UI_LAYOUT_CLASS, win,
141 efl_file_set(efl_added, buf),
142 efl_file_key_set(efl_added, "image"));
143 elm_object_part_content_set(ly, "mask2", smart_mask);
144
127 // FIXME: No genlist in EO API 145 // FIXME: No genlist in EO API
128 o = gl = elm_genlist_add(win); 146 o = gl = elm_genlist_add(win);
129 elm_genlist_homogeneous_set(gl, 1); 147 elm_genlist_homogeneous_set(gl, 1);
@@ -157,7 +175,7 @@ test_evas_mask(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event
157 175
158 // FIXME: button EO API 176 // FIXME: button EO API
159 efl_add(EFL_UI_BUTTON_CLASS, win, 177 efl_add(EFL_UI_BUTTON_CLASS, win,
160 efl_text_set(efl_added, "Toggle mask"), 178 efl_text_set(efl_added, "Toggle mask (image)"),
161 efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _toggle_mask, ly), 179 efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _toggle_mask, ly),
162 efl_gfx_hint_weight_set(efl_added, 0.0, 0.0), 180 efl_gfx_hint_weight_set(efl_added, 0.0, 0.0),
163 efl_pack(box2, efl_added)); 181 efl_pack(box2, efl_added));