sc/qa/unit/helper/qahelper.cxx | 18 ++++++------- sc/qa/unit/helper/qahelper.hxx | 43 ++++++++++++++++----------------- sc/qa/unit/subsequent_export_test.cxx | 2 - sc/qa/unit/subsequent_filters_test.cxx | 6 ++-- 4 files changed, 35 insertions(+), 34 deletions(-)
New commits: commit 9174e784f8bbd802c8a8719a0a59bec5ad1af90c Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu Nov 17 14:44:38 2022 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Nov 17 19:40:09 2022 +0100 sc: these methods are only used in ScModelTestBase reduce the scope Change-Id: I2c02579e981de218d1f8ec6034b541ee2fdd8870 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142841 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 09100b11e57e..25abd86a64e7 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -125,7 +125,7 @@ bool testEqualsWithTolerance( tools::Long nVal1, tools::Long nVal2, tools::Long return ( std::abs( nVal1 - nVal2 ) <= nTol ); } -void loadFile(const OUString& aFileName, std::string& aContent) +void ScModelTestBase::loadFile(const OUString& aFileName, std::string& aContent) { OString aOFileName = OUStringToOString(aFileName, RTL_TEXTENCODING_UTF8); @@ -150,7 +150,7 @@ void loadFile(const OUString& aFileName, std::string& aContent) aContent = aOStream.str(); } -void testFile(const OUString& aFileName, ScDocument& rDoc, SCTAB nTab, StringType aStringFormat) +void ScModelTestBase::testFile(const OUString& aFileName, ScDocument& rDoc, SCTAB nTab, StringType aStringFormat) { csv_handler aHandler(&rDoc, nTab, aStringFormat); orcus::csv::parser_config aConfig; @@ -175,7 +175,7 @@ void testFile(const OUString& aFileName, ScDocument& rDoc, SCTAB nTab, StringTyp } } -void testCondFile(const OUString& aFileName, ScDocument* pDoc, SCTAB nTab) +void ScModelTestBase::testCondFile(const OUString& aFileName, ScDocument* pDoc, SCTAB nTab) { conditional_format_handler aHandler(pDoc, nTab); orcus::csv::parser_config aConfig; @@ -198,10 +198,10 @@ void testCondFile(const OUString& aFileName, ScDocument* pDoc, SCTAB nTab) } } -void testFormats(ScModelTestBase* pTest, ScDocument* pDoc,std::u16string_view sFormat) +void ScModelTestBase::testFormats(ScDocument* pDoc,std::u16string_view sFormat) { //test Sheet1 with csv file - OUString aCSVFileName = pTest->createFilePath(u"contentCSV/numberFormat.csv"); + OUString aCSVFileName = createFilePath(u"contentCSV/numberFormat.csv"); testFile(aCSVFileName, *pDoc, 0, StringType::PureString); //need to test the color of B3 //it's not a font color! @@ -272,7 +272,7 @@ void testFormats(ScModelTestBase* pTest, ScDocument* pDoc,std::u16string_view sF //test Sheet3 only for ods and xlsx if ( sFormat == u"calc8" || sFormat == u"Calc Office Open XML" ) { - aCSVFileName = pTest->createFilePath(u"contentCSV/conditionalFormatting.csv"); + aCSVFileName = createFilePath(u"contentCSV/conditionalFormatting.csv"); testCondFile(aCSVFileName, pDoc, 2); // test parent cell style import ( fdo#55198 ) if ( sFormat == u"Calc Office Open XML" ) @@ -312,7 +312,7 @@ void testFormats(ScModelTestBase* pTest, ScDocument* pDoc,std::u16string_view sF CPPUNIT_ASSERT_EQUAL(ScRangeList(ScRange(1,1,2,3,1,2)), rRange3); } -const SdrOle2Obj* getSingleOleObject(ScDocument& rDoc, sal_uInt16 nPage) +const SdrOle2Obj* ScModelTestBase::getSingleOleObject(ScDocument& rDoc, sal_uInt16 nPage) { // Retrieve the chart object instance from the 2nd page (for the 2nd sheet). ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer(); @@ -351,7 +351,7 @@ const SdrOle2Obj* getSingleOleObject(ScDocument& rDoc, sal_uInt16 nPage) return static_cast<const SdrOle2Obj*>(pObj); } -const SdrOle2Obj* getSingleChartObject(ScDocument& rDoc, sal_uInt16 nPage) +const SdrOle2Obj* ScModelTestBase::getSingleChartObject(ScDocument& rDoc, sal_uInt16 nPage) { const SdrOle2Obj* pObj = getSingleOleObject(rDoc, nPage); @@ -413,7 +413,7 @@ static std::vector<OUString> getChartRangeRepresentations(const SdrOle2Obj& rCha return aRangeReps; } -ScRangeList getChartRanges(ScDocument& rDoc, const SdrOle2Obj& rChartObj) +ScRangeList ScModelTestBase::getChartRanges(ScDocument& rDoc, const SdrOle2Obj& rChartObj) { std::vector<OUString> aRangeReps = getChartRangeRepresentations(rChartObj); ScRangeList aRanges; diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index ec4db2f10b7b..d036bed19579 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -113,25 +113,6 @@ SCQAHELPER_DLLPUBLIC std::ostream& operator<<(std::ostream& rStrm, const Color& SCQAHELPER_DLLPUBLIC std::ostream& operator<<(std::ostream& rStrm, const OpCode& rCode); -// Why is this here and not in osl, and using the already existing file -// handling APIs? Do we really want to add arbitrary new file handling -// wrappers here and there (and then having to handle the Android (and -// eventually perhaps iOS) special cases here, too)? Please move this to osl, -// it sure looks generally useful. Or am I missing something? - -void loadFile(const OUString& aFileName, std::string& aContent); - -SCQAHELPER_DLLPUBLIC void testFile(const OUString& aFileName, ScDocument& rDoc, SCTAB nTab, StringType aStringFormat = StringType::StringValue); - -//need own handler because conditional formatting strings must be generated -SCQAHELPER_DLLPUBLIC void testCondFile(const OUString& aFileName, ScDocument* pDoc, SCTAB nTab); - -SCQAHELPER_DLLPUBLIC const SdrOle2Obj* getSingleOleObject(ScDocument& rDoc, sal_uInt16 nPage); - -SCQAHELPER_DLLPUBLIC const SdrOle2Obj* getSingleChartObject(ScDocument& rDoc, sal_uInt16 nPage); - -SCQAHELPER_DLLPUBLIC ScRangeList getChartRanges(ScDocument& rDoc, const SdrOle2Obj& rChartObj); - bool checkFormula(ScDocument& rDoc, const ScAddress& rPos, const char* pExpected); bool checkFormulaPosition(ScDocument& rDoc, const ScAddress& rPos); @@ -241,6 +222,28 @@ public: ScDocShell* getScDocShell(); ScTabViewShell* getViewShell(); void miscRowHeightsTest( TestParam const * aTestValues, unsigned int numElems); + + void testFile(const OUString& aFileName, ScDocument& rDoc, SCTAB nTab, StringType aStringFormat = StringType::StringValue); + + //need own handler because conditional formatting strings must be generated + void testCondFile(const OUString& aFileName, ScDocument* pDoc, SCTAB nTab); + + const SdrOle2Obj* getSingleOleObject(ScDocument& rDoc, sal_uInt16 nPage); + + const SdrOle2Obj* getSingleChartObject(ScDocument& rDoc, sal_uInt16 nPage); + + ScRangeList getChartRanges(ScDocument& rDoc, const SdrOle2Obj& rChartObj); + + void testFormats(ScDocument* pDoc,std::u16string_view sFormat); + +private: + // Why is this here and not in osl, and using the already existing file + // handling APIs? Do we really want to add arbitrary new file handling + // wrappers here and there (and then having to handle the Android (and + // eventually perhaps iOS) special cases here, too)? Please move this to osl, + // it sure looks generally useful. Or am I missing something? + + void loadFile(const OUString& aFileName, std::string& aContent); }; #define ASSERT_DOUBLES_EQUAL( expected, result ) \ @@ -255,8 +258,6 @@ SCQAHELPER_DLLPUBLIC void checkFormula(ScDocument& rDoc, const ScAddress& rPos, #define ASSERT_FORMULA_EQUAL(doc, pos, expected, msg) \ checkFormula(doc, pos, expected, msg, CPPUNIT_SOURCELINE()) -SCQAHELPER_DLLPUBLIC void testFormats(ScModelTestBase* pTest, ScDocument* pDoc,std::u16string_view sFormat); - SCQAHELPER_DLLPUBLIC ScTokenArray* getTokens(ScDocument& rDoc, const ScAddress& rPos); SCQAHELPER_DLLPUBLIC std::string to_std_string(const OUString& rStr); diff --git a/sc/qa/unit/subsequent_export_test.cxx b/sc/qa/unit/subsequent_export_test.cxx index 7c006b163544..94e35146b729 100644 --- a/sc/qa/unit/subsequent_export_test.cxx +++ b/sc/qa/unit/subsequent_export_test.cxx @@ -767,7 +767,7 @@ void ScExportTest::testFormatExportODS() ScDocument* pDoc = getScDoc(); - testFormats(this, &*pDoc, u"calc8"); + testFormats(pDoc, u"calc8"); } void ScExportTest::testCommentExportXLSX() diff --git a/sc/qa/unit/subsequent_filters_test.cxx b/sc/qa/unit/subsequent_filters_test.cxx index d4f83e008b3b..ddb72bc64e37 100644 --- a/sc/qa/unit/subsequent_filters_test.cxx +++ b/sc/qa/unit/subsequent_filters_test.cxx @@ -1208,7 +1208,7 @@ void ScFiltersTest::testFormatsODS() ScDocument* pDoc = getScDoc(); - testFormats(this, &*pDoc, u"calc8"); + testFormats(pDoc, u"calc8"); } // void ScFiltersTest::testFormatsXLS() @@ -1218,7 +1218,7 @@ void ScFiltersTest::testFormatsODS() // // ScDocument& rDoc = xDocSh->GetDocument(); // -// testFormats(this, rDoc, FORMAT_XLS); +// testFormats(rDoc, FORMAT_XLS); // } // void ScFiltersTest::testFormatsXLSX() @@ -1228,7 +1228,7 @@ void ScFiltersTest::testFormatsODS() // // ScDocument& rDoc = xDocSh->GetDocument(); // -// testFormats(this, rDoc, FORMAT_XLSX); +// testFormats(rDoc, FORMAT_XLSX); // } void ScFiltersTest::testMatrixODS()