summaryrefslogtreecommitdiffstats
path: root/tests/auto/printsupport
diff options
context:
space:
mode:
authorKai Pastor <dg0yt@darc.de>2015-09-11 01:22:14 +0200
committerKai Pastor <dg0yt@darc.de>2016-02-25 18:42:47 +0000
commit44357dbe423d430246504d977f4422ed0e2e7a5a (patch)
tree2ac646155768ec7fbb5b7bdd448e0503189bc33b /tests/auto/printsupport
parentdebc44cf1106fb20065aab7848759eace3211c65 (diff)
QMacPrintEngine: Really set the printer resolution
As already reported in 2009 (Qt 4.6) QPrinter never actually set the printer resolution. This change adds the necessary call to PMPrinterSetOutputResolution (available since OS X 10.5). [ChangeLog][QtPrintSupport][OS X] QMacPrintEngine now really sets the printer resolution. Task-number: QTBUG-7000 Change-Id: I3e851b62e1a7ed78564a8a6fd576b0a18d7eff63 Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
Diffstat (limited to 'tests/auto/printsupport')
-rw-r--r--tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
index aa72be3ea8..5e7a40d3b5 100644
--- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
+++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
@@ -1628,7 +1628,24 @@ void tst_QPrinter::resolution()
// Test set/get
int expected = 333;
#ifdef Q_OS_MAC
- // Set resolution does nothing on OSX, see QTBUG-7000
+ // QMacPrintEngine chooses the closest supported resolution.
+ const QList<int> all_supported = native.supportedResolutions();
+ foreach (int supported, all_supported) {
+ // Test setting a supported resolution
+ int requested = supported;
+ native.setResolution(requested);
+ QCOMPARE(native.resolution(), requested);
+
+ // Test setting an unsupported resolution
+ do {
+ requested += 5;
+ } while (all_supported.contains(requested));
+ native.setResolution(requested);
+ int result = native.resolution();
+ QVERIFY(all_supported.contains(result));
+ QVERIFY(qAbs(result - requested) <= qAbs(supported - requested));
+ }
+
expected = native.resolution();
#endif // Q_OS_MAC
native.setResolution(expected);