Mercurial > MadButterfly
annotate src/animate.c @ 116:1d74eb3861b7
move animation actions from animate.c to files.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sun, 14 Sep 2008 09:42:07 +0800 |
parents | 8feb89b19619 |
children | e4e47d2cdbcd |
rev | line source |
---|---|
111 | 1 /*! \file |
2 * \brief Animation tools. | |
3 * | |
4 * \sa ani | |
5 */ | |
6 /*! \page ani What is Animation? | |
41 | 7 * |
8 * XXX: Program is a sequence of actions duration a perior. | |
9 * Actions are grouped into words. A program defines | |
10 * the order and time of playing of words. A word | |
11 * defines how long to perform a set of actions. Actions | |
12 * in a word are performed concurrently. | |
45 | 13 * |
14 * Animation shapes are updated periodically. Every action | |
15 * are working with start, step, and stop 3 calls. start is | |
16 * called when start time the word, contain it, due. step is | |
17 * called periodically in duration of playing time start at | |
18 * 'start time'. When the clock run out the playing time of | |
19 * a word, it call stop of actions in the word. | |
111 | 20 * |
21 * A program is driven by a timer. Once a program is started, it registers | |
22 * with timer for periodic running. \ref mb_tman_t is timer of | |
23 * MadButterfly. The update frequence is 10fps by default, now. | |
24 * | |
25 * \sa animate.c | |
41 | 26 */ |
27 #include <stdio.h> | |
28 #include <stdlib.h> | |
29 #include <string.h> | |
30 #include "mb_types.h" | |
31 #include "redraw_man.h" | |
32 #include "mb_timer.h" | |
33 #include "animate.h" | |
34 | |
35 | |
42 | 36 #define STEP_INTERVAL 100000 |
41 | 37 #define ASSERT(x) |
38 | |
39 /*! \brief A word is a set of concurrent actions in a program. | |
40 */ | |
41 struct _mb_word { | |
42 mb_timeval_t start_time; /*!< time to start the word */ | |
43 mb_timeval_t playing_time; /*!< time duration of playing */ | |
48
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
44 mb_timeval_t abs_start, abs_stop; |
41 | 45 STAILQ(mb_action_t) actions; |
46 }; | |
47 | |
48 /*! \brief A program describe a series of actions to animate shapes. | |
51 | 49 * |
50 * first_playing is an index to one of words. It always points to | |
51 * the first of words that is playing or waiting for playing. | |
41 | 52 */ |
53 struct _mb_progm { | |
54 redraw_man_t *rdman; | |
55 | |
46 | 56 mb_timeval_t start_time; |
41 | 57 int first_playing; /*!< first playing word. */ |
58 mb_tman_t *tman; | |
59 | |
60 int n_words; | |
61 int max_words; | |
62 mb_word_t words[1]; | |
63 }; | |
64 | |
65 mb_progm_t *mb_progm_new(int max_words, redraw_man_t *rdman) { | |
66 mb_progm_t *progm; | |
67 int i; | |
68 | |
69 progm = (mb_progm_t *)malloc(sizeof(mb_progm_t) + | |
70 (sizeof(mb_word_t) * (max_words - 1))); | |
71 if(progm == NULL) | |
72 return NULL; | |
73 | |
74 progm->rdman = rdman; | |
75 progm->n_words = 0; | |
76 progm->max_words = max_words; | |
77 for(i = 0; i < max_words; i++) | |
78 STAILQ_INIT(progm->words[i].actions); | |
79 return progm; | |
80 } | |
81 | |
82 void mb_progm_free(mb_progm_t *progm) { | |
83 int n_words; | |
84 mb_word_t *word; | |
85 mb_action_t *cur_act; | |
86 int i; | |
87 | |
88 n_words = progm->n_words; | |
89 for(i = 0; i < n_words; i++) { | |
90 word = progm->words + i; | |
91 for(cur_act = STAILQ_HEAD(word->actions); | |
92 cur_act != NULL; | |
93 cur_act = STAILQ_HEAD(word->actions)) { | |
94 STAILQ_REMOVE(word->actions, mb_action_t, next, cur_act); | |
95 cur_act->free(cur_act); | |
96 } | |
97 } | |
98 free(progm); | |
99 } | |
100 | |
101 /*! \brief Add a new word into a program. | |
102 * | |
103 * The start time of new word should bigger or equal to last one. | |
104 * The time should be specified in incremental order. | |
105 */ | |
106 mb_word_t *mb_progm_next_word(mb_progm_t *progm, | |
107 const mb_timeval_t *start, | |
108 const mb_timeval_t *playing) { | |
109 mb_word_t *word; | |
110 if(progm->n_words >= progm->max_words) | |
111 return NULL; | |
112 if(progm->n_words && | |
113 MB_TIMEVAL_LATER(&progm->words[progm->n_words - 1].start_time, start)) | |
114 return NULL; | |
115 word = progm->words + progm->n_words++; | |
43
6270230b9248
Use MB_TIMEVAL_CP() instead of memcpy
Thinker K.F. Li <thinker@branda.to>
parents:
42
diff
changeset
|
116 MB_TIMEVAL_CP(&word->start_time, start); |
6270230b9248
Use MB_TIMEVAL_CP() instead of memcpy
Thinker K.F. Li <thinker@branda.to>
parents:
42
diff
changeset
|
117 MB_TIMEVAL_CP(&word->playing_time, playing); |
41 | 118 return word; |
119 } | |
120 | |
116
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
111
diff
changeset
|
121 void mb_word_add_action(mb_word_t *word, mb_action_t *act) { |
41 | 122 STAILQ_INS_TAIL(word->actions, mb_action_t, next, act); |
123 } | |
124 | |
125 static void mb_word_start(mb_word_t *word, const mb_timeval_t *tmo, | |
126 const mb_timeval_t *now, redraw_man_t *rdman) { | |
42 | 127 mb_action_t *act; |
128 | |
129 for(act = STAILQ_HEAD(word->actions); | |
130 act != NULL; | |
131 act = STAILQ_NEXT(mb_action_t, next, act)) { | |
132 act->start(act, tmo, &word->playing_time, rdman); | |
133 } | |
41 | 134 } |
135 | |
136 static void mb_word_step(mb_word_t *word, const mb_timeval_t *tmo, | |
137 const mb_timeval_t *now, redraw_man_t *rdman) { | |
42 | 138 mb_action_t *act; |
139 | |
140 for(act = STAILQ_HEAD(word->actions); | |
141 act != NULL; | |
142 act = STAILQ_NEXT(mb_action_t, next, act)) { | |
143 act->step(act, tmo, rdman); | |
144 } | |
41 | 145 } |
146 | |
147 static void mb_word_stop(mb_word_t *word, const mb_timeval_t *tmo, | |
148 const mb_timeval_t *now, redraw_man_t *rdman) { | |
42 | 149 mb_action_t *act; |
150 | |
151 for(act = STAILQ_HEAD(word->actions); | |
152 act != NULL; | |
153 act = STAILQ_NEXT(mb_action_t, next, act)) { | |
154 act->stop(act, tmo, rdman); | |
155 } | |
41 | 156 } |
157 | |
46 | 158 /* |
159 * Any two actions in concurrent words never change the same attribute. | |
160 * Start time of words in a program are specified in incremental order. | |
161 */ | |
41 | 162 static void mb_progm_step(const mb_timeval_t *tmo, |
46 | 163 const mb_timeval_t *now, |
164 void *arg) { | |
41 | 165 mb_progm_t *progm = (mb_progm_t *)arg; |
48
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
166 mb_timeval_t next_tmo; |
41 | 167 mb_word_t *word; |
168 mb_timer_t *timer; | |
169 int i; | |
170 | |
48
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
171 MB_TIMEVAL_SET(&next_tmo, 0, STEP_INTERVAL); |
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
172 MB_TIMEVAL_ADD(&next_tmo, tmo); |
41 | 173 |
48
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
174 /* _step() or _stop() words that in playing. */ |
41 | 175 i = progm->first_playing; |
176 for(word = progm->words + i; | |
48
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
177 i < progm->n_words && MB_TIMEVAL_LATER(tmo, &word->abs_start); |
41 | 178 word = progm->words + ++i) { |
48
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
179 if(MB_TIMEVAL_LATER(tmo, &word->abs_stop)) |
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
180 continue; |
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
181 if(MB_TIMEVAL_LATER(&next_tmo, &word->abs_stop)) |
46 | 182 mb_word_stop(word, tmo, now, progm->rdman); |
183 else | |
41 | 184 mb_word_step(word, tmo, now, progm->rdman); |
185 } | |
186 | |
48
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
187 /* Start words that their abs_start is in duration |
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
188 * from now to timeout for next update. |
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
189 */ |
41 | 190 for(word = progm->words + i; |
48
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
191 i < progm->n_words && MB_TIMEVAL_LATER(&next_tmo, &word->abs_start); |
41 | 192 word = progm->words + ++i) { |
193 mb_word_start(word, tmo, now, progm->rdman); | |
48
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
194 if(MB_TIMEVAL_LATER(&next_tmo, &word->abs_stop)) |
46 | 195 mb_word_stop(word, tmo, now, progm->rdman); |
41 | 196 } |
197 | |
48
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
198 /* Find a new first_playing if any consequence words, following current |
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
199 * first_playing word, are stoped. |
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
200 */ |
46 | 201 i = progm->first_playing; |
202 for(word = progm->words + i; | |
48
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
203 i < progm->n_words && MB_TIMEVAL_LATER(&next_tmo, &word->abs_stop); |
46 | 204 word = progm->words + ++i) { |
205 progm->first_playing++; | |
206 } | |
207 | |
48
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
208 /* Setup timeout for next update. */ |
41 | 209 if(progm->first_playing < progm->n_words) { |
42 | 210 word = progm->words + progm->first_playing; |
48
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
211 if(MB_TIMEVAL_LATER(&word->abs_start, &next_tmo)) |
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
212 MB_TIMEVAL_CP(&next_tmo, &word->abs_start); |
46 | 213 timer = mb_tman_timeout(progm->tman, &next_tmo, |
214 mb_progm_step, progm); | |
41 | 215 } |
216 } | |
217 | |
218 void mb_progm_start(mb_progm_t *progm, mb_tman_t *tman, | |
219 mb_timeval_t *now) { | |
220 mb_timer_t *timer; | |
48
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
221 mb_word_t *word; |
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
222 int i; |
41 | 223 |
224 if(progm->n_words == 0) | |
225 return; | |
226 | |
227 progm->tman = tman; | |
43
6270230b9248
Use MB_TIMEVAL_CP() instead of memcpy
Thinker K.F. Li <thinker@branda.to>
parents:
42
diff
changeset
|
228 MB_TIMEVAL_CP(&progm->start_time, now); |
41 | 229 progm->first_playing = 0; |
230 | |
48
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
231 for(i = 0; i < progm->n_words; i++) { |
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
232 word = progm->words + i; |
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
233 MB_TIMEVAL_CP(&word->abs_start, &word->start_time); |
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
234 MB_TIMEVAL_ADD(&word->abs_start, now); |
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
235 MB_TIMEVAL_CP(&word->abs_stop, &word->abs_start); |
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
236 MB_TIMEVAL_ADD(&word->abs_stop, &word->playing_time); |
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
237 } |
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
238 |
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
239 if(MB_TIMEVAL_EQ(&progm->words[0].abs_start, now)) { |
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
240 mb_progm_step(now, now, progm); |
41 | 241 return; |
242 } | |
243 | |
48
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
244 timer = mb_tman_timeout(tman, &progm->words[0].abs_start, |
bdf711cbf0fb
Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents:
47
diff
changeset
|
245 mb_progm_step, progm); |
41 | 246 ASSERT(timer != NULL); |
247 } | |
248 | |
42 | 249 void mb_progm_abort(mb_progm_t *progm, mb_tman_t *tman) { |
250 } | |
251 | |
50 | 252 #ifdef UNITTEST |
253 | |
254 #include <CUnit/Basic.h> | |
255 | |
256 typedef struct _mb_dummy mb_dummy_t; | |
257 | |
258 struct _mb_dummy { | |
259 mb_action_t action; | |
260 int id; | |
261 int *logidx; | |
262 int *logs; | |
263 }; | |
264 | |
265 | |
266 static void mb_dummy_start(mb_action_t *act, | |
267 const mb_timeval_t *now, | |
268 const mb_timeval_t *playing_time, | |
269 redraw_man_t *rdman) { | |
270 mb_dummy_t *dummy = (mb_dummy_t *)act; | |
271 | |
272 dummy->logs[(*dummy->logidx)++] = dummy->id; | |
273 } | |
274 | |
275 static void mb_dummy_step(mb_action_t *act, | |
276 const mb_timeval_t *now, | |
277 redraw_man_t *rdman) { | |
278 mb_dummy_t *dummy = (mb_dummy_t *)act; | |
279 | |
280 dummy->logs[(*dummy->logidx)++] = dummy->id; | |
281 } | |
282 | |
283 static void mb_dummy_stop(mb_action_t *act, | |
284 const mb_timeval_t *now, | |
285 redraw_man_t *rdman) { | |
286 mb_dummy_t *dummy = (mb_dummy_t *)act; | |
287 | |
288 dummy->logs[(*dummy->logidx)++] = dummy->id; | |
289 } | |
290 | |
291 static void mb_dummy_free(mb_action_t *act) { | |
292 free(act); | |
293 } | |
294 | |
295 mb_action_t *mb_dummy_new(int id, int *logidx, int *logs, mb_word_t *word) { | |
296 mb_dummy_t *dummy; | |
297 | |
298 dummy = (mb_dummy_t *)malloc(sizeof(mb_dummy_t)); | |
299 if(dummy == NULL) | |
300 return NULL; | |
301 | |
302 dummy->id = id; | |
303 dummy->logidx = logidx; | |
304 dummy->logs = logs; | |
305 | |
306 dummy->action.start = mb_dummy_start; | |
307 dummy->action.step = mb_dummy_step; | |
308 dummy->action.stop = mb_dummy_stop; | |
309 dummy->action.free = mb_dummy_free; | |
310 | |
311 mb_word_add_action(word, (mb_action_t *)dummy); | |
312 | |
313 return (mb_action_t *)dummy; | |
314 } | |
315 | |
316 void test_animate_words(void) { | |
317 mb_progm_t *progm; | |
318 mb_word_t *word; | |
319 mb_action_t *acts[4]; | |
320 mb_tman_t *tman; | |
321 mb_timeval_t tv1, tv2, now, tmo_after; | |
322 int logcnt = 0; | |
323 int logs[256]; | |
324 int r; | |
325 | |
326 tman = mb_tman_new(); | |
327 CU_ASSERT(tman != NULL); | |
328 | |
329 progm = mb_progm_new(3, NULL); | |
330 CU_ASSERT(progm != NULL); | |
331 | |
332 MB_TIMEVAL_SET(&tv1, 1, 0); | |
333 MB_TIMEVAL_SET(&tv2, 0, STEP_INTERVAL * 3); | |
334 word = mb_progm_next_word(progm, &tv1, &tv2); | |
335 CU_ASSERT(word != NULL); | |
336 acts[0] = mb_dummy_new(0, &logcnt, logs, word); | |
337 CU_ASSERT(acts[0] != NULL); | |
338 | |
339 MB_TIMEVAL_SET(&tv1, 1, STEP_INTERVAL * 4 / 3); | |
340 MB_TIMEVAL_SET(&tv2, 0, STEP_INTERVAL / 3); | |
341 word = mb_progm_next_word(progm, &tv1, &tv2); | |
342 CU_ASSERT(word != NULL); | |
343 acts[1] = mb_dummy_new(1, &logcnt, logs, word); | |
344 CU_ASSERT(acts[1] != NULL); | |
345 | |
346 MB_TIMEVAL_SET(&tv1, 1, STEP_INTERVAL * 2); | |
347 MB_TIMEVAL_SET(&tv2, 0, STEP_INTERVAL * 3); | |
348 word = mb_progm_next_word(progm, &tv1, &tv2); | |
349 CU_ASSERT(word != NULL); | |
350 acts[2] = mb_dummy_new(2, &logcnt, logs, word); | |
351 CU_ASSERT(acts[2] != NULL); | |
352 | |
353 MB_TIMEVAL_SET(&now, 0, 0); | |
354 mb_progm_start(progm, tman, &now); | |
355 | |
356 r = mb_tman_next_timeout(tman, &now, &tmo_after); | |
357 CU_ASSERT(r == 0); | |
358 CU_ASSERT(MB_TIMEVAL_SEC(&tmo_after) == 1 && | |
359 MB_TIMEVAL_USEC(&tmo_after) == 0); | |
360 | |
361 /* 1.0s */ | |
362 MB_TIMEVAL_ADD(&now, &tmo_after); | |
363 mb_tman_handle_timeout(tman, &now); | |
364 CU_ASSERT(logcnt == 1); | |
365 | |
366 r = mb_tman_next_timeout(tman, &now, &tmo_after); | |
367 CU_ASSERT(r == 0); | |
368 CU_ASSERT(MB_TIMEVAL_SEC(&tmo_after) == 0 && | |
369 MB_TIMEVAL_USEC(&tmo_after) == STEP_INTERVAL); | |
370 | |
371 /* 1.1s */ | |
372 MB_TIMEVAL_ADD(&now, &tmo_after); | |
373 mb_tman_handle_timeout(tman, &now); | |
374 CU_ASSERT(logcnt == 4); | |
375 | |
376 r = mb_tman_next_timeout(tman, &now, &tmo_after); | |
377 CU_ASSERT(r == 0); | |
378 CU_ASSERT(MB_TIMEVAL_SEC(&tmo_after) == 0 && | |
379 MB_TIMEVAL_USEC(&tmo_after) == STEP_INTERVAL); | |
380 | |
381 /* 1.2s */ | |
382 MB_TIMEVAL_ADD(&now, &tmo_after); | |
383 mb_tman_handle_timeout(tman, &now); | |
384 CU_ASSERT(logcnt == 6); | |
385 | |
386 r = mb_tman_next_timeout(tman, &now, &tmo_after); | |
387 CU_ASSERT(r == 0); | |
388 CU_ASSERT(MB_TIMEVAL_SEC(&tmo_after) == 0 && | |
389 MB_TIMEVAL_USEC(&tmo_after) == STEP_INTERVAL); | |
390 | |
391 /* 1.3s */ | |
392 MB_TIMEVAL_ADD(&now, &tmo_after); | |
393 mb_tman_handle_timeout(tman, &now); | |
394 CU_ASSERT(logcnt == 8); | |
395 | |
396 r = mb_tman_next_timeout(tman, &now, &tmo_after); | |
397 CU_ASSERT(r == 0); | |
398 CU_ASSERT(MB_TIMEVAL_SEC(&tmo_after) == 0 && | |
399 MB_TIMEVAL_USEC(&tmo_after) == STEP_INTERVAL); | |
400 | |
401 /* 1.4s */ | |
402 MB_TIMEVAL_ADD(&now, &tmo_after); | |
403 mb_tman_handle_timeout(tman, &now); | |
404 CU_ASSERT(logcnt == 9); | |
405 | |
406 r = mb_tman_next_timeout(tman, &now, &tmo_after); | |
407 CU_ASSERT(r == 0); | |
408 CU_ASSERT(MB_TIMEVAL_SEC(&tmo_after) == 0 && | |
409 MB_TIMEVAL_USEC(&tmo_after) == STEP_INTERVAL); | |
410 | |
411 /* 1.5s */ | |
412 MB_TIMEVAL_ADD(&now, &tmo_after); | |
413 mb_tman_handle_timeout(tman, &now); | |
414 CU_ASSERT(logcnt == 10); | |
415 | |
416 r = mb_tman_next_timeout(tman, &now, &tmo_after); | |
417 CU_ASSERT(r == -1); | |
418 | |
419 mb_progm_free(progm); | |
420 mb_tman_free(tman); | |
421 } | |
422 | |
423 CU_pSuite get_animate_suite(void) { | |
424 CU_pSuite suite; | |
425 | |
426 suite = CU_add_suite("Suite_animate", NULL, NULL); | |
427 if(suite == NULL) | |
428 return NULL; | |
429 | |
430 CU_ADD_TEST(suite, test_animate_words); | |
431 | |
432 return suite; | |
433 } | |
434 | |
435 #endif /* UNITTEST */ |