[Tests] Assert settings navigation through the event player

This commit is contained in:
Lukas Brübach 2026-10-23 21:30:23 +02:00
parent 45cc3b54f7
commit 3c0715ca61
2 changed files with 36 additions and 0 deletions

View file

@ -0,0 +1,33 @@
<events>
<!--
Settings navigation (state assertions).
Navigates the settings page tree by label, checks that the page stack
followed, then filters with the search box and verifies the text landed
in the edit — then closes with the OK button.
-->
<event widget="MainWindow/menubar" command="activate" arguments="cockatriceMenu" />
<event widget="MainWindow/menubar/cockatriceMenu" command="activate" arguments="actionSettings" />
<event widget="MainWindow" command="pause" arguments="500" />
<!-- The dialog opens on the first page (General) -->
<event widget="MainWindow/settingsDialog/settingsView/pagesContainer/pagesWidget" command="expectProperty" arguments="currentIndex,0" />
<!-- Navigate to Shortcuts, the last page of the tree -->
<event widget="MainWindow/settingsDialog/settingsView/navTree" command="selectItem" arguments="Shortcuts" />
<event widget="MainWindow" command="pause" arguments="300" />
<event widget="MainWindow/settingsDialog/settingsView/pagesContainer/pagesWidget" command="expectProperty" arguments="currentIndex,7" />
<!-- ... and back to General -->
<event widget="MainWindow/settingsDialog/settingsView/navTree" command="selectItem" arguments="General" />
<event widget="MainWindow" command="pause" arguments="300" />
<event widget="MainWindow/settingsDialog/settingsView/pagesContainer/pagesWidget" command="expectProperty" arguments="currentIndex,0" />
<!-- Filters the settings by search term -->
<event widget="MainWindow/settingsDialog/settingsView/settingsSearchEdit" command="typeText" arguments="sound" />
<event widget="MainWindow" command="pause" arguments="300" />
<event widget="MainWindow/settingsDialog/settingsView/settingsSearchEdit" command="expectProperty" arguments="text,sound" />
<!-- Close -->
<event widget="MainWindow/settingsDialog/settingsOkButton" command="activate" arguments="" />
</events>

View file

@ -144,6 +144,7 @@ void SettingsView::setupUi()
// Pages stacked widget
pagesWidget = new QStackedWidget;
pagesWidget->setObjectName("pagesWidget");
auto *generalPage = new GeneralSettingsPage;
auto *appearancePage = new AppearanceSettingsPage;
@ -208,6 +209,7 @@ void SettingsView::setupUi()
// Pages container (stacked widget + search results overlay)
pagesContainer = new QWidget;
pagesContainer->setObjectName("pagesContainer");
auto *containerLayout = new QStackedLayout;
containerLayout->setStackingMode(QStackedLayout::StackAll);
containerLayout->addWidget(pagesWidget);
@ -247,6 +249,7 @@ void SettingsView::setupUi()
void SettingsView::setupNavTree()
{
navTree = new QTreeWidget;
navTree->setObjectName("navTree");
navTree->setHeaderHidden(true);
navTree->setRootIsDecorated(true);
navTree->setIconSize(QSize(24, 24));