Пример #1
0
    def test_add_element(self, _init_pygame, default_ui_manager: IUIManagerInterface,
                         _display_surface_return_none):
        container = UIScrollingContainer(pygame.Rect(100, 100, 200, 200),
                                         manager=default_ui_manager)

        button = UIButton(relative_rect=pygame.Rect(0, 0, 50, 50), text="",
                          manager=default_ui_manager)
        default_ui_manager.get_root_container().remove_element(button)
        container.get_container().add_element(button)
        assert len(container.get_container().elements) == 1
    def test_update(self, _init_pygame, default_ui_manager,
                    _display_surface_return_none):
        container = UIScrollingContainer(pygame.Rect(100, 100, 200, 200),
                                         manager=default_ui_manager)

        container.set_scrollable_area_dimensions((500, 600))

        container.horiz_scroll_bar.scroll_wheel_right = True
        container.horiz_scroll_bar.update(0.02)

        container.update(0.02)

        assert container.get_container().relative_rect.x == -18
 def test_get_container(self, _init_pygame,
                        default_ui_manager: IUIManagerInterface,
                        _display_surface_return_none):
     container = UIScrollingContainer(pygame.Rect(100, 100, 200, 200),
                                      manager=default_ui_manager)
     assert container.get_container() == container.scrollable_container