Commit 05846601 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

partest: Fix one test interfering with the next

Cleanup settings and docdata in between tests
parent f7ea32c1
Pipeline #57293 passed with stage
in 27 minutes and 42 seconds
......@@ -15,6 +15,7 @@
#include <QtTest>
#include "../core/annotations.h"
#include "../core/document_p.h"
#include "../core/form.h"
#include "../core/page.h"
#include "../part/pageview.h"
......@@ -58,6 +59,8 @@ signals:
void urlHandler(const QUrl &url); // NOLINT(readability-inconsistent-declaration-parameter-name)
private slots:
void init();
void testZoomWithCrop();
void testReload();
void testCanceledReload();
......@@ -144,6 +147,26 @@ bool PartTest::openDocument(Okular::Part *part, const QString &filePath)
return part->m_document->isOpened();
}
void PartTest::init()
{
// Default settings for every test
Okular::Settings::self()->setDefaults();
// Clean docdatas
const QList<QUrl> urls = {QUrl::fromUserInput(QStringLiteral("file://" KDESRCDIR "data/file1.pdf")),
QUrl::fromUserInput(QStringLiteral("file://" KDESRCDIR "data/file2.pdf")),
QUrl::fromUserInput(QStringLiteral("file://" KDESRCDIR "data/simple-multipage.pdf")),
QUrl::fromUserInput(QStringLiteral("file://" KDESRCDIR "data/tocreload.pdf")),
QUrl::fromUserInput(QStringLiteral("file://" KDESRCDIR "data/pdf_with_links.pdf")),
QUrl::fromUserInput(QStringLiteral("file://" KDESRCDIR "data/RequestFullScreen.pdf"))};
for (const QUrl &url : urls) {
QFileInfo fileReadTest(url.toLocalFile());
const QString docDataPath = Okular::DocumentPrivate::docDataFileName(url, fileReadTest.size());
QFile::remove(docDataPath);
}
}
// Test that Okular doesn't crash after a successful reload
void PartTest::testReload()
{
......@@ -2113,6 +2136,8 @@ int main(int argc, char *argv[])
// Disable fancy debug output
qunsetenv("QT_MESSAGE_PATTERN");
Okular::Settings::instance(QStringLiteral("okularparttest"));
QApplication app(argc, argv);
app.setApplicationName(QStringLiteral("okularparttest"));
app.setOrganizationDomain(QStringLiteral("kde.org"));
......
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