示例#1
0
    def test_get_top_layer(self, _init_pygame, default_ui_manager,
                           _display_surface_return_none):
        window = UIWindow(pygame.Rect(0, 0, 400, 300),
                          window_display_title="Test Window",
                          manager=default_ui_manager)

        button_rect = pygame.Rect(0, 0, 150, 30)
        button_rect.topright = (-10, 10)
        button = UIButton(
            relative_rect=button_rect,
            text="Test Button",
            tool_tip_text=
            "This is a test of the button's tool tip functionality.",
            manager=default_ui_manager,
            container=window,
            anchors={
                'left': 'right',
                'right': 'right',
                'top': 'top',
                'bottom': 'top'
            })

        menu = UIDropDownMenu(options_list=['eggs', 'flour', 'sugar'],
                              starting_option='eggs',
                              relative_rect=pygame.Rect(10, 10, 150, 30),
                              manager=default_ui_manager,
                              container=window)

        assert window.get_top_layer() == 4
        window.update(0.05)
        assert window.get_top_layer() == 6
示例#2
0
    def test_change_layer(self, _init_pygame, default_ui_manager,
                          _display_surface_return_none):
        window = UIWindow(pygame.Rect(0, 0, 200, 200),
                          window_display_title="Test Window",
                          manager=default_ui_manager)

        assert window.get_top_layer() == 4

        window.change_layer(10)

        assert window.get_top_layer() == 12

        window.update(0.05)

        assert window.get_top_layer() == 12