diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-05-18 12:46:16 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-05-18 13:54:56 +0200 |
commit | 329cc83324f8f361a5383bf7dac2c9c21799dcdc (patch) | |
tree | d0bd55bdf75f62360598a24937e09d34b9b5c0d3 | |
parent | 6f954416bbbf11293d3dc91e534e1b41c4157325 (diff) |
tdf#128985: sd_export: Add unittest
Change-Id: Id6cfeaeaf8484787705f06b7b1acc9a75287546d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115735
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r-- | sd/qa/unit/data/odp/tdf128985.odp | bin | 0 -> 14781 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests.cxx | 41 |
2 files changed, 40 insertions, 1 deletions
diff --git a/sd/qa/unit/data/odp/tdf128985.odp b/sd/qa/unit/data/odp/tdf128985.odp Binary files differnew file mode 100644 index 000000000000..61a184ac77ee --- /dev/null +++ b/sd/qa/unit/data/odp/tdf128985.odp diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 76e8cdc02948..24797c0bb674 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -37,7 +37,7 @@ #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/table/BorderLine2.hpp> - +#include <com/sun/star/text/WritingMode2.hpp> #include <svx/svdotable.hxx> #include <vcl/filter/PDFiumLibrary.hxx> @@ -57,6 +57,7 @@ public: void testBnc480256(); void testUnknownAttributes(); void testTdf80020(); + void testTdf128985(); void testLinkedGraphicRT(); void testTdf79082(); void testImageWithSpecialID(); @@ -99,6 +100,7 @@ public: CPPUNIT_TEST(testBnc480256); CPPUNIT_TEST(testUnknownAttributes); CPPUNIT_TEST(testTdf80020); + CPPUNIT_TEST(testTdf128985); CPPUNIT_TEST(testLinkedGraphicRT); CPPUNIT_TEST(testTdf79082); CPPUNIT_TEST(testImageWithSpecialID); @@ -599,6 +601,43 @@ void SdExportTest::testTdf80020() xDocShRef->DoClose(); } +void SdExportTest::testTdf128985() +{ + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf128985.odp"), ODP); + + { + uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(xDocShRef->GetModel(), uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies(); + uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName("LushGreen"), uno::UNO_QUERY); + uno::Reference<style::XStyle> xStyle(xStyleFamily->getByName("outline1"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropSet( xStyle, uno::UNO_QUERY ); + + sal_Int16 nWritingMode = 0; + xPropSet->getPropertyValue( "WritingMode" ) >>= nWritingMode; + CPPUNIT_ASSERT_EQUAL(text::WritingMode2::RL_TB, nWritingMode); + + xPropSet->setPropertyValue("WritingMode", uno::makeAny(text::WritingMode2::LR_TB)); + + xDocShRef = saveAndReload( xDocShRef.get(), ODP ); + } + + uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(xDocShRef->GetModel(), uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies(); + uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName("LushGreen"), uno::UNO_QUERY); + uno::Reference<style::XStyle> xStyle(xStyleFamily->getByName("outline1"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropSet( xStyle, uno::UNO_QUERY ); + + sal_Int16 nWritingMode = 0; + xPropSet->getPropertyValue( "WritingMode" ) >>= nWritingMode; + + // Without the fix in place, this test would have failed with + // - Expected: 0 + // - Actual : 1 + CPPUNIT_ASSERT_EQUAL(text::WritingMode2::LR_TB, nWritingMode); + + xDocShRef->DoClose(); +} + void SdExportTest::testLinkedGraphicRT() { // Problem was with linked images |