summaryrefslogtreecommitdiff
path: root/tests/auto/widgets/printing/tst_printing.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/printing/tst_printing.cpp')
-rw-r--r--tests/auto/widgets/printing/tst_printing.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/widgets/printing/tst_printing.cpp b/tests/auto/widgets/printing/tst_printing.cpp
index 1c1e0615e..1f9b5059c 100644
--- a/tests/auto/widgets/printing/tst_printing.cpp
+++ b/tests/auto/widgets/printing/tst_printing.cpp
@@ -23,6 +23,7 @@ private slots:
#if QT_CONFIG(webengine_system_poppler)
void printToPdfPoppler();
#endif
+ void interruptPrinting();
};
void tst_Printing::printToPdfBasic()
@@ -117,6 +118,19 @@ void tst_Printing::printToPdfPoppler()
}
#endif
+void tst_Printing::interruptPrinting()
+{
+ QWebEngineView view;
+ QSignalSpy spy(&view, &QWebEngineView::loadFinished);
+ view.load(QUrl("qrc:///resources/basic_printing_page.html"));
+ QTRY_VERIFY(spy.size() == 1);
+
+ QTemporaryDir tempDir(QDir::tempPath() + "/tst_qwebengineview-XXXXXX");
+ QVERIFY(tempDir.isValid());
+ view.page()->printToPdf(tempDir.path() + "/file.pdf");
+ // Navigation stop interrupts print job, preferably do this without crash/assert
+ view.page()->triggerAction(QWebEnginePage::Stop);
+}
QTEST_MAIN(tst_Printing)
#include "tst_printing.moc"