otko/tests/gui/test_constraint_and_display_dialogs.py
smillmorel 612936a00b
Some checks failed
CI / lint (push) Has been cancelled
CI / test (macos-latest, 3.10) (push) Has been cancelled
CI / test (macos-latest, 3.11) (push) Has been cancelled
CI / test (macos-latest, 3.12) (push) Has been cancelled
CI / test (ubuntu-latest, 3.10) (push) Has been cancelled
CI / test (ubuntu-latest, 3.11) (push) Has been cancelled
CI / test (ubuntu-latest, 3.12) (push) Has been cancelled
CI / test (windows-latest, 3.10) (push) Has been cancelled
CI / test (windows-latest, 3.11) (push) Has been cancelled
CI / test (windows-latest, 3.12) (push) Has been cancelled
feat: initial otko import
2026-09-08 02:12:15 -04:00

40 lines
1.1 KiB
Python

"""GUI tests for equalDOF and display-option dialogs."""
from __future__ import annotations
import pytest
pytest.importorskip("PySide6")
from otko.views.dialogs.assign_equal_dof import AssignEqualDOFDialog
from otko.views.dialogs.display_options import DisplayOptionsDialog
@pytest.mark.gui
def test_assign_equal_dof_dialog_requires_explicit_dof_choice(qtbot) -> None: # type: ignore[no-untyped-def]
dlg = AssignEqualDOFDialog([3, 4], ndf=3)
qtbot.addWidget(dlg)
with pytest.raises(ValueError, match="at least one DOF"):
dlg.constraint()
dlg2 = AssignEqualDOFDialog([3, 4], ndf=3, suggested_dofs=(2, 3))
qtbot.addWidget(dlg2)
c = dlg2.constraint()
assert c.retained_node == 3
assert c.constrained_node == 4
assert c.dofs == (2, 3)
@pytest.mark.gui
def test_display_options_dialog_round_trip(qtbot) -> None: # type: ignore[no-untyped-def]
dlg = DisplayOptionsDialog(
show_node_labels=False,
show_element_labels=True,
)
qtbot.addWidget(dlg)
dlg._show_node_labels.setChecked(True)
dlg._show_element_labels.setChecked(False)
assert dlg.values() == (True, False)