diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-12-08 08:42:18 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-06-28 08:24:38 +0200 |
commit | 3d210f998928cb00e6989d9c2ad64ef1fa699175 (patch) | |
tree | aa41dfb5949232bb2b5bed5a70d88076129a1913 /xmloff/qa/unit | |
parent | e207983a09cbb0139bcc693d63f3ea0980699b26 (diff) |
ODP import: handle theme of master pages
This is just the theme itself, we don't refer to this theme from e.g.
shape text color yet.
(cherry picked from commit 26c8e266e1ae267fd15878057a92340078136140)
Change-Id: I0d8f4b06217fb491e47d775628fde742d8ff104d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136496
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'xmloff/qa/unit')
-rw-r--r-- | xmloff/qa/unit/data/theme.odp | bin | 0 -> 13253 bytes | |||
-rw-r--r-- | xmloff/qa/unit/draw.cxx | 24 |
2 files changed, 24 insertions, 0 deletions
diff --git a/xmloff/qa/unit/data/theme.odp b/xmloff/qa/unit/data/theme.odp Binary files differnew file mode 100644 index 000000000000..da8d189753f0 --- /dev/null +++ b/xmloff/qa/unit/data/theme.odp diff --git a/xmloff/qa/unit/draw.cxx b/xmloff/qa/unit/draw.cxx index fd32c59d90b8..f3bab2a69996 100644 --- a/xmloff/qa/unit/draw.cxx +++ b/xmloff/qa/unit/draw.cxx @@ -155,6 +155,30 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeExport) assertXPath(pXmlDoc, "//style:master-page/loext:theme/loext:color-table/loext:color", 12); } +CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeImport) +{ + // Given a document that has a master page with a theme associated: + OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "theme.odp"; + + // When loading that document: + getComponent() = loadFromDesktop(aURL); + + // Then make sure the doc model has a master page with a theme: + uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); + uno::Reference<drawing::XMasterPageTarget> xDrawPage( + xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xMasterpage(xDrawPage->getMasterPage(), uno::UNO_QUERY); + comphelper::SequenceAsHashMap aMap(xMasterpage->getPropertyValue("Theme")); + // Without the accompanying fix in place, this test would have failed with: + // Cannot extract an Any(void) to string! + // i.e. the master page had no theme. + CPPUNIT_ASSERT_EQUAL(OUString("Office Theme"), aMap["Name"].get<OUString>()); + CPPUNIT_ASSERT_EQUAL(OUString("Office"), aMap["ColorSchemeName"].get<OUString>()); + auto aColorScheme = aMap["ColorScheme"].get<uno::Sequence<util::Color>>(); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(12), aColorScheme.getLength()); + CPPUNIT_ASSERT_EQUAL(static_cast<util::Color>(0x954F72), aColorScheme[11]); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |