┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFelix Ernst <[email protected]>2024-03-14 10:50:48 +0000
committerMéven Car <[email protected]>2024-03-14 10:50:48 +0000
commitad47e8dea16509ad7fca93661669e61ada10ce84 (patch)
treea3af44af3d5104ec48037f0091b772c9fca2d0b3 /src
parentfcf395aa01e13e9a8cc3e120f11ab83d14dc745f (diff)
Adapt testOpenInNewTabTitle() to upstream change
Prior to this commit the test failed because it expected a generic "inode-directory" icon for directories like "home" or "tmp" even though we have more specialised and nicer icons for these directories. I assume the test only used to pass because we were actually always using generic and therefore unhelpful icons for tabs. This commit removes the hard-coded expectation of the "inode-directory" icon and instead compares the tab icon with the return value of KIO::iconNameForUrl(tabUrl).
Diffstat (limited to 'src')
-rw-r--r--src/tests/dolphinmainwindowtest.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/tests/dolphinmainwindowtest.cpp b/src/tests/dolphinmainwindowtest.cpp
index 6b4b0f71b..f5ece564d 100644
--- a/src/tests/dolphinmainwindowtest.cpp
+++ b/src/tests/dolphinmainwindowtest.cpp
@@ -212,7 +212,8 @@ void DolphinMainWindowTest::testUpdateWindowTitleAfterChangingSplitView()
// Test case for bug #397910
void DolphinMainWindowTest::testOpenInNewTabTitle()
{
- m_mainWindow->openDirectories({QUrl::fromLocalFile(QDir::homePath())}, false);
+ const QUrl homePathUrl{QUrl::fromLocalFile(QDir::homePath())};
+ m_mainWindow->openDirectories({homePathUrl}, false);
m_mainWindow->show();
QVERIFY(QTest::qWaitForWindowExposed(m_mainWindow.data()));
QVERIFY(m_mainWindow->isVisible());
@@ -220,13 +221,14 @@ void DolphinMainWindowTest::testOpenInNewTabTitle()
auto tabWidget = m_mainWindow->findChild<DolphinTabWidget *>("tabWidget");
QVERIFY(tabWidget);
- tabWidget->openNewTab(QUrl::fromLocalFile(QDir::tempPath()));
+ const QUrl tempPathUrl{QUrl::fromLocalFile(QDir::tempPath())};
+ tabWidget->openNewTab(tempPathUrl);
QCOMPARE(tabWidget->count(), 2);
QVERIFY(tabWidget->tabText(0) != tabWidget->tabText(1));
- if (!tabWidget->tabIcon(0).isNull() && !tabWidget->tabIcon(1).isNull()) {
- QCOMPARE(QStringLiteral("inode-directory"), tabWidget->tabIcon(0).name());
- QCOMPARE(QStringLiteral("inode-directory"), tabWidget->tabIcon(1).name());
- }
+
+ QVERIFY2(!tabWidget->tabIcon(0).isNull() && !tabWidget->tabIcon(1).isNull(), "Tabs are supposed to have icons.");
+ QCOMPARE(KIO::iconNameForUrl(homePathUrl), tabWidget->tabIcon(0).name());
+ QCOMPARE(KIO::iconNameForUrl(tempPathUrl), tabWidget->tabIcon(1).name());
}
void DolphinMainWindowTest::testNewFileMenuEnabled_data()