diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-07-06 01:36:57 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-07-06 04:30:25 +0200 |
commit | a2c665e4dd73007fe7f0eda2de31db8b768f1df9 (patch) | |
tree | 38df7f4df79baa45a07c95601e3a786444621be3 /sc | |
parent | af8f249ad6368fb957b98ea70bfdf6778709d2eb (diff) |
WIN fix some unit tests more generally
Fixes regressed unit test failures from commit 3f7e8ddea89f ("Enable
many more unit tests on all archs").
Change-Id: I76a8f7560675b9be3765237f8368d05cff22591d
Reviewed-on: https://gerrit.libreoffice.org/75155
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/helper/qahelper.cxx | 8 | ||||
-rw-r--r-- | sc/qa/unit/helper/qahelper.hxx | 4 | ||||
-rw-r--r-- | sc/qa/unit/subsequent_export-test.cxx | 17 |
3 files changed, 18 insertions, 11 deletions
diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index b38dcdfac161..c5f183161a78 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -405,8 +405,6 @@ ScRangeList getChartRanges(ScDocument& rDoc, const SdrOle2Obj& rChartObj) return aRanges; } -namespace { - ScTokenArray* getTokens(ScDocument& rDoc, const ScAddress& rPos) { ScFormulaCell* pCell = rDoc.GetFormulaCell(rPos); @@ -420,8 +418,6 @@ ScTokenArray* getTokens(ScDocument& rDoc, const ScAddress& rPos) return pCell->GetCode(); } -} - bool checkFormula(ScDocument& rDoc, const ScAddress& rPos, const char* pExpected) { ScTokenArray* pCode = getTokens(rDoc, rPos); @@ -778,15 +774,11 @@ void ScBootstrapFixture::miscRowHeightsTest( TestParam const * aTestValues, unsi } } -namespace { - std::string to_std_string(const OUString& rStr) { return std::string(rStr.toUtf8().getStr()); } -} - void checkFormula(ScDocument& rDoc, const ScAddress& rPos, const char* expected, const char* msg, CppUnit::SourceLine const & sourceLine) { ScTokenArray* pCode = getTokens(rDoc, rPos); diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index 671b3bdcad1b..d0ad00b258d7 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -219,6 +219,10 @@ SCQAHELPER_DLLPUBLIC void checkFormula(ScDocument& rDoc, const ScAddress& rPos, SCQAHELPER_DLLPUBLIC void testFormats(ScBootstrapFixture* pTest, ScDocument* pDoc, sal_Int32 nFormat); +SCQAHELPER_DLLPUBLIC ScTokenArray* getTokens(ScDocument& rDoc, const ScAddress& rPos); + +SCQAHELPER_DLLPUBLIC std::string to_std_string(const OUString& rStr); + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 462320794754..473be4c8593b 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -3223,11 +3223,22 @@ void ScExportTest::testSupBookVirtualPathXLS() ScDocument& rDoc = xDocSh->GetDocument(); + ScAddress aPos(0,0,0); + ScTokenArray* pCode = getTokens(rDoc, aPos); + if (!pCode) + CppUnit::Asserter::fail("empty token array", CPPUNIT_SOURCELINE()); + + OUString aFormula = toString(rDoc, aPos, *pCode, rDoc.GetGrammar()); #ifdef _WIN32 - ASSERT_FORMULA_EQUAL(rDoc, ScAddress(0,0,0), "'file:///C:/home/timar/Documents/external.xls'#$Sheet1.A1", "Wrong SupBook VirtualPath URL"); -#else - ASSERT_FORMULA_EQUAL(rDoc, ScAddress(0,0,0), "'file:///home/timar/Documents/external.xls'#$Sheet1.A1", "Wrong SupBook VirtualPath URL"); + aFormula = aFormula.copy(0, 9) + aFormula.copy(12); // strip drive letter, e.g. 'C:/' #endif + OUString aExpectedFormula = OUStringLiteral("'file:///home/timar/Documents/external.xls'#$Sheet1.A1"); + if (aFormula != aExpectedFormula) + { + CppUnit::Asserter::failNotEqual(to_std_string(aExpectedFormula), + to_std_string(aFormula), CPPUNIT_SOURCELINE(), CppUnit::AdditionalMessage("Wrong SupBook VirtualPath URL")); + } + xDocSh->DoClose(); } |