summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-11-11 17:23:55 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2021-11-11 19:00:02 +0100
commitce64e3feb72dbe8f14a5b22a6a02722b02b391b0 (patch)
tree4dbf231865dfc7de88442ed3ca35785124d99471
parentsw: the RedlineComment property is settable on SwXRedline (diff)
downloadcore-ce64e3feb72dbe8f14a5b22a6a02722b02b391b0.tar.gz
core-ce64e3feb72dbe8f14a5b22a6a02722b02b391b0.zip
CppunitTest_sc_macros_test: simplify test
Change-Id: Icefb1de06f26b2e0d0b20920fdfef7947cfed964 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125067 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--sc/qa/extras/macros-test.cxx54
1 files changed, 20 insertions, 34 deletions
diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx
index 5ef95b2018d7..f6745d3a711a 100644
--- a/sc/qa/extras/macros-test.cxx
+++ b/sc/qa/extras/macros-test.cxx
@@ -539,41 +539,27 @@ void ScMacrosTest::testTdf142033()
aParams, aRet, aOutParamIndex, aOutParam);
// Export to ODS
- uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY);
- utl::MediaDescriptor aMediaDescriptor;
- aMediaDescriptor["FilterName"] <<= OUString("calc8");
- auto pTempFile = std::make_shared<utl::TempFile>();
- pTempFile->EnableKillingFile();
- xStorable->storeToURL(pTempFile->GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
- xComponent->dispose();
+ saveAndReload(xComponent, "calc8");
+ CPPUNIT_ASSERT(xComponent);
+
+ SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(xComponent);
- xmlDocUniquePtr pContentXml = XPathHelper::parseExport(pTempFile, m_xSFactory, "content.xml");
- CPPUNIT_ASSERT(pContentXml);
-
- assertXPathContent(pContentXml,
- "/office:document-content/office:body/office:spreadsheet/table:table[1]/"
- "table:table-row[1]/table:table-cell[1]/text:p", "string no newlines");
-
- assertXPathContent(pContentXml,
- "/office:document-content/office:body/office:spreadsheet/table:table[1]/"
- "table:table-row[1]/table:table-cell[2]/text:p[1]", "string with");
-
- // Without the fix in place, this test would have failed here with
- // - Expression: xmlXPathNodeSetGetLength(pXmlNodes) > 0
- assertXPathContent(pContentXml,
- "/office:document-content/office:body/office:spreadsheet/table:table[1]/"
- "table:table-row[1]/table:table-cell[2]/text:p[2]", "newlines");
-
- assertXPathContent(pContentXml,
- "/office:document-content/office:body/office:spreadsheet/table:table[1]/"
- "table:table-row[2]/table:table-cell[1]/text:p", "string no newlines");
-
- assertXPathContent(pContentXml,
- "/office:document-content/office:body/office:spreadsheet/table:table[1]/"
- "table:table-row[2]/table:table-cell[2]/text:p[1]", "string with");
- assertXPathContent(pContentXml,
- "/office:document-content/office:body/office:spreadsheet/table:table[1]/"
- "table:table-row[2]/table:table-cell[2]/text:p[2]", "newlines");
+ CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
+ ScDocShell* pDocSh = static_cast<ScDocShell*>(pFoundShell);
+ ScDocument& rDoc = pDocSh->GetDocument();
+
+ CPPUNIT_ASSERT_EQUAL(OUString("string no newlines"), rDoc.GetString(ScAddress(0,0,0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("string no newlines"), rDoc.GetString(ScAddress(0,1,0)));
+
+ // Without the fix in place, this test would have failed with
+ // - Expected: string with
+ // newlines
+ // - Actual : string withnewlines
+ CPPUNIT_ASSERT_EQUAL(OUString(u"string with" + OUStringChar(u'\xA') + u"newlines"), rDoc.GetString(ScAddress(1,0,0)));
+ CPPUNIT_ASSERT_EQUAL(OUString(u"string with" + OUStringChar(u'\xA') + u"newlines"), rDoc.GetString(ScAddress(1,1,0)));
+
+ css::uno::Reference<css::util::XCloseable> xCloseable(xComponent, css::uno::UNO_QUERY_THROW);
+ xCloseable->close(true);
}
void ScMacrosTest::testTdf131562()