summaryrefslogtreecommitdiff
path: root/tests/auto/qpointer
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-04-05 17:57:29 +1000
committerJason McDonald <jason.mcdonald@nokia.com>2011-04-05 17:57:29 +1000
commit6260df3316cf7a3756fa8616f5e7f2561acabea1 (patch)
tree89472ead58f087da4beb26aa1007ea428eb559b2 /tests/auto/qpointer
parent6349d6aed801354167038a094b62ad91de6b8b57 (diff)
downloadqt4-tools-6260df3316cf7a3756fa8616f5e7f2561acabea1.tar.gz
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/auto/qpointer')
-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 b8a3da2090..7bc5fb6a5b 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;
}