1 | #include <QtTest/QTest> |
---|---|
2 | |
3 | #include <poppler-qt6.h> |
4 | |
5 | class TestPageMode : public QObject |
6 | { |
7 | Q_OBJECT |
8 | public: |
9 | explicit TestPageMode(QObject *parent = nullptr) : QObject(parent) { } |
10 | private slots: |
11 | void checkNone(); |
12 | void checkFullScreen(); |
13 | void checkAttachments(); |
14 | void checkThumbs(); |
15 | void checkOC(); |
16 | }; |
17 | |
18 | void 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 | |
26 | void 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 | |
34 | void 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 | |
42 | void 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 | |
50 | void 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 | |
58 | QTEST_GUILESS_MAIN(TestPageMode) |
59 | #include "check_pagemode.moc" |
60 |