summaryrefslogtreecommitdiffstats
path: root/tests/auto/qprinter/tst_qprinter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qprinter/tst_qprinter.cpp')
-rw-r--r--tests/auto/qprinter/tst_qprinter.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/qprinter/tst_qprinter.cpp b/tests/auto/qprinter/tst_qprinter.cpp
index d6df94b..3c05d90 100644
--- a/tests/auto/qprinter/tst_qprinter.cpp
+++ b/tests/auto/qprinter/tst_qprinter.cpp
@@ -108,6 +108,8 @@ private slots:
void testActualNumCopies();
+ void taskQTBUG4497_reusePrinterOnDifferentFiles();
+
private:
};
@@ -971,5 +973,37 @@ void tst_QPrinter::testActualNumCopies()
QCOMPARE(p.actualNumCopies(), 15);
}
+static void printPage(QPainter *painter)
+{
+ painter->setPen(QPen(Qt::black, 4));
+ painter->drawRect(50, 60, 70, 80);
+}
+
+void tst_QPrinter::taskQTBUG4497_reusePrinterOnDifferentFiles()
+{
+ QPrinter printer;
+ {
+
+ printer.setOutputFileName("out1.ps");
+ QPainter painter(&printer);
+ printPage(&painter);
+
+ }
+ {
+
+ printer.setOutputFileName("out2.ps");
+ QPainter painter(&printer);
+ printPage(&painter);
+
+ }
+ QFile file1("out1.ps");
+ QVERIFY(file1.open(QIODevice::ReadOnly));
+
+ QFile file2("out2.ps");
+ QVERIFY(file2.open(QIODevice::ReadOnly));
+
+ QCOMPARE(file1.readAll(), file2.readAll());
+}
+
QTEST_MAIN(tst_QPrinter)
#include "tst_qprinter.moc"