From 6260df3316cf7a3756fa8616f5e7f2561acabea1 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 5 Apr 2011 17:57:29 +1000 Subject: 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 --- tests/auto/qpointer/tst_qpointer.cpp | 7 +++++++ 1 file changed, 7 insertions(+) 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(object)); QCOMPARE(p1, QPointer(p2)); + // Test assignment with the same pointer that's already guarded + p1 = object; + p2 = p1; + QCOMPARE(p1, QPointer(object)); + QCOMPARE(p2, QPointer(object)); + QCOMPARE(p1, QPointer(p2)); + // Cleanup delete object; } -- cgit v0.12