From 5e79415218cbb2dcd74aa9613ab0bbe53e28f5a6 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 5 Jun 2012 13:13:20 +0200 Subject: [PATCH] Make qpointer autotest build without widgets Change-Id: Ibd05a49174e7055faa89c48659130a11418b9616 Reviewed-by: Lars Knoll Reviewed-by: Debao Zhang Reviewed-by: Thiago Macieira --- tests/auto/corelib/kernel/qpointer/qpointer.pro | 3 ++- tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/auto/corelib/kernel/qpointer/qpointer.pro b/tests/auto/corelib/kernel/qpointer/qpointer.pro index e9b4b59719..87dcdba262 100644 --- a/tests/auto/corelib/kernel/qpointer/qpointer.pro +++ b/tests/auto/corelib/kernel/qpointer/qpointer.pro @@ -1,5 +1,6 @@ CONFIG += testcase CONFIG += parallel_test TARGET = tst_qpointer -QT += widgets testlib +QT += testlib +!contains(QT_CONFIG, no-widgets): QT += widgets SOURCES = tst_qpointer.cpp diff --git a/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp b/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp index 9eac2b78be..3540df17ac 100644 --- a/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp +++ b/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp @@ -42,7 +42,9 @@ #include #include +#ifndef QT_NO_WIDGETS #include +#endif class tst_QPointer : public QObject { @@ -138,7 +140,9 @@ void tst_QPointer::equality_operators() QVERIFY(p1 == p2); QObject *object = 0; +#ifndef QT_NO_WIDGETS QWidget *widget = 0; +#endif p1 = object; QVERIFY(p1 == p2); @@ -162,10 +166,12 @@ void tst_QPointer::equality_operators() QVERIFY(object == p1); QVERIFY(p2 != object); QVERIFY(object != p2); +#ifndef QT_NO_WIDGETS QVERIFY(p1 == widget); QVERIFY(widget == p1); QVERIFY(p2 != widget); QVERIFY(widget != p2); +#endif } void tst_QPointer::isNull() @@ -228,6 +234,7 @@ ChildObject::~ChildObject() QCOMPARE(qobject_cast(guardedPointer), static_cast(0)); } +#ifndef QT_NO_WIDGETS class ChildWidget : public QWidget { QPointer guardedPointer; @@ -244,6 +251,7 @@ ChildWidget::~ChildWidget() QCOMPARE(static_cast(guardedPointer), parentWidget()); QCOMPARE(qobject_cast(guardedPointer), parentWidget()); } +#endif class DerivedChild; @@ -297,11 +305,13 @@ void tst_QPointer::castDuringDestruction() delete parentObject; } +#ifndef QT_NO_WIDGETS { QWidget *parentWidget = new QWidget(); (void) new ChildWidget(parentWidget); delete parentWidget; } +#endif { delete new DerivedParent();