diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/ring.hxx | 3 | ||||
-rw-r--r-- | sw/qa/core/uwriter.cxx | 8 |
2 files changed, 11 insertions, 0 deletions
diff --git a/sw/inc/ring.hxx b/sw/inc/ring.hxx index bd5c6348475d..913d62a362b6 100644 --- a/sw/inc/ring.hxx +++ b/sw/inc/ring.hxx @@ -85,6 +85,9 @@ namespace sw /** @return the previous item in the ring container */ const_value_type* GetPrevInRing() const { return pPrev; } + /** @return true if and only if this item is alone in its ring */ + bool unique() const + { return algo::unique(static_cast< const_value_type* >(this)); } private: /** internal implementation class -- not for external use */ diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index e69229aecd44..e1de0209d6f4 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -1282,6 +1282,8 @@ namespace { return GetNextInRing(); } TestRing* GetPrev() { return GetPrevInRing(); } + bool lonely() const + { return unique(); } #if 0 void debug() { @@ -1301,11 +1303,17 @@ void SwDocTest::testIntrusiveRing() vRings.push_back(&aRing4); vRings.push_back(&aRing5); CPPUNIT_ASSERT_EQUAL(aRing1.GetRingContainer().size(), static_cast<size_t>(1)); + CPPUNIT_ASSERT(aRing1.lonely()); + CPPUNIT_ASSERT(aRing2.lonely()); + CPPUNIT_ASSERT(aRing3.lonely()); aRing2.MoveTo(&aRing1); aRing3.MoveTo(&aRing1); CPPUNIT_ASSERT_EQUAL(aRing1.GetRingContainer().size(), static_cast<size_t>(3)); CPPUNIT_ASSERT_EQUAL(aRing2.GetRingContainer().size(), static_cast<size_t>(3)); CPPUNIT_ASSERT_EQUAL(aRing3.GetRingContainer().size(), static_cast<size_t>(3)); + CPPUNIT_ASSERT(!aRing1.lonely()); + CPPUNIT_ASSERT(!aRing2.lonely()); + CPPUNIT_ASSERT(!aRing3.lonely()); aRing5.MoveTo(&aRing4); CPPUNIT_ASSERT_EQUAL(aRing4.GetRingContainer().size(), static_cast<size_t>(2)); aRing4.GetRingContainer().merge(aRing1.GetRingContainer()); |