summaryrefslogtreecommitdiff
path: root/src/tests/ecore/ecore_test_animator.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-07-13 15:31:51 -0700
committerCedric BAIL <cedric@osg.samsung.com>2016-07-13 15:32:15 -0700
commit649f120326d800b596fa54fbef633bba9b98c3fc (patch)
tree03216fd5e197eee6af0d6531c17be011d8fb20b7 /src/tests/ecore/ecore_test_animator.c
parentfd5d31696d834a6c0fad3fe89cfb523899c04531 (diff)
ecore: add test case for tick begin/end.
Diffstat (limited to '')
-rw-r--r--src/tests/ecore/ecore_test_animator.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/tests/ecore/ecore_test_animator.c b/src/tests/ecore/ecore_test_animator.c
index c99e216de3..172d77062b 100644
--- a/src/tests/ecore/ecore_test_animator.c
+++ b/src/tests/ecore/ecore_test_animator.c
@@ -97,8 +97,70 @@ START_TEST(ecore_test_pos_map)
97} 97}
98END_TEST 98END_TEST
99 99
100static void _animator_called_cb(void *data)
101{
102 Eina_Bool *called = data;
103
104 *called = EINA_TRUE;
105}
106
107static Eina_Bool _animator_cb(void *data)
108{
109 Eina_Bool *called = data;
110
111 *called = EINA_TRUE;
112 return ECORE_CALLBACK_RENEW;
113}
114
115static Eina_Bool _switch_cb(void* data EINA_UNUSED)
116{
117 ecore_animator_custom_tick();
118 return ECORE_CALLBACK_CANCEL;
119}
120
121static Eina_Bool _quit_cb(void* data EINA_UNUSED)
122{
123 ecore_main_loop_quit();
124 return ECORE_CALLBACK_CANCEL;
125}
126
127START_TEST(ecore_test_begin_end_tick)
128{
129 Ecore_Timer *timer1, *timer2;
130 Ecore_Animator *animator;
131 Eina_Bool is_animator_cb_called = EINA_FALSE;
132 Eina_Bool is_begin_cb_called = EINA_FALSE;
133 Eina_Bool is_end_cb_called = EINA_FALSE;
134
135 ecore_init();
136
137 ecore_animator_custom_source_tick_begin_callback_set(_animator_called_cb, &is_begin_cb_called);
138 ecore_animator_custom_source_tick_end_callback_set(_animator_called_cb, &is_end_cb_called);
139
140 animator = ecore_animator_add(_animator_cb, &is_animator_cb_called);
141 fail_if(!animator);
142
143 timer1 = ecore_timer_add(0.01, _switch_cb, NULL);
144 fail_if(!timer1);
145
146 timer2 = ecore_timer_add(0.03, _quit_cb, NULL);
147 fail_if(!timer2);
148
149 ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_CUSTOM);
150 ecore_main_loop_begin();
151 ecore_animator_del(animator);
152
153 fail_if(!is_begin_cb_called);
154 fail_if(!is_end_cb_called);
155 fail_if(!is_animator_cb_called);
156
157 ecore_shutdown();
158}
159END_TEST
160
100void ecore_test_animator(TCase *tc) 161void ecore_test_animator(TCase *tc)
101{ 162{
102 tcase_add_test(tc, ecore_test_animators); 163 tcase_add_test(tc, ecore_test_animators);
103 tcase_add_test(tc, ecore_test_pos_map); 164 tcase_add_test(tc, ecore_test_pos_map);
165 tcase_add_test(tc, ecore_test_begin_end_tick);
104} 166}