[Libreoffice-commits] .: 3 commits - sc/inc sc/qa sc/source solenv/gbuild

Markus Mohrhard mmohrhard at kemper.freedesktop.org
Fri Nov 18 17:52:33 PST 2011


 sc/inc/nameuno.hxx               |    4 ++--
 sc/qa/unit/filters-test.cxx      |    3 +++
 sc/qa/unit/ucalc.cxx             |   16 +++++++++++++---
 sc/source/ui/unoobj/nameuno.cxx  |    6 +++---
 solenv/gbuild/platform/macosx.mk |    3 +--
 5 files changed, 22 insertions(+), 10 deletions(-)

New commits:
commit 833567fa698e92f3bb9b7ef929093faee59f65f0
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Nov 19 02:48:23 2011 +0100

    don't pass uno interface implementation directly
    
    Passing the implementation instead of an uno reference may result in
    lifetime problems if the passed interface is distroyed while the second
    one is still valid
    see rhbz#579817 with memcheck

diff --git a/sc/inc/nameuno.hxx b/sc/inc/nameuno.hxx
index c082226..4872373 100644
--- a/sc/inc/nameuno.hxx
+++ b/sc/inc/nameuno.hxx
@@ -67,7 +67,7 @@ class ScNamedRangeObj : public ::cppu::WeakImplHelper6<
                         public SfxListener
 {
 private:
-    ScNamedRangesObj*       mpParent;
+    com::sun::star::uno::Reference< com::sun::star::sheet::XNamedRanges > mxParent;
     ScDocShell*             pDocShell;
     String                  aName;
     com::sun::star::uno::Reference< com::sun::star::container::XNamed > mxSheet;
@@ -81,7 +81,7 @@ private:
     SCTAB                   GetTab_Impl();
 
 public:
-                            ScNamedRangeObj(ScNamedRangesObj* pParent, ScDocShell* pDocSh, const String& rNm,
+                            ScNamedRangeObj( com::sun::star::uno::Reference< com::sun::star::sheet::XNamedRanges > xParent, ScDocShell* pDocSh, const String& rNm,
                                     com::sun::star::uno::Reference< com::sun::star::container::XNamed > xSheet = com::sun::star::uno::Reference< com::sun::star::container::XNamed > ());
     virtual                 ~ScNamedRangeObj();
 
diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx
index 7e9a52d..ab23b19 100644
--- a/sc/source/ui/unoobj/nameuno.cxx
+++ b/sc/source/ui/unoobj/nameuno.cxx
@@ -99,8 +99,8 @@ bool lcl_UserVisibleName(const ScRangeData& rData)
     return !rData.HasType(RT_DATABASE) && !rData.HasType(RT_SHARED);
 }
 
-ScNamedRangeObj::ScNamedRangeObj(ScNamedRangesObj* pParent, ScDocShell* pDocSh, const String& rNm, Reference<container::XNamed> xSheet):
-    mpParent(pParent),
+ScNamedRangeObj::ScNamedRangeObj( Reference< sheet::XNamedRanges > xParent, ScDocShell* pDocSh, const String& rNm, Reference<container::XNamed> xSheet):
+    mxParent(xParent),
     pDocShell( pDocSh ),
     aName( rNm ),
     mxSheet( xSheet )
@@ -215,7 +215,7 @@ void ScNamedRangeObj::Modify_Impl( const String* pNewName, const ScTokenArray* p
     if (pNewRanges->insert(pNew))
     {
         ScDocFunc aFunc(*pDocShell);
-        aFunc.SetNewRangeNames(pNewRanges, mpParent->IsModifyAndBroadcast(), nTab);
+        aFunc.SetNewRangeNames(pNewRanges, dynamic_cast<ScNamedRangesObj*>(mxParent.get())->IsModifyAndBroadcast(), nTab);
 
         aName = aInsName;   //! broadcast?
     }
commit 0cb0952a5047ebc28f9e9f1cfa45ea7f0f50be33
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Nov 19 01:29:44 2011 +0100

    little cleanup in ucalc

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index b18bfe0..c4848c2 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -2398,6 +2398,7 @@ void Test::testPostIts()
     rtl::OUString aHello(RTL_CONSTASCII_USTRINGPARAM("Hello world"));
     rtl::OUString aJimBob(RTL_CONSTASCII_USTRINGPARAM("Jim Bob"));
     rtl::OUString aTabName(RTL_CONSTASCII_USTRINGPARAM("PostIts"));
+    rtl::OUString aTabName2(RTL_CONSTASCII_USTRINGPARAM("Table2"));
     m_pDoc->InsertTab(0, aTabName);
 
     ScAddress rAddr(2, 2, 0);
@@ -2422,6 +2423,11 @@ void Test::testPostIts()
     rAddr.IncCol();
     CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNote(rAddr) == pNote);
 
+    m_pDoc->InsertTab(0, aTabName2);
+    CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNote(rAddr) == NULL);
+    rAddr.IncTab();
+    CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNote(rAddr) == pNote);
+
     m_pDoc->DeleteTab(0);
 }
 
@@ -2716,9 +2722,7 @@ void Test::testMergedCells()
 void Test::testUpdateReference()
 {
     //test that formulas are correctly updated during sheet delete
-    //TODO: add test cases for InsertTabs/InsertTab and DeleteTabs
-    //TODO: add tests for references to other sheets, relative references, updating of named ranges, ...
-    //TODO: maybe rename then to testUpdateReference
+    //TODO: add tests for relative references, updating of named ranges, ...
     rtl::OUString aSheet1(RTL_CONSTASCII_USTRINGPARAM("Sheet1"));
     rtl::OUString aSheet2(RTL_CONSTASCII_USTRINGPARAM("Sheet2"));
     rtl::OUString aSheet3(RTL_CONSTASCII_USTRINGPARAM("Sheet3"));
@@ -2766,6 +2770,7 @@ void Test::testUpdateReference()
     m_pDoc->GetValue(2,1,2, aValue);
     CPPUNIT_ASSERT_MESSAGE("after inserting second sheet formula does not return correct result", aValue == 5);
 
+    //test new DeleteTabs/InsertTabs methods
     m_pDoc->DeleteTabs(0, 2);
     m_pDoc->GetValue(2, 0, 0, aValue);
     CPPUNIT_ASSERT_MESSAGE("after deleting sheets formula does not return correct result", aValue == 3);
@@ -2784,6 +2789,11 @@ void Test::testUpdateReference()
     CPPUNIT_ASSERT_MESSAGE("after inserting sheets formula does not return correct result", aValue == 3);
     m_pDoc->GetValue(2, 1, 2, aValue);
     CPPUNIT_ASSERT_MESSAGE("after inserting sheets formula does not return correct result", aValue == 5);
+
+    m_pDoc->DeleteTab(3);
+    m_pDoc->DeleteTab(2);
+    m_pDoc->DeleteTab(1);
+    m_pDoc->DeleteTab(0);
 }
 
 
commit ed398366d510024e32d7124315c6e432bbe4ed0c
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Nov 18 22:59:46 2011 +0100

    remove libsqlite from macosx library path again and disable testPassword there

diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index 195d5ef..cb99cd1 100644
--- a/sc/qa/unit/filters-test.cxx
+++ b/sc/qa/unit/filters-test.cxx
@@ -199,7 +199,10 @@ public:
     CPPUNIT_TEST(testBugFixesODS);
     CPPUNIT_TEST(testBugFixesXLS);
     CPPUNIT_TEST(testBugFixesXLSX);
+    //disable testPassword on MacOSX due to problems with libsqlite3
+#if !defined(MACOSX)
     CPPUNIT_TEST(testPassword);
+#endif
 
 #if TEST_BUG_FILES
     CPPUNIT_TEST(testBugFiles);
diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk
index 9d70d0b..4b84db4 100644
--- a/solenv/gbuild/platform/macosx.mk
+++ b/solenv/gbuild/platform/macosx.mk
@@ -363,8 +363,7 @@ endef
 
 # CppunitTest class
 
-gb_CppunitTest_CPPTESTPRECOMMAND := \
-    $(call gb_Helper_extend_ld_path,$(OUTDIR_FOR_BUILD)/lib/sqlite)
+gb_CppunitTest_CPPTESTPRECOMMAND := $(gb_Helper_set_ld_path)
 gb_CppunitTest_SYSPRE := libtest_
 gb_CppunitTest_EXT := .dylib
 gb_CppunitTest_LIBDIR := $(gb_Helper_OUTDIRLIBDIR)


More information about the Libreoffice-commits mailing list