Commit f21b73fc authored by David Faure's avatar David Faure
Browse files

Make konqpopupmenutest more robust

parent a7ef9e7f
......@@ -92,7 +92,7 @@ void KonqPopupMenuTest::initTestCase()
KConfigGroup(dolphin, "General").writeEntry("ShowCopyMoveMenu", true);
m_thisDirectoryItem = KFileItem(QUrl::fromLocalFile(QDir::currentPath()), QStringLiteral("inode/directory"), S_IFDIR + 0777);
const QString makefile = QDir::currentPath() + "/Makefile";
const QString makefile = QCoreApplication::applicationDirPath() + "/../Makefile";
QVERIFY2(QFile::exists(makefile), qPrintable(makefile));
m_fileItem = KFileItem(QUrl::fromLocalFile(makefile), QStringLiteral("text/x-makefile"), S_IFREG + 0660);
m_linkItem = KFileItem(QUrl::fromLocalFile(QStringLiteral("http://www.kde.org/foo")), QStringLiteral("text/html"), S_IFREG + 0660);
......@@ -179,12 +179,16 @@ void KonqPopupMenuTest::testFile()
QStringList actions = extractActionNames(popup);
actions.removeAll(QStringLiteral("services_submenu"));
// Be tolerant with openwith, it could be there once or twice
if (actions.count(QStringLiteral("openwith")) == 2) {
actions.removeOne(QStringLiteral("openwith"));
}
qDebug() << actions;
QStringList expectedActions;
expectedActions << QStringLiteral("openInNewWindow") << QStringLiteral("openInNewTab") << QStringLiteral("separator")
<< QStringLiteral("cut") << QStringLiteral("copy") << QStringLiteral("rename") << QStringLiteral("trash")
<< QStringLiteral("openwith")
<< QStringLiteral("openwith")
<< QStringLiteral("separator")
<< QStringLiteral("preview1");
expectedActions << QStringLiteral("separator");
......@@ -221,12 +225,15 @@ void KonqPopupMenuTest::testFileInReadOnlyDirectory()
QStringList actions = extractActionNames(popup);
actions.removeAll(QStringLiteral("services_submenu"));
// Be tolerant with openwith, it could be there once or twice
if (actions.count(QStringLiteral("openwith")) == 2) {
actions.removeOne(QStringLiteral("openwith"));
}
qDebug() << actions;
QStringList expectedActions;
expectedActions << QStringLiteral("openInNewWindow") << QStringLiteral("openInNewTab") << QStringLiteral("separator")
<< QStringLiteral("copy")
<< QStringLiteral("openwith")
<< QStringLiteral("openwith")
<< QStringLiteral("separator")
<< QStringLiteral("preview1");
expectedActions << QStringLiteral("separator");
......@@ -256,12 +263,15 @@ void KonqPopupMenuTest::testFilePreviewSubMenu()
QStringList actions = extractActionNames(popup);
actions.removeAll(QStringLiteral("services_submenu"));
// Be tolerant with openwith, it could be there once or twice
if (actions.count(QStringLiteral("openwith")) == 2) {
actions.removeOne(QStringLiteral("openwith"));
}
qDebug() << actions;
QStringList expectedActions;
expectedActions << QStringLiteral("openInNewWindow") << QStringLiteral("openInNewTab") << QStringLiteral("separator")
<< QStringLiteral("cut") << QStringLiteral("copy") << QStringLiteral("rename") << QStringLiteral("trash")
<< QStringLiteral("openwith")
<< QStringLiteral("openwith")
<< QStringLiteral("separator")
<< QStringLiteral("preview_submenu");
expectedActions << QStringLiteral("separator");
......@@ -395,7 +405,6 @@ void KonqPopupMenuTest::testHtmlLink()
expectedActions << QStringLiteral("openInNewWindow") << QStringLiteral("openInNewTab") << QStringLiteral("separator")
<< QStringLiteral("bookmark_add") << QStringLiteral("savelinkas") << QStringLiteral("copylinklocation")
<< QStringLiteral("openwith")
<< QStringLiteral("openwith")
<< QStringLiteral("separator")
<< QStringLiteral("preview_submenu")
<< QStringLiteral("separator")
......@@ -434,7 +443,6 @@ void KonqPopupMenuTest::testHtmlPage()
qDebug() << actions;
QStringList expectedActions;
expectedActions << QStringLiteral("bookmark_add")
<< QStringLiteral("openwith")
<< QStringLiteral("openwith")
<< QStringLiteral("separator")
<< QStringLiteral("preview_submenu")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment