From 569f88693e0a6a0eb8f04fa8f8ffccf1cbd112f1 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Thu, 9 Apr 2020 14:32:54 +0200 Subject: sd: move some import tests to export tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I1003f153e7baf7568f44359784af7df3e9e33270 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91971 Tested-by: Jenkins Reviewed-by: Xisco FaulĂ­ --- sd/qa/unit/export-tests-ooxml2.cxx | 76 ++++++++++++++++++++++++++++++++++++++ sd/qa/unit/import-tests.cxx | 70 ----------------------------------- 2 files changed, 76 insertions(+), 70 deletions(-) (limited to 'sd') diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index fa555e9c57b5..5c6167485c87 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -88,6 +89,9 @@ public: void testBnc822341(); void testMathObject(); void testMathObjectPPT2010(); + void testTdf119015(); + void testTdf123090(); + void testTdf126324(); void testTdf80224(); void testExportTransitionsPPTX(); void testPresetShapesExport(); @@ -192,6 +196,9 @@ public: CPPUNIT_TEST(testBnc822341); CPPUNIT_TEST(testMathObject); CPPUNIT_TEST(testMathObjectPPT2010); + CPPUNIT_TEST(testTdf119015); + CPPUNIT_TEST(testTdf123090); + CPPUNIT_TEST(testTdf126324); CPPUNIT_TEST(testTdf80224); CPPUNIT_TEST(testExportTransitionsPPTX); CPPUNIT_TEST(testPresetShapesExport); @@ -476,6 +483,75 @@ void SdOOXMLExportTest2::testMathObjectPPT2010() xDocShRef->DoClose(); } +void SdOOXMLExportTest2::testTdf119015() +{ + ::sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf119015.pptx"), PPTX); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); + + const SdrPage* pPage = GetPage(1, xDocShRef); + + sdr::table::SdrTableObj* pTableObj = dynamic_cast(pPage->GetObj(0)); + CPPUNIT_ASSERT(pTableObj); + // The position was previously not properly initialized: (0, 0, 100, 100) + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(6991, 6902), Size(14099, 1999)), + pTableObj->GetLogicRect()); + uno::Reference xTable(pTableObj->getTable()); + + // Test that we actually have three cells: this threw css.lang.IndexOutOfBoundsException + uno::Reference xTextRange(xTable->getCellByPosition(1, 0), + uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(OUString("A3"), xTextRange->getString()); + + xDocShRef->DoClose(); +} + +void SdOOXMLExportTest2::testTdf123090() +{ + ::sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf123090.pptx"), PPTX); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); + + const SdrPage* pPage = GetPage(1, xDocShRef); + + sdr::table::SdrTableObj* pTableObj = dynamic_cast(pPage->GetObj(0)); + CPPUNIT_ASSERT(pTableObj); + + uno::Reference xTable(pTableObj->getTable()); + + // Test that we actually have two cells: this threw css.lang.IndexOutOfBoundsException + uno::Reference xTextRange(xTable->getCellByPosition(1, 0), + uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(OUString("aaa"), xTextRange->getString()); + + sal_Int32 nWidth; + const OUString sWidth("Width"); + uno::Reference< css::table::XTableColumns > xColumns( xTable->getColumns(), uno::UNO_SET_THROW); + uno::Reference< beans::XPropertySet > xRefColumn( xColumns->getByIndex(1), uno::UNO_QUERY_THROW ); + xRefColumn->getPropertyValue( sWidth ) >>= nWidth; + CPPUNIT_ASSERT_EQUAL( sal_Int32(9136), nWidth); + + xDocShRef->DoClose(); +} + +void SdOOXMLExportTest2::testTdf126324() +{ + sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf126324.pptx"), PPTX); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); + uno::Reference xDoc(xDocShRef->GetDoc()->getUnoModel(), + uno::UNO_QUERY); + CPPUNIT_ASSERT(xDoc.is()); + uno::Reference xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT(xPage.is()); + uno::Reference xShape(getShape(0, xPage)); + CPPUNIT_ASSERT(xShape.is()); + uno::Reference< text::XText > xText = uno::Reference< text::XTextRange>( xShape, uno::UNO_QUERY_THROW )->getText(); + CPPUNIT_ASSERT_EQUAL(OUString("17"), xText->getString()); + + xDocShRef->DoClose(); +} + void SdOOXMLExportTest2::testTdf80224() { ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf80224.odp"), ODP); diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index d3670d167ff5..bccfc56dc392 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -207,15 +207,12 @@ public: void testTdf116899(); void testTdf77747(); void testTdf116266(); - void testTdf126324(); void testTdf128684(); void testShapeGlowEffectPPTXImpoer(); bool checkPattern(sd::DrawDocShellRef const & rDocRef, int nShapeNumber, std::vector& rExpected); void testPatternImport(); void testPptCrop(); - void testTdf119015(); - void testTdf123090(); void testTdf120028(); void testTdf120028b(); void testDescriptionImport(); @@ -312,15 +309,12 @@ public: CPPUNIT_TEST(testTdf114913); CPPUNIT_TEST(testTdf114821); CPPUNIT_TEST(testTdf115394); - CPPUNIT_TEST(testTdf126324); CPPUNIT_TEST(testTdf115394PPT); CPPUNIT_TEST(testTdf51340); CPPUNIT_TEST(testTdf116899); CPPUNIT_TEST(testTdf77747); CPPUNIT_TEST(testTdf116266); CPPUNIT_TEST(testPptCrop); - CPPUNIT_TEST(testTdf119015); - CPPUNIT_TEST(testTdf123090); CPPUNIT_TEST(testTdf120028); CPPUNIT_TEST(testTdf120028b); CPPUNIT_TEST(testDescriptionImport); @@ -2801,55 +2795,6 @@ void SdImportTest::testTdf116266() xDocShRef->DoClose(); } -void SdImportTest::testTdf119015() -{ - ::sd::DrawDocShellRef xDocShRef - = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf119015.pptx"), PPTX); - - const SdrPage* pPage = GetPage(1, xDocShRef); - - sdr::table::SdrTableObj* pTableObj = dynamic_cast(pPage->GetObj(0)); - CPPUNIT_ASSERT(pTableObj); - // The position was previously not properly initialized: (0, 0, 100, 100) - CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(6991, 6902), Size(14099, 1999)), - pTableObj->GetLogicRect()); - uno::Reference xTable(pTableObj->getTable()); - - // Test that we actually have three cells: this threw css.lang.IndexOutOfBoundsException - uno::Reference xTextRange(xTable->getCellByPosition(1, 0), - uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT_EQUAL(OUString("A3"), xTextRange->getString()); - - xDocShRef->DoClose(); -} - -void SdImportTest::testTdf123090() -{ - ::sd::DrawDocShellRef xDocShRef - = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf123090.pptx"), PPTX); - - const SdrPage* pPage = GetPage(1, xDocShRef); - - sdr::table::SdrTableObj* pTableObj = dynamic_cast(pPage->GetObj(0)); - CPPUNIT_ASSERT(pTableObj); - - uno::Reference xTable(pTableObj->getTable()); - - // Test that we actually have two cells: this threw css.lang.IndexOutOfBoundsException - uno::Reference xTextRange(xTable->getCellByPosition(1, 0), - uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT_EQUAL(OUString("aaa"), xTextRange->getString()); - - sal_Int32 nWidth; - const OUString sWidth("Width"); - uno::Reference< css::table::XTableColumns > xColumns( xTable->getColumns(), uno::UNO_SET_THROW); - uno::Reference< beans::XPropertySet > xRefColumn( xColumns->getByIndex(1), uno::UNO_QUERY_THROW ); - xRefColumn->getPropertyValue( sWidth ) >>= nWidth; - CPPUNIT_ASSERT_EQUAL( sal_Int32(9136), nWidth); - - xDocShRef->DoClose(); -} - void SdImportTest::testTdf120028() { // Check that the table shape has 4 columns. @@ -2923,21 +2868,6 @@ void SdImportTest::testTdf120028b() xDocShRef->DoClose(); } -void SdImportTest::testTdf126324() -{ - sd::DrawDocShellRef xDocShRef - = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf126324.pptx"), PPTX); - uno::Reference xDoc(xDocShRef->GetDoc()->getUnoModel(), - uno::UNO_QUERY); - CPPUNIT_ASSERT(xDoc.is()); - uno::Reference xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY); - CPPUNIT_ASSERT(xPage.is()); - uno::Reference xShape(getShape(0, xPage)); - CPPUNIT_ASSERT(xShape.is()); - uno::Reference< text::XText > xText = uno::Reference< text::XTextRange>( xShape, uno::UNO_QUERY_THROW )->getText(); - CPPUNIT_ASSERT_EQUAL(OUString{"17"}, xText->getString()); -} - void SdImportTest::testDescriptionImport() { sd::DrawDocShellRef xDocShRef -- cgit