Anonymous avatar Anonymous committed aafeabd

swbookmarkfixes01: cleanup of unit test helpers

Comments (0)

Files changed (9)

sw/inc/PageDescDisposingHint.hxx

 
 #include <svl/hint.hxx>
 
+class SwPageDesc;
+
 namespace sw { namespace pagedesc {
 
 class SW_DLLPUBLIC PageDescDisposingHint : public SfxHint
 {
     public:
         PageDescDisposingHint(const SwPageDesc* const pPageDesc) : m_pPageDesc(pPageDesc) {};
+        virtual ~PageDescDisposingHint() {};
         const SwPageDesc* GetPageDesc() const { return m_pPageDesc; };
     private:
         const SwPageDesc* const m_pPageDesc;

sw/inc/StyleOperationHint.hxx

             , m_eFamily(eFamily)
             , m_nOp(nOp)
         {};
+        virtual ~StyleOperationHint() {};
         const String& GetName() const { return m_rName; };
         SfxStyleFamily GetStyleFamily() const { return m_eFamily; };
         sal_Int32 GetOp() const { return m_nOp; };

sw/qa/core/PageDescManager/PageDescManagerTest.cxx

 #include <cppunit/extensions/HelperMacros.h>
 #include <cppunit/plugin/TestPlugIn.h>
 
+#include <set>
+#include <vector>
+
 #include <boost/scoped_ptr.hpp>
 #include <boost/shared_ptr.hpp>
 
-#include <tools/rtti.hxx>
-#include <rsc/rscsfx.hxx>
-#include <svl/style.hxx>
-#include <editeng/frmdir.hxx>
-#include <set>
-#include <vector>
+#include <swatrset.hxx>
+#include <init.hxx>
+#include <svl/brdcst.hxx>
 
-#include <swatrset.hxx>
-#include <hintids.hxx>
-#include <init.hxx>
-
-#include <mock/FormatAccessMockBase.hxx>
-#include <mock/UndoRedoMockBase.hxx>
-#include <mock/InterfaceProviderMockBase.hxx>
-#include <source/core/doc/PageDescManager.hxx>
 #include <StyleOperationHint.hxx>
 #include <CheckPageDescHint.hxx>
 #include <PageDescDisposingHint.hxx>
+
+#include <mock/ApplicationMockBase.hxx>
+#include <mock/FormatAccessMockBase.hxx>
+#include <mock/InterfaceProviderMockBase.hxx>
+#include <mock/UndoRedoMockBase.hxx>
+#include <mock/BroadcastRecorderBase.hxx>
+
+#include <source/core/doc/PageDescManager.hxx>
 #include <pagedesc.hxx>
 #include <SwUndoPageDesc.hxx>
 
-#include <swapplication.hxx>
-#include <i18npool/lang.h>
-
-namespace sw { namespace mock
-{
-    struct ApplicationMock : public ::sw::Application
-    {
-        virtual LanguageType GetLanguage()
-            { return LANGUAGE_SYSTEM; }
-        virtual Size GetDefaultPaperSize(MapUnit)
-            { return Size(100, 100); }
-        virtual MeasurementSystem GetMeasurementSystem()
-            { return MEASURE_METRIC; }
-    };
-}}
-
-namespace
-{
-
-    struct UndoRedoMock : public ::sw::mock::UndoRedoMockBase
-    {
-        UndoRedoMock() : m_isActive(false), m_isModified(false) {};
-        bool m_isActive;
-        bool m_isModified;
-        ::std::vector< ::boost::shared_ptr<SwUndo> > m_vUndos;
-        virtual void DoUndo(bool bOn) { m_isActive = bOn; };
-        virtual bool DoesUndo() const { return m_isActive; };
-        virtual void AppendUndo(SwUndo* pUndo)
-            { m_vUndos.push_back(::boost::shared_ptr<SwUndo>(pUndo)); }
-        virtual void SetModified() { m_isModified = true; }
-    };
-}
 
 using namespace ::boost;
 using namespace ::std;
 using namespace ::sw::style;
 using namespace ::sw::mock;
 using namespace ::sw::format;
+
+#include <svl/lstner.hxx>
 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)
         {
             //OSL_TRACE("Received hint of type %s", typeid(rHint).name());
                 RecordHint(rBC, new SfxHint(rHint));
             }
         }
-        void RecordHint(SfxBroadcaster& rBC, const SfxHint* pHint)
-        {
-            //OSL_TRACE("Recording hint of type %s", typeid(*pHint).name());
-            record_type aRecord(&rBC, shared_ptr<const SfxHint>(pHint));
-            m_vHints.push_back(aRecord);
-        }
     };
 }
 
             void Setup();
             void AddPageDesc(const String& rName);
             scoped_ptr<InterfaceProviderMockBase> m_pInterfaceProvider;
-            scoped_ptr<UndoRedoMock> m_pUndoRedo;
+            scoped_ptr<UndoRedoMockBase> m_pUndoRedo;
             scoped_ptr<FormatAccessMockBase> m_pFormatAccess;
             scoped_ptr<SwAttrPool> m_pPool;
             scoped_ptr<SfxBroadcaster> m_pStyleOperationBroadcaster;
         PageDescManagerTest::isSwCoreInitialized = true;
     }
     m_pInterfaceProvider.reset(new InterfaceProviderMockBase());
