summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <m.blumenkran@samsung.com>2013-10-01 12:25:28 +0100
committerMike Blumenkrantz <m.blumenkran@samsung.com>2013-10-01 12:29:12 +0100
commit3abb6e81b865b6e11fcf3cf22dfc9162f1404381 (patch)
treede4681d8dacdcb21e56c6d2f1b3bcc966ee29d17
parentb685ae5ea305cac53984a744244c5cff49db46fb (diff)
add a series of tests for borderless/override/alpha rendering
-rw-r--r--compbench.c142
1 files changed, 112 insertions, 30 deletions
diff --git a/compbench.c b/compbench.c
index 5e99fd4..ce90598 100644
--- a/compbench.c
+++ b/compbench.c
@@ -11,30 +11,134 @@ static Evas_Object *win, *rect;
11 11
12static unsigned int max, num = 0; 12static unsigned int max, num = 0;
13 13
14typedef enum
15{
16 TEST_NORMAL,
17 TEST_ALPHA,
18 TEST_BORDERLESS,
19 TEST_BORDERLESS_ALPHA,
20 TEST_OVERRIDE,
21 TEST_OVERRIDE_ALPHA,
22 TEST_END
23} Test;
24
25static const char *test_string[] =
26{
27 [TEST_NORMAL] = "NORMAL",
28 [TEST_ALPHA] = "ALPHA",
29 [TEST_BORDERLESS] = "BORDERLESS",
30 [TEST_BORDERLESS_ALPHA] = "BORDERLESS_ALPHA",
31 [TEST_OVERRIDE] = "OVERRIDE",
32 [TEST_OVERRIDE_ALPHA] = "OVERRIDE_ALPHA"
33};
34
35static Test test = TEST_OVERRIDE_ALPHA;
36
37static Eina_Bool test_override[] =
38{
39 [TEST_NORMAL] = EINA_FALSE,
40 [TEST_ALPHA] = EINA_FALSE,
41 [TEST_BORDERLESS] = EINA_FALSE,
42 [TEST_BORDERLESS_ALPHA] = EINA_FALSE,
43 [TEST_OVERRIDE] = EINA_TRUE,
44 [TEST_OVERRIDE_ALPHA] = EINA_TRUE
45};
46
47static Eina_Bool test_borderless[] =
48{
49 [TEST_NORMAL] = EINA_FALSE,
50 [TEST_ALPHA] = EINA_FALSE,
51 [TEST_BORDERLESS] = EINA_TRUE,
52 [TEST_BORDERLESS_ALPHA] = EINA_TRUE,
53 [TEST_OVERRIDE] = EINA_FALSE,
54 [TEST_OVERRIDE_ALPHA] = EINA_FALSE
55};
56
57static Eina_Bool test_alpha[] =
58{
59 [TEST_NORMAL] = EINA_FALSE,
60 [TEST_ALPHA] = EINA_TRUE,
61 [TEST_BORDERLESS] = EINA_FALSE,
62 [TEST_BORDERLESS_ALPHA] = EINA_TRUE,
63 [TEST_OVERRIDE] = EINA_FALSE,
64 [TEST_OVERRIDE_ALPHA] = EINA_TRUE
65};
66
14static void _resize1(void *data EINA_UNUSED, Efx_Map_Data *emd EINA_UNUSED, Evas_Object *o EINA_UNUSED); 67static void _resize1(void *data EINA_UNUSED, Efx_Map_Data *emd EINA_UNUSED, Evas_Object *o EINA_UNUSED);
15 68
69static Eina_Bool
70_test_init(void)
71{
72 Evas_Object *pwin;
73
74 test++;
75 if (test == TEST_END)
76 test = TEST_NORMAL;
77
78 pwin = win;
79 if (pwin) evas_object_hide(pwin);
80 win = elm_win_util_standard_add("compbench", "compbench");
81 elm_win_autodel_set(win, 1);
82 elm_win_override_set(win, test_override[test]);
83 elm_win_borderless_set(win, test_borderless[test]);
84 elm_win_alpha_set(win, test_alpha[test]);
85 evas_object_show(win);
86 elm_win_screen_size_get(win, NULL, NULL, &sw, &sh);
87 /* objects start at 0,0
88 * need to do some other move to force the 0,0 coords
89 */
90 evas_object_move(win, -1, -1);
91 evas_object_move(win, 0, 0);
92 evas_object_resize(win, 400, 400);
93 rect = elm_bg_add(win);
94 elm_bg_color_set(rect, 0, 0, 0);
95 evas_object_size_hint_align_set(rect, EVAS_HINT_FILL, EVAS_HINT_FILL);
96 evas_object_size_hint_expand_set(rect, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
97 elm_win_resize_object_add(win, rect);
98 evas_object_show(rect);
99
100 rect = evas_object_rectangle_add(evas_object_evas_get(win));
101 evas_object_resize(rect, 400, 400);
102 evas_object_show(rect);
103 /* start with a red rect */
104 efx_fade(rect, EFX_EFFECT_SPEED_LINEAR, EFX_COLOR(255, 0, 0), 255, 0.0, NULL, NULL);
105
106 /* first effect is a resize! */
107 efx_resize(rect, EFX_EFFECT_SPEED_LINEAR, NULL, 100, 100, 10.0, _resize1, NULL);
108 if (pwin) evas_object_del(pwin);
109 return EINA_FALSE;
110}
111
16static void 112static void
17_reset(void *data EINA_UNUSED, Efx_Map_Data *emd EINA_UNUSED, Evas_Object *o EINA_UNUSED) 113_reset(void *data EINA_UNUSED, Efx_Map_Data *emd EINA_UNUSED, Evas_Object *o EINA_UNUSED)
18{ 114{
19 /* we've completed a loop! */ 115 /* we've completed a loop! */
20 num++; 116 if (_test_init())
117 {
118 /* we've completed a test set! */
119 num++;
120 printf("TEST SET #%d COMPLETE!\n", num);
121 }
21 /* quit here if we reached the max desired loops */ 122 /* quit here if we reached the max desired loops */
22 if (max && (num == max)) ecore_main_loop_quit(); 123 if (max && (num == max)) ecore_main_loop_quit();
23 /* start our first op again, then hook the initial callback */ 124 else
24 efx_resize(rect, EFX_EFFECT_SPEED_LINEAR, NULL, 100, 100, 10.0, _resize1, NULL); 125 printf("STARTING TEST: %s\n", test_string[test]);
25} 126}
26 127
27static void 128static void
28_fs_toggle(void *data EINA_UNUSED, Efx_Map_Data *emd EINA_UNUSED, Evas_Object *o EINA_UNUSED) 129_fs_toggle(void *data EINA_UNUSED, Efx_Map_Data *emd EINA_UNUSED, Evas_Object *o EINA_UNUSED)
29{ 130{
30 Eina_Bool fs = elm_win_fullscreen_get(win); 131 Eina_Bool fs = elm_win_fullscreen_get(win);
132 static int done = 0;
31 133
32 /* toggle fullscreen */ 134 /* toggle fullscreen */
33 elm_win_fullscreen_set(win, !fs); 135 elm_win_fullscreen_set(win, !fs);
34 if (!fs) return; 136 printf("FULLSCREEN: %d\n", !fs);
137 if (!done++) return;
35 /* when coming out of fullscreen, resize ourselves to starting size */ 138 /* when coming out of fullscreen, resize ourselves to starting size */
36 efx_resize(win, EFX_EFFECT_SPEED_LINEAR, EFX_POINT(0, 0), 400, 400, 10.0, NULL, NULL); 139 efx_resize(win, EFX_EFFECT_SPEED_LINEAR, NULL, 400, 400, 10.0, _reset, NULL);
37 efx_resize(rect, EFX_EFFECT_SPEED_LINEAR, NULL, 400, 400, 10.0, _reset, NULL); 140 efx_follow(win, rect);
141 done = 0;
38} 142}
39 143
40static void 144static void
@@ -155,31 +259,9 @@ main(int argc, char *argv[])
155 efx_init(); 259 efx_init();
156 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); 260 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
157 261
158 win = elm_win_util_standard_add("compbench", "compbench"); 262 _test_init();
159 elm_win_autodel_set(win, 1);
160 evas_object_show(win);
161 elm_win_screen_size_get(win, NULL, NULL, &sw, &sh);
162 /* objects start at 0,0
163 * need to do some other move to force the 0,0 coords
164 */
165 evas_object_move(win, -1, -1);
166 evas_object_move(win, 0, 0);
167 evas_object_resize(win, 400, 400);
168 rect = elm_bg_add(win);
169 elm_bg_color_set(rect, 0, 0, 0);
170 evas_object_size_hint_align_set(rect, EVAS_HINT_FILL, EVAS_HINT_FILL);
171 evas_object_size_hint_expand_set(rect, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
172 elm_win_resize_object_add(win, rect);
173 evas_object_show(rect);
174
175 rect = evas_object_rectangle_add(evas_object_evas_get(win));
176 evas_object_resize(rect, 400, 400);
177 evas_object_show(rect);
178 /* start with a red rect */
179 efx_fade(rect, EFX_EFFECT_SPEED_LINEAR, EFX_COLOR(255, 0, 0), 255, 0.0, NULL, NULL);
180 263
181 /* first effect is a resize! */ 264 printf("STARTING TEST: %s\n", test_string[test]);
182 efx_resize(rect, EFX_EFFECT_SPEED_LINEAR, NULL, 100, 100, 10.0, _resize1, NULL);
183 265
184 ecore_main_loop_begin(); 266 ecore_main_loop_begin();
185 return 0; 267 return 0;