┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/tests/dolphinmainwindowtest.cpp
diff options
context:
space:
mode:
authorElvis Angelaccio <[email protected]>2018-10-07 19:53:08 +0200
committerElvis Angelaccio <[email protected]>2018-10-07 19:53:08 +0200
commit7904ae417af2b7b59ee54a9f875191e9e4802492 (patch)
tree17d2aefe619ff58bafa8b54bbba049fbfe673886 /src/tests/dolphinmainwindowtest.cpp
parent467df92fb9f2dc5f54162feb9149b4636bac43e7 (diff)
parente2f93a28294fd0575cf8427f31a2fba4f8d6b099 (diff)
Merge branch 'Applications/18.08'
Diffstat (limited to 'src/tests/dolphinmainwindowtest.cpp')
-rw-r--r--src/tests/dolphinmainwindowtest.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/tests/dolphinmainwindowtest.cpp b/src/tests/dolphinmainwindowtest.cpp
index ca492215a..027ab3e89 100644
--- a/src/tests/dolphinmainwindowtest.cpp
+++ b/src/tests/dolphinmainwindowtest.cpp
@@ -18,6 +18,7 @@
***************************************************************************/
#include "dolphinmainwindow.h"
+#include "dolphinnewfilemenu.h"
#include "dolphintabpage.h"
#include "dolphintabwidget.h"
#include "dolphinviewcontainer.h"
@@ -40,6 +41,9 @@ private slots:
void testActiveViewAfterClosingSplitView();
void testUpdateWindowTitleAfterClosingSplitView();
void testOpenInNewTabTitle();
+ void testNewFileMenuEnabled_data();
+ void testNewFileMenuEnabled();
+
private:
QScopedPointer<DolphinMainWindow> m_mainWindow;
@@ -188,6 +192,31 @@ void DolphinMainWindowTest::testOpenInNewTabTitle()
QVERIFY(tabWidget->tabText(0) != tabWidget->tabText(1));
}
+void DolphinMainWindowTest::testNewFileMenuEnabled_data()
+{
+ QTest::addColumn<QUrl>("activeViewUrl");
+ QTest::addColumn<bool>("expectedEnabled");
+
+ QTest::newRow("home") << QUrl::fromLocalFile(QDir::homePath()) << true;
+ QTest::newRow("root") << QUrl::fromLocalFile(QDir::rootPath()) << false;
+ QTest::newRow("trash") << QUrl::fromUserInput(QStringLiteral("trash:/")) << false;
+}
+
+void DolphinMainWindowTest::testNewFileMenuEnabled()
+{
+ QFETCH(QUrl, activeViewUrl);
+ m_mainWindow->openDirectories({ activeViewUrl }, false);
+ m_mainWindow->show();
+ QVERIFY(QTest::qWaitForWindowExposed(m_mainWindow.data()));
+ QVERIFY(m_mainWindow->isVisible());
+
+ auto newFileMenu = m_mainWindow->findChild<DolphinNewFileMenu*>("newFileMenu");
+ QVERIFY(newFileMenu);
+
+ QFETCH(bool, expectedEnabled);
+ QCOMPARE(newFileMenu->isEnabled(), expectedEnabled);
+}
+
QTEST_MAIN(DolphinMainWindowTest)
#include "dolphinmainwindowtest.moc"