-    m_pUndoRedo.reset(new UndoRedoMock());
+    m_pUndoRedo.reset(new UndoRedoMockBase());
     m_pInterfaceProvider->m_pUndoRedo = m_pUndoRedo.get();
     m_pFormatAccess.reset(new FormatAccessMockBase());
     m_pInterfaceProvider->m_pFormatAccess = m_pFormatAccess.get();

sw/qa/core/inc/mock/ApplicationMockBase.hxx

+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org.  If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef SWAPPLICATIONMOCKBASE_HXX
+#define SWAPPLICATIONMOCKBASE_HXX
+
+#include <swapplication.hxx>
+
+namespace sw { namespace mock
+{
+    struct ApplicationMock : public ::sw::Application
+    {
+        virtual LanguageType GetLanguage()
+            { return LANGUAGE_SYSTEM; }
+        virtual Size GetDefaultPaperSize(MapUnit)
+            { return Size(100, 100); }
+        virtual MeasurementSystem GetMeasurementSystem()
+            { return MEASURE_METRIC; }
+    };
+}}
+
+#endif

sw/qa/core/inc/mock/BroadcastRecorderBase.hxx

+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org.  If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+#ifndef SW_MOCK_BROADCASTRECORDERBASE_HXX
+#define SW_MOCK_BROADCASTRECORDERBASE_HXX
+
+#include <svl/lstner.hxx>
+
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+class SfxHint;
+
+namespace sw { namespace mock
+{
+    struct BroadcastRecorderBase : public SfxListener
+    {
+        typedef ::std::pair< SfxBroadcaster*, ::boost::shared_ptr<const SfxHint> > record_type;
+        typedef ::std::vector<record_type> container_type;
+        container_type m_vHints;
+        void RecordHint(SfxBroadcaster& rBC, const SfxHint* pHint)
+        {
+            //OSL_TRACE("Recording hint of type %s", typeid(*pHint).name());
+            record_type aRecord(&rBC, ::boost::shared_ptr<const SfxHint>(pHint));
+            m_vHints.push_back(aRecord);
+        }
+    };
+}}
+
+#endif

sw/qa/core/inc/mock/FootnoteAccessMockBase.hxx

 
 namespace sw { namespace mock
 {
-    class FootnoteAccessMockBase : public ::sw::pagedesc::IDocumentFootnoteAccess
+    struct FootnoteAccessMockBase : public ::sw::pagedesc::IDocumentFootnoteAccess
     {
         public:
             virtual const SwFtnInfo& GetFtnInfo() const { return *((SwFtnInfo*)NULL); }

sw/qa/core/inc/mock/FormatAccessMockBase.hxx

 
 namespace sw { namespace mock
 {
-    class FormatAccessMockBase : public ::sw::format::IDocumentFormatAccess
+    struct FormatAccessMockBase : public ::sw::format::IDocumentFormatAccess
     {
         public:
             FormatAccessMockBase() {};

sw/qa/core/inc/mock/LayoutAccessMockBase.hxx

 
 namespace sw { namespace mock {
 
-class LayoutAccessMockBase : public IDocumentLayoutAccess
+struct LayoutAccessMockBase : public IDocumentLayoutAccess
 {
     public:
         LayoutAccessMockBase() {};

sw/qa/core/inc/mock/UndoRedoMockBase.hxx

 #define UNDOREDOMOCKBASE_HXX_INCLUDED
 
 #include <IDocumentUndoRedo.hxx>
+#include <vector>
+#include <boost/shared_ptr.hpp>
 
+class SwUndo;
 
 namespace sw { namespace mock {
 
-class UndoRedoMockBase : public IDocumentUndoRedo
+struct UndoRedoMockBase : public IDocumentUndoRedo
 {
     public:
-        UndoRedoMockBase() {};
+        UndoRedoMockBase() : m_isActive(false), m_isModified(false) {};
         virtual void SetUndoNoResetModified() {};
         virtual bool IsUndoNoResetModified() const {return false; };
-        virtual void DoUndo(bool) {};
-        virtual bool DoesUndo() const { return false; };
+        virtual void DoUndo(bool bOn) { m_isActive = bOn; };
+        virtual bool DoesUndo() const { return m_isActive; };
         virtual void DoGroupUndo(bool) {};
         virtual bool DoesGroupUndo() const { return false; };
         virtual bool Undo(SwUndoIter&) { return false; };
         virtual bool Repeat(SwUndoIter&, sal_uInt16) { return false; };
         virtual SwUndoId GetRepeatIds(String*, SwUndoIds*) const { return SwUndoId(); };
         virtual String GetRepeatIdsStr(String*, SwUndoIds*) const { return String(); };
-        virtual void AppendUndo(SwUndo*) {};
+        virtual void AppendUndo(SwUndo* pUndo)
+            { m_vUndos.push_back(::boost::shared_ptr<SwUndo>(pUndo)); }
         virtual void ClearRedo() {};
         virtual void setUndoNoModifiedPosition( SwUndoNoModifiedPosition ) {};
         virtual SwUndoNoModifiedPosition getUndoNoModifiedPosition() const { return SwUndoNoModifiedPosition(); };
-        virtual void SetModified() {};
+        virtual void SetModified() { m_isModified = true; }
+
+        bool m_isActive;
+        bool m_isModified;
+        ::std::vector< ::boost::shared_ptr<SwUndo> > m_vUndos;
 };
 
 }}
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.