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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Mon May 17 15:47:20 UTC 2021


 sc/qa/unit/ucalc.cxx               |   30 +--------
 sc/qa/unit/ucalc_copypaste.cxx     |  112 +------------------------------------
 sc/qa/unit/ucalc_formula.cxx       |   62 +-------------------
 sc/qa/unit/ucalc_sharedformula.cxx |    2 
 sc/qa/unit/ucalc_sort.cxx          |   10 ---
 5 files changed, 15 insertions(+), 201 deletions(-)

New commits:
commit 9bbf8057d9d92857aa3c693c1387589ad378695d
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Mon May 17 13:41:27 2021 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Mon May 17 17:46:39 2021 +0200

    sc_ucalc: use DoLoad instead of DoInitNew
    
    In 145b2d8ee131dca592a41f7b26341a542a23845b
    <sc_ucalc: restore formula options after using them>
    I wrongly assumed that the formula options have to be reset
    back to default after using them.
    Later, I realized that was not the reason why some tests didn't
    fail when executed individually but failed when the module
    was executed as a whole.
    After some investigation, it turned out the problem was caused
    by DoInitNew changing the defaults separators.
    Why? I don't know, but using DoLoad seems to fix this problem
    
    This change revealed that Test::testMatrixConditionalBooleanResult,
    Test::testFormulaWizardSubformula and Test::testTdf93415
    were relying on other tests and failed if executed individually.
    Adapt them to use the default separators.
    
    Change-Id: I08c1d88d7c6411592cc9a5779bfaa2b3bb6429ff
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115704
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 5b34c2a073fb..49238a0f4191 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -1968,10 +1968,10 @@ void Test::testMatrixConditionalBooleanResult()
     // boolean and numeric results in an unformatted area.
     ScMarkData aMark(m_pDoc->GetSheetLimits());
     aMark.SelectOneTable(0);
-    m_pDoc->InsertMatrixFormula( 0,0, 1,0, aMark, "=IF({1,0};TRUE();42)");  // {TRUE,42}
-    m_pDoc->InsertMatrixFormula( 0,1, 1,1, aMark, "=IF({0,1};TRUE();42)");  // {42,1} aim for {42,TRUE}
-    m_pDoc->InsertMatrixFormula( 0,2, 1,2, aMark, "=IF({1,0};42;FALSE())"); // {42,0} aim for {42,FALSE}
-    m_pDoc->InsertMatrixFormula( 0,3, 1,3, aMark, "=IF({0,1};42;FALSE())"); // {FALSE,42}
+    m_pDoc->InsertMatrixFormula( 0,0, 1,0, aMark, "=IF({1;0};TRUE();42)");  // {TRUE,42}
+    m_pDoc->InsertMatrixFormula( 0,1, 1,1, aMark, "=IF({0;1};TRUE();42)");  // {42,1} aim for {42,TRUE}
+    m_pDoc->InsertMatrixFormula( 0,2, 1,2, aMark, "=IF({1;0};42;FALSE())"); // {42,0} aim for {42,FALSE}
+    m_pDoc->InsertMatrixFormula( 0,3, 1,3, aMark, "=IF({0;1};42;FALSE())"); // {FALSE,42}
 
     CPPUNIT_ASSERT_EQUAL( OUString("TRUE"),  m_pDoc->GetString(0,0,0));
     CPPUNIT_ASSERT_EQUAL( OUString("42"),    m_pDoc->GetString(1,0,0));
@@ -5591,7 +5591,7 @@ void Test::testFormulaWizardSubformula()
     ScSimpleFormulaCalculator aFCell1( *m_pDoc, ScAddress(0,0,0), "=B1:B3", true );
     FormulaError nErrCode = aFCell1.GetErrCode();
     CPPUNIT_ASSERT( nErrCode == FormulaError::NONE || aFCell1.IsMatrix() );
-    CPPUNIT_ASSERT_EQUAL( OUString("{1;#DIV/0!;#NAME?}"), aFCell1.GetString().getString() );
+    CPPUNIT_ASSERT_EQUAL( OUString("{1|#DIV/0!|#NAME?}"), aFCell1.GetString().getString() );
 
     m_pDoc->SetString(ScAddress(1,0,0), "=NA()");       // B1
     m_pDoc->SetString(ScAddress(1,1,0), "2");           // B2
@@ -5599,7 +5599,7 @@ void Test::testFormulaWizardSubformula()
     ScSimpleFormulaCalculator aFCell2( *m_pDoc, ScAddress(0,0,0), "=B1:B3", true );
     nErrCode = aFCell2.GetErrCode();
     CPPUNIT_ASSERT( nErrCode == FormulaError::NONE || aFCell2.IsMatrix() );
-    CPPUNIT_ASSERT_EQUAL( OUString("{#N/A;2;3}"), aFCell2.GetString().getString() );
+    CPPUNIT_ASSERT_EQUAL( OUString("{#N/A|2|3}"), aFCell2.GetString().getString() );
 
     m_pDoc->DeleteTab(0);
 }
@@ -6048,12 +6048,6 @@ void Test::testProtectedSheetEditByRow()
     ScDocFunc& rDocFunc = m_xDocShell->GetDocFunc();
     m_pDoc->InsertTab(0, "Protected");
 
-    ScFormulaOptions aOldOptions, aNewOptions;
-    aOldOptions = SC_MOD()->GetFormulaOptions();
-    aNewOptions.SetFormulaSepArg(";");
-    aNewOptions.SetFormulaSepArrayCol(";");
-    m_xDocShell->SetFormulaOptions(aNewOptions);
-
     {
         // Remove protected flags from rows 2-5.
         ScPatternAttr aAttr(m_pDoc->GetPool());
@@ -6121,9 +6115,6 @@ void Test::testProtectedSheetEditByRow()
         CPPUNIT_ASSERT_MESSAGE("row insertion at row 3 should fail.", !bInserted);
     }
 
-    // restore formula options back to default
-    m_xDocShell->SetFormulaOptions(aOldOptions);
-
     m_pDoc->DeleteTab(1);
     m_pDoc->DeleteTab(0);
 }
@@ -6133,12 +6124,6 @@ void Test::testProtectedSheetEditByColumn()
     ScDocFunc& rDocFunc = m_xDocShell->GetDocFunc();
     m_pDoc->InsertTab(0, "Protected");
 
-    ScFormulaOptions aOldOptions, aNewOptions;
-    aOldOptions = SC_MOD()->GetFormulaOptions();
-    aNewOptions.SetFormulaSepArg(";");
-    aNewOptions.SetFormulaSepArrayCol(";");
-    m_xDocShell->SetFormulaOptions(aNewOptions);
-
     {
         // Remove protected flags from columns B to E.
         ScPatternAttr aAttr(m_pDoc->GetPool());
@@ -6206,9 +6191,6 @@ void Test::testProtectedSheetEditByColumn()
         CPPUNIT_ASSERT_MESSAGE("column insertion at column C should fail.", !bInserted);
     }
 
-    // restore formula options back to default
-    m_xDocShell->SetFormulaOptions(aOldOptions);
-
     m_pDoc->DeleteTab(1);
     m_pDoc->DeleteTab(0);
 }
diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx
index 974dabe51802..40536a573d90 100644
--- a/sc/qa/unit/ucalc_copypaste.cxx
+++ b/sc/qa/unit/ucalc_copypaste.cxx
@@ -1458,11 +1458,6 @@ void TestCopyPaste::executeCopyPasteSpecial(bool bApplyFilter, bool bIncludedFil
                                             InsertDeleteFlags aFlags = InsertDeleteFlags::CONTENTS
                                                                        | InsertDeleteFlags::ATTRIB)
 {
-    ScFormulaOptions aOldOptions, aNewOptions;
-    aOldOptions = SC_MOD()->GetFormulaOptions();
-    aNewOptions.SetFormulaSepArg(";");
-    m_xDocShell->SetFormulaOptions(aNewOptions);
-
     const SCTAB srcSheet = 0;
     m_pDoc->InsertTab(srcSheet, "SrcSheet");
 
@@ -1872,9 +1867,6 @@ void TestCopyPaste::executeCopyPasteSpecial(bool bApplyFilter, bool bIncludedFil
     }
     if (bCalcAll)
         m_pDoc->CalcAll();
-
-    // restore formula options back to default
-    m_xDocShell->SetFormulaOptions(aOldOptions);
 }
 
 void TestCopyPaste::testCopyPasteSpecial()
