tests: added gui tests and furtehr tests in daq and common
This commit is contained in:
1 parent
35d747c785
commit
7168f5512d
12 files changed
+1072
No files matched your search
@@ -0,0 +1,61 @@
|
||||
import pytest
|
||||
from unittest.mock import MagicMock
|
||||
from PySide6.QtWidgets import QWidget
|
||||
from aare.gui.tutorials.tutorial_manager import TutorialManager
|
||||
from aare.gui.tutorials.tutorial_models import (
|
||||
TutorialScenario, TutorialStepDefinition, TutorialMode, StepKind, TutorialTextRef, TutorialTarget, TargetKind
|
||||
)
|
||||
from aare.gui.tutorials.tutorial_runtime import (
|
||||
DictionaryTextResolver, NoOpActionExecutor, DictTargetResolver, TutorialEventBus
|
||||
)
|
||||
|
||||
@pytest.fixture
|
||||
def mock_window(qapp):
|
||||
return QWidget()
|
||||
|
||||
@pytest.fixture
|
||||
def tutorial_scenario():
|
||||
step1 = TutorialStepDefinition(
|
||||
id="step1",
|
||||
kind=StepKind.INFO,
|
||||
title=TutorialTextRef(key="step1_title"),
|
||||
body=TutorialTextRef(key="step1_body"),
|
||||
target=TutorialTarget(kind=TargetKind.NONE, target_id="")
|
||||
)
|
||||
scenario = TutorialScenario(
|
||||
id="test_scenario",
|
||||
title=TutorialTextRef(key="scenario_title"),
|
||||
description=TutorialTextRef(key="scenario_desc"),
|
||||
mode=TutorialMode.LINEAR,
|
||||
steps=[step1]
|
||||
)
|
||||
return scenario
|
||||
|
||||
def test_tutorial_manager_start_stop(qtbot, mock_window, tutorial_scenario):
|
||||
text_resolver = DictionaryTextResolver({
|
||||
"en": {
|
||||
"step1_title": "Step 1",
|
||||
"step1_body": "This is step 1",
|
||||
"scenario_title": "Test",
|
||||
"scenario_desc": "Test Desc"
|
||||
}
|
||||
})
|
||||
target_resolver = DictTargetResolver({})
|
||||
action_executor = NoOpActionExecutor()
|
||||
event_bus = TutorialEventBus()
|
||||
|
||||
manager = TutorialManager(
|
||||
parent_window=mock_window,
|
||||
target_resolver=target_resolver,
|
||||
text_resolver=text_resolver,
|
||||
action_executor=action_executor,
|
||||
event_bus=event_bus
|
||||
)
|
||||
manager.add_scenario(tutorial_scenario)
|
||||
|
||||
manager.start("test_scenario")
|
||||
assert manager.get_current_step() is not None
|
||||
assert manager.get_current_step().id == "step1"
|
||||
|
||||
manager.stop()
|
||||
assert manager.get_current_step() is None
|
||||
Reference in new issue
Block a user