Changes in uspace/lib/ui/test/scrollbar.c [ef4d684:d68239a1] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/test/scrollbar.c
ref4d684 rd68239a1 1 1 /* 2 * Copyright (c) 202 3Jiri Svoboda2 * Copyright (c) 2022 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 284 284 } 285 285 286 /** ui_scrollbar_t rough_length() gives correct scrollbar trough length */287 PCUT_TEST(t rough_length)286 /** ui_scrollbar_through_length() gives correct scrollbar through length */ 287 PCUT_TEST(through_length) 288 288 { 289 289 ui_t *ui = NULL; … … 316 316 ui_scrollbar_set_rect(scrollbar, &rect); 317 317 318 length = ui_scrollbar_t rough_length(scrollbar);318 length = ui_scrollbar_through_length(scrollbar); 319 319 320 320 /* Total length minus buttons */ … … 620 620 } 621 621 622 /** Press and release up per trough */623 PCUT_TEST(up per_trough_press_release)622 /** Press and release up through */ 623 PCUT_TEST(up_through_press_release) 624 624 { 625 625 ui_t *ui = NULL; … … 654 654 ui_scrollbar_set_cb(scrollbar, &test_scrollbar_cb, &resp); 655 655 656 PCUT_ASSERT_FALSE(scrollbar->up per_trough_held);657 658 ui_scrollbar_up per_trough_press(scrollbar);659 PCUT_ASSERT_TRUE(scrollbar->up per_trough_held);656 PCUT_ASSERT_FALSE(scrollbar->up_through_held); 657 658 ui_scrollbar_up_through_press(scrollbar); 659 PCUT_ASSERT_TRUE(scrollbar->up_through_held); 660 660 PCUT_ASSERT_TRUE(resp.page_up); 661 661 … … 665 665 666 666 ui_scrollbar_release(scrollbar, &pos); 667 PCUT_ASSERT_FALSE(scrollbar->up per_trough_held);668 669 ui_scrollbar_destroy(scrollbar); 670 ui_window_destroy(window); 671 ui_destroy(ui); 672 } 673 674 /** Press and release lower trough */675 PCUT_TEST( lower_trough_press_release)667 PCUT_ASSERT_FALSE(scrollbar->up_through_held); 668 669 ui_scrollbar_destroy(scrollbar); 670 ui_window_destroy(window); 671 ui_destroy(ui); 672 } 673 674 /** Press and release down through */ 675 PCUT_TEST(down_through_press_release) 676 676 { 677 677 ui_t *ui = NULL; … … 706 706 ui_scrollbar_set_cb(scrollbar, &test_scrollbar_cb, &resp); 707 707 708 PCUT_ASSERT_FALSE(scrollbar-> lower_trough_held);709 710 ui_scrollbar_ lower_trough_press(scrollbar);711 PCUT_ASSERT_TRUE(scrollbar-> lower_trough_held);708 PCUT_ASSERT_FALSE(scrollbar->down_through_held); 709 710 ui_scrollbar_down_through_press(scrollbar); 711 PCUT_ASSERT_TRUE(scrollbar->down_through_held); 712 712 PCUT_ASSERT_TRUE(resp.page_down); 713 713 … … 717 717 718 718 ui_scrollbar_release(scrollbar, &pos); 719 PCUT_ASSERT_FALSE(scrollbar-> lower_trough_held);720 721 ui_scrollbar_destroy(scrollbar); 722 ui_window_destroy(window); 723 ui_destroy(ui); 724 } 725 726 /** Updating state of t roughs when cursor or thumb moves */727 PCUT_TEST(t roughs_update)719 PCUT_ASSERT_FALSE(scrollbar->down_through_held); 720 721 ui_scrollbar_destroy(scrollbar); 722 ui_window_destroy(window); 723 ui_destroy(ui); 724 } 725 726 /** Updating state of throughs when cursor or thumb moves */ 727 PCUT_TEST(throughs_update) 728 728 { 729 729 ui_t *ui = NULL; … … 754 754 ui_scrollbar_set_rect(scrollbar, &rect); 755 755 756 PCUT_ASSERT_FALSE(scrollbar-> lower_trough_inside);756 PCUT_ASSERT_FALSE(scrollbar->down_through_inside); 757 757 758 758 pos.x = 60; 759 759 pos.y = 22; 760 760 761 ui_scrollbar_t roughs_update(scrollbar, &pos);762 PCUT_ASSERT_TRUE(scrollbar-> lower_trough_inside);761 ui_scrollbar_throughs_update(scrollbar, &pos); 762 PCUT_ASSERT_TRUE(scrollbar->down_through_inside); 763 763 764 764 ui_scrollbar_destroy(scrollbar); … … 1082 1082 } 1083 1083 1084 /** ui_scrollbar_pos_event() detects up per trough press/release */1085 PCUT_TEST(pos_event_press_release_up per_trough)1084 /** ui_scrollbar_pos_event() detects up through press/release */ 1085 PCUT_TEST(pos_event_press_release_up_through) 1086 1086 { 1087 1087 ui_t *ui = NULL; … … 1107 1107 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 1108 1108 1109 PCUT_ASSERT_FALSE(scrollbar->up per_trough_held);1109 PCUT_ASSERT_FALSE(scrollbar->up_through_held); 1110 1110 1111 1111 rect.p0.x = 20; … … 1115 1115 ui_scrollbar_set_rect(scrollbar, &rect); 1116 1116 1117 /* Need to move thumb so that up per trough can be accessed */1117 /* Need to move thumb so that up through can be accessed */ 1118 1118 ui_scrollbar_set_pos(scrollbar, 42); 1119 1119 1120 /* Press inside up per trough is claimed and depresses it */1120 /* Press inside up through is claimed and depresses it */ 1121 1121 event.type = POS_PRESS; 1122 1122 event.hpos = 50; 1123 1123 event.vpos = 20; 1124 1124 claim = ui_scrollbar_pos_event(scrollbar, &event); 1125 PCUT_ASSERT_TRUE(scrollbar->up per_trough_held);1125 PCUT_ASSERT_TRUE(scrollbar->up_through_held); 1126 1126 PCUT_ASSERT_EQUALS(ui_claimed, claim); 1127 1127 1128 /* Release outside (or anywhere) is claimed and relases up per trough */1128 /* Release outside (or anywhere) is claimed and relases up through */ 1129 1129 event.type = POS_RELEASE; 1130 1130 event.hpos = 41; 1131 1131 event.vpos = 32; 1132 1132 claim = ui_scrollbar_pos_event(scrollbar, &event); 1133 PCUT_ASSERT_FALSE(scrollbar->up per_trough_held);1133 PCUT_ASSERT_FALSE(scrollbar->up_through_held); 1134 1134 PCUT_ASSERT_EQUALS(ui_claimed, claim); 1135 1135 … … 1139 1139 } 1140 1140 1141 /** ui_scrollbar_pos_event() detects lower trough press/release */1142 PCUT_TEST(pos_event_press_release_ lower_trough)1141 /** ui_scrollbar_pos_event() detects down through press/release */ 1142 PCUT_TEST(pos_event_press_release_down_through) 1143 1143 { 1144 1144 ui_t *ui = NULL; … … 1164 1164 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 1165 1165 1166 PCUT_ASSERT_FALSE(scrollbar->up per_trough_held);1166 PCUT_ASSERT_FALSE(scrollbar->up_through_held); 1167 1167 1168 1168 rect.p0.x = 20; … … 1172 1172 ui_scrollbar_set_rect(scrollbar, &rect); 1173 1173 1174 /* Press inside lower trough is claimed and depresses it */1174 /* Press inside down through is claimed and depresses it */ 1175 1175 event.type = POS_PRESS; 1176 1176 event.hpos = 70; 1177 1177 event.vpos = 20; 1178 1178 claim = ui_scrollbar_pos_event(scrollbar, &event); 1179 PCUT_ASSERT_TRUE(scrollbar-> lower_trough_held);1179 PCUT_ASSERT_TRUE(scrollbar->down_through_held); 1180 1180 PCUT_ASSERT_EQUALS(ui_claimed, claim); 1181 1181 1182 /* Release outside (or anywhere) is claimed and relases up per trough */1182 /* Release outside (or anywhere) is claimed and relases up through */ 1183 1183 event.type = POS_RELEASE; 1184 1184 event.hpos = 41; 1185 1185 event.vpos = 32; 1186 1186 claim = ui_scrollbar_pos_event(scrollbar, &event); 1187 PCUT_ASSERT_FALSE(scrollbar-> lower_trough_held);1187 PCUT_ASSERT_FALSE(scrollbar->down_through_held); 1188 1188 PCUT_ASSERT_EQUALS(ui_claimed, claim); 1189 1189
Note:
See TracChangeset
for help on using the changeset viewer.