Expedite: Proxy tests: Add some proxy tests.
[framework/uifw/expedite.git] / src / bin / proxy_text_random.c
1 #undef FNAME
2 #undef NAME
3 #undef ICON
4
5 /* metadata */
6 #define FNAME proxy_text_random
7 #define NAME "Proxy Text Random"
8 #define ICON "text.png"
9
10 #ifndef PROTO
11 # ifndef UI
12 #  include "main.h"
13
14 /* standard var */
15 static int done = 0;
16
17 /* private data */
18 static Evas_Object *o_texts[OBNUM];
19
20 /* setup */
21 static void _setup(void)
22 {
23    int i = 0;
24    Evas_Object *o;
25    Evas_Coord x, y, w, h;
26    char buf[1024];
27    const char *strs[] = {
28       "Big", "Smelly", "Fish", "Pants", "Octopus", "Garden", "There", "I",
29         "Am", "You", "Are", "Erogenous", "We", "Stick", "Wet", "Fishy",
30         "Fiddly", "Family", "Lair", "Monkeys", "Magazine"
31    };
32    srnd();
33    o = evas_object_text_add(evas);
34    o_texts[0] = o;
35    evas_object_text_font_set(o, "Vera-Bold", 20);
36    snprintf(buf, sizeof(buf), "%s %s %s %s.",
37                    strs[rnd() % (sizeof(strs) / sizeof(char *))],
38                    strs[rnd() % (sizeof(strs) / sizeof(char *))],
39                    strs[rnd() % (sizeof(strs) / sizeof(char *))],
40                    strs[rnd() % (sizeof(strs) / sizeof(char *))]);
41    evas_object_text_text_set(o, buf);
42    evas_object_color_set(o, 0, 0, 0, 255);
43    evas_object_geometry_get(o, NULL, NULL, &w, &h);
44    x = (win_w / 2) - (w / 2);
45    x += sin((double)((i * 13)) / (36.7 * SLOW)) * (w / 2);
46    y = (win_h / 2) - (h / 2);
47    y += cos((double)((i * 28)) / (43.8 * SLOW)) * (w / 2);
48    evas_object_move(o, x, y);
49    evas_object_show(o);
50    for (i = 1  ; i < OBNUM ; i ++)
51      {
52         o = evas_object_image_add(evas);
53         o_texts[i] = o;
54         evas_object_image_source_set(o, o_texts[0]);
55         evas_object_geometry_get(o_texts[0], NULL, NULL, &w, &h);
56         evas_object_resize(o, w, h);
57         evas_object_image_fill_set(o, 0, 0, w, h);
58         x = (win_w / 2) - (w / 2);
59         x += sin((double)((i * 13)) / (36.7 * SLOW)) * (w / 2);
60         y = (win_h / 2) - (h / 2);
61         y += cos((double)((i * 28)) / (43.8 * SLOW)) * (w / 2);
62         evas_object_move(o, x, y);
63
64         evas_object_show(o);
65      }
66
67
68    done = 0;
69 }
70
71 /* cleanup */
72 static void _cleanup(void)
73 {
74    int i;
75    for (i = 0; i < OBNUM; i++) evas_object_del(o_texts[i]);
76 }
77
78 /* loop - do things */
79 static void _loop(double t, int f)
80 {
81    int i,w,h;
82    char buf[1024];
83    const char *strs[] = {
84       "Big", "Smelly", "Fish", "Pants", "Octopus", "Garden", "There", "I",
85         "Am", "You", "Are", "Erogenous", "We", "Stick", "Wet", "Fishy",
86         "Fiddly", "Family", "Lair", "Monkeys", "Magazine"
87    };
88    snprintf(buf, sizeof(buf), "%s %s %s %s.",
89                    strs[rnd() % (sizeof(strs) / sizeof(char *))],
90                    strs[rnd() % (sizeof(strs) / sizeof(char *))],
91                    strs[rnd() % (sizeof(strs) / sizeof(char *))],
92                    strs[rnd() % (sizeof(strs) / sizeof(char *))]);
93    evas_object_text_text_set(o_texts[0], buf);
94    evas_object_geometry_get(o_texts[0], NULL, NULL, &w, &h);
95    for (i = 1; i < OBNUM; i++)
96      {
97         evas_object_resize(o_texts[i],w,h);
98         evas_object_image_fill_set(o_texts[i],0,0,w,h);
99      }
100    FPS_STD(NAME);
101 }
102
103 /* prepend special key handlers if interactive (before STD) */
104 static void _key(char *key)
105 {
106    KEY_STD;
107 }
108
109
110
111
112
113
114
115
116
117
118
119
120 /* template stuff - ignore */
121 # endif
122 #endif
123
124 #ifdef UI
125 _ui_menu_item_add(ICON, NAME, FNAME);
126 #endif
127
128 #ifdef PROTO
129 void FNAME(void);
130 #endif
131
132 #ifndef PROTO
133 # ifndef UI
134 void FNAME(void)
135 {
136    ui_func_set(_key, _loop);
137    _setup();
138 }
139 # endif
140 #endif
141 #undef FNAME
142 #undef NAME
143 #undef ICON