summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2020-05-08 23:25:17 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2020-05-11 00:12:33 +0200
commit5952331844450dad93e21d2e329d51841ae1700e (patch)
treeee95ae8c96b27928ba6ae30620e9e524c1982d3e /sd
parentce0933c0d8cc0d51774d0168a8be4e9bb3153463 (diff)
tdf#49247: implement soft edges document model and import/export
... for ODF and OOXML. Two object properties added: SoftEdge (boolean, effect enabled/disabled) SoftEdgeRad (sal_Int32, effect radius in 100ths of mm) Two corresponding ODF attributes added: loext:softedge ("visible"/"hidden") loext:softedge-radius (metric) Change-Id: I0dc4d7fc3e5b0c2c36092d430568ebcfd3a68c9c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93833 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/odg/softedges.odgbin0 -> 10130 bytes
-rw-r--r--sd/qa/unit/data/pptx/shape-soft-edges.pptxbin0 -> 32995 bytes
-rw-r--r--sd/qa/unit/export-tests-ooxml2.cxx16
-rw-r--r--sd/qa/unit/export-tests.cxx36
4 files changed, 52 insertions, 0 deletions
diff --git a/sd/qa/unit/data/odg/softedges.odg b/sd/qa/unit/data/odg/softedges.odg
new file mode 100644
index 000000000000..a1fcab90e9ad
--- /dev/null
+++ b/sd/qa/unit/data/odg/softedges.odg
Binary files differ
diff --git a/sd/qa/unit/data/pptx/shape-soft-edges.pptx b/sd/qa/unit/data/pptx/shape-soft-edges.pptx
new file mode 100644
index 000000000000..cafb8cf4ca59
--- /dev/null
+++ b/sd/qa/unit/data/pptx/shape-soft-edges.pptx
Binary files differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 645c3cb4f388..72e1110fe693 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -196,6 +196,7 @@ public:
void testTdf131554();
void testTdf132282();
void testTdf132201EffectOrder();
+ void testShapeSoftEdgeEffect();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
@@ -309,6 +310,7 @@ public:
CPPUNIT_TEST(testTdf131554);
CPPUNIT_TEST(testTdf132282);
CPPUNIT_TEST(testTdf132201EffectOrder);
+ CPPUNIT_TEST(testShapeSoftEdgeEffect);
CPPUNIT_TEST_SUITE_END();
@@ -2915,6 +2917,20 @@ void SdOOXMLExportTest2::testTdf132201EffectOrder()
xDocShRef->DoClose();
}
+void SdOOXMLExportTest2::testShapeSoftEdgeEffect()
+{
+ auto xDocShRef
+ = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/shape-soft-edges.pptx"), PPTX);
+ xDocShRef = saveAndReload(xDocShRef.get(), PPTX);
+ auto xShapeProps(getShapeFromPage(0, 0, xDocShRef));
+ bool bHasSoftEdges = false;
+ xShapeProps->getPropertyValue("SoftEdge") >>= bHasSoftEdges;
+ CPPUNIT_ASSERT(bHasSoftEdges);
+ sal_Int32 nRadius = -1;
+ xShapeProps->getPropertyValue("SoftEdgeRad") >>= nRadius;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(635), nRadius); // 18 pt
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 516eaf6df3c9..eeac217a3b83 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -75,6 +75,7 @@ public:
void testTdf113822();
void testTdf126761();
void testGlow();
+ void testSoftEdges();
CPPUNIT_TEST_SUITE(SdExportTest);
@@ -110,6 +111,7 @@ public:
CPPUNIT_TEST(testTdf113822);
CPPUNIT_TEST(testTdf126761);
CPPUNIT_TEST(testGlow);
+ CPPUNIT_TEST(testSoftEdges);
CPPUNIT_TEST_SUITE_END();
@@ -1307,6 +1309,40 @@ void SdExportTest::testGlow()
xDocShRef->DoClose();
}
+void SdExportTest::testSoftEdges()
+{
+ auto xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odg/softedges.odg"), ODG);
+ utl::TempFile tempFile;
+ xDocShRef = saveAndReload(xDocShRef.get(), ODG, &tempFile);
+ auto xShapeProps(getShapeFromPage(0, 0, xDocShRef));
+
+ // Check glow properties
+ bool bEffect = false;
+ CPPUNIT_ASSERT(xShapeProps->getPropertyValue("SoftEdge") >>= bEffect);
+ CPPUNIT_ASSERT(bEffect);
+ sal_Int32 nRad = 0;
+ CPPUNIT_ASSERT(xShapeProps->getPropertyValue("SoftEdgeRad") >>= nRad);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(635), nRad); // 18 pt
+
+ // Test ODF element
+ xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "content.xml");
+
+ // check that we actually test graphic style
+ assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/style:style[2]",
+ "family", "graphic");
+ // check loext graphic attributes
+ assertXPath(
+ pXmlDoc,
+ "/office:document-content/office:automatic-styles/style:style[2]/style:graphic-properties",
+ "softedge", "visible");
+ assertXPath(
+ pXmlDoc,
+ "/office:document-content/office:automatic-styles/style:style[2]/style:graphic-properties",
+ "softedge-radius", "0.635cm");
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();