diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-03-08 10:01:51 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-03-08 12:15:03 +0000 |
commit | 366812f72f73c12e5be83d27409272769e9337f2 (patch) | |
tree | 30496d26737dc09a8376168144f4ce4d95ee493d /test/source | |
parent | d2cdc92d4a2664ead411a5e848dafaf559ba47ce (diff) |
UnoApiXmlTest: remove workaround to handle chart file names in tests
No longer needed after 269585d6b461b565fe75f77b6dbf219749edc5ab
"oox, sd: fix ever-increasing chart IDs when exporting to PPTX"
and b27b250f70f4651d387ef0646a9668950371e779
"sc: fix ever-increasing chart IDs when exporting to XLSX"
Also restored the documents modified in d913584909c2e0a235546a5f800baf45c3446d8b
"UnoApiXmlTest: merge parseExport from ChartTest" to ensure
only one chart was possible per document. Sample documents in unittests
can have more than one chart now, since the chart file name wouldn't
change
Kudos to Miklos Vajna for fixing the chart file names when exporting them
Change-Id: I10e2c44e41953a2d0d08bbb2a813134861e74660
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148461
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'test/source')
-rw-r--r-- | test/source/unoapixml_test.cxx | 47 |
1 files changed, 3 insertions, 44 deletions
diff --git a/test/source/unoapixml_test.cxx b/test/source/unoapixml_test.cxx index c80ceb616665..23dc826cbc97 100644 --- a/test/source/unoapixml_test.cxx +++ b/test/source/unoapixml_test.cxx @@ -11,13 +11,9 @@ #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XStorable.hpp> -#include <com/sun/star/packages/zip/ZipFileAccess.hpp> #include <comphelper/processfactory.hxx> #include <comphelper/propertyvalue.hxx> -#include <o3tl/string_view.hxx> -#include <unotools/ucbstreamhelper.hxx> - #include <sfx2/app.hxx> #include <sfx2/objsh.hxx> #include <utility> @@ -32,46 +28,9 @@ UnoApiXmlTest::UnoApiXmlTest(OUString path) xmlDocUniquePtr UnoApiXmlTest::parseExport(OUString const& rStreamName) { - if (rStreamName.indexOf("chart") == -1) - { - std::unique_ptr<SvStream> const pStream( - parseExportStream(maTempFile.GetURL(), rStreamName)); - xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); - return pXmlDoc; - } - else - { - // we have a static counter that increments chart export file names. So - // only the first exported file gets the file name chart1.xml and all the - // following charts are incremented by one even if they are in a different file. - OUString aStreamName(rStreamName); - uno::Reference<packages::zip::XZipFileAccess2> xNameAccess - = packages::zip::ZipFileAccess::createWithURL( - comphelper::getComponentContext(m_xSFactory), maTempFile.GetURL()); - const uno::Sequence<OUString> aNames = xNameAccess->getElementNames(); - - if (aStreamName.endsWith(".xml")) - // remove "1.xml" - aStreamName = aStreamName.copy(0, aStreamName.getLength() - 5); - - uno::Reference<io::XInputStream> xInputStream; - - int nCount = 0; - for (const auto& rElementName : aNames) - { - if (o3tl::starts_with(rElementName, aStreamName)) - { - xInputStream.set(xNameAccess->getByName(rElementName), uno::UNO_QUERY); - ++nCount; - assert(nCount == 1 && "Only use one chart per document"); - } - } - - CPPUNIT_ASSERT(xInputStream.is()); - std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true)); - - return parseXmlStream(pStream.get()); - } + std::unique_ptr<SvStream> const pStream(parseExportStream(maTempFile.GetURL(), rStreamName)); + xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); + return pXmlDoc; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |