diff options
author | Jesus Fernandez <jesus.fernandez@qt.io> | 2018-10-04 16:49:34 +0200 |
---|---|---|
committer | Mikhail Svetkin <mikhail.svetkin@qt.io> | 2018-12-10 22:14:56 +0000 |
commit | b3008f8e253f5fca2c7d3328badcfeb189181652 (patch) | |
tree | 5b7de815fe970718eedd5fb7e47489b17c3ddcb5 /tests | |
parent | 177577932e89772ef7ab281dd5771d5c66ad3a93 (diff) |
Use QScopedPointer instead of new/delete
Change-Id: I0651ad0244c1b4d3126a1dd3304f247f92240ffa
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/kernel/qobject/tst_qobject.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 68a92ebcc3..31268c5cf3 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -41,6 +41,7 @@ #include <QThread> #include <QMutex> #include <QWaitCondition> +#include <QScopedPointer> #if QT_CONFIG(process) # include <QProcess> #endif @@ -500,14 +501,13 @@ void tst_QObject::connectSlotsByName() void tst_QObject::qobject_castTemplate() { - QObject *o = 0; - QVERIFY( !::qobject_cast<QObject*>(o) ); + QScopedPointer<QObject> o; + QVERIFY(!::qobject_cast<QObject*>(o.data())); - o = new SenderObject; - QVERIFY( ::qobject_cast<SenderObject*>(o) ); - QVERIFY( ::qobject_cast<QObject*>(o) ); - QVERIFY( !::qobject_cast<ReceiverObject*>(o) ); - delete o; + o.reset(new SenderObject); + QVERIFY(::qobject_cast<SenderObject*>(o.data())); + QVERIFY(::qobject_cast<QObject*>(o.data())); + QVERIFY(!::qobject_cast<ReceiverObject*>(o.data())); } void tst_QObject::findChildren() |