1#include <QtTest/QTest>
2
3#include <poppler-qt6.h>
4
5class TestPermissions : public QObject
6{
7 Q_OBJECT
8public:
9 explicit TestPermissions(QObject *parent = nullptr) : QObject(parent) { }
10private slots:
11 void permissions1();
12};
13
14void TestPermissions::permissions1()
15{
16 std::unique_ptr<Poppler::Document> doc = Poppler::Document::load(TESTDATADIR "/unittestcases/orientation.pdf");
17 QVERIFY(doc);
18
19 // we are allowed to print
20 QVERIFY(doc->okToPrint());
21
22 // we are not allowed to change
23 QVERIFY(!(doc->okToChange()));
24
25 // we are not allowed to copy or extract content
26 QVERIFY(!(doc->okToCopy()));
27
28 // we are not allowed to print at high resolution
29 QVERIFY(!(doc->okToPrintHighRes()));
30
31 // we are not allowed to fill forms
32 QVERIFY(!(doc->okToFillForm()));
33
34 // we are allowed to extract content for accessibility
35 QVERIFY(doc->okToExtractForAccessibility());
36
37 // we are allowed to assemble this document
38 QVERIFY(doc->okToAssemble());
39}
40
41QTEST_GUILESS_MAIN(TestPermissions)
42#include "check_permissions.moc"
43

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