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