┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Ernst <[email protected]>2022-09-23 20:35:34 +0200
committerFelix Ernst <[email protected]>2022-09-23 21:17:19 +0200
commit75183e609f6fa903afb5c2a9475d8cb10569532f (patch)
tree06594c5894e3504d305df7d224f7bd4ef1c253b5
parent6c65d06bcd4b34ef7a82203b3ba06b6c3604986b (diff)
Increase code coverage of places panel width resistance test
Improve the test by also testing the various selection mode bars. No combination of bars should lead to a resize of the paces panel. This commit also helps with increasing code coverage by making all possible selection mode bars appear.
-rw-r--r--src/tests/dolphinmainwindowtest.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/tests/dolphinmainwindowtest.cpp b/src/tests/dolphinmainwindowtest.cpp
index ef972ff25..eefca4204 100644
--- a/src/tests/dolphinmainwindowtest.cpp
+++ b/src/tests/dolphinmainwindowtest.cpp
@@ -277,6 +277,7 @@ void DolphinMainWindowTest::testPlacesPanelWidthResistance()
{
m_mainWindow->openDirectories({ QUrl::fromLocalFile(QDir::homePath()) }, false);
m_mainWindow->show();
+ m_mainWindow->resize(800, m_mainWindow->height()); // make sure the size is sufficient so a places panel resize shouldn't be necessary.
QVERIFY(QTest::qWaitForWindowExposed(m_mainWindow.data()));
QVERIFY(m_mainWindow->isVisible());
@@ -292,6 +293,16 @@ void DolphinMainWindowTest::testPlacesPanelWidthResistance()
m_mainWindow->actionCollection()->action(QStringLiteral("show_filter_bar"))->trigger();
QCOMPARE(placesPanel->width(), initialPlacesPanelWidth);
+ // Make all selection mode bars appear and test for each that this doesn't affect the places panel's width.
+ // One of the bottom bars (SelectionMode::BottomBar::GeneralContents) only shows up when at least one item is selected so we do that before we begin iterating.
+ m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::SelectAll))->trigger();
+ for (int selectionModeStates = SelectionMode::BottomBar::CopyContents; selectionModeStates != SelectionMode::BottomBar::RenameContents; selectionModeStates++) {
+ const auto contents = static_cast<SelectionMode::BottomBar::Contents>(selectionModeStates);
+ m_mainWindow->slotSetSelectionMode(true, contents);
+ QTest::qWait(20); // give time for a paint/resize
+ QCOMPARE(placesPanel->width(), initialPlacesPanelWidth);
+ }
+
m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::Find))->trigger();
QCOMPARE(placesPanel->width(), initialPlacesPanelWidth);