Skip to content

Commit

Permalink
test instantiation of meta and loader widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
niksirbi committed Mar 16, 2024
1 parent 7e98430 commit 983a99b
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/test_unit/test_napari_widgets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest
from qtpy.QtWidgets import QWidget

from movement.napari.meta_widget import MovementMetaWidget

Expand All @@ -11,3 +12,31 @@ def meta_widget(make_napari_viewer) -> MovementMetaWidget:
can be instantiated without crashing."""
viewer = make_napari_viewer()
return MovementMetaWidget(viewer)


@pytest.fixture
def loader_widget(meta_widget) -> QWidget:
"""Fixture to expose the Loader widget for testing."""
# content() gets the QWidget inside the CollapsibleWidget
loader = meta_widget.loader.content()
return loader


def test_meta_widget(meta_widget):
"""Test that the meta widget is properly instantiated."""
assert meta_widget is not None
assert len(meta_widget.collapsible_widgets) >= 1

first_widget = meta_widget.collapsible_widgets[0]
assert first_widget._text == "Load"
assert first_widget.isExpanded()


def test_loader_widget(loader_widget):
"""Test that the loader widget is properly instantiated."""
assert loader_widget is not None
# Default values
assert loader_widget.source_software_combo.currentText() == "SLEAP"
assert loader_widget.fps_spinbox.value() == 50
assert loader_widget.file_path_edit.text() == ""
assert loader_widget.load_button.text() == "Load"

0 comments on commit 983a99b

Please sign in to comment.