Changeset ef4d684 in mainline for uspace/lib/ui/test/scrollbar.c


Ignore:
Timestamp:
2023-11-29T12:39:32Z (5 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, topic/simplify-dev-export
Children:
0e2eee1
Parents:
84d29a2
Message:

It should be 'trough', not 'through', dummy! (thx thepinballroom)

Who said watching a guy making a pinball machine was a waste of time?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ui/test/scrollbar.c

    r84d29a2 ref4d684  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    284284}
    285285
    286 /** ui_scrollbar_through_length() gives correct scrollbar through length */
    287 PCUT_TEST(through_length)
     286/** ui_scrollbar_trough_length() gives correct scrollbar trough length */
     287PCUT_TEST(trough_length)
    288288{
    289289        ui_t *ui = NULL;
     
    316316        ui_scrollbar_set_rect(scrollbar, &rect);
    317317
    318         length = ui_scrollbar_through_length(scrollbar);
     318        length = ui_scrollbar_trough_length(scrollbar);
    319319
    320320        /* Total length minus buttons */
     
    620620}
    621621
    622 /** Press and release up through */
    623 PCUT_TEST(up_through_press_release)
     622/** Press and release upper trough */
     623PCUT_TEST(upper_trough_press_release)
    624624{
    625625        ui_t *ui = NULL;
     
    654654        ui_scrollbar_set_cb(scrollbar, &test_scrollbar_cb, &resp);
    655655
    656         PCUT_ASSERT_FALSE(scrollbar->up_through_held);
    657 
    658         ui_scrollbar_up_through_press(scrollbar);
    659         PCUT_ASSERT_TRUE(scrollbar->up_through_held);
     656        PCUT_ASSERT_FALSE(scrollbar->upper_trough_held);
     657
     658        ui_scrollbar_upper_trough_press(scrollbar);
     659        PCUT_ASSERT_TRUE(scrollbar->upper_trough_held);
    660660        PCUT_ASSERT_TRUE(resp.page_up);
    661661
     
    665665
    666666        ui_scrollbar_release(scrollbar, &pos);
    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)
     667        PCUT_ASSERT_FALSE(scrollbar->upper_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 */
     675PCUT_TEST(lower_trough_press_release)
    676676{
    677677        ui_t *ui = NULL;
     
    706706        ui_scrollbar_set_cb(scrollbar, &test_scrollbar_cb, &resp);
    707707
    708         PCUT_ASSERT_FALSE(scrollbar->down_through_held);
    709 
    710         ui_scrollbar_down_through_press(scrollbar);
    711         PCUT_ASSERT_TRUE(scrollbar->down_through_held);
     708        PCUT_ASSERT_FALSE(scrollbar->lower_trough_held);
     709
     710        ui_scrollbar_lower_trough_press(scrollbar);
     711        PCUT_ASSERT_TRUE(scrollbar->lower_trough_held);
    712712        PCUT_ASSERT_TRUE(resp.page_down);
    713713
     
    717717
    718718        ui_scrollbar_release(scrollbar, &pos);
    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)
     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 troughs when cursor or thumb moves */
     727PCUT_TEST(troughs_update)
    728728{
    729729        ui_t *ui = NULL;
     
    754754        ui_scrollbar_set_rect(scrollbar, &rect);
    755755
    756         PCUT_ASSERT_FALSE(scrollbar->down_through_inside);
     756        PCUT_ASSERT_FALSE(scrollbar->lower_trough_inside);
    757757
    758758        pos.x = 60;
    759759        pos.y = 22;
    760760
    761         ui_scrollbar_throughs_update(scrollbar, &pos);
    762         PCUT_ASSERT_TRUE(scrollbar->down_through_inside);
     761        ui_scrollbar_troughs_update(scrollbar, &pos);
     762        PCUT_ASSERT_TRUE(scrollbar->lower_trough_inside);
    763763
    764764        ui_scrollbar_destroy(scrollbar);
     
    10821082}
    10831083
    1084 /** ui_scrollbar_pos_event() detects up through press/release */
    1085 PCUT_TEST(pos_event_press_release_up_through)
     1084/** ui_scrollbar_pos_event() detects upper trough press/release */
     1085PCUT_TEST(pos_event_press_release_upper_trough)
    10861086{
    10871087        ui_t *ui = NULL;
     
    11071107        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    11081108
    1109         PCUT_ASSERT_FALSE(scrollbar->up_through_held);
     1109        PCUT_ASSERT_FALSE(scrollbar->upper_trough_held);
    11101110
    11111111        rect.p0.x = 20;
     
    11151115        ui_scrollbar_set_rect(scrollbar, &rect);
    11161116
    1117         /* Need to move thumb so that up through can be accessed */
     1117        /* Need to move thumb so that upper trough can be accessed */
    11181118        ui_scrollbar_set_pos(scrollbar, 42);
    11191119
    1120         /* Press inside up through is claimed and depresses it */
     1120        /* Press inside upper trough is claimed and depresses it */
    11211121        event.type = POS_PRESS;
    11221122        event.hpos = 50;
    11231123        event.vpos = 20;
    11241124        claim = ui_scrollbar_pos_event(scrollbar, &event);
    1125         PCUT_ASSERT_TRUE(scrollbar->up_through_held);
     1125        PCUT_ASSERT_TRUE(scrollbar->upper_trough_held);
    11261126        PCUT_ASSERT_EQUALS(ui_claimed, claim);
    11271127
    1128         /* Release outside (or anywhere) is claimed and relases up through */
     1128        /* Release outside (or anywhere) is claimed and relases upper trough */
    11291129        event.type = POS_RELEASE;
    11301130        event.hpos = 41;
    11311131        event.vpos = 32;
    11321132        claim = ui_scrollbar_pos_event(scrollbar, &event);
    1133         PCUT_ASSERT_FALSE(scrollbar->up_through_held);
     1133        PCUT_ASSERT_FALSE(scrollbar->upper_trough_held);
    11341134        PCUT_ASSERT_EQUALS(ui_claimed, claim);
    11351135
     
    11391139}
    11401140
    1141 /** ui_scrollbar_pos_event() detects down through press/release */
    1142 PCUT_TEST(pos_event_press_release_down_through)
     1141/** ui_scrollbar_pos_event() detects lower trough press/release */
     1142PCUT_TEST(pos_event_press_release_lower_trough)
    11431143{
    11441144        ui_t *ui = NULL;
     
    11641164        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    11651165
    1166         PCUT_ASSERT_FALSE(scrollbar->up_through_held);
     1166        PCUT_ASSERT_FALSE(scrollbar->upper_trough_held);
    11671167
    11681168        rect.p0.x = 20;
     
    11721172        ui_scrollbar_set_rect(scrollbar, &rect);
    11731173
    1174         /* Press inside down through is claimed and depresses it */
     1174        /* Press inside lower trough is claimed and depresses it */
    11751175        event.type = POS_PRESS;
    11761176        event.hpos = 70;
    11771177        event.vpos = 20;
    11781178        claim = ui_scrollbar_pos_event(scrollbar, &event);
    1179         PCUT_ASSERT_TRUE(scrollbar->down_through_held);
     1179        PCUT_ASSERT_TRUE(scrollbar->lower_trough_held);
    11801180        PCUT_ASSERT_EQUALS(ui_claimed, claim);
    11811181
    1182         /* Release outside (or anywhere) is claimed and relases up through */
     1182        /* Release outside (or anywhere) is claimed and relases upper trough */
    11831183        event.type = POS_RELEASE;
    11841184        event.hpos = 41;
    11851185        event.vpos = 32;
    11861186        claim = ui_scrollbar_pos_event(scrollbar, &event);
    1187         PCUT_ASSERT_FALSE(scrollbar->down_through_held);
     1187        PCUT_ASSERT_FALSE(scrollbar->lower_trough_held);
    11881188        PCUT_ASSERT_EQUALS(ui_claimed, claim);
    11891189
Note: See TracChangeset for help on using the changeset viewer.