1#include <QtTest/QTest>
2
3#include <poppler-qt6.h>
4
5class TestPageMode : public QObject
6{
7 Q_OBJECT
8public:
9 explicit TestPageMode(QObject *parent = nullptr) : QObject(parent) { }
10private slots:
11 void checkNone();
12 void checkFullScreen();
13 void checkAttachments();
14 void checkThumbs();
15 void checkOC();
16};
17
18void TestPageMode::checkNone()
19{
20 std::unique_ptr<Poppler::Document> doc = Poppler::Document::load(TESTDATADIR "/unittestcases/UseNone.pdf");
21 QVERIFY(doc);
22
23 QCOMPARE(doc->pageMode(), Poppler::Document::UseNone);
24}
25
26void TestPageMode::checkFullScreen()
27{
28 std::unique_ptr<Poppler::Document> doc = Poppler::Document::load(TESTDATADIR "/unittestcases/FullScreen.pdf");
29 QVERIFY(doc);
30
31 QCOMPARE(doc->pageMode(), Poppler::Document::FullScreen);
32}
33
34void TestPageMode::checkAttachments()
35{
36 std::unique_ptr<Poppler::Document> doc = Poppler::Document::load(TESTDATADIR "/unittestcases/UseAttachments.pdf");
37 QVERIFY(doc);
38
39 QCOMPARE(doc->pageMode(), Poppler::Document::UseAttach);
40}
41
42void TestPageMode::checkThumbs()
43{
44 std::unique_ptr<Poppler::Document> doc = Poppler::Document::load(TESTDATADIR "/unittestcases/UseThumbs.pdf");
45 QVERIFY(doc);
46
47 QCOMPARE(doc->pageMode(), Poppler::Document::UseThumbs);
48}
49
50void TestPageMode::checkOC()
51{
52 std::unique_ptr<Poppler::Document> doc = Poppler::Document::load(TESTDATADIR "/unittestcases/UseOC.pdf");
53 QVERIFY(doc);
54
55 QCOMPARE(doc->pageMode(), Poppler::Document::UseOC);
56}
57
58QTEST_GUILESS_MAIN(TestPageMode)
59#include "check_pagemode.moc"
60

source code of poppler/qt6/tests/check_pagemode.cpp