Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tbruno25 committed Jul 19, 2024
1 parent e399197 commit d0a4e9d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
4 changes: 4 additions & 0 deletions src/can_explorer/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ def _add_row(self) -> None:
self._row_values.append(row)

def _sync_rows(self) -> None:
"""
Pair the current row_keys with the row_values.
Automatically hide's any rows not being used.
"""
while len(self._row_keys) > len(self._row_values):
self._add_row()

Expand Down
7 changes: 7 additions & 0 deletions tests/test_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,10 @@ def test_controller_cannot_start_without_stopping(app, tag, controller):
assert controller.is_active()
with pytest.raises(RuntimeError):
controller.start()


def test_controller_must_be_inactive_to_apply_settings(app, tag, controller):
controller.start()
assert controller.is_active()
with pytest.raises(RuntimeError):
controller.settings_apply_button_callback()
17 changes: 1 addition & 16 deletions tests/test_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def virtual_gui(request, process):
save_screenshot(request)


def test_gui_launch_basic(app, controller, tag):
def test_gui_launch(app, controller, tag):
assert dpg.is_dearpygui_running()

# Check if the main window was created
Expand All @@ -103,21 +103,6 @@ def test_gui_launch_basic(app, controller, tag):
assert dpg.get_item_label(tag.main_button) == "Start"


def test_gui_must_be_inactive_to_apply_settings(app, tag, controller):
pytest.skip("Todo")
# app.run()

# dpg.set_value(tag.settings_interface, "virtual")
# controller.settings_apply_button_callback()

# controller.start_stop_button_callback()
# assert controller.is_active()

# dpg.set_value(tag.settings_interface, None)
# with pytest.raises(RuntimeError):
# controller.settings_apply_button_callback()


def test_gui_visualizes_traffic(virtual_gui):
pyautogui.click(pyautogui.locate(Gui.Button.START))
sleep(1)
Expand Down

0 comments on commit d0a4e9d

Please sign in to comment.