summaryrefslogtreecommitdiff
path: root/src/tests/edje/data
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-05-23 16:29:16 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-05-24 13:02:20 +0900
commit9d48350ae40eaa1ea6247c402dee06bb31553484 (patch)
tree38877339500e5beded999ca3ae646c832fe9e125 /src/tests/edje/data
parente7abfba03404bb8b594855ec712c9242ca9656eb (diff)
edje: Implement EO API for message_send
Since this uses generic_value (aka Eina_Value), there is an implicit type detection and conversion. I did not attempt to cover all types (namely string+int and string+float and even less sets of those) as I believe they aren't really used. Or they most likely could be replaced by multiple messages rather than a single message. Note: should we pass ptr(generic_value) instead of generic_value? The API looks a little odd in C when passing by value. @feature
Diffstat (limited to 'src/tests/edje/data')
-rw-r--r--src/tests/edje/data/test_messages.edc67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/tests/edje/data/test_messages.edc b/src/tests/edje/data/test_messages.edc
new file mode 100644
index 0000000000..bd207cd81f
--- /dev/null
+++ b/src/tests/edje/data/test_messages.edc
@@ -0,0 +1,67 @@
1collections {
2 group { "test_group";
3 parts {
4 rect { "bg";
5 desc { "default";
6 color: 0 0 0 255;
7 }
8 }
9 text { "text";
10 desc { "default";
11 text {
12 font: "Sans";
13 size: 24;
14 text: "HELLO";
15 }
16 }
17 }
18 }
19
20// Messages IDs:
21 // 0. string, text string
22 // 1. int, text size
23 // 2. int set, bg color (4 ints)
24 // 3. float, sends signal
25
26 script {
27 public message(Msg_Type:type, id, ...) {
28 if ((type == MSG_STRING) && (id == 0)) {
29 new str[64], buf[64];
30
31 getsarg(2, str, sizeof(str));
32 set_text(PART:"text", str);
33
34 snprintf(buf, sizeof(buf), "str %s", str);
35 emit(buf, "edc");
36 }
37 else if ((type == MSG_INT) && (id == 1)) {
38 new i, buf[64];
39
40 i = getarg(2);
41 set_state_val(PART:"text", STATE_TEXT_SIZE, i);
42
43 snprintf(buf, sizeof(buf), "int %d", i);
44 emit(buf, "edc");
45 }
46 else if ((type == MSG_FLOAT) && (id == 2)) {
47 new f, buf[64];
48
49 f = getarg(2);
50 snprintf(buf, sizeof(buf), "float %f", f);
51 emit(buf, "edc");
52 }
53 else if ((type == MSG_INT_SET) && (id == 3)) {
54 new r, g, b, a, buf[64];
55
56 r = getarg(2);
57 g = getarg(3);
58 b = getarg(4);
59 a = getarg(5);
60 set_state_val(PART:"bg", STATE_COLOR, r, g, b, a);
61
62 snprintf(buf, sizeof(buf), "int set %d %d %d %d", r, g, b, a);
63 emit(buf, "edc");
64 }
65 }
66 }
67 }