summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-02-04 17:34:39 +0100
committerMiklos Vajna <vmiklos@collabora.com>2019-02-04 18:42:36 +0100
commit82365563fb2fd55d90d444a104fa475d4ffc4cf1 (patch)
tree6ced7ee022ad45db2037110577c17829a76f1f65 /sd
parent0a20339351dcbc75599df4e97626204c4cce8fb1 (diff)
Related: tdf#94238 PPTX export: handle border and center of radial gradient
Map Border to a gradient stop before the final one. Map X/YOffset to the focus rectangle of the center shade, i.e. the opposite of what the import already does. Change-Id: I88db7d579da7327e5e06b736a75a6892b338dd73 Reviewed-on: https://gerrit.libreoffice.org/67369 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/export-tests-ooxml1.cxx34
-rw-r--r--sd/qa/unit/import-tests.cxx31
2 files changed, 34 insertions, 31 deletions
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx
index 109c5a3f2261..f3e167f9f16c 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -101,6 +101,7 @@ public:
void testTdf111884();
void testTdf112633();
void testCustomXml();
+ void testTdf94238();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest1);
@@ -131,6 +132,7 @@ public:
CPPUNIT_TEST(testTdf111884);
CPPUNIT_TEST(testTdf112633);
CPPUNIT_TEST(testCustomXml);
+ CPPUNIT_TEST(testTdf94238);
CPPUNIT_TEST_SUITE_END();
@@ -846,6 +848,38 @@ void SdOOXMLExportTest1::testCustomXml()
CPPUNIT_ASSERT(pStream);
}
+void SdOOXMLExportTest1::testTdf94238()
+{
+ // Load document and export it to a temporary file.
+ ::sd::DrawDocShellRef xDocShRef
+ = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf94238.pptx"), PPTX);
+ utl::TempFile tempFile;
+ xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+ uno::Reference<drawing::XDrawPagesSupplier> xDoc(xDocShRef->GetDoc()->getUnoModel(),
+ uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xDoc.is());
+
+ uno::Reference<drawing::XDrawPage> xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xPage.is());
+
+ uno::Reference<beans::XPropertySet> xShape(getShape(0, xPage));
+ CPPUNIT_ASSERT(xShape.is());
+
+ awt::Gradient aGradient;
+ CPPUNIT_ASSERT(xShape->getPropertyValue("FillGradient") >>= aGradient);
+
+ // Without the accompanying fix in place, this test would have failed with
+ // the following details:
+ // - aGradient.Style was awt::GradientStyle_ELLIPTICAL
+ // - aGradient.YOffset was 70
+ // - aGradient.Border was 0
+ CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_RADIAL, aGradient.Style);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(100), aGradient.YOffset);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(39), aGradient.Border);
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest1);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 4a60ca586719..5cf40ad1f4cc 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -192,7 +192,6 @@ public:
void testTdf119015();
void testTdf120028();
void testTdf120028b();
- void testTdf94238();
void testTdf44223();
CPPUNIT_TEST_SUITE(SdImportTest);
@@ -277,7 +276,6 @@ public:
CPPUNIT_TEST(testTdf119015);
CPPUNIT_TEST(testTdf120028);
CPPUNIT_TEST(testTdf120028b);
- CPPUNIT_TEST(testTdf94238);
CPPUNIT_TEST(testTdf44223);
CPPUNIT_TEST_SUITE_END();
@@ -2598,35 +2596,6 @@ void SdImportTest::testTdf120028b()
xDocShRef->DoClose();
}
-void SdImportTest::testTdf94238()
-{
- // Assert how the gradient fill of the only shape in the document is
- // imported.
- ::sd::DrawDocShellRef xDocShRef
- = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf94238.pptx"), PPTX);
- uno::Reference<drawing::XDrawPagesSupplier> xDoc(xDocShRef->GetDoc()->getUnoModel(),
- uno::UNO_QUERY);
- CPPUNIT_ASSERT(xDoc.is());
-
- uno::Reference<drawing::XDrawPage> xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
- CPPUNIT_ASSERT(xPage.is());
-
- uno::Reference<beans::XPropertySet> xShape(getShape(0, xPage));
- CPPUNIT_ASSERT(xShape.is());
-
- awt::Gradient aGradient;
- CPPUNIT_ASSERT(xShape->getPropertyValue("FillGradient") >>= aGradient);
-
- // Without the accompanying fix in place, this test would have failed with
- // the following details:
- // - aGradient.Style was awt::GradientStyle_ELLIPTICAL
- // - aGradient.YOffset was 70
- // - aGradient.Border was 0
- CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_RADIAL, aGradient.Style);
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(100), aGradient.YOffset);
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(39), aGradient.Border);
-}
-
void SdImportTest::testTdf44223()
{
::sd::DrawDocShellRef xDocShRef