Skip to content

Commit

Permalink
More always on top tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MyreMylar committed Apr 13, 2024
1 parent 8872080 commit 2921cde
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions tests/test_core/test_window_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ def test_move_window_to_front_with_always_on_top(self, _init_pygame, default_ui_
window_always_on_top = UIWindow(pygame.Rect(0, 0, 200, 200), window_display_title="Test Window",
manager=default_ui_manager, element_id='test_window',
always_on_top=True)
window_always_on_top_2 = UIWindow(pygame.Rect(0, 0, 200, 200), window_display_title="Test Window",
manager=default_ui_manager, element_id='test_window',
always_on_top=True)
window = UIWindow(pygame.Rect(100, 100, 200, 200), window_display_title="Test Window",
manager=default_ui_manager, element_id='test_window')
window_2 = UIWindow(pygame.Rect(50, 50, 200, 200), window_display_title="Test Window",
Expand All @@ -170,17 +173,20 @@ def test_move_window_to_front_with_always_on_top(self, _init_pygame, default_ui_
manager=default_ui_manager, element_id='test_window')

stack.add_new_window(window_always_on_top)
stack.add_new_window(window_always_on_top_2)
stack.add_new_window(window)
stack.add_new_window(window_2)
stack.add_new_window(window_3)
stack.move_window_to_front(window)
stack.move_window_to_front(window_3)
stack.move_window_to_front(window_2)
stack.move_window_to_front(window_always_on_top)

assert stack.stack[0] == window
assert stack.stack[2] == window_2
assert stack.top_stack[0] == window_always_on_top
assert window_always_on_top.layer > window_2.layer
assert stack.top_stack[0] == window_always_on_top_2
assert stack.top_stack[1] == window_always_on_top
assert window_always_on_top_2.layer > window_2.layer

def test_swap_window_always_on_top(self, _init_pygame, default_ui_manager,
_display_surface_return_none):
Expand Down Expand Up @@ -210,8 +216,8 @@ def test_update_always_on_top(self, _init_pygame, default_ui_manager,
UIWindow(pygame.Rect(100, 100, 200, 200), window_display_title="Test Window",
manager=manager, element_id='test_window')
assert manager.get_window_stack().get_full_stack()[-1].get_top_layer() == 8
UIWindow(pygame.Rect(100, 100, 200, 200), window_display_title="Test Window",
manager=manager, element_id='test_window', always_on_top=True)
window_always_on_top = UIWindow(pygame.Rect(100, 100, 200, 200), window_display_title="Test Window",
manager=manager, element_id='test_window', always_on_top=True)
assert manager.get_window_stack().get_full_stack()[-1].get_top_layer() == 11
window_always_on_top_2 = UIWindow(pygame.Rect(100, 100, 200, 200), window_display_title="Test Window",
manager=manager, element_id='test_window', always_on_top=True)
Expand All @@ -228,6 +234,13 @@ def test_update_always_on_top(self, _init_pygame, default_ui_manager,
assert manager.get_window_stack().get_full_stack()[-1].get_top_layer() == 16
assert window_always_on_top_2.get_top_layer() == 16

UIDropDownMenu(["Test", "Test"], "Test", (50, 50, 120, 30), container=window_always_on_top, manager=manager)
assert window_always_on_top.layer_thickness == 2
window_always_on_top.update(0.4)
assert window_always_on_top.layer_thickness == 4
assert manager.get_window_stack().get_full_stack()[-1].get_top_layer() == 18
assert window_always_on_top_2.get_top_layer() == 18


if __name__ == '__main__':
pytest.console_main()

0 comments on commit 2921cde

Please sign in to comment.