diff options
author | Tibor Nagy <nagy.tibor2@nisz.hu> | 2021-03-12 11:35:53 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2021-03-29 16:55:57 +0200 |
commit | f35e0b2cbfd6e7150aeb5699e1db1d7c13fdb935 (patch) | |
tree | eee0dec7c9c0495f2d7b1f64e5eb17f4878f2dcf /sd/qa | |
parent | 503d9209df268cf3e964eede49b247021a9e17ce (diff) |
tdf#137367 PPTX import: fix lost direct hyperlink colors
Regression from commit 92f74f6ccb5a55807724db85815f7ea0c49370e0
(bnc#887230: always use theme color for hyperlinks in Impress)
Testing: direct color of the first text line is theme based
(a:rPr/a:solidFill/a:schemeClr), the second line contains
a direct color (a:rPr/a:solidFill/a:srgbClr), the third one
contains a theme based direct color darkened by 25.000%
(val=75000 of a:rPr/a:solidFill/a:schemeClr/a:lumMod).
Note: overwriting default theme based hyperlink colors is
also supported by Google Docs, Office 365 and MS Office 2019.
Change-Id: I1e3e78fac729a97f42c8dddcffd877a16383adbf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112377
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sd/qa')
-rw-r--r-- | sd/qa/unit/data/pptx/tdf137367.pptx | bin | 0 -> 35083 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 41 |
2 files changed, 41 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/tdf137367.pptx b/sd/qa/unit/data/pptx/tdf137367.pptx Binary files differnew file mode 100644 index 000000000000..cf6aa086d9a8 --- /dev/null +++ b/sd/qa/unit/data/pptx/tdf137367.pptx diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 64c215d9b02a..1b36fc2ba866 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -118,6 +118,7 @@ public: virtual void setUp() override; void testDocumentLayout(); + void testHyperlinkColor(); void testSmoketest(); void testTdf131269(); void testN759180(); @@ -236,6 +237,7 @@ public: CPPUNIT_TEST_SUITE(SdImportTest); CPPUNIT_TEST(testDocumentLayout); + CPPUNIT_TEST(testHyperlinkColor); CPPUNIT_TEST(testSmoketest); CPPUNIT_TEST(testTdf131269); CPPUNIT_TEST(testN759180); @@ -430,6 +432,45 @@ void SdImportTest::testDocumentLayout() } } +void SdImportTest::testHyperlinkColor() +{ + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf137367.pptx"), PPTX); + + uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) ); + + // Get first paragraph of the text + uno::Reference<text::XTextRange> const xParagraph1( getParagraphFromShape( 0, xShape ) ); + // Get second paragraph of the text + uno::Reference<text::XTextRange> const xParagraph2( getParagraphFromShape( 1, xShape ) ); + // Get third paragraph of the text + uno::Reference<text::XTextRange> const xParagraph3( getParagraphFromShape( 2, xShape ) ); + + // Get run of the first paragraph + uno::Reference<text::XTextRange> xRun1( getRunFromParagraph (0, xParagraph1 ) ); + uno::Reference< beans::XPropertySet > xPropSet1( xRun1, uno::UNO_QUERY_THROW ); + sal_Int32 nCharColorBlue; + xPropSet1->getPropertyValue( "CharColor" ) >>= nCharColorBlue; + + // Get run of the second paragraph + uno::Reference<text::XTextRange> xRun2( getRunFromParagraph (1, xParagraph2 ) ); + uno::Reference< beans::XPropertySet > xPropSet2( xRun2, uno::UNO_QUERY_THROW ); + sal_Int32 nCharColorRed; + xPropSet2->getPropertyValue( "CharColor" ) >>= nCharColorRed; + + // Get run of the third paragraph + uno::Reference<text::XTextRange> xRun3( getRunFromParagraph (2, xParagraph3 ) ); + uno::Reference< beans::XPropertySet > xPropSet3( xRun3, uno::UNO_QUERY_THROW ); + sal_Int32 nCharColorGreen; + xPropSet3->getPropertyValue( "CharColor" ) >>= nCharColorGreen; + + // Hyperlink colors should be blue, red, green. + CPPUNIT_ASSERT_EQUAL( sal_Int32(4485828), nCharColorBlue ); + CPPUNIT_ASSERT_EQUAL( sal_Int32(16711680), nCharColorRed ); + CPPUNIT_ASSERT_EQUAL( sal_Int32(5538357), nCharColorGreen ); + + xDocShRef->DoClose(); +} + void SdImportTest::testSmoketest() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/smoketest.pptx"), PPTX); |