[Libreoffice-commits] core.git: sc/inc sc/qa

Jan Holesovsky kendy at collabora.com
Mon Nov 10 03:24:29 PST 2014


 sc/inc/inputopt.hxx         |    3 ++-
 sc/inc/scmod.hxx            |    4 ++--
 sc/qa/unit/filters-test.cxx |   21 +++++++++++++++++++++
 3 files changed, 25 insertions(+), 3 deletions(-)

New commits:
commit 447d523fa7c6c82476f9ee48e4b9c82cfad05c50
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon Nov 10 12:17:35 2014 +0100

    fdo#85584: Adapt the unit test to the new default.
    
    Change-Id: I7c4935040ba16378023695c74bf2a5cd75fe8a77

diff --git a/sc/inc/inputopt.hxx b/sc/inc/inputopt.hxx
index 37bfbc4..b6d2a09 100644
--- a/sc/inc/inputopt.hxx
+++ b/sc/inc/inputopt.hxx
@@ -20,9 +20,10 @@
 #ifndef INCLUDED_SC_INC_INPUTOPT_HXX
 #define INCLUDED_SC_INC_INPUTOPT_HXX
 
+#include <scdllapi.h>
 #include <unotools/configitem.hxx>
 
-class ScInputOptions
+class SC_DLLPUBLIC ScInputOptions
 {
 private:
     sal_uInt16  nMoveDir;           // enum ScDirection
diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx
index 136f08f..59b1ab0 100644
--- a/sc/inc/scmod.hxx
+++ b/sc/inc/scmod.hxx
@@ -174,14 +174,14 @@ SC_DLLPUBLIC    const ScDocOptions&     GetDocOptions   ();
 SC_DLLPUBLIC    const ScAppOptions&     GetAppOptions   ();
 SC_DLLPUBLIC    const ScDefaultsOptions&   GetDefaultsOptions ();
     SC_DLLPUBLIC const ScFormulaOptions&   GetFormulaOptions ();
-    const ScInputOptions&   GetInputOptions ();
+    SC_DLLPUBLIC const ScInputOptions& GetInputOptions ();
 SC_DLLPUBLIC    const ScPrintOptions&   GetPrintOptions ();
     void                    SetViewOptions  ( const ScViewOptions& rOpt );
 SC_DLLPUBLIC    void                    SetDocOptions   ( const ScDocOptions& rOpt );
 SC_DLLPUBLIC    void                    SetAppOptions   ( const ScAppOptions& rOpt );
     void                    SetDefaultsOptions ( const ScDefaultsOptions& rOpt );
     SC_DLLPUBLIC void                    SetFormulaOptions ( const ScFormulaOptions& rOpt );
-    void                    SetInputOptions ( const ScInputOptions& rOpt );
+    SC_DLLPUBLIC void   SetInputOptions ( const ScInputOptions& rOpt );
     void                    SetPrintOptions ( const ScPrintOptions& rOpt );
     void                    InsertEntryToLRUList(sal_uInt16 nFIndex);
     void                    RecentFunctionsChanged();
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index 2080207..f8a911f 100644
--- a/sc/qa/unit/filters-test.cxx
+++ b/sc/qa/unit/filters-test.cxx
@@ -23,6 +23,7 @@
 #include "helper/qahelper.hxx"
 
 #include "docsh.hxx"
+#include "inputopt.hxx"
 #include "postit.hxx"
 #include "patattr.hxx"
 #include "scitems.hxx"
@@ -103,6 +104,7 @@ public:
 
 private:
     uno::Reference<uno::XInterface> m_xCalcComponent;
+    bool mbUpdateReferenceOnSort; ///< Remember the configuration option so that we can set it back.
 };
 
 bool ScFiltersTest::load(const OUString &rFilter, const OUString &rURL,
@@ -611,6 +613,12 @@ void ScFiltersTest::testSortWithSharedFormulasODS()
 // Document contains cached external references.
 void ScFiltersTest::testSortWithSheetExternalReferencesODS()
 {
+    // this test only works with UpdateReferenceOnSort == true, set it now.
+    // we reset the value back to the original in tearDown()
+    ScInputOptions aInputOption = SC_MOD()->GetInputOptions();
+    aInputOption.SetSortRefUpdate(true);
+    SC_MOD()->SetInputOptions(aInputOption);
+
     ScDocShellRef xDocSh = loadDoc("sort-with-sheet-external-references.", ODS, true);
     CPPUNIT_ASSERT(xDocSh.Is());
     ScDocument& rDoc = xDocSh->GetDocument();
@@ -698,12 +706,25 @@ void ScFiltersTest::setUp()
     m_xCalcComponent =
         getMultiServiceFactory()->createInstance("com.sun.star.comp.Calc.SpreadsheetDocument");
     CPPUNIT_ASSERT_MESSAGE("no calc component!", m_xCalcComponent.is());
+
+    // one test sets this configuration option; make sure we remember the
+    // original value
+    ScInputOptions aInputOption = SC_MOD()->GetInputOptions();
+    mbUpdateReferenceOnSort = aInputOption.GetSortRefUpdate();
 }
 
 void ScFiltersTest::tearDown()
 {
     uno::Reference< lang::XComponent >( m_xCalcComponent, UNO_QUERY_THROW )->dispose();
     test::BootstrapFixture::tearDown();
+
+    // one test sets this configuration option; make sure we return it back
+    ScInputOptions aInputOption = SC_MOD()->GetInputOptions();
+    if (mbUpdateReferenceOnSort != aInputOption.GetSortRefUpdate())
+    {
+        aInputOption.SetSortRefUpdate(mbUpdateReferenceOnSort);
+        SC_MOD()->SetInputOptions(aInputOption);
+    }
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(ScFiltersTest);


More information about the Libreoffice-commits mailing list