@@ -2176,11 +2168,6 @@ void TestCopyPaste::checkCopyPasteSpecial(bool bSkipEmpty)
     const SCTAB srcSheet = 0;
     const SCTAB destSheet = 1;
 
-    ScFormulaOptions aOldOptions, aNewOptions;
-    aOldOptions = SC_MOD()->GetFormulaOptions();
-    aNewOptions.SetFormulaSepArg(";");
-    m_xDocShell->SetFormulaOptions(aNewOptions);
-
     /*
          |  D  |    E     | F  |  G  |     H      |        I            |
 
@@ -2453,9 +2440,6 @@ void TestCopyPaste::checkCopyPasteSpecial(bool bSkipEmpty)
 
     m_pDoc->DeleteTab(destSheet);
     m_pDoc->DeleteTab(srcSheet);
-
-    // restore formula options back to default
-    m_xDocShell->SetFormulaOptions(aOldOptions);
 }
 
 void TestCopyPaste::checkCopyPasteSpecialFiltered(bool bSkipEmpty)
@@ -2463,11 +2447,6 @@ void TestCopyPaste::checkCopyPasteSpecialFiltered(bool bSkipEmpty)
     const SCTAB srcSheet = 0;
     const SCTAB destSheet = 1;
 
-    ScFormulaOptions aOldOptions, aNewOptions;
-    aOldOptions = SC_MOD()->GetFormulaOptions();
-    aNewOptions.SetFormulaSepArg(";");
-    m_xDocShell->SetFormulaOptions(aNewOptions);
-
     /*
          |  D  |    E     | F  |  G  |     H      |        I            |
 
@@ -2730,9 +2709,6 @@ void TestCopyPaste::checkCopyPasteSpecialFiltered(bool bSkipEmpty)
     CPPUNIT_ASSERT_EQUAL(m_pDoc->GetNote(ScAddress(5, 3, srcSheet))->GetText(),
                          m_pDoc->GetNote(ScAddress(8, 3, destSheet))->GetText());
 
-    // restore formula options back to default
-    m_xDocShell->SetFormulaOptions(aOldOptions);
-
     m_pDoc->DeleteTab(destSheet);
     m_pDoc->DeleteTab(srcSheet);
 }
@@ -2742,11 +2718,6 @@ void TestCopyPaste::checkCopyPasteSpecialTranspose(bool bSkipEmpty)
     const SCTAB srcSheet = 0;
     const SCTAB destSheet = 1;
 
-    ScFormulaOptions aOldOptions, aNewOptions;
-    aOldOptions = SC_MOD()->GetFormulaOptions();
-    aNewOptions.SetFormulaSepArg(";");
-    m_xDocShell->SetFormulaOptions(aNewOptions);
-
     /*
              |         D          |    E     |    F     |       G       |
 
@@ -3132,9 +3103,6 @@ void TestCopyPaste::checkCopyPasteSpecialTranspose(bool bSkipEmpty)
                                  m_pDoc->GetNote(ScAddress(5, 3, srcSheet))->GetText(),
                                  m_pDoc->GetNote(ScAddress(6, 6, destSheet))->GetText());
 
-    // restore formula options back to default
-    m_xDocShell->SetFormulaOptions(aOldOptions);
-
     m_pDoc->DeleteTab(destSheet);
     m_pDoc->DeleteTab(srcSheet);
 }
@@ -3144,11 +3112,6 @@ void TestCopyPaste::checkCopyPasteSpecialFilteredTranspose(bool bSkipEmpty)
     const SCTAB srcSheet = 0;
     const SCTAB destSheet = 1;
 
-    ScFormulaOptions aOldOptions, aNewOptions;
-    aOldOptions = SC_MOD()->GetFormulaOptions();
-    aNewOptions.SetFormulaSepArg(";");
-    m_xDocShell->SetFormulaOptions(aNewOptions);
-
     /*
                                   ┌--- filtered src row 2          ┌--- repeated row
                                   v                                v
@@ -3547,9 +3510,6 @@ void TestCopyPaste::checkCopyPasteSpecialFilteredTranspose(bool bSkipEmpty)
                                  m_pDoc->GetNote(ScAddress(5, 3, srcSheet))->GetText(),
                                  m_pDoc->GetNote(ScAddress(5, 6, destSheet))->GetText());
 
-    // restore formula options back to default
-    m_xDocShell->SetFormulaOptions(aOldOptions);
-
     m_pDoc->DeleteTab(destSheet);
     m_pDoc->DeleteTab(srcSheet);
 }
@@ -3559,11 +3519,6 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeCol(bool bSkipEmpty)
     const SCTAB srcSheet = 0;
     const SCTAB destSheet = 1;
 
-    ScFormulaOptions aOldOptions, aNewOptions;
-    aOldOptions = SC_MOD()->GetFormulaOptions();
-    aNewOptions.SetFormulaSepArg(";");
-    m_xDocShell->SetFormulaOptions(aNewOptions);
-
     /*
                           ┌--- not selected src col C
                           v
@@ -3830,9 +3785,6 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeCol(bool bSkipEmpty)
     CPPUNIT_ASSERT_EQUAL(m_pDoc->GetNote(ScAddress(5, 3, srcSheet))->GetText(),
                          m_pDoc->GetNote(ScAddress(7, 4, destSheet))->GetText());
 
-    // restore formula options back to default
-    m_xDocShell->SetFormulaOptions(aOldOptions);
-
     m_pDoc->DeleteTab(destSheet);
     m_pDoc->DeleteTab(srcSheet);
 }
@@ -3842,11 +3794,6 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeColFiltered(bool bSkipEmpty)
     const SCTAB srcSheet = 0;
     const SCTAB destSheet = 1;
 
-    ScFormulaOptions aOldOptions, aNewOptions;
-    aOldOptions = SC_MOD()->GetFormulaOptions();
-    aNewOptions.SetFormulaSepArg(";");
-    m_xDocShell->SetFormulaOptions(aNewOptions);
-
     /*
                           ┌--- not selected src col C
                           v
@@ -4068,9 +4015,6 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeColFiltered(bool bSkipEmpty)
     CPPUNIT_ASSERT_EQUAL(m_pDoc->GetNote(ScAddress(5, 3, srcSheet))->GetText(),
                          m_pDoc->GetNote(ScAddress(7, 3, destSheet))->GetText());
 
-    // restore formula options back to default
-    m_xDocShell->SetFormulaOptions(aOldOptions);
-
     m_pDoc->DeleteTab(destSheet);
     m_pDoc->DeleteTab(srcSheet);
 }
@@ -4080,11 +4024,6 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeColTranspose(bool bSkipEmpty)
     const SCTAB srcSheet = 0;
     const SCTAB destSheet = 1;
 
-    ScFormulaOptions aOldOptions, aNewOptions;
-    aOldOptions = SC_MOD()->GetFormulaOptions();
-    aNewOptions.SetFormulaSepArg(";");
-    m_xDocShell->SetFormulaOptions(aNewOptions);
-
     /*
              |         D          |    E     |    F     |       G       |
 
@@ -4354,9 +4293,6 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeColTranspose(bool bSkipEmpty)
     CPPUNIT_ASSERT_EQUAL(m_pDoc->GetNote(ScAddress(5, 3, srcSheet))->GetText(),
                          m_pDoc->GetNote(ScAddress(6, 5, destSheet))->GetText());
 
-    // restore formula options back to default
-    m_xDocShell->SetFormulaOptions(aOldOptions);
-
     m_pDoc->DeleteTab(destSheet);
     m_pDoc->DeleteTab(srcSheet);
 }
@@ -4366,11 +4302,6 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeColFilteredTranspose(bool bSk
     const SCTAB srcSheet = 0;
     const SCTAB destSheet = 1;
 
-    ScFormulaOptions aOldOptions, aNewOptions;
-    aOldOptions = SC_MOD()->GetFormulaOptions();
-    aNewOptions.SetFormulaSepArg(";");
-    m_xDocShell->SetFormulaOptions(aNewOptions);
-
     /*
                                   ┌--- filtered src row 2
                                   v
@@ -4612,9 +4543,6 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeColFilteredTranspose(bool bSk
     CPPUNIT_ASSERT_EQUAL(m_pDoc->GetNote(ScAddress(5, 3, srcSheet))->GetText(),
                          m_pDoc->GetNote(ScAddress(5, 5, destSheet))->GetText());
 
-    // restore formula options back to default
-    m_xDocShell->SetFormulaOptions(aOldOptions);
-
     m_pDoc->DeleteTab(destSheet);
     m_pDoc->DeleteTab(srcSheet);
 }
@@ -4624,11 +4552,6 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeRow(bool bSkipEmpty)
     const SCTAB srcSheet = 0;
     const SCTAB destSheet = 1;
 
-    ScFormulaOptions aOldOptions, aNewOptions;
-    aOldOptions = SC_MOD()->GetFormulaOptions();
-    aNewOptions.SetFormulaSepArg(";");
-    m_xDocShell->SetFormulaOptions(aNewOptions);
-
     /*
          |  D  |    E     | F    |  G   |     H      |        I            |
 
@@ -4943,9 +4866,6 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeRow(bool bSkipEmpty)
     CPPUNIT_ASSERT_EQUAL(m_pDoc->GetNote(ScAddress(2, 4, srcSheet))->GetText(),
                          m_pDoc->GetNote(ScAddress(5, 4, destSheet))->GetText());
 
-    // restore formula options back to default
-    m_xDocShell->SetFormulaOptions(aOldOptions);
-
     m_pDoc->DeleteTab(destSheet);
     m_pDoc->DeleteTab(srcSheet);
 }
@@ -4955,11 +4875,6 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeRowFiltered(bool bSkipEmpty)
     const SCTAB srcSheet = 0;
     const SCTAB destSheet = 1;
 
-    ScFormulaOptions aOldOptions, aNewOptions;
-    aOldOptions = SC_MOD()->GetFormulaOptions();
-    aNewOptions.SetFormulaSepArg(";");
-    m_xDocShell->SetFormulaOptions(aNewOptions);
-
     /*
          |  D  |    E     | F  |  G  |     H      |        I            |
 
@@ -5228,9 +5143,6 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeRowFiltered(bool bSkipEmpty)
     CPPUNIT_ASSERT_EQUAL(m_pDoc->GetNote(ScAddress(2, 4, srcSheet))->GetText(),
                          m_pDoc->GetNote(ScAddress(5, 3, destSheet))->GetText());
 
-    // restore formula options back to default
-    m_xDocShell->SetFormulaOptions(aOldOptions);
-
     m_pDoc->DeleteTab(destSheet);
     m_pDoc->DeleteTab(srcSheet);
 }
@@ -5240,11 +5152,6 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeRowTranspose(bool bSkipEmpty)
     const SCTAB srcSheet = 0;
     const SCTAB destSheet = 1;
 
-    ScFormulaOptions aOldOptions, aNewOptions;
-    aOldOptions = SC_MOD()->GetFormulaOptions();
-    aNewOptions.SetFormulaSepArg(";");
-    m_xDocShell->SetFormulaOptions(aNewOptions);
-
     /*
              |         D          |    E     |    F     | G  |  H  |
 
@@ -5625,9 +5532,6 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeRowTranspose(bool bSkipEmpty)
     CPPUNIT_ASSERT_EQUAL(m_pDoc->GetNote(ScAddress(2, 4, srcSheet))->GetText(),
                          m_pDoc->GetNote(ScAddress(6, 3, destSheet))->GetText());
 
-    // restore formula options back to default
-    m_xDocShell->SetFormulaOptions(aOldOptions);
-
     m_pDoc->DeleteTab(destSheet);
     m_pDoc->DeleteTab(srcSheet);
 }
@@ -5637,11 +5541,6 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeRowFilteredTranspose(bool bSk
     const SCTAB srcSheet = 0;
     const SCTAB destSheet = 1;
 
-    ScFormulaOptions aOldOptions, aNewOptions;
-    aOldOptions = SC_MOD()->GetFormulaOptions();
-    aNewOptions.SetFormulaSepArg(";");
-    m_xDocShell->SetFormulaOptions(aNewOptions);
-
     /*
              |         D          |    E     | F  |  G  |
 
@@ -5979,9 +5878,6 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeRowFilteredTranspose(bool bSk
     CPPUNIT_ASSERT_EQUAL(m_pDoc->GetNote(ScAddress(2, 4, srcSheet))->GetText(),
                          m_pDoc->GetNote(ScAddress(5, 3, destSheet))->GetText());
 
-    // restore formula options back to default
-    m_xDocShell->SetFormulaOptions(aOldOptions);
-
     m_pDoc->DeleteTab(destSheet);
     m_pDoc->DeleteTab(srcSheet);
 }
@@ -6825,13 +6721,13 @@ void TestCopyPaste::testCopyPasteFormulas()
 void TestCopyPaste::testCopyPasteFormulasExternalDoc()
 {
     SfxMedium* pMedium = new SfxMedium("file:///source.fake", StreamMode::STD_READWRITE);
-    m_xDocShell->DoInitNew(pMedium);
+    m_xDocShell->DoLoad(pMedium);
 
     ScDocShellRef xExtDocSh = new ScDocShell;
     xExtDocSh->SetIsInUcalc();
     OUString const aExtDocName("file:///extdata.fake");
     SfxMedium* pMed = new SfxMedium(aExtDocName, StreamMode::STD_READWRITE);
-    xExtDocSh->DoInitNew(pMed);
+    xExtDocSh->DoLoad(pMed);
     CPPUNIT_ASSERT_MESSAGE("external document instance not loaded.",
                            findLoadedDocShellByName(aExtDocName) != nullptr);
 
@@ -6884,13 +6780,13 @@ void TestCopyPaste::testCopyPasteFormulasExternalDoc()
 void TestCopyPaste::testCopyPasteReferencesExternalDoc()
 {
     SfxMedium* pMedium = new SfxMedium("file:///source.fake", StreamMode::STD_READWRITE);
-    m_xDocShell->DoInitNew(pMedium);
+    m_xDocShell->DoLoad(pMedium);
 
     ScDocShellRef xExtDocSh = new ScDocShell;
     xExtDocSh->SetIsInUcalc();
     OUString aExtDocName("file:///extdata.fake");
     SfxMedium* pMed = new SfxMedium(aExtDocName, StreamMode::STD_READWRITE);
-    xExtDocSh->DoInitNew(pMed);
+    xExtDocSh->DoLoad(pMed);
     CPPUNIT_ASSERT_MESSAGE("external document instance not loaded.",
                            findLoadedDocShellByName(aExtDocName) != nullptr);
 
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 909586873193..3a2dca70affe 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -1016,14 +1016,6 @@ void Test::testFormulaCompilerJumpReordering()
         StackVar meType;
     };
 
-    // Set separators first.
-    ScFormulaOptions aOldOptions, aNewOptions;
-    aOldOptions = SC_MOD()->GetFormulaOptions();
-    aNewOptions.SetFormulaSepArg(";");
-    aNewOptions.SetFormulaSepArrayCol(";");
-    aNewOptions.SetFormulaSepArrayRow("|");
-    m_xDocShell->SetFormulaOptions(aNewOptions);
-
     {
         // Compile formula string first.
         std::unique_ptr<ScTokenArray> pCode(compileFormula(m_pDoc, "=IF(B1;12;\"text\")"));
@@ -1081,9 +1073,6 @@ void Test::testFormulaCompilerJumpReordering()
                 CPPUNIT_ASSERT_EQUAL(static_cast<int>(aCheckRPN2[i].meType), static_cast<int>(p->GetType()));
         }
     }
-
-    // restore formula options back to default
-    m_xDocShell->SetFormulaOptions(aOldOptions);
 }
 
 void Test::testFormulaCompilerImplicitIntersection2Param()
@@ -5013,11 +5002,6 @@ void Test::testFuncCOUNTIF()
 {
     sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on.
 
-    ScFormulaOptions aOldOptions, aNewOptions;
-    aOldOptions = SC_MOD()->GetFormulaOptions();
-    aNewOptions.SetFormulaSepArg(";");
-    m_xDocShell->SetFormulaOptions(aNewOptions);
-
     // COUNTIF (test case adopted from OOo i#36381)
 
     CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet",
@@ -5131,9 +5115,6 @@ void Test::testFuncCOUNTIF()
     CPPUNIT_ASSERT_EQUAL_MESSAGE("One cell with 0.0",  1.0, m_pDoc->GetValue(ScAddress(0,0,0)));
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Two cells with 1.0", 2.0, m_pDoc->GetValue(ScAddress(0,1,0)));
 
-    // restore formula options back to default
-    m_xDocShell->SetFormulaOptions(aOldOptions);
-
     m_pDoc->DeleteTab(0);
 }
 
@@ -5141,12 +5122,6 @@ void Test::testFuncIF()
 {
     sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on.
 
-    ScFormulaOptions aOldOptions, aNewOptions;
-    aOldOptions = SC_MOD()->GetFormulaOptions();
-    aNewOptions.SetFormulaSepArg(";");
-    aNewOptions.SetFormulaSepArrayCol(";");
-    m_xDocShell->SetFormulaOptions(aNewOptions);
-
     m_pDoc->InsertTab(0, "Formula");
 
     m_pDoc->SetString(ScAddress(0,0,0), "=IF(B1=2;\"two\";\"not two\")");
@@ -5189,9 +5164,6 @@ void Test::testFuncIF()
     CPPUNIT_ASSERT_EQUAL(34.0, m_pDoc->GetValue(ScAddress(0,10,0)));
     CPPUNIT_ASSERT_EQUAL(56.0, m_pDoc->GetValue(ScAddress(1,10,0)));
 
-    // restore formula options back to default
-    m_xDocShell->SetFormulaOptions(aOldOptions);
-
     m_pDoc->DeleteTab(0);
 }
 
@@ -6144,11 +6116,6 @@ void Test::testFuncINDIRECT()
 //
 void Test::testFuncINDIRECT2()
 {
-    ScFormulaOptions aOldOptions, aNewOptions;
-    aOldOptions = SC_MOD()->GetFormulaOptions();
-    aNewOptions.SetFormulaSepArg(";");
-    m_xDocShell->SetFormulaOptions(aNewOptions);
-
     CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet",
                             m_pDoc->InsertTab (0, "foo"));
     CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet",
@@ -6208,9 +6175,6 @@ void Test::testFuncINDIRECT2()
     CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC);
     CPPUNIT_ASSERT_MESSAGE("This formula cell should be an error.", pFC->GetErrCode() != FormulaError::NONE);
 
-    // restore formula options back to default
-    m_xDocShell->SetFormulaOptions(aOldOptions);
-
     m_pDoc->DeleteTab(2);
     m_pDoc->DeleteTab(1);
     m_pDoc->DeleteTab(0);
@@ -6607,7 +6571,7 @@ void Test::testExternalRef()
     OUString aExtSh2Name("Data2");
     OUString aExtSh3Name("Data3");
     SfxMedium* pMed = new SfxMedium(aExtDocName, StreamMode::STD_READWRITE);
-    xExtDocSh->DoInitNew(pMed);
+    xExtDocSh->DoLoad(pMed);
     CPPUNIT_ASSERT_MESSAGE("external document instance not loaded.",
                            findLoadedDocShellByName(aExtDocName) != nullptr);
 
@@ -6779,7 +6743,7 @@ void Test::testExternalRangeName()
     xExtDocSh->SetIsInUcalc();
     OUString const aExtDocName("file:///extdata.fake");
     SfxMedium* pMed = new SfxMedium(aExtDocName, StreamMode::STD_READWRITE);
-    xExtDocSh->DoInitNew(pMed);
+    xExtDocSh->DoLoad(pMed);
     CPPUNIT_ASSERT_MESSAGE("external document instance not loaded.",
                            findLoadedDocShellByName(aExtDocName) != nullptr);
 
@@ -6891,7 +6855,7 @@ void Test::testExternalRefFunctions()
     xExtDocSh->SetIsInUcalc();
     OUString aExtDocName("file:///extdata.fake");
     SfxMedium* pMed = new SfxMedium(aExtDocName, StreamMode::STD_READWRITE);
-    xExtDocSh->DoInitNew(pMed);
+    xExtDocSh->DoLoad(pMed);
     CPPUNIT_ASSERT_MESSAGE("external document instance not loaded.",
                            findLoadedDocShellByName(aExtDocName) != nullptr);
 
@@ -7227,11 +7191,6 @@ void Test::testFuncTableRef()
 {
     sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc.
 
-    ScFormulaOptions aOldOptions, aNewOptions;
-    aOldOptions = SC_MOD()->GetFormulaOptions();
-    aNewOptions.SetFormulaSepArg(";");
-    m_xDocShell->SetFormulaOptions(aNewOptions);
-
     m_pDoc->InsertTab(0, "Sheet1");
     ScMarkData aMark(m_pDoc->GetSheetLimits());
     aMark.SelectOneTable(0);
@@ -7571,9 +7530,6 @@ void Test::testFuncTableRef()
         CPPUNIT_ASSERT_EQUAL( OUString(aPrefix + "448"), OUString(aPrefix + m_pDoc->GetString(aPos)));
     }
 
-    // restore formula options back to default
-    m_xDocShell->SetFormulaOptions(aOldOptions);
-
     m_pDoc->DeleteTab(0);
 }
 
@@ -8447,13 +8403,6 @@ void Test::testFormulaErrorPropagation()
 {
     sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on.
 
-    ScFormulaOptions aOldOptions, aNewOptions;
-    aOldOptions = SC_MOD()->GetFormulaOptions();
-    aNewOptions.SetFormulaSepArg(";");
-    aNewOptions.SetFormulaSepArrayCol(";");
-    aNewOptions.SetFormulaSepArrayRow("|");
-    m_xDocShell->SetFormulaOptions(aNewOptions);
-
     m_pDoc->InsertTab(0, "Sheet1");
 
     ScMarkData aMark(m_pDoc->GetSheetLimits());
@@ -8522,9 +8471,6 @@ void Test::testFormulaErrorPropagation()
     CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos.Format(ScRefFlags::VALID).toUtf8().getStr(), aTRUE, m_pDoc->GetString(aPos));
     CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos2.Format(ScRefFlags::VALID).toUtf8().getStr(), aFALSE, m_pDoc->GetString(aPos2));
 
-    // restore formula options back to default
-    m_xDocShell->SetFormulaOptions(aOldOptions);
-
     m_pDoc->DeleteTab(0);
 }
 
@@ -8709,7 +8655,7 @@ void Test::testTdf93415()
     m_pDoc->CalcAll();
 
     ScAddress aPos(0,0,0);
-    m_pDoc->SetString(aPos, "=ADDRESS(1,1,,,\"Sheet1\")");
+    m_pDoc->SetString(aPos, "=ADDRESS(1;1;;;\"Sheet1\")");
 
     // Without the fix in place, this would have failed with
     // - Expected: Sheet1!$A$1
diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx
index 61b35d5cadad..1f7bc50ed2f5 100644
--- a/sc/qa/unit/ucalc_sharedformula.cxx
+++ b/sc/qa/unit/ucalc_sharedformula.cxx
@@ -891,7 +891,7 @@ void TestSharedFormula::testSharedFormulasRefUpdateExternal()
     xExtDocSh->SetIsInUcalc();
 
     SfxMedium* pMed = new SfxMedium("file:///extdata.fake", StreamMode::STD_READWRITE);
-    xExtDocSh->DoInitNew(pMed);
+    xExtDocSh->DoLoad(pMed);
     ScDocument& rExtDoc = xExtDocSh->GetDocument();
 
     // Populate A1:A3.
diff --git a/sc/qa/unit/ucalc_sort.cxx b/sc/qa/unit/ucalc_sort.cxx
index ab2322cfef8a..f885fe2be76f 100644
--- a/sc/qa/unit/ucalc_sort.cxx
+++ b/sc/qa/unit/ucalc_sort.cxx
@@ -217,13 +217,6 @@ void TestSort::testSortHorizontal()
 {
     SortRefUpdateSetter aUpdateSet;
 
-    ScFormulaOptions aOldOptions, aNewOptions;
-    aOldOptions = SC_MOD()->GetFormulaOptions();
-    aNewOptions.SetFormulaSepArg(";");
-    aNewOptions.SetFormulaSepArrayCol(";");
-    aNewOptions.SetFormulaSepArrayRow("|");
-    m_xDocShell->SetFormulaOptions(aNewOptions);
-
     sc::AutoCalcSwitch aACSwitch(*m_pDoc, true);
     m_pDoc->InsertTab(0, "Sort");
 
@@ -284,9 +277,6 @@ void TestSort::testSortHorizontal()
     ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,2,0), "CONCATENATE(C3;\"-\";D3)", "Wrong formula!");
     ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,3,0), "CONCATENATE(C4;\"-\";D4)", "Wrong formula!");
 
-    // restore formula options back to default
-    m_xDocShell->SetFormulaOptions(aOldOptions);
-
     m_pDoc->DeleteTab(0);
 }
 


More information about the Libreoffice-commits mailing list