From 97b4c5a5746a33a27076d72ceb3533fbd54b9642 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 10 Sep 2012 15:05:28 +0200 Subject: [PATCH] Stabilize qprinter test The CreationDate entry in the two PDF files can potentially be different depending on when the test is run. We ignore the line for this entry when comparing the two results. Task-number: QTBUG-27171 Change-Id: I8978678295217edd537edb0d2c25260813aa3d93 Reviewed-by: Qt Doc Bot Reviewed-by: Jiang Jiang --- tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp index ca7fd4f..6977bbe 100644 --- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp +++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp @@ -985,7 +985,16 @@ void tst_QPrinter::taskQTBUG4497_reusePrinterOnDifferentFiles() QFile file2("out2.ps"); QVERIFY(file2.open(QIODevice::ReadOnly)); - QCOMPARE(file1.readAll(), file2.readAll()); + while (!file1.atEnd() && !file2.atEnd()) { + QByteArray file1Line = file1.readLine(); + QByteArray file2Line = file2.readLine(); + + if (!file1Line.startsWith("%%CreationDate")) + QCOMPARE(file1Line, file2Line); + } + + QVERIFY(file1.atEnd()); + QVERIFY(file2.atEnd()); } void tst_QPrinter::testCurrentPage() -- 2.7.4