summaryrefslogtreecommitdiffstats
path: root/tests/auto/pdf
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2014-12-16 00:51:08 +0100
committerMichal Klocek <michal.klocek@qt.io>2019-11-25 12:01:39 +0100
commit8d1e0d331b91cafa4e5f5b189e7dfee7ddb9b276 (patch)
tree989e267e1be97920c1af5349b70e5dc3f0539136 /tests/auto/pdf
parentaa2955dfb064149e57d407671011b551c8d28be2 (diff)
Clean up the loading
Unify the load API and implementation to always go through FPDFAvail.
Diffstat (limited to 'tests/auto/pdf')
-rw-r--r--tests/auto/pdf/qpdfdocument/tst_qpdfdocument.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/auto/pdf/qpdfdocument/tst_qpdfdocument.cpp b/tests/auto/pdf/qpdfdocument/tst_qpdfdocument.cpp
index 6ebd1979f..336c6e8d9 100644
--- a/tests/auto/pdf/qpdfdocument/tst_qpdfdocument.cpp
+++ b/tests/auto/pdf/qpdfdocument/tst_qpdfdocument.cpp
@@ -66,7 +66,12 @@ void tst_QPdfDocument::loadFromIODevice()
{
TemporaryPdf tempPdf;
QPdfDocument doc;
- QCOMPARE(doc.load(&tempPdf), QPdfDocument::NoError);
+ QSignalSpy startedSpy(&doc, SIGNAL(documentLoadStarted()));
+ QSignalSpy finishedSpy(&doc, SIGNAL(documentLoadFinished()));
+ doc.load(&tempPdf);
+ QCOMPARE(startedSpy.count(), 1);
+ QCOMPARE(finishedSpy.count(), 1);
+ QCOMPARE(doc.error(), QPdfDocument::NoError);
QCOMPARE(doc.pageCount(), 2);
}
@@ -83,7 +88,7 @@ void tst_QPdfDocument::loadAsync()
QSignalSpy startedSpy(&doc, SIGNAL(documentLoadStarted()));
QSignalSpy finishedSpy(&doc, SIGNAL(documentLoadFinished()));
- doc.loadAsynchronously(reply.data());
+ doc.load(reply.data());
QCOMPARE(startedSpy.count(), 1);
QCOMPARE(finishedSpy.count(), 1);
@@ -95,8 +100,10 @@ void tst_QPdfDocument::password()
QPdfDocument doc;
QCOMPARE(doc.pageCount(), 0);
QCOMPARE(doc.load(QFINDTESTDATA("pdf-sample.protected.pdf")), QPdfDocument::IncorrectPasswordError);
- QCOMPARE(doc.load(QFINDTESTDATA("pdf-sample.protected.pdf"), QStringLiteral("WrongPassword")), QPdfDocument::IncorrectPasswordError);
- QCOMPARE(doc.load(QFINDTESTDATA("pdf-sample.protected.pdf"), QStringLiteral("Qt")), QPdfDocument::NoError);
+ doc.setPassword(QStringLiteral("WrongPassword"));
+ QCOMPARE(doc.load(QFINDTESTDATA("pdf-sample.protected.pdf")), QPdfDocument::IncorrectPasswordError);
+ doc.setPassword(QStringLiteral("Qt"));
+ QCOMPARE(doc.load(QFINDTESTDATA("pdf-sample.protected.pdf")), QPdfDocument::NoError);
QCOMPARE(doc.pageCount(), 1);
}