From 3eac847927a0cdfa40c3fea38c473ed2ad7faecc Mon Sep 17 00:00:00 2001 From: Balazs Varga Date: Wed, 21 Aug 2024 17:34:23 +0200 Subject: tdf#161826 - Add uniform Glow effect for texts in shapes - Add new text Glow effect properties for shapes - Using TextGlowPrimitive for rendering uniform text glow in shapes - Add/allow new UI Glow Effect for texts in shapes on sidebar (Only for Impress/Draw and Calc) - Import/Export ooxml files with Glow effect on texts in shapes (Only PPTX/XLSX) - Import/Export odf files with Glow effect on texts in shapes - Add unit test for glow text attributes in ODF - Add uni tests for OOXML import/export Note: Also this patch effects on tdf#144061 - Effects: Allow GLOW to apply to Text (as we have for shapes) Change-Id: I16586c01654f197f532129e4e06aa2ef9f214395 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172216 Reviewed-by: Balazs Varga Tested-by: Jenkins Reviewed-by: Regina Henschel --- sd/qa/unit/data/odp/shape-text-glow-effect.odp | Bin 0 -> 28028 bytes sd/qa/unit/data/pptx/shape-text-glow-effect.pptx | Bin 0 -> 34693 bytes sd/qa/unit/export-tests-ooxml4.cxx | 16 +++++++++ sd/qa/unit/export-tests.cxx | 41 +++++++++++++++++++++++ sd/qa/unit/import-tests2.cxx | 16 +++++++++ 5 files changed, 73 insertions(+) create mode 100644 sd/qa/unit/data/odp/shape-text-glow-effect.odp create mode 100644 sd/qa/unit/data/pptx/shape-text-glow-effect.pptx (limited to 'sd/qa/unit') diff --git a/sd/qa/unit/data/odp/shape-text-glow-effect.odp b/sd/qa/unit/data/odp/shape-text-glow-effect.odp new file mode 100644 index 000000000000..944d281cf99d Binary files /dev/null and b/sd/qa/unit/data/odp/shape-text-glow-effect.odp differ diff --git a/sd/qa/unit/data/pptx/shape-text-glow-effect.pptx b/sd/qa/unit/data/pptx/shape-text-glow-effect.pptx new file mode 100644 index 000000000000..945c9baf5374 Binary files /dev/null and b/sd/qa/unit/data/pptx/shape-text-glow-effect.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml4.cxx b/sd/qa/unit/export-tests-ooxml4.cxx index 054e2232107a..38afc68be086 100644 --- a/sd/qa/unit/export-tests-ooxml4.cxx +++ b/sd/qa/unit/export-tests-ooxml4.cxx @@ -474,6 +474,22 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testShapeGlowEffect) CPPUNIT_ASSERT_EQUAL(sal_Int16(60), nTransparency); } +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testShapeTextGlowEffect) +{ + createSdImpressDoc("pptx/shape-text-glow-effect.pptx"); + saveAndReload(u"Impress Office Open XML"_ustr); + uno::Reference xShape(getShapeFromPage(0, 0)); + sal_Int32 nRadius = -1; + xShape->getPropertyValue(u"GlowTextEffectRadius"_ustr) >>= nRadius; + CPPUNIT_ASSERT_EQUAL(sal_Int32(706), nRadius); // 20 pt = 706 mm/100 + Color nColor; + xShape->getPropertyValue(u"GlowTextEffectColor"_ustr) >>= nColor; + CPPUNIT_ASSERT_EQUAL(Color(0x4EA72E), nColor); + sal_Int16 nTransparency; + xShape->getPropertyValue(u"GlowTextEffectTransparency"_ustr) >>= nTransparency; + CPPUNIT_ASSERT_EQUAL(sal_Int16(5), nTransparency); +} + CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testUnderline) { createSdImpressDoc("underline.fodp"); diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 04ce872ffe10..c5630158f0d7 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -1534,6 +1534,47 @@ CPPUNIT_TEST_FIXTURE(SdExportTest, testGlow) "glow-transparency"_ostr, u"60%"_ustr); } +CPPUNIT_TEST_FIXTURE(SdExportTest, testGlowTextInShape) +{ + createSdImpressDoc("odp/shape-text-glow-effect.odp"); + saveAndReload(u"impress8"_ustr); + + uno::Reference xDP(getPage(0)); + uno::Reference xShape(xDP->getByIndex(0), uno::UNO_QUERY); + + // Check glow text properties in shapes + sal_Int32 nGlowEffectRad = 0; + CPPUNIT_ASSERT(xShape->getPropertyValue(u"GlowTextEffectRadius"_ustr) >>= nGlowEffectRad); + CPPUNIT_ASSERT_EQUAL(sal_Int32(706), nGlowEffectRad); // 20 pt = 706 mm/100 + Color nGlowEffectColor; + CPPUNIT_ASSERT(xShape->getPropertyValue(u"GlowTextEffectColor"_ustr) >>= nGlowEffectColor); + CPPUNIT_ASSERT_EQUAL(Color(0x4EA72E), nGlowEffectColor); + sal_Int16 nGlowEffectTransparency = 0; + CPPUNIT_ASSERT(xShape->getPropertyValue(u"GlowTextEffectTransparency"_ustr) + >>= nGlowEffectTransparency); + CPPUNIT_ASSERT_EQUAL(sal_Int16(5), nGlowEffectTransparency); + + // Test ODF element + xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); + + // check that we actually test graphic style + assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/style:style[3]"_ostr, + "family"_ostr, u"graphic"_ustr); + // check loext graphic attributes for th + assertXPath( + pXmlDoc, + "/office:document-content/office:automatic-styles/style:style[3]/style:graphic-properties"_ostr, + "glow-text-radius"_ostr, u"0.706cm"_ustr); + assertXPath( + pXmlDoc, + "/office:document-content/office:automatic-styles/style:style[3]/style:graphic-properties"_ostr, + "glow-text-color"_ostr, u"#4ea72e"_ustr); + assertXPath( + pXmlDoc, + "/office:document-content/office:automatic-styles/style:style[3]/style:graphic-properties"_ostr, + "glow-text-transparency"_ostr, u"5%"_ustr); +} + CPPUNIT_TEST_FIXTURE(SdExportTest, testSoftEdges) { createSdDrawDoc("odg/softedges.odg"); diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx index d66e12a52663..a39bc847c784 100644 --- a/sd/qa/unit/import-tests2.cxx +++ b/sd/qa/unit/import-tests2.cxx @@ -1664,6 +1664,22 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testShapeGlowEffectPPTXImpoer) CPPUNIT_ASSERT_EQUAL(sal_Int16(60), nTransparency); } +CPPUNIT_TEST_FIXTURE(SdImportTest2, testShapeTextGlowEffectPPTXImport) +{ + createSdImpressDoc("pptx/shape-text-glow-effect.pptx"); + + uno::Reference xShape(getShapeFromPage(0, 0)); + sal_Int32 nRadius = -1; + xShape->getPropertyValue(u"GlowTextEffectRadius"_ustr) >>= nRadius; + CPPUNIT_ASSERT_EQUAL(sal_Int32(706), nRadius); // 20 pt = 706 mm/100 + Color nColor; + xShape->getPropertyValue(u"GlowTextEffectColor"_ustr) >>= nColor; + CPPUNIT_ASSERT_EQUAL(Color(0x4EA72E), nColor); + sal_Int16 nTransparency; + xShape->getPropertyValue(u"GlowTextEffectTransparency"_ustr) >>= nTransparency; + CPPUNIT_ASSERT_EQUAL(sal_Int16(5), nTransparency); +} + CPPUNIT_TEST_FIXTURE(SdImportTest2, testShapeBlurPPTXImport) { createSdImpressDoc("pptx/shape-blur-effect.pptx"); -- cgit v1.2.3