def test_check_has_moved_recently(self, _init_pygame, default_ui_manager, _display_surface_return_none): scroll_bar = UIHorizontalScrollBar(relative_rect=pygame.Rect( 100, 100, 150, 30), visible_percentage=0.7, manager=default_ui_manager) # move the scroll bar a bit scroll_bar.right_button.held = True scroll_bar.update(0.2) assert scroll_bar.check_has_moved_recently() is True
def test_check_update_buttons(self, _init_pygame, default_ui_manager, _display_surface_return_none): scroll_bar = UIHorizontalScrollBar(relative_rect=pygame.Rect( 100, 100, 150, 30), visible_percentage=0.7, manager=default_ui_manager) # scroll down a bit then up again to exercise update scroll_bar.right_button.held = True scroll_bar.update(0.3) scroll_bar.right_button.held = False scroll_bar.left_button.held = True scroll_bar.update(0.3) assert scroll_bar.check_has_moved_recently() is True