summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-04-05 07:57:29 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2011-04-05 07:57:29 (GMT)
commit6260df3316cf7a3756fa8616f5e7f2561acabea1 (patch)
tree89472ead58f087da4beb26aa1007ea428eb559b2 /tests
parent6349d6aed801354167038a094b62ad91de6b8b57 (diff)
downloadQt-6260df3316cf7a3756fa8616f5e7f2561acabea1.zip
Qt-6260df3316cf7a3756fa8616f5e7f2561acabea1.tar.gz
Qt-6260df3316cf7a3756fa8616f5e7f2561acabea1.tar.bz2
Improve coverage of qpointer autotest
Coverage analysis revealed that the assignment test was not exercising code that shortcuts assignment when assigning the value that is already held. Reviewed-by: Rohan McGovern
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qpointer/tst_qpointer.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/auto/qpointer/tst_qpointer.cpp b/tests/auto/qpointer/tst_qpointer.cpp
index b8a3da2..7bc5fb6 100644
--- a/tests/auto/qpointer/tst_qpointer.cpp
+++ b/tests/auto/qpointer/tst_qpointer.cpp
@@ -121,6 +121,13 @@ void tst_QPointer::assignment_operators()
QCOMPARE(p2, QPointer<QObject>(object));
QCOMPARE(p1, QPointer<QObject>(p2));
+ // Test assignment with the same pointer that's already guarded
+ p1 = object;
+ p2 = p1;
+ QCOMPARE(p1, QPointer<QObject>(object));
+ QCOMPARE(p2, QPointer<QObject>(object));
+ QCOMPARE(p1, QPointer<QObject>(p2));
+
// Cleanup
delete object;
}