QtPrintSupport: allow slight deviations from pre-defined paper sizes in tests

CUPS paper sizes may differ from Qt paper sizes slightly and thus fail
the strict comparison in qprinter tests. This is needed for the
followup patch which initializes the cupsplugin with CUPS/PPD defaults.

Change-Id: Ie66f77ead0204de0fc7c7913005fa516d57d34eb
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
Teemu Katajisto 2012-08-21 10:53:31 +03:00 committed by The Qt Project
parent 906c0168c5
commit 0b2068eafd

View File

@ -491,8 +491,8 @@ void tst_QPrinter::testMulitpleSets()
return;
}
QCOMPARE(printer.widthMM(), widthMMAfter);
QCOMPARE(printer.heightMM(), heightMMAfter);
QVERIFY(qAbs(printer.widthMM() - widthMMAfter) <= 2);
QVERIFY(qAbs(printer.heightMM() - heightMMAfter) <= 2);
computePageValue(printer, paperWidth, paperHeight);
@ -501,8 +501,8 @@ void tst_QPrinter::testMulitpleSets()
// Set it again and see if it still works.
printer.setPageSize(printerPageSize);
QCOMPARE(printer.widthMM(), widthMMAfter);
QCOMPARE(printer.heightMM(), heightMMAfter);
QVERIFY(qAbs(printer.widthMM() - widthMMAfter) <= 2);
QVERIFY(qAbs(printer.heightMM() - heightMMAfter) <= 2);
printer.setOrientation(QPrinter::Landscape);
computePageValue(printer, paperWidth, paperHeight);