Commit a698c378 authored by Sandro Knauß's avatar Sandro Knauß Committed by David Faure
Browse files

Add test for NodeHelper::createTempDir

additionally test the remove of the dir, too.

Differential Revision: https://phabricator.kde.org/D883
parent 943304ae
...@@ -205,8 +205,22 @@ void NodeHelperTest::testLocalFiles() ...@@ -205,8 +205,22 @@ void NodeHelperTest::testLocalFiles()
QCOMPARE(helper.fromHREF(msg, helper.tempFileUrlFromNode(subsubExtra)), subsubExtra); QCOMPARE(helper.fromHREF(msg, helper.tempFileUrlFromNode(subsubExtra)), subsubExtra);
helper.writeNodeToTempFile(subsubExtraNode); helper.writeNodeToTempFile(subsubExtraNode);
QCOMPARE(helper.fromHREF(msg, helper.tempFileUrlFromNode(subsubExtraNode)), subsubExtraNode); QCOMPARE(helper.fromHREF(msg, helper.tempFileUrlFromNode(subsubExtraNode)), subsubExtraNode);
}
helper.forceCleanTempFiles(); void NodeHelperTest::testCreateTempDir()
{
QString path;
{
NodeHelper helper;
path = helper.createTempDir(QStringLiteral("foo"));
QVERIFY(path.endsWith(QStringLiteral(".index.foo")));
QVERIFY(QDir(path).exists());
QVERIFY(QFile(path).permissions() & QFileDevice::WriteUser);
QVERIFY(QFile(path).permissions() & QFileDevice::ExeUser);
QVERIFY(QFile(path).permissions() & QFileDevice::ReadUser);
}
QVERIFY(!QDir(path).exists());
} }
QTEST_GUILESS_MAIN(NodeHelperTest) QTEST_GUILESS_MAIN(NodeHelperTest)
......
...@@ -37,6 +37,7 @@ private Q_SLOTS: ...@@ -37,6 +37,7 @@ private Q_SLOTS:
void testPersistentIndex(); void testPersistentIndex();
void testLocalFiles(); void testLocalFiles();
void testHREF(); void testHREF();
void testCreateTempDir();
}; };
} }
......
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