sd/qa/unit/data/pptx/tdf149206.pptx |binary sd/qa/unit/import-tests2.cxx | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+)
New commits: commit 504d61697bac45236da27fba23c7189daf8c171e Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Mon May 23 13:39:52 2022 +0200 Commit: Bartosz Kosiorek <gan...@poczta.onet.pl> CommitDate: Tue May 24 08:20:06 2022 +0200 tdf#149206: sd_import_tests2: Add unittest Change-Id: I1ff0974d1fa2ae6eb45fc95115fad665eecc45bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134818 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl> diff --git a/sd/qa/unit/data/pptx/tdf149206.pptx b/sd/qa/unit/data/pptx/tdf149206.pptx new file mode 100644 index 000000000000..ec39ec635cc9 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf149206.pptx differ diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx index b06a699b04bd..fd875abe79cc 100644 --- a/sd/qa/unit/import-tests2.cxx +++ b/sd/qa/unit/import-tests2.cxx @@ -116,6 +116,7 @@ public: std::vector<sal_uInt8>& rExpected); void testPatternImport(); void testPptCrop(); + void testTdf149206(); void testTdf120028(); void testDescriptionImport(); void testTdf83247(); @@ -178,6 +179,7 @@ public: CPPUNIT_TEST(testTdf77747); CPPUNIT_TEST(testTdf116266); CPPUNIT_TEST(testPptCrop); + CPPUNIT_TEST(testTdf149206); CPPUNIT_TEST(testTdf120028); CPPUNIT_TEST(testDescriptionImport); CPPUNIT_TEST(testTdf83247); @@ -1531,6 +1533,29 @@ void SdImportTest2::testPptCrop() xDocShRef->DoClose(); } +void SdImportTest2::testTdf149206() +{ + // Check that the image is cropped + ::sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf149206.pptx"), PPTX); + uno::Reference<drawing::XDrawPagesSupplier> xDoc(xDocShRef->GetDoc()->getUnoModel(), + uno::UNO_QUERY); + + uno::Reference<beans::XPropertySet> xPropertySet( + getShapeFromPage(/*nShape=*/0, /*nPage=*/0, xDocShRef)); + text::GraphicCrop aCrop; + xPropertySet->getPropertyValue("GraphicCrop") >>= aCrop; + + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), aCrop.Top); + + // Without the fix in place, this test would have failed with + // - Expected: 5937 + // - Actual : 0 + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(5937), aCrop.Bottom); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), aCrop.Left); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), aCrop.Right); +} + void SdImportTest2::testTdf120028() { // Check that the text shape has 4 columns.