From b188221fee0eaacec115b514185a0508ef655897 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 21 Mar 2012 17:17:42 +0200 Subject: Fix QPrinter test in Windows Fixed Q_WS_WIN flagging to Q_OS_WIN in QPrinter API and related implementation to make API match the documentation and Qt 4.8. Also Removed the unused internal HDC related functions from the API, that were previously behind Q_WS_WIN flag. Some of the properties tested are documented to be valid for native print engine only in X11 environment, so skipped testing those in non-xcb environments. Copy collation is also apparently not supported in Windows native print engine, though this seems to be undocumented, so skipped that only in Windows. At least one of the test blocks in tst_QPrinter::valuePreservation() failed due to default printer not getting set properly, so fixed that, too. Task-number: QTBUG-24191 Task-number: QTBUG-22927 Change-Id: I44a5e3d647a1279fcc7f1e99de6881f9be330246 Reviewed-by: Friedemann Kleint --- src/plugins/printsupport/windows/qwindowsprintersupport.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/plugins/printsupport') diff --git a/src/plugins/printsupport/windows/qwindowsprintersupport.cpp b/src/plugins/printsupport/windows/qwindowsprintersupport.cpp index 2905063c51..c5c60ae5cc 100644 --- a/src/plugins/printsupport/windows/qwindowsprintersupport.cpp +++ b/src/plugins/printsupport/windows/qwindowsprintersupport.cpp @@ -58,12 +58,13 @@ QWindowsPrinterSupport::QWindowsPrinterSupport() LPBYTE buffer = new BYTE[needed]; if (EnumPrinters(PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS, NULL, 4, buffer, needed, &needed, &returned)) { PPRINTER_INFO_4 infoList = reinterpret_cast(buffer); - QPrinterInfo defPrn = defaultPrinter(); + QString defaultPrinterName; + QWin32PrintEngine::queryDefaultPrinter(defaultPrinterName, QString(), QString()); for (uint i = 0; i < returned; ++i) { QString printerName(QString::fromWCharArray(infoList[i].pPrinterName)); QPrinterInfo printerInfo(printerName); - if (printerInfo.printerName() == defPrn.printerName()) + if (printerInfo.printerName() == defaultPrinterName) printerInfo.d_ptr->isDefault = true; mPrinterList.append(printerInfo); } -- cgit v1.2.3