From bdcece7d46e1c9ca9717dfc10e699f8dfbd2286e Mon Sep 17 00:00:00 2001 From: Titta Heikkala Date: Thu, 6 Sep 2012 12:58:18 +0300 Subject: [PATCH] Revert a change to printer orientation Reverting change: Ia6bc9ae14d79a646e61bfc97652f9f5af90738b3 The previous change does not set the printer correctly. It looks based on the tests that the correct printer is set, but in reality the default printer is used (even though printerName() is returning the printer set). Updated taskQTBUG4497_reusePrinterOnDifferentFiles() test case so that it generates PDF instead of PS. Testing the binary output can't be guaranteed to work in this case. Change-Id: Iee111f2c2dec84f86344a38816c21e191f5373ea Reviewed-by: Andy Shaw --- src/printsupport/kernel/qprintengine_win.cpp | 17 ++--------------- .../kernel/qprinter/tst_qprinter.cpp | 12 ++++++------ 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp index 759a76de09..27351dee48 100644 --- a/src/printsupport/kernel/qprintengine_win.cpp +++ b/src/printsupport/kernel/qprintengine_win.cpp @@ -1174,16 +1174,6 @@ void QWin32PrintEnginePrivate::doReinit() if (state == QPrinter::Active) { reinit = true; } else { - if (!name.isEmpty()) { - HANDLE hCheckPrinter; - if (!OpenPrinter((LPWSTR)name.utf16(), (LPHANDLE)&hCheckPrinter, 0)) { - initialize(); - return; - } else { - ClosePrinter(hCheckPrinter); - hCheckPrinter = 0; - } - } resetDC(); initDevRects(); reinit = false; @@ -1306,12 +1296,9 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & case PPK_PrinterName: d->name = value.toString(); - if (d->name.isEmpty()) { + if (d->name.isEmpty()) d->queryDefault(); - d->initialize(); - } else { - d->doReinit(); - } + d->initialize(); break; case PPK_Resolution: diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp index 7f872a4ffb..0f7c7f7a84 100644 --- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp +++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp @@ -965,28 +965,28 @@ static void printPage(QPainter *painter) void tst_QPrinter::taskQTBUG4497_reusePrinterOnDifferentFiles() { - TempFileCleanup tmpFile1("out1.ps"); - TempFileCleanup tmpFile2("out2.ps"); + TempFileCleanup tmpFile1("out1.pdf"); + TempFileCleanup tmpFile2("out2.pdf"); QPrinter printer; { - printer.setOutputFileName("out1.ps"); + printer.setOutputFileName("out1.pdf"); QPainter painter(&printer); printPage(&painter); } { - printer.setOutputFileName("out2.ps"); + printer.setOutputFileName("out2.pdf"); QPainter painter(&printer); printPage(&painter); } - QFile file1("out1.ps"); + QFile file1("out1.pdf"); QVERIFY(file1.open(QIODevice::ReadOnly)); - QFile file2("out2.ps"); + QFile file2("out2.pdf"); QVERIFY(file2.open(QIODevice::ReadOnly)); while (!file1.atEnd() && !file2.atEnd()) {