2 * Copyright (c) 2023 Jiri Svoboda
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #include <gfx/context.h>
30 #include <gfx/coord.h>
32 #include <pcut/pcut.h>
34 #include <ui/control.h>
35 #include <ui/pbutton.h>
36 #include <ui/resource.h>
37 #include "../private/pbutton.h"
41 PCUT_TEST_SUITE(pbutton
);
43 static errno_t
testgc_set_clip_rect(void *, gfx_rect_t
*);
44 static errno_t
testgc_set_color(void *, gfx_color_t
*);
45 static errno_t
testgc_fill_rect(void *, gfx_rect_t
*);
46 static errno_t
testgc_update(void *);
47 static errno_t
testgc_bitmap_create(void *, gfx_bitmap_params_t
*,
48 gfx_bitmap_alloc_t
*, void **);
49 static errno_t
testgc_bitmap_destroy(void *);
50 static errno_t
testgc_bitmap_render(void *, gfx_rect_t
*, gfx_coord2_t
*);
51 static errno_t
testgc_bitmap_get_alloc(void *, gfx_bitmap_alloc_t
*);
53 static gfx_context_ops_t ops
= {
54 .set_clip_rect
= testgc_set_clip_rect
,
55 .set_color
= testgc_set_color
,
56 .fill_rect
= testgc_fill_rect
,
57 .update
= testgc_update
,
58 .bitmap_create
= testgc_bitmap_create
,
59 .bitmap_destroy
= testgc_bitmap_destroy
,
60 .bitmap_render
= testgc_bitmap_render
,
61 .bitmap_get_alloc
= testgc_bitmap_get_alloc
64 static void test_pbutton_clicked(ui_pbutton_t
*, void *);
65 static void test_pbutton_down(ui_pbutton_t
*, void *);
66 static void test_pbutton_up(ui_pbutton_t
*, void *);
68 static ui_pbutton_cb_t test_pbutton_cb
= {
69 .clicked
= test_pbutton_clicked
,
70 .down
= test_pbutton_down
,
74 static ui_pbutton_cb_t dummy_pbutton_cb
= {
80 gfx_bitmap_params_t bm_params
;
90 gfx_bitmap_alloc_t alloc
;
100 /** Create and destroy button */
101 PCUT_TEST(create_destroy
)
103 ui_pbutton_t
*pbutton
= NULL
;
106 rc
= ui_pbutton_create(NULL
, "Hello", &pbutton
);
107 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
108 PCUT_ASSERT_NOT_NULL(pbutton
);
110 ui_pbutton_destroy(pbutton
);
113 /** ui_pbutton_destroy() can take NULL argument (no-op) */
114 PCUT_TEST(destroy_null
)
116 ui_pbutton_destroy(NULL
);
119 /** ui_pbutton_ctl() returns control that has a working virtual destructor */
122 ui_pbutton_t
*pbutton
;
123 ui_control_t
*control
;
126 rc
= ui_pbutton_create(NULL
, "Hello", &pbutton
);
127 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
129 control
= ui_pbutton_ctl(pbutton
);
130 PCUT_ASSERT_NOT_NULL(control
);
132 ui_control_destroy(control
);
135 /** Set flags sets internal field */
138 ui_pbutton_t
*pbutton
;
141 rc
= ui_pbutton_create(NULL
, "Hello", &pbutton
);
142 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
144 ui_pbutton_set_flags(pbutton
, ui_pbf_no_text_depress
);
145 PCUT_ASSERT_INT_EQUALS(ui_pbf_no_text_depress
, pbutton
->flags
);
147 ui_pbutton_destroy(pbutton
);
150 /** Set button rectangle sets internal field */
153 ui_pbutton_t
*pbutton
;
157 rc
= ui_pbutton_create(NULL
, "Hello", &pbutton
);
158 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
165 ui_pbutton_set_rect(pbutton
, &rect
);
166 PCUT_ASSERT_INT_EQUALS(rect
.p0
.x
, pbutton
->rect
.p0
.x
);
167 PCUT_ASSERT_INT_EQUALS(rect
.p0
.y
, pbutton
->rect
.p0
.y
);
168 PCUT_ASSERT_INT_EQUALS(rect
.p1
.x
, pbutton
->rect
.p1
.x
);
169 PCUT_ASSERT_INT_EQUALS(rect
.p1
.y
, pbutton
->rect
.p1
.y
);
171 ui_pbutton_destroy(pbutton
);
174 /** Set default flag sets internal field */
175 PCUT_TEST(set_default
)
177 ui_pbutton_t
*pbutton
;
180 rc
= ui_pbutton_create(NULL
, "Hello", &pbutton
);
181 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
183 ui_pbutton_set_default(pbutton
, true);
184 PCUT_ASSERT_TRUE(pbutton
->isdefault
);
186 ui_pbutton_set_default(pbutton
, false);
187 PCUT_ASSERT_FALSE(pbutton
->isdefault
);
189 ui_pbutton_destroy(pbutton
);
192 /** Get light gets internal field */
195 ui_pbutton_t
*pbutton
;
198 rc
= ui_pbutton_create(NULL
, "Hello", &pbutton
);
199 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
201 pbutton
->light
= true;
202 PCUT_ASSERT_TRUE(ui_pbutton_get_light(pbutton
));
204 pbutton
->light
= false;
205 PCUT_ASSERT_FALSE(ui_pbutton_get_light(pbutton
));
207 ui_pbutton_destroy(pbutton
);
210 /** Set light sets internal field */
213 ui_pbutton_t
*pbutton
;
216 rc
= ui_pbutton_create(NULL
, "Hello", &pbutton
);
217 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
219 ui_pbutton_set_light(pbutton
, true);
220 PCUT_ASSERT_TRUE(pbutton
->light
);
222 ui_pbutton_set_light(pbutton
, false);
223 PCUT_ASSERT_FALSE(pbutton
->light
);
225 ui_pbutton_destroy(pbutton
);
228 /** Set caption sets internal field */
229 PCUT_TEST(set_caption
)
231 ui_pbutton_t
*pbutton
;
234 rc
= ui_pbutton_create(NULL
, "Hello", &pbutton
);
235 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
237 PCUT_ASSERT_STR_EQUALS("Hello", pbutton
->caption
);
239 rc
= ui_pbutton_set_caption(pbutton
, "World");
240 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
242 PCUT_ASSERT_STR_EQUALS("World", pbutton
->caption
);
244 ui_pbutton_destroy(pbutton
);
251 gfx_context_t
*gc
= NULL
;
253 ui_resource_t
*resource
= NULL
;
254 ui_pbutton_t
*pbutton
;
256 memset(&tgc
, 0, sizeof(tgc
));
257 rc
= gfx_context_new(&ops
, &tgc
, &gc
);
258 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
260 rc
= ui_resource_create(gc
, false, &resource
);
261 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
262 PCUT_ASSERT_NOT_NULL(resource
);
264 rc
= ui_pbutton_create(resource
, "Hello", &pbutton
);
265 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
267 rc
= ui_pbutton_paint(pbutton
);
268 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
270 ui_pbutton_destroy(pbutton
);
271 ui_resource_destroy(resource
);
273 rc
= gfx_context_delete(gc
);
274 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
277 /** Test ui_pbutton_clicked() */
281 ui_pbutton_t
*pbutton
;
284 rc
= ui_pbutton_create(NULL
, "Hello", &pbutton
);
285 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
287 /* Clicked with no callbacks set */
288 ui_pbutton_clicked(pbutton
);
290 /* Clicked with callback not implementing clicked */
291 ui_pbutton_set_cb(pbutton
, &dummy_pbutton_cb
, NULL
);
292 ui_pbutton_clicked(pbutton
);
294 /* Clicked with real callback set */
295 resp
.clicked
= false;
296 ui_pbutton_set_cb(pbutton
, &test_pbutton_cb
, &resp
);
297 ui_pbutton_clicked(pbutton
);
298 PCUT_ASSERT_TRUE(resp
.clicked
);
300 ui_pbutton_destroy(pbutton
);
303 /** Test ui_pbutton_down() */
307 ui_pbutton_t
*pbutton
;
310 rc
= ui_pbutton_create(NULL
, "Hello", &pbutton
);
311 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
313 /* Down with no callbacks set */
314 ui_pbutton_clicked(pbutton
);
316 /* Down with callback not implementing down */
317 ui_pbutton_set_cb(pbutton
, &dummy_pbutton_cb
, NULL
);
318 ui_pbutton_down(pbutton
);
320 /* Down with real callback set */
322 ui_pbutton_set_cb(pbutton
, &test_pbutton_cb
, &resp
);
323 ui_pbutton_down(pbutton
);
324 PCUT_ASSERT_TRUE(resp
.down
);
326 ui_pbutton_destroy(pbutton
);
329 /** Test ui_pbutton_up() */
333 ui_pbutton_t
*pbutton
;
336 rc
= ui_pbutton_create(NULL
, "Hello", &pbutton
);
337 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
339 /* Up with no callbacks set */
340 ui_pbutton_clicked(pbutton
);
342 /* Up with callback not implementing up */
343 ui_pbutton_set_cb(pbutton
, &dummy_pbutton_cb
, NULL
);
344 ui_pbutton_up(pbutton
);
346 /* Up with real callback set */
348 ui_pbutton_set_cb(pbutton
, &test_pbutton_cb
, &resp
);
349 ui_pbutton_up(pbutton
);
350 PCUT_ASSERT_TRUE(resp
.up
);
352 ui_pbutton_destroy(pbutton
);
355 /** Press and release button */
356 PCUT_TEST(press_release
)
359 gfx_context_t
*gc
= NULL
;
361 ui_resource_t
*resource
= NULL
;
362 ui_pbutton_t
*pbutton
;
365 memset(&tgc
, 0, sizeof(tgc
));
366 rc
= gfx_context_new(&ops
, &tgc
, &gc
);
367 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
369 rc
= ui_resource_create(gc
, false, &resource
);
370 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
371 PCUT_ASSERT_NOT_NULL(resource
);
373 rc
= ui_pbutton_create(resource
, "Hello", &pbutton
);
374 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
376 resp
.clicked
= false;
379 ui_pbutton_set_cb(pbutton
, &test_pbutton_cb
, &resp
);
381 PCUT_ASSERT_FALSE(pbutton
->held
);
382 PCUT_ASSERT_FALSE(pbutton
->inside
);
384 ui_pbutton_press(pbutton
);
385 PCUT_ASSERT_TRUE(pbutton
->held
);
386 PCUT_ASSERT_TRUE(pbutton
->inside
);
387 PCUT_ASSERT_TRUE(resp
.down
);
388 PCUT_ASSERT_FALSE(resp
.up
);
389 PCUT_ASSERT_FALSE(resp
.clicked
);
391 ui_pbutton_release(pbutton
);
392 PCUT_ASSERT_FALSE(pbutton
->held
);
393 PCUT_ASSERT_TRUE(pbutton
->inside
);
394 PCUT_ASSERT_TRUE(resp
.up
);
395 PCUT_ASSERT_TRUE(resp
.clicked
);
397 ui_pbutton_destroy(pbutton
);
398 ui_resource_destroy(resource
);
400 rc
= gfx_context_delete(gc
);
401 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
404 /** Press, leave and release button */
405 PCUT_TEST(press_leave_release
)
408 gfx_context_t
*gc
= NULL
;
410 ui_resource_t
*resource
= NULL
;
411 ui_pbutton_t
*pbutton
;
414 memset(&tgc
, 0, sizeof(tgc
));
415 rc
= gfx_context_new(&ops
, &tgc
, &gc
);
416 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
418 rc
= ui_resource_create(gc
, false, &resource
);
419 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
420 PCUT_ASSERT_NOT_NULL(resource
);
422 rc
= ui_pbutton_create(resource
, "Hello", &pbutton
);
423 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
425 resp
.clicked
= false;
426 ui_pbutton_set_cb(pbutton
, &test_pbutton_cb
, &resp
);
428 PCUT_ASSERT_FALSE(pbutton
->held
);
429 PCUT_ASSERT_FALSE(pbutton
->inside
);
431 ui_pbutton_press(pbutton
);
432 PCUT_ASSERT_TRUE(pbutton
->held
);
433 PCUT_ASSERT_TRUE(pbutton
->inside
);
434 PCUT_ASSERT_FALSE(resp
.clicked
);
436 ui_pbutton_leave(pbutton
);
437 PCUT_ASSERT_TRUE(pbutton
->held
);
438 PCUT_ASSERT_FALSE(pbutton
->inside
);
439 PCUT_ASSERT_FALSE(resp
.clicked
);
441 ui_pbutton_release(pbutton
);
442 PCUT_ASSERT_FALSE(pbutton
->held
);
443 PCUT_ASSERT_FALSE(pbutton
->inside
);
444 PCUT_ASSERT_FALSE(resp
.clicked
);
446 ui_pbutton_destroy(pbutton
);
447 ui_resource_destroy(resource
);
449 rc
= gfx_context_delete(gc
);
450 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
453 /** Press, leave, enter and release button */
454 PCUT_TEST(press_leave_enter_release
)
457 gfx_context_t
*gc
= NULL
;
459 ui_resource_t
*resource
= NULL
;
460 ui_pbutton_t
*pbutton
;
463 memset(&tgc
, 0, sizeof(tgc
));
464 rc
= gfx_context_new(&ops
, &tgc
, &gc
);
465 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
467 rc
= ui_resource_create(gc
, false, &resource
);
468 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
469 PCUT_ASSERT_NOT_NULL(resource
);
471 rc
= ui_pbutton_create(resource
, "Hello", &pbutton
);
472 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
474 resp
.clicked
= false;
475 ui_pbutton_set_cb(pbutton
, &test_pbutton_cb
, &resp
);
477 PCUT_ASSERT_FALSE(pbutton
->held
);
478 PCUT_ASSERT_FALSE(pbutton
->inside
);
480 ui_pbutton_press(pbutton
);
481 PCUT_ASSERT_TRUE(pbutton
->held
);
482 PCUT_ASSERT_TRUE(pbutton
->inside
);
483 PCUT_ASSERT_FALSE(resp
.clicked
);
485 ui_pbutton_leave(pbutton
);
486 PCUT_ASSERT_TRUE(pbutton
->held
);
487 PCUT_ASSERT_FALSE(pbutton
->inside
);
488 PCUT_ASSERT_FALSE(resp
.clicked
);
490 ui_pbutton_enter(pbutton
);
491 PCUT_ASSERT_TRUE(pbutton
->held
);
492 PCUT_ASSERT_TRUE(pbutton
->inside
);
493 PCUT_ASSERT_FALSE(resp
.clicked
);
495 ui_pbutton_release(pbutton
);
496 PCUT_ASSERT_FALSE(pbutton
->held
);
497 PCUT_ASSERT_TRUE(pbutton
->inside
);
498 PCUT_ASSERT_TRUE(resp
.clicked
);
500 ui_pbutton_destroy(pbutton
);
501 ui_resource_destroy(resource
);
503 rc
= gfx_context_delete(gc
);
504 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
507 /** ui_pos_event() correctly translates POS_PRESS/POS_RELEASE */
508 PCUT_TEST(pos_event_press_release
)
511 gfx_context_t
*gc
= NULL
;
513 ui_resource_t
*resource
= NULL
;
514 ui_pbutton_t
*pbutton
;
519 memset(&tgc
, 0, sizeof(tgc
));
520 rc
= gfx_context_new(&ops
, &tgc
, &gc
);
521 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
523 rc
= ui_resource_create(gc
, false, &resource
);
524 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
525 PCUT_ASSERT_NOT_NULL(resource
);
527 rc
= ui_pbutton_create(resource
, "Hello", &pbutton
);
528 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
530 PCUT_ASSERT_FALSE(pbutton
->held
);
536 ui_pbutton_set_rect(pbutton
, &rect
);
538 /* Press outside is not claimed and does nothing */
539 event
.type
= POS_PRESS
;
542 claim
= ui_pbutton_pos_event(pbutton
, &event
);
543 PCUT_ASSERT_FALSE(pbutton
->held
);
544 PCUT_ASSERT_EQUALS(ui_unclaimed
, claim
);
546 /* Press inside is claimed and depresses button */
547 event
.type
= POS_PRESS
;
550 claim
= ui_pbutton_pos_event(pbutton
, &event
);
551 PCUT_ASSERT_TRUE(pbutton
->held
);
552 PCUT_ASSERT_EQUALS(ui_claimed
, claim
);
554 /* Release outside (or anywhere) is claimed and relases button */
555 event
.type
= POS_RELEASE
;
558 claim
= ui_pbutton_pos_event(pbutton
, &event
);
559 PCUT_ASSERT_FALSE(pbutton
->held
);
560 PCUT_ASSERT_EQUALS(ui_claimed
, claim
);
562 ui_pbutton_destroy(pbutton
);
563 ui_resource_destroy(resource
);
565 rc
= gfx_context_delete(gc
);
566 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
569 /** ui_pos_event() correctly translates POS_UPDATE to enter/leave */
570 PCUT_TEST(pos_event_enter_leave
)
573 gfx_context_t
*gc
= NULL
;
575 ui_resource_t
*resource
= NULL
;
576 ui_pbutton_t
*pbutton
;
580 memset(&tgc
, 0, sizeof(tgc
));
581 rc
= gfx_context_new(&ops
, &tgc
, &gc
);
582 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
584 rc
= ui_resource_create(gc
, false, &resource
);
585 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
586 PCUT_ASSERT_NOT_NULL(resource
);
588 rc
= ui_pbutton_create(resource
, "Hello", &pbutton
);
589 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
591 PCUT_ASSERT_FALSE(pbutton
->inside
);
597 ui_pbutton_set_rect(pbutton
, &rect
);
599 /* Moving outside does nothing */
600 event
.type
= POS_UPDATE
;
603 ui_pbutton_pos_event(pbutton
, &event
);
604 PCUT_ASSERT_FALSE(pbutton
->inside
);
606 /* Moving inside sets inside flag */
607 event
.type
= POS_UPDATE
;
610 ui_pbutton_pos_event(pbutton
, &event
);
611 PCUT_ASSERT_TRUE(pbutton
->inside
);
613 /* Moving outside clears inside flag */
614 event
.type
= POS_UPDATE
;
617 ui_pbutton_pos_event(pbutton
, &event
);
618 PCUT_ASSERT_FALSE(pbutton
->inside
);
620 ui_pbutton_destroy(pbutton
);
621 ui_resource_destroy(resource
);
623 rc
= gfx_context_delete(gc
);
624 PCUT_ASSERT_ERRNO_VAL(EOK
, rc
);
627 static errno_t
testgc_set_clip_rect(void *arg
, gfx_rect_t
*rect
)
634 static errno_t
testgc_set_color(void *arg
, gfx_color_t
*color
)
641 static errno_t
testgc_fill_rect(void *arg
, gfx_rect_t
*rect
)
648 static errno_t
testgc_update(void *arg
)
654 static errno_t
testgc_bitmap_create(void *arg
, gfx_bitmap_params_t
*params
,
655 gfx_bitmap_alloc_t
*alloc
, void **rbm
)
657 test_gc_t
*tgc
= (test_gc_t
*) arg
;
658 testgc_bitmap_t
*tbm
;
660 tbm
= calloc(1, sizeof(testgc_bitmap_t
));
665 tbm
->alloc
.pitch
= (params
->rect
.p1
.x
- params
->rect
.p0
.x
) *
668 tbm
->alloc
.pixels
= calloc(sizeof(uint32_t),
669 (params
->rect
.p1
.x
- params
->rect
.p0
.x
) *
670 (params
->rect
.p1
.y
- params
->rect
.p0
.y
));
672 if (tbm
->alloc
.pixels
== NULL
) {
681 tgc
->bm_created
= true;
682 tgc
->bm_params
= *params
;
683 tgc
->bm_pixels
= tbm
->alloc
.pixels
;
688 static errno_t
testgc_bitmap_destroy(void *bm
)
690 testgc_bitmap_t
*tbm
= (testgc_bitmap_t
*)bm
;
692 free(tbm
->alloc
.pixels
);
693 tbm
->tgc
->bm_destroyed
= true;
698 static errno_t
testgc_bitmap_render(void *bm
, gfx_rect_t
*srect
,
701 testgc_bitmap_t
*tbm
= (testgc_bitmap_t
*)bm
;
702 tbm
->tgc
->bm_rendered
= true;
703 tbm
->tgc
->bm_srect
= *srect
;
704 tbm
->tgc
->bm_offs
= *offs
;
708 static errno_t
testgc_bitmap_get_alloc(void *bm
, gfx_bitmap_alloc_t
*alloc
)
710 testgc_bitmap_t
*tbm
= (testgc_bitmap_t
*)bm
;
712 tbm
->tgc
->bm_got_alloc
= true;
716 static void test_pbutton_clicked(ui_pbutton_t
*pbutton
, void *arg
)
718 test_cb_resp_t
*resp
= (test_cb_resp_t
*) arg
;
720 resp
->clicked
= true;
723 static void test_pbutton_down(ui_pbutton_t
*pbutton
, void *arg
)
725 test_cb_resp_t
*resp
= (test_cb_resp_t
*) arg
;
730 static void test_pbutton_up(ui_pbutton_t
*pbutton
, void *arg
)
732 test_cb_resp_t
*resp
= (test_cb_resp_t
*) arg
;
737 PCUT_EXPORT(pbutton
);