summaryrefslogtreecommitdiffstats
path: root/tests/auto/printsupport/kernel/qprinterinfo
diff options
context:
space:
mode:
authorJohn Layt <jlayt@kde.org>2013-11-25 20:36:58 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-26 18:45:10 +0100
commitdb4afbef7d1e2405a3b8f007e9009f509b4a3eac (patch)
tree443b4405a5d7c464e7b9e15b75a7268a91c8bf34 /tests/auto/printsupport/kernel/qprinterinfo
parent42fa59b151eb4a6fecbe5b5672112c9f78b856a9 (diff)
QPrinterInfo - Fix isNull() by fixing constructors
The QPrinterInfo copy and QPrinter constructors and the assignment operator were not taking the shared_null into account, and so any use of them resulted in a new null QPrinterInfo different to shared_null, which lead to isNull() always returning true in anything other than the simplest use case. While fixing this also make the shared_null a Q_GLOBAL_STATIC. Task-number: QTBUG-21087 Change-Id: I0beb24088208e9ed58d21ca26b0c8d00b02e5b8f Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'tests/auto/printsupport/kernel/qprinterinfo')
-rw-r--r--tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp b/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp
index 7deb31c2c9..9416224440 100644
--- a/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp
+++ b/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp
@@ -275,6 +275,9 @@ void tst_QPrinterInfo::testConstructors()
QCOMPARE(null.printerName(), QString());
QVERIFY(null.isNull());
+ QPrinterInfo null2(null);
+ QVERIFY(null2.isNull());
+
QList<QPrinterInfo> printers = QPrinterInfo::availablePrinters();
for (int i = 0; i < printers.size(); ++i) {
@@ -295,6 +298,12 @@ void tst_QPrinterInfo::testConstructors()
void tst_QPrinterInfo::testAssignment()
{
+ QPrinterInfo null;
+ QVERIFY(null.isNull());
+ QPrinterInfo null2;
+ null2 = null;
+ QVERIFY(null2.isNull());
+
QList<QPrinterInfo> printers = QPrinterInfo::availablePrinters();
for (int i = 0; i < printers.size(); ++i) {