Changeset faca61b8 in mainline for uspace/lib/ui/test/pbutton.c
- Timestamp:
- 2020-10-15T10:05:42Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8ef48ece
- Parents:
- 4ed00d3
- git-author:
- Jiri Svoboda <jiri@…> (2020-10-14 19:05:34)
- git-committer:
- Jiri Svoboda <jiri@…> (2020-10-15 10:05:42)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/test/pbutton.c
r4ed00d3 rfaca61b8 185 185 } 186 186 187 /** ui_pos_event() correctly translates POS_PRESS/POS_RELEASE */ 188 PCUT_TEST(pos_event_press_release) 189 { 190 ui_pbutton_t *pbutton; 191 pos_event_t event; 192 gfx_rect_t rect; 193 errno_t rc; 194 195 rc = ui_pbutton_create(NULL, "Hello", &pbutton); 196 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 197 198 PCUT_ASSERT_FALSE(pbutton->held); 199 200 rect.p0.x = 10; 201 rect.p0.y = 20; 202 rect.p1.x = 30; 203 rect.p1.y = 40; 204 ui_pbutton_set_rect(pbutton, &rect); 205 206 /* Press outside does nothing */ 207 event.type = POS_PRESS; 208 event.hpos = 9; 209 event.vpos = 20; 210 ui_pbutton_pos_event(pbutton, &event); 211 PCUT_ASSERT_FALSE(pbutton->held); 212 213 /* Press inside depresses button */ 214 event.type = POS_PRESS; 215 event.hpos = 10; 216 event.vpos = 20; 217 ui_pbutton_pos_event(pbutton, &event); 218 PCUT_ASSERT_TRUE(pbutton->held); 219 220 /* Release outside (or anywhere) relases button */ 221 event.type = POS_RELEASE; 222 event.hpos = 9; 223 event.vpos = 20; 224 ui_pbutton_pos_event(pbutton, &event); 225 PCUT_ASSERT_FALSE(pbutton->held); 226 227 ui_pbutton_destroy(pbutton); 228 } 229 187 230 static errno_t testgc_set_color(void *arg, gfx_color_t *color) 188 231 { … … 214 257 tbm->alloc.off0 = 0; 215 258 tbm->alloc.pixels = calloc(sizeof(uint32_t), 216 217 259 (params->rect.p1.x - params->rect.p0.x) * 260 (params->rect.p1.y - params->rect.p0.y)); 218 261 tbm->myalloc = true; 219 262 if (tbm->alloc.pixels == NULL) {
Note:
See TracChangeset
for help on using the changeset viewer.