summaryrefslogtreecommitdiff
path: root/sd/qa
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2017-02-04 00:38:52 +0100
committerTamás Zolnai <tamas.zolnai@collabora.com>2017-02-05 18:28:56 +0000
commitaeece6f198685b96579bdbd1409b3535fb5f09d1 (patch)
tree5355105f799ca5094fc3d455361a69e94603a7f8 /sd/qa
parent900556a89278f6d98fcce1405c9954318e52e671 (diff)
tdf#31488: Background fill changes its color when saving a PPTX file to ODP
For a gradient fill we need to generate a name because ODP export works with this name. In case of shapes it works because when fill attribute changes some internal name generation is triggered. The same thing doesn't work for slide background so generate this name explicitely in oox code. Change-Id: Ic6ebf37ef3d66a9c274747ca04653363b1fe6d02 Reviewed-on: https://gerrit.libreoffice.org/33937 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'sd/qa')
-rwxr-xr-xsd/qa/unit/data/pptx/tdf105739.pptxbin0 -> 30709 bytes
-rw-r--r--sd/qa/unit/export-tests-ooxml2.cxx35
2 files changed, 35 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/tdf105739.pptx b/sd/qa/unit/data/pptx/tdf105739.pptx
new file mode 100755
index 000000000000..08e26f55a91d
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf105739.pptx
Binary files differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 540e80022d7d..0c098dceae99 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -103,6 +103,7 @@ public:
void testTdf99224();
void testTdf92076();
void testTdf59046();
+ void testTdf105739();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
@@ -129,6 +130,7 @@ public:
CPPUNIT_TEST(testTdf99224);
CPPUNIT_TEST(testTdf92076);
CPPUNIT_TEST(testTdf59046);
+ CPPUNIT_TEST(testTdf105739);
CPPUNIT_TEST_SUITE_END();
@@ -757,6 +759,39 @@ void SdOOXMLExportTest2::testTdf59046()
assertXPath(pXmlDocRels, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path", 1);
}
+void SdOOXMLExportTest2::testTdf105739()
+{
+ // Gradient was lost during saving to ODP
+ sd::DrawDocShellRef xShell = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf105739.pptx"), PPTX);
+ utl::TempFile tempFile;
+ xShell = saveAndReload(xShell.get(), ODP, &tempFile);
+ uno::Reference<drawing::XDrawPage> xPage = getPage(0, xShell);
+ uno::Reference<beans::XPropertySet> xPropSet(xPage, uno::UNO_QUERY);
+ uno::Any aAny = xPropSet->getPropertyValue("Background");
+ CPPUNIT_ASSERT(aAny.hasValue());
+ if (aAny.hasValue())
+ {
+ uno::Reference< beans::XPropertySet > aXBackgroundPropSet;
+ aAny >>= aXBackgroundPropSet;
+ aAny = aXBackgroundPropSet->getPropertyValue("FillBitmapName");
+
+ // Test fill type
+ drawing::FillStyle aFillStyle(drawing::FillStyle_NONE);
+ aXBackgroundPropSet->getPropertyValue("FillStyle") >>= aFillStyle;
+ CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, aFillStyle);
+
+ // Test gradient properties
+ com::sun::star::awt::Gradient aFillGradient;
+ aXBackgroundPropSet->getPropertyValue("FillGradient") >>= aFillGradient;
+ CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_LINEAR, aFillGradient.Style);
+ CPPUNIT_ASSERT_EQUAL(util::Color(0xff0000), aFillGradient.StartColor);
+ CPPUNIT_ASSERT_EQUAL(util::Color(0x00b050), aFillGradient.EndColor);
+ }
+
+ xShell->DoClose();
+}
+
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
CPPUNIT_PLUGIN_IMPLEMENT();