1 | #include <QtTest/QTest> |
---|---|
2 | |
3 | #include <poppler-qt6.h> |
4 | |
5 | class TestPermissions : public QObject |
6 | { |
7 | Q_OBJECT |
8 | public: |
9 | explicit TestPermissions(QObject *parent = nullptr) : QObject(parent) { } |
10 | private slots: |
11 | void permissions1(); |
12 | }; |
13 | |
14 | void 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 | |
41 | QTEST_GUILESS_MAIN(TestPermissions) |
42 | #include "check_permissions.moc" |
43 |