otko/tests/gui/test_define_dialogs.py
smillmorel ba783718d4 chore: adopt remaining local development state
Catch-all for the intermixed residue of the unpushed otko-development
work ported into this tree: combinations/console-dock/quick-guide wiring
across commands, core, services, views and tests; repo-wide ruff-format
normalization; README/CONTRIBUTING updates; and the toolbar default
(both toolbars now open in the top area, quick guide text updated).

Splitting this further would require hunk-level surgery with low
confidence; the preceding commits in this branch isolate the
self-contained features.
2026-09-16 12:03:22 -04:00

45 lines
1.3 KiB
Python

"""GUI tests for Define dialogs."""
from __future__ import annotations
import pytest
pytest.importorskip("PySide6")
from otko.core import LinearTimeSeries, Project # noqa: E402
from otko.views.dialogs.linear_time_series import LinearTimeSeriesDialog # noqa: E402
from otko.views.dialogs.plain_pattern import PlainPatternDialog # noqa: E402
@pytest.mark.gui
def test_linear_time_series_dialog_builds_entity(qtbot) -> None: # type: ignore[no-untyped-def]
dlg = LinearTimeSeriesDialog(next_ts_id=3)
qtbot.addWidget(dlg)
dlg._name_edit.setText("Gravity")
dlg._factor_spin.setValue(1.5)
ts = dlg.time_series()
assert ts.id == 3
assert ts.name == "Gravity"
assert ts.factor == pytest.approx(1.5)
@pytest.mark.gui
def test_plain_pattern_dialog_uses_selected_time_series(qtbot) -> None: # type: ignore[no-untyped-def]
proj = Project(
time_series=[
LinearTimeSeries(id=1, name="GravityTS"),
LinearTimeSeries(id=2, name="RampTS"),
]
)
dlg = PlainPatternDialog(project=proj, next_pattern_id=4)
qtbot.addWidget(dlg)
dlg._name_edit.setText("Gravity")
dlg._ts_cb.setCurrentIndex(1)
pat = dlg.pattern()
assert pat.id == 4
assert pat.name == "Gravity"
assert pat.time_series_id == 2