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 <andy.shaw@digia.com>
This commit is contained in:
Titta Heikkala 2012-09-06 12:58:18 +03:00 committed by The Qt Project
parent 2097b9193f
commit bdcece7d46
2 changed files with 8 additions and 21 deletions

View File

@ -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:

View File

@ -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()) {