geng
This commit is contained in:
@@ -26,10 +26,16 @@ class _ShellPageDouble(QWidget):
|
||||
self.permissions = permissions
|
||||
self.current_user = current_user
|
||||
self.refresh_count = 0
|
||||
self.show_count = 0
|
||||
|
||||
def refresh(self) -> None:
|
||||
self.refresh_count += 1
|
||||
|
||||
def showEvent(self, event: Any) -> None: # noqa: N802 - Qt virtual
|
||||
super().showEvent(event)
|
||||
self.show_count += 1
|
||||
self.refresh()
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def application() -> QApplication:
|
||||
@@ -211,6 +217,34 @@ def test_every_visible_page_navigates_and_visited_tabs_track_active_page(
|
||||
]
|
||||
|
||||
|
||||
def test_real_navigation_refreshes_once_and_current_page_click_is_a_noop(
|
||||
application: QApplication,
|
||||
shell_window: ShellWindow,
|
||||
) -> None:
|
||||
appointments = shell_window.pages["appointments"]
|
||||
reception = shell_window.pages["reception"]
|
||||
assert isinstance(appointments, _ShellPageDouble)
|
||||
assert isinstance(reception, _ShellPageDouble)
|
||||
assert appointments.refresh_count == 1
|
||||
assert appointments.show_count == 1
|
||||
assert reception.refresh_count == 0
|
||||
|
||||
shell_window.nav_buttons["reception"].click()
|
||||
application.processEvents()
|
||||
assert reception.refresh_count == 1
|
||||
assert reception.show_count == 1
|
||||
|
||||
shell_window.nav_buttons["reception"].click()
|
||||
application.processEvents()
|
||||
assert reception.refresh_count == 1
|
||||
assert reception.show_count == 1
|
||||
|
||||
shell_window.nav_buttons["appointments"].click()
|
||||
application.processEvents()
|
||||
assert appointments.refresh_count == 2
|
||||
assert appointments.show_count == 2
|
||||
|
||||
|
||||
def test_non_fixed_tabs_close_and_active_close_renavigates(
|
||||
shell_window: ShellWindow,
|
||||
) -> None:
|
||||
|
||||
Reference in New Issue
Block a user