Kaydet (Commit) 447d523f authored tarafından Jan Holesovsky's avatar Jan Holesovsky

fdo#85584: Adapt the unit test to the new default.

Change-Id: I7c4935040ba16378023695c74bf2a5cd75fe8a77
üst f86df6e0
...@@ -20,9 +20,10 @@ ...@@ -20,9 +20,10 @@
#ifndef INCLUDED_SC_INC_INPUTOPT_HXX #ifndef INCLUDED_SC_INC_INPUTOPT_HXX
#define INCLUDED_SC_INC_INPUTOPT_HXX #define INCLUDED_SC_INC_INPUTOPT_HXX
#include <scdllapi.h>
#include <unotools/configitem.hxx> #include <unotools/configitem.hxx>
class ScInputOptions class SC_DLLPUBLIC ScInputOptions
{ {
private: private:
sal_uInt16 nMoveDir; // enum ScDirection sal_uInt16 nMoveDir; // enum ScDirection
......
...@@ -174,14 +174,14 @@ SC_DLLPUBLIC const ScDocOptions& GetDocOptions (); ...@@ -174,14 +174,14 @@ SC_DLLPUBLIC const ScDocOptions& GetDocOptions ();
SC_DLLPUBLIC const ScAppOptions& GetAppOptions (); SC_DLLPUBLIC const ScAppOptions& GetAppOptions ();
SC_DLLPUBLIC const ScDefaultsOptions& GetDefaultsOptions (); SC_DLLPUBLIC const ScDefaultsOptions& GetDefaultsOptions ();
SC_DLLPUBLIC const ScFormulaOptions& GetFormulaOptions (); SC_DLLPUBLIC const ScFormulaOptions& GetFormulaOptions ();
const ScInputOptions& GetInputOptions (); SC_DLLPUBLIC const ScInputOptions& GetInputOptions ();
SC_DLLPUBLIC const ScPrintOptions& GetPrintOptions (); SC_DLLPUBLIC const ScPrintOptions& GetPrintOptions ();
void SetViewOptions ( const ScViewOptions& rOpt ); void SetViewOptions ( const ScViewOptions& rOpt );
SC_DLLPUBLIC void SetDocOptions ( const ScDocOptions& rOpt ); SC_DLLPUBLIC void SetDocOptions ( const ScDocOptions& rOpt );
SC_DLLPUBLIC void SetAppOptions ( const ScAppOptions& rOpt ); SC_DLLPUBLIC void SetAppOptions ( const ScAppOptions& rOpt );
void SetDefaultsOptions ( const ScDefaultsOptions& rOpt ); void SetDefaultsOptions ( const ScDefaultsOptions& rOpt );
SC_DLLPUBLIC void SetFormulaOptions ( const ScFormulaOptions& 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 SetPrintOptions ( const ScPrintOptions& rOpt );
void InsertEntryToLRUList(sal_uInt16 nFIndex); void InsertEntryToLRUList(sal_uInt16 nFIndex);
void RecentFunctionsChanged(); void RecentFunctionsChanged();
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "helper/qahelper.hxx" #include "helper/qahelper.hxx"
#include "docsh.hxx" #include "docsh.hxx"
#include "inputopt.hxx"
#include "postit.hxx" #include "postit.hxx"
#include "patattr.hxx" #include "patattr.hxx"
#include "scitems.hxx" #include "scitems.hxx"
...@@ -103,6 +104,7 @@ public: ...@@ -103,6 +104,7 @@ public:
private: private:
uno::Reference<uno::XInterface> m_xCalcComponent; 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, bool ScFiltersTest::load(const OUString &rFilter, const OUString &rURL,
...@@ -611,6 +613,12 @@ void ScFiltersTest::testSortWithSharedFormulasODS() ...@@ -611,6 +613,12 @@ void ScFiltersTest::testSortWithSharedFormulasODS()
// Document contains cached external references. // Document contains cached external references.
void ScFiltersTest::testSortWithSheetExternalReferencesODS() 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); ScDocShellRef xDocSh = loadDoc("sort-with-sheet-external-references.", ODS, true);
CPPUNIT_ASSERT(xDocSh.Is()); CPPUNIT_ASSERT(xDocSh.Is());
ScDocument& rDoc = xDocSh->GetDocument(); ScDocument& rDoc = xDocSh->GetDocument();
...@@ -698,12 +706,25 @@ void ScFiltersTest::setUp() ...@@ -698,12 +706,25 @@ void ScFiltersTest::setUp()
m_xCalcComponent = m_xCalcComponent =
getMultiServiceFactory()->createInstance("com.sun.star.comp.Calc.SpreadsheetDocument"); getMultiServiceFactory()->createInstance("com.sun.star.comp.Calc.SpreadsheetDocument");
CPPUNIT_ASSERT_MESSAGE("no calc component!", m_xCalcComponent.is()); 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() void ScFiltersTest::tearDown()
{ {
uno::Reference< lang::XComponent >( m_xCalcComponent, UNO_QUERY_THROW )->dispose(); uno::Reference< lang::XComponent >( m_xCalcComponent, UNO_QUERY_THROW )->dispose();
test::BootstrapFixture::tearDown(); 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); CPPUNIT_TEST_SUITE_REGISTRATION(ScFiltersTest);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment