1 | #include <QtTest/QTest> |
---|---|
2 | |
3 | #include <poppler-qt6.h> |
4 | |
5 | class TestPageLayout : public QObject |
6 | { |
7 | Q_OBJECT |
8 | public: |
9 | explicit TestPageLayout(QObject *parent = nullptr) : QObject(parent) { } |
10 | private slots: |
11 | void checkNone(); |
12 | void checkSingle(); |
13 | void checkFacing(); |
14 | }; |
15 | |
16 | void TestPageLayout::checkNone() |
17 | { |
18 | std::unique_ptr<Poppler::Document> doc = Poppler::Document::load(TESTDATADIR "/unittestcases/UseNone.pdf"); |
19 | QVERIFY(doc); |
20 | |
21 | QCOMPARE(doc->pageLayout(), Poppler::Document::NoLayout); |
22 | } |
23 | |
24 | void TestPageLayout::checkSingle() |
25 | { |
26 | std::unique_ptr<Poppler::Document> doc = Poppler::Document::load(TESTDATADIR "/unittestcases/FullScreen.pdf"); |
27 | QVERIFY(doc); |
28 | |
29 | QCOMPARE(doc->pageLayout(), Poppler::Document::SinglePage); |
30 | } |
31 | |
32 | void TestPageLayout::checkFacing() |
33 | { |
34 | std::unique_ptr<Poppler::Document> doc = Poppler::Document::load(TESTDATADIR "/unittestcases/doublepage.pdf"); |
35 | QVERIFY(doc); |
36 | |
37 | QCOMPARE(doc->pageLayout(), Poppler::Document::TwoPageRight); |
38 | } |
39 | |
40 | QTEST_GUILESS_MAIN(TestPageLayout) |
41 | #include "check_pagelayout.moc" |
42 |