summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2017-09-15 17:08:15 +0100
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2017-09-17 11:42:26 +0000
commitfc208838aef911e4ac1a498115160e50491ceb1e (patch)
treecb574ea32781ab716e4d26285b170c0da25cd869 /tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp
parent72f700edd66f59ee6b7af1ec55bbd9645e680653 (diff)
QScopedPointer: add get()
For self-consistency with QSharedPointer and minor consistency with std::unique_ptr (although QScopedPointer isn't movable, so we can't claim STL compatibility with it). [ChangeLog][QtCore][QScopedPointer] Added get(). Change-Id: Ib58f936afa0e0d5bce57a61d1467b69956f37ceb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp')
-rw-r--r--tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp b/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp
index a4b06d1b3b..b943b04e23 100644
--- a/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp
+++ b/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp
@@ -68,6 +68,7 @@ void tst_QScopedPointer::defaultConstructor()
/* Check that the members, one, is correctly initialized. */
QScopedPointer<int> p;
QCOMPARE(p.data(), static_cast<int *>(0));
+ QCOMPARE(p.get(), static_cast<int *>(0));
}
void tst_QScopedPointer::dataOnDefaultConstructed()
@@ -75,6 +76,7 @@ void tst_QScopedPointer::dataOnDefaultConstructed()
QScopedPointer<int> p;
QCOMPARE(p.data(), static_cast<int *>(0));
+ QCOMPARE(p.get(), static_cast<int *>(0));
}
class MyClass
@@ -113,6 +115,7 @@ void tst_QScopedPointer::reset()
QScopedPointer<int> p;
p.reset();
QCOMPARE(p.data(), static_cast<int *>(0));
+ QCOMPARE(p.get(), static_cast<int *>(0));
}
/* Call reset() on an active value. */
@@ -120,6 +123,7 @@ void tst_QScopedPointer::reset()
QScopedPointer<int> p(new int(3));
p.reset();
QCOMPARE(p.data(), static_cast<int *>(0));
+ QCOMPARE(p.get(), static_cast<int *>(0));
}
/* Call reset() with a value, on an active value. */
@@ -129,6 +133,7 @@ void tst_QScopedPointer::reset()
int *const value = new int(9);
p.reset(value);
QCOMPARE(*p.data(), 9);
+ QCOMPARE(*p.get(), 9);
}
/* Call reset() with a value, on default constructed value. */
@@ -138,6 +143,7 @@ void tst_QScopedPointer::reset()
int *const value = new int(9);
p.reset(value);
QCOMPARE(*p.data(), 9);
+ QCOMPARE(*p.get(), 9);
}
}