Commits

Anonymous committed b3822d8

swbookmarkfixes01: merged relevant changes from the branch testing a live sw lib

Comments (0)

Files changed (1)

sw/qa/core/PageDescManager/PageDescManagerTest.cxx

 {
     public:
         SwPageDesc() {};
-        SwPageDesc(const String& rName, SwFrmFmt*, SwAttrPool*, SvxFrameDirection) : m_sName(rName) {};
-        SwPageDesc(const String& rName, SwFrmFmt*, SwAttrPool*) : m_sName(rName) {};
+        SwPageDesc(const String& rName, SwFrmFmt*, SwAttrPool*, SvxFrameDirection) : m_sName(rName), m_pFollow(this) {};
+        SwPageDesc(const String& rName, SwFrmFmt*, SwAttrPool*) : m_sName(rName), m_pFollow(this) {};
         SwPageDesc(const SwPageDesc& rOther) : m_sName(rOther.m_sName), m_nFmtId(rOther.m_nFmtId) {};
         String GetName() const { return m_sName; };
         void SetName(const String& rName) { m_sName = rName; };
         SwFrmFmt& GetLeft() { return *((SwFrmFmt*)NULL); };
         SwFrmFmt& GetMaster() { return *((SwFrmFmt*)NULL); };
-        SwPageDesc* GetFollow() { return NULL; };
-        void SetFollow(SwPageDesc*) {};
+        SwPageDesc* GetFollow() { return m_pFollow; };
+        void SetFollow(SwPageDesc* pFollow) { m_pFollow = pFollow; };
         const SwPageDesc* GetFollow() const { return NULL; };
         void Dispose() {};
         bool HasInvalidPageFormat() const { return true; };
         USHORT m_nFmtId;
         USHORT m_nHid;
         BYTE  m_nHfid;
+        SwPageDesc* m_pFollow;
 };
 class SwPageDescExt : public SwPageDesc {};
 
 #include <mock/FormatAccessMockBase.hxx>
 #include <mock/UndoRedoMockBase.hxx>
+#include <mock/BroadcastRecorderBase.hxx>
+
 namespace
 {
     struct UndoRedoMock : public ::sw::mock::UndoRedoMockBase
 using namespace ::sw::mock;
 namespace
 {
-    struct BroadcastRecorder : public SfxListener
+    struct BroadcastRecorder : public BroadcastRecorderBase
     {
-        typedef pair< SfxBroadcaster*, shared_ptr<const SfxHint> > record_type;
-        typedef vector<record_type> container_type;
-        container_type m_vHints;
         virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
         {
             if( const StyleOperationHint* pStyleHint = dynamic_cast<const StyleOperationHint*>(&rHint) )
             else
                 RecordHint(rBC, new SfxHint(rHint));
         }
-        void RecordHint(SfxBroadcaster& rBC, const SfxHint* pHint)
-        {
-            record_type aRecord(&rBC, shared_ptr<const SfxHint>(pHint));
-            m_vHints.push_back(aRecord);
-        }
     };
 }
 namespace sw { namespace test
     CPPUNIT_ASSERT(--nCount==m_pPageDescAccess->GetPageDescCnt());
     CPPUNIT_ASSERT(m_pPageDescAccess->GetPageDescByName(our_sOtherName)==NULL);
     const BroadcastRecorder::container_type* pHints(&m_pBroadcastRecorder->m_vHints);
-    CPPUNIT_ASSERT(pHints->size() == 1);
+    CPPUNIT_ASSERT(pHints->size() == 2);
     CPPUNIT_ASSERT((*pHints)[0].first == m_pModelEventBroadcaster.get());
-    CPPUNIT_ASSERT(dynamic_cast<const PageDescDisposingHint*>((*pHints)[0].second.get()));
+    CPPUNIT_ASSERT((*pHints)[1].first == m_pModelEventBroadcaster.get());
+    CPPUNIT_ASSERT(dynamic_cast<const CheckPageDescHint*>((*pHints)[0].second.get()));
+    CPPUNIT_ASSERT(dynamic_cast<const PageDescDisposingHint*>((*pHints)[1].second.get()));
 
     nCount = m_pPageDescAccess->GetPageDescCnt();
     m_pPageDescAccess->DelPageDesc(m_pPageDescAccess->GetDefaultPageDesc()->GetName());
     CPPUNIT_ASSERT(nCount==m_pPageDescAccess->GetPageDescCnt());
     CPPUNIT_ASSERT(m_pPageDescAccess->GetDefaultPageDesc());
-    CPPUNIT_ASSERT(pHints->size() == 1);
+    CPPUNIT_ASSERT(pHints->size() == 2);
 }
 
 void PageDescManagerTest::DelPageDesc_Undo()
     CPPUNIT_ASSERT(m_pPageDescAccess->GetDefaultPageDesc());
 
     const BroadcastRecorder::container_type* pHints(&m_pBroadcastRecorder->m_vHints);
-    CPPUNIT_ASSERT(pHints->size() == 3);
+    CPPUNIT_ASSERT(pHints->size() == 6);
     CPPUNIT_ASSERT((*pHints)[0].first == m_pModelEventBroadcaster.get());
     CPPUNIT_ASSERT((*pHints)[1].first == m_pModelEventBroadcaster.get());
     CPPUNIT_ASSERT((*pHints)[2].first == m_pModelEventBroadcaster.get());
-    CPPUNIT_ASSERT(dynamic_cast<const PageDescDisposingHint*>((*pHints)[0].second.get()));
+    CPPUNIT_ASSERT((*pHints)[3].first == m_pModelEventBroadcaster.get());
+    CPPUNIT_ASSERT((*pHints)[4].first == m_pModelEventBroadcaster.get());
+    CPPUNIT_ASSERT((*pHints)[5].first == m_pModelEventBroadcaster.get());
+    CPPUNIT_ASSERT(dynamic_cast<const CheckPageDescHint*>((*pHints)[0].second.get()));
     CPPUNIT_ASSERT(dynamic_cast<const PageDescDisposingHint*>((*pHints)[1].second.get()));
-    CPPUNIT_ASSERT(dynamic_cast<const PageDescDisposingHint*>((*pHints)[2].second.get()));
+    CPPUNIT_ASSERT(dynamic_cast<const CheckPageDescHint*>((*pHints)[2].second.get()));
+    CPPUNIT_ASSERT(dynamic_cast<const PageDescDisposingHint*>((*pHints)[3].second.get()));
+    CPPUNIT_ASSERT(dynamic_cast<const CheckPageDescHint*>((*pHints)[4].second.get()));
+    CPPUNIT_ASSERT(dynamic_cast<const PageDescDisposingHint*>((*pHints)[5].second.get()));
 }
 
 namespace
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.