summaryrefslogtreecommitdiffstats
path: root/tests/auto/printsupport/kernel
diff options
context:
space:
mode:
authorJohn Layt <jlayt@kde.org>2012-05-14 20:27:21 +0100
committerQt by Nokia <qt-info@nokia.com>2012-05-23 23:55:43 +0200
commitf3ad57e90ecc33f3d4de7bf8d612abc0ccb2fb6e (patch)
tree5fe5fae79d664224376938c4c9405a5652495d82 /tests/auto/printsupport/kernel
parente9d20b1951657ace845f730df3c924ddadcf15af (diff)
QtPrintSupport - Fix Mac printerName() use
Mac in Qt4 and 5 has been using the PMPrinter Name for the QPrinter and QPrinterInfo printerName() value, but this is incorrect. This is in fact the CUPS Description field, is in human readable form and is not guaranteed to be unique. The CUPS Name field is the PMPrinter ID value and should be used as the unique identifier when accessing printers. This has worked up to now due to an undocumented feature in the OSX api that accepted the Name when the ID should be used. Changing all uses of PMPrinterGetName to PMPrinterGetID fixes this and allows the QPrinterInfo test of names to pass without munging the names. Change-Id: I25322aa1a924bed9f67f4ad5e208274c8b700e17 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: John Layt <jlayt@kde.org>
Diffstat (limited to 'tests/auto/printsupport/kernel')
-rw-r--r--tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp15
1 files changed, 0 insertions, 15 deletions
diff --git a/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp b/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp
index 404aa06399..70a00edb10 100644
--- a/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp
+++ b/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp
@@ -70,7 +70,6 @@ private slots:
void testAssignment();
private:
- void macFixNameFormat(QString *printerName);
QString getDefaultPrinterFromSystem();
QStringList getPrintersFromSystem();
@@ -86,18 +85,6 @@ void tst_QPrinterInfo::initTestCase()
#else
-void tst_QPrinterInfo::macFixNameFormat(QString *printerName)
-{
-// Modify the format of the printer name to match Qt, lpstat returns
-// foo___domain_no, Qt returns foo @ domain.no
-#ifdef Q_OS_MAC
- printerName->replace(QLatin1String("___"), QLatin1String(" @ "));
- printerName->replace(QLatin1String("_"), QLatin1String("."));
-#else
- Q_UNUSED(printerName);
-#endif
-}
-
QString tst_QPrinterInfo::getDefaultPrinterFromSystem()
{
QStringList command;
@@ -113,7 +100,6 @@ QString tst_QPrinterInfo::getDefaultPrinterFromSystem()
QRegExp defaultReg("default.*: *([a-zA-Z0-9_-]+)");
defaultReg.indexIn(output);
QString printer = defaultReg.cap(1);
- macFixNameFormat(&printer);
return printer;
}
@@ -130,7 +116,6 @@ QStringList tst_QPrinterInfo::getPrintersFromSystem()
for (int c = 0; c < list.size(); ++c) {
if (reg.indexIn(list[c]) >= 0) {
QString printer = reg.cap(1);
- macFixNameFormat(&printer);
ans << printer;
}
}