1#include <QtTest/QTest>
2
3#include <poppler-qt6.h>
4
5#include <memory>
6
7class TestOverprint : public QObject
8{
9 Q_OBJECT
10public:
11 explicit TestOverprint(QObject *parent = nullptr) : QObject(parent) { }
12private slots:
13 void checkOverprintImageRendering();
14};
15
16void TestOverprint::checkOverprintImageRendering()
17{
18 std::unique_ptr<Poppler::Document> doc = Poppler::Document::load(TESTDATADIR "/tests/mask-seams.pdf");
19 QVERIFY(doc);
20
21 doc->setRenderHint(hint: Poppler::Document::OverprintPreview, on: true);
22
23 std::unique_ptr<Poppler::Page> page = doc->page(index: 0);
24 QVERIFY(page);
25
26 constexpr int width = 600;
27 constexpr int height = 400;
28
29 QImage img = page->renderToImage(xres: 300.0, yres: 300.0, x: 0, y: 0, w: width, h: height);
30 QCOMPARE(img.format(), QImage::Format_RGB32);
31 QCOMPARE(img.width(), width);
32 QCOMPARE(img.height(), height);
33 QCOMPARE(img.bytesPerLine(), width * 4);
34 QCOMPARE(img.sizeInBytes(), width * height * 4);
35}
36
37QTEST_GUILESS_MAIN(TestOverprint)
38#include "check_overprint.moc"
39

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