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