+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);
+}
+