style: format with ruff
This commit is contained in:
@@ -3,16 +3,27 @@ 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
|
||||
TutorialScenario,
|
||||
TutorialStepDefinition,
|
||||
TutorialMode,
|
||||
StepKind,
|
||||
TutorialTextRef,
|
||||
TutorialTarget,
|
||||
TargetKind,
|
||||
)
|
||||
from aare.gui.tutorials.tutorial_runtime import (
|
||||
DictionaryTextResolver, NoOpActionExecutor, DictTargetResolver, TutorialEventBus
|
||||
DictionaryTextResolver,
|
||||
NoOpActionExecutor,
|
||||
DictTargetResolver,
|
||||
TutorialEventBus,
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_window(qapp):
|
||||
return QWidget()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def tutorial_scenario():
|
||||
step1 = TutorialStepDefinition(
|
||||
@@ -20,42 +31,45 @@ def tutorial_scenario():
|
||||
kind=StepKind.INFO,
|
||||
title=TutorialTextRef(key="step1_title"),
|
||||
body=TutorialTextRef(key="step1_body"),
|
||||
target=TutorialTarget(kind=TargetKind.NONE, target_id="")
|
||||
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]
|
||||
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"
|
||||
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
|
||||
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