diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2018-02-14 02:15:54 +0100 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2018-02-14 04:08:46 +0100 |
commit | 53551d49d3be2301985f2cf2d8bb23ff374ecfd1 (patch) | |
tree | 6c9c0b00cde12b4fe60a3d1bd5a2724563040b3c /sd | |
parent | d0aca687f654eff81b86540007e7c8606ab00e1f (diff) |
tdf#51340: Line spacing is imported incorrectly from PPTX
Move the line spacing member to the TextParagraphProperties class
which is used to do the inheritance from master / layout slides.
Change-Id: I0bf92420963163eae78e06ebc7fdfa1f2c72fdf8
Reviewed-on: https://gerrit.libreoffice.org/49692
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'sd')
-rwxr-xr-x | sd/qa/unit/data/pptx/tdf51340.pptx | bin | 0 -> 16503 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 42 |
2 files changed, 42 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/tdf51340.pptx b/sd/qa/unit/data/pptx/tdf51340.pptx Binary files differnew file mode 100755 index 000000000000..090ea1be182a --- /dev/null +++ b/sd/qa/unit/data/pptx/tdf51340.pptx diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 101131de259b..257a59fbd05f 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -68,6 +68,8 @@ #include <com/sun/star/table/BorderLineStyle.hpp> #include <com/sun/star/table/BorderLine2.hpp> #include <com/sun/star/style/ParagraphAdjust.hpp> +#include <com/sun/star/style/LineSpacing.hpp> +#include <com/sun/star/style/LineSpacingMode.hpp> #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/table/XTableRows.hpp> #include <com/sun/star/style/NumberingType.hpp> @@ -176,6 +178,7 @@ public: void testTdf114821(); void testTdf115394(); void testTdf115394PPT(); + void testTdf51340(); bool checkPattern(sd::DrawDocShellRef const & rDocRef, int nShapeNumber, std::vector<sal_uInt8>& rExpected); void testPatternImport(); @@ -255,6 +258,7 @@ public: CPPUNIT_TEST(testTdf114821); CPPUNIT_TEST(testTdf115394); CPPUNIT_TEST(testTdf115394PPT); + CPPUNIT_TEST(testTdf51340); CPPUNIT_TEST_SUITE_END(); }; @@ -2439,6 +2443,44 @@ void SdImportTest::testTdf115394PPT() xDocShRef->DoClose(); } +void SdImportTest::testTdf51340() +{ + // Line spacing was not inherited from upper levels (slide layout, master slide) + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf51340.pptx"), PPTX); + uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 1, 0, xDocShRef ) ); + + // First paragraph has a 90% line spacing set on master slide + uno::Reference<text::XTextRange> xParagraph( getParagraphFromShape( 0, xShape ) ); + uno::Reference< beans::XPropertySet > xPropSet( xParagraph, uno::UNO_QUERY_THROW ); + css::style::LineSpacing aSpacing; + xPropSet->getPropertyValue( "ParaLineSpacing" ) >>= aSpacing; + CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16>(css::style::LineSpacingMode::PROP), aSpacing.Mode ); + CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16>(90), aSpacing.Height ); + + // Second paragraph has a 125% line spacing set on slide layout + xParagraph.set( getParagraphFromShape( 1, xShape ) ); + xPropSet.set( xParagraph, uno::UNO_QUERY_THROW ); + xPropSet->getPropertyValue( "ParaLineSpacing" ) >>= aSpacing; + CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16>(css::style::LineSpacingMode::PROP), aSpacing.Mode ); + CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16>(125), aSpacing.Height ); + + // Third paragraph has a 70% line spacing set directly on normal slide (master slide property ir overriden) + xParagraph.set( getParagraphFromShape( 2, xShape ) ); + xPropSet.set( xParagraph, uno::UNO_QUERY_THROW ); + xPropSet->getPropertyValue( "ParaLineSpacing" ) >>= aSpacing; + CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16>(css::style::LineSpacingMode::PROP), aSpacing.Mode ); + CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16>(70), aSpacing.Height ); + + // Fourth paragraph has a 190% line spacing set directly on normal slide (slide layout property is overriden) + xParagraph.set( getParagraphFromShape( 3, xShape ) ); + xPropSet.set( xParagraph, uno::UNO_QUERY_THROW ); + xPropSet->getPropertyValue( "ParaLineSpacing" ) >>= aSpacing; + CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16>(css::style::LineSpacingMode::PROP), aSpacing.Mode ); + CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16>(190), aSpacing.Height ); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); |