Ejemplo n.º 1
0
    def test_find_invalid_position(self, _init_pygame, default_ui_manager: UIManager):
        tool_tip = UITooltip(html_text="A tip about tools.",
                             hover_distance=(0, 10),
                             manager=default_ui_manager)

        found_position = tool_tip.find_valid_position(pygame.math.Vector2(0.0, -600.0))

        assert found_position is False
Ejemplo n.º 2
0
    def test_find_valid_position(self, _init_pygame, default_ui_manager: UIManager,
                                 _display_surface_return_none):
        tool_tip = UITooltip(html_text="A tip about tools.",
                             hover_distance=(0, 10),
                             manager=default_ui_manager)

        found_position = tool_tip.find_valid_position(pygame.math.Vector2(400.0, 300.0))

        assert found_position is True
Ejemplo n.º 3
0
    def test_find_valid_position_off_left(self, _init_pygame, default_ui_manager: UIManager):
        tool_tip = UITooltip(html_text="A tip about tools.",
                             hover_distance=(0, 10),
                             manager=default_ui_manager)

        found_position = tool_tip.find_valid_position(pygame.math.Vector2(1.0, 300.0))

        root_window_rect = default_ui_manager.get_root_container().rect

        assert found_position is True and bool(root_window_rect.contains(tool_tip.rect)) is True
Ejemplo n.º 4
0
    def test_find_valid_position_screen_too_small(self, _init_pygame):
        manager = UIManager((50, 50))
        tool_tip = UITooltip(html_text="A tip about tools.",
                             hover_distance=(0, 10),
                             manager=manager)

        found_position = tool_tip.find_valid_position(pygame.math.Vector2(25.0, 25.0))

        root_window_rect = manager.get_root_container().rect

        assert found_position is False and bool(root_window_rect.contains(tool_tip.rect)) is False