diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-01-30 17:42:39 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2019-02-04 11:10:46 +0100 |
commit | f4999d0e3eae63f9b00c7e809f55a99fe596e8e2 (patch) | |
tree | a3569bd54ed1c608893b1e834b602383ce96393c /sd | |
parent | 79f84cf94dd26c4fee14a0db4a98df7791df78f2 (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.
Change-Id: I419da70482de37031aa2c7fc735692019d7665f5
Reviewed-on: https://gerrit.libreoffice.org/67175
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/pptx/tdf94238.pptx | bin | 0 -> 33928 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 33 |
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 Binary files differnew file mode 100644 index 000000000000..cf35ecee8d12 --- /dev/null +++ b/sd/qa/unit/data/pptx/tdf94238.pptx diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index c8fcc4584be3..094a051b7c1c 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -179,6 +179,7 @@ public: void testTdf119015(); void testTdf120028(); void testTdf120028b(); + void testTdf94238(); CPPUNIT_TEST_SUITE(SdImportTest); @@ -257,6 +258,7 @@ public: CPPUNIT_TEST(testTdf119015); CPPUNIT_TEST(testTdf120028); CPPUNIT_TEST(testTdf120028b); + CPPUNIT_TEST(testTdf94238); CPPUNIT_TEST_SUITE_END(); }; @@ -2516,6 +2518,37 @@ 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); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); |