summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-01-30 17:42:39 +0100
committerMiklos Vajna <vmiklos@collabora.com>2019-06-18 13:03:22 +0200
commitcc678cbe2e9f8d1bd9b571e0c3af0a38d0d2a4ad (patch)
tree0db38eb03943689a7e38b0d7541e3e3a82d6e67e /sd
parent8842b1938bba44315b3c88e1accbaadcc2a6df09 (diff)
Related: tdf#94238 PPTX import: handle subset of radial gradient fill
Handle the case when the horizontal center is at 50%. Other cases are still unhandled, those are more complex. After fixing the style, center and border, the gradient fill looks similar to how PowerPoint renders it. Reviewed-on: https://gerrit.libreoffice.org/67168 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins (cherry picked from commit fa6d726a9369fd49ff2b6c00da682641a025ba50) Conflicts: sd/qa/unit/import-tests.cxx Change-Id: I419da70482de37031aa2c7fc735692019d7665f5
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/pptx/tdf94238.pptxbin0 -> 33928 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx33
2 files changed, 33 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/tdf94238.pptx b/sd/qa/unit/data/pptx/tdf94238.pptx
new file mode 100644
index 000000000000..cf35ecee8d12
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf94238.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 362d67814d91..36d4806efdb2 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -194,6 +194,7 @@ public:
void testTdf120028();
void testTdf120028b();
void testCropToShape();
+ void testTdf94238();
CPPUNIT_TEST_SUITE(SdImportTest);
@@ -280,6 +281,7 @@ public:
CPPUNIT_TEST(testTdf120028);
CPPUNIT_TEST(testTdf120028b);
CPPUNIT_TEST(testCropToShape);
+ CPPUNIT_TEST(testTdf94238);
CPPUNIT_TEST_SUITE_END();
};
@@ -2675,6 +2677,37 @@ void SdImportTest::testCropToShape()
CPPUNIT_ASSERT_EQUAL(css::drawing::BitmapMode_STRETCH, bitmapmode);
}
+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);
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
CPPUNIT_PLUGIN_IMPLEMENT();