diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-12-09 08:43:27 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-12-09 09:34:39 +0100 |
commit | 91f649a119d4b7ece26f9737a38663664953a57a (patch) | |
tree | b2d3d85cd532ed21a1b1f86b942659b4a2407ada /xmloff/qa | |
parent | 27487243c3ee31927e17a0859614ffa0df7881d7 (diff) |
ODP import/export: refer to theme from shape text color
Refer to the 12 pre-defined colors by name + don't write the attribute
for the case when there is no theme.
Change-Id: Ib6ab5b7b34d896a36e04309bf0cb410998acce01
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126566
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'xmloff/qa')
-rw-r--r-- | xmloff/qa/unit/data/refer-to-theme.odp | bin | 0 -> 14488 bytes | |||
-rw-r--r-- | xmloff/qa/unit/draw.cxx | 24 |
2 files changed, 24 insertions, 0 deletions
diff --git a/xmloff/qa/unit/data/refer-to-theme.odp b/xmloff/qa/unit/data/refer-to-theme.odp Binary files differnew file mode 100644 index 000000000000..83bad49b5f56 --- /dev/null +++ b/xmloff/qa/unit/data/refer-to-theme.odp diff --git a/xmloff/qa/unit/draw.cxx b/xmloff/qa/unit/draw.cxx index cd991e691d7c..a61ef6de2717 100644 --- a/xmloff/qa/unit/draw.cxx +++ b/xmloff/qa/unit/draw.cxx @@ -177,6 +177,30 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeImport) CPPUNIT_ASSERT_EQUAL(static_cast<util::Color>(0x954F72), aColorScheme[11]); } +CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testReferToTheme) +{ + // Given a document that refers to a theme color: + OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "refer-to-theme.odp"; + + // When loading and saving that document: + getComponent() = loadFromDesktop(aURL); + utl::TempFile aTempFile; + save("impress8", aTempFile); + + // Make sure the export result has the theme reference: + std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml"); + xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); + // Without the accompanying fix in place, this test would have failed with: + // - XPath '//style:style[@style:name='T1']/style:text-properties' no attribute 'theme-color' exist + // i.e. only the direct color was written, but not the theme reference. + assertXPath(pXmlDoc, "//style:style[@style:name='T1']/style:text-properties", "theme-color", + "accent1"); + assertXPath(pXmlDoc, "//style:style[@style:name='T2']/style:text-properties", "theme-color", + "accent1"); + assertXPath(pXmlDoc, "//style:style[@style:name='T3']/style:text-properties", "theme-color", + "accent1"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |