diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2020-05-07 14:24:44 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2020-05-07 19:24:52 +0200 |
commit | 5ac2075d56cfff57f2254e4e5bd5a1e3a3579f83 (patch) | |
tree | fda46c21aff3de5aa68828ce5e7256806fc15398 /sd | |
parent | 36110559e9cd2b4f7c3dd173cb1cd60bb8d3df6f (diff) |
tdf#101181: unit test for glow attributes in ODF
Tests loext:glow,
loext:glow-radius,
loext:glow-color,
loext:glow-transparency
There's original decision to keep EMUs in GlowEffectRad property,
which makes this to be stored as hundreds of cm in ODF. I suppose
we should change this in a follow-up to use mm100s instead.
Change-Id: I47bf6530799ed16a55d58d0be5a8a7c3446d2df9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93633
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/odg/glow.odg | bin | 0 -> 8297 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests.cxx | 50 |
2 files changed, 50 insertions, 0 deletions
diff --git a/sd/qa/unit/data/odg/glow.odg b/sd/qa/unit/data/odg/glow.odg Binary files differnew file mode 100644 index 000000000000..11d697c491da --- /dev/null +++ b/sd/qa/unit/data/odg/glow.odg diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 285294bca8ea..de092590f2cd 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -74,6 +74,7 @@ public: void testTdf123557(); void testTdf113822(); void testTdf126761(); + void testGlow(); CPPUNIT_TEST_SUITE(SdExportTest); @@ -108,6 +109,7 @@ public: CPPUNIT_TEST(testTdf123557); CPPUNIT_TEST(testTdf113822); CPPUNIT_TEST(testTdf126761); + CPPUNIT_TEST(testGlow); CPPUNIT_TEST_SUITE_END(); @@ -1257,6 +1259,54 @@ void SdExportTest::testTdf126761() xDocShRef->DoClose(); } +void SdExportTest::testGlow() +{ + auto xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odg/glow.odg"), ODG); + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), ODG, &tempFile); + uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0, xDocShRef)); + + // Check glow properties + bool bGlowEffect = false; + CPPUNIT_ASSERT(xShape->getPropertyValue("GlowEffect") >>= bGlowEffect); + CPPUNIT_ASSERT(bGlowEffect); + sal_Int32 nGlowEffectRad = 0; + CPPUNIT_ASSERT(xShape->getPropertyValue("GlowEffectRad") >>= nGlowEffectRad); + CPPUNIT_ASSERT_EQUAL(sal_Int32(190500), nGlowEffectRad); // 15 pt = 190500 EMU + sal_Int32 nGlowEffectColor = 0; + CPPUNIT_ASSERT(xShape->getPropertyValue("GlowEffectColor") >>= nGlowEffectColor); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00FF4000), nGlowEffectColor); // "Brick" + sal_Int16 nGlowEffectTransparency = 0; + CPPUNIT_ASSERT(xShape->getPropertyValue("GlowEffectTransparency") >>= nGlowEffectTransparency); + CPPUNIT_ASSERT_EQUAL(sal_Int16(60), nGlowEffectTransparency); // 60% + + // Test ODF element + xmlDocPtr 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", + "glow", "visible"); + assertXPath( + pXmlDoc, + "/office:document-content/office:automatic-styles/style:style[2]/style:graphic-properties", + "glow-radius", "190.5cm"); // ??? + assertXPath( + pXmlDoc, + "/office:document-content/office:automatic-styles/style:style[2]/style:graphic-properties", + "glow-color", "#ff4000"); + assertXPath( + pXmlDoc, + "/office:document-content/office:automatic-styles/style:style[2]/style:graphic-properties", + "glow-transparency", "60%"); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); |