[Libreoffice-commits] core.git: sd/CppunitTest_sd_import_tests.mk sd/qa

Miklos Vajna vmiklos at collabora.co.uk
Wed Jan 17 13:05:29 UTC 2018


 sd/CppunitTest_sd_import_tests.mk |    1 
 sd/qa/unit/import-tests.cxx       |   41 +++++++++++++++++---------------------
 2 files changed, 20 insertions(+), 22 deletions(-)

New commits:
commit fb4296d14f0421e289afa5e456b75082cdf8716f
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Jan 17 10:28:38 2018 +0100

    CppunitTest_sd_import_tests: clean up manual model/frame/controller assembly
    
    Change-Id: I50341e783ad0964167dc9819a28aa1f264de44b0
    Reviewed-on: https://gerrit.libreoffice.org/48032
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sd/CppunitTest_sd_import_tests.mk b/sd/CppunitTest_sd_import_tests.mk
index 0307580ac9d7..f12e200a29d6 100644
--- a/sd/CppunitTest_sd_import_tests.mk
+++ b/sd/CppunitTest_sd_import_tests.mk
@@ -80,6 +80,7 @@ $(eval $(call gb_CppunitTest_use_components,sd_import_tests,\
     filter/source/svg/svgfilter \
     filter/source/xmlfilteradaptor/xmlfa \
 	filter/source/xmlfilterdetect/xmlfd \
+	filter/source/storagefilterdetect/storagefd \
     forms/util/frm \
     framework/util/fwk \
     i18npool/util/i18npool \
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 52d7d0c44010..ea237604bf4e 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -70,6 +70,7 @@
 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
 #include <com/sun/star/table/XTableRows.hpp>
 #include <com/sun/star/style/NumberingType.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
 
 #include <stlpool.hxx>
 #include <comphelper/processfactory.hxx>
@@ -99,6 +100,8 @@ std::ostream& operator<<(std::ostream& rStrm, const uno::Reference<T>& xRef)
 class SdImportTest : public SdModelTestBase
 {
 public:
+    virtual void setUp() override;
+
     void testDocumentLayout();
     void testSmoketest();
     void testN759180();
@@ -244,6 +247,12 @@ public:
     CPPUNIT_TEST_SUITE_END();
 };
 
+void SdImportTest::setUp()
+{
+    SdModelTestBase::setUp();
+    mxDesktop.set(frame::Desktop::create(getComponentContext()));
+}
+
 /** Test document against a reference XML dump of shapes.
 
 If you want to update one of these tests, or add a new one, set the nUpdateMe
@@ -1376,25 +1385,11 @@ void SdImportTest::testTdf99729()
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(filenames); ++i)
     {
         // 1st check for new behaviour - having AnchoredTextOverflowLegacy compatibility flag set to false in settings.xml
-        sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(filenames[i]), ODP);
-
-        const css::uno::Reference< css::frame::XFrame > xFrame = SfxFrame::CreateBlankFrame();
-        CPPUNIT_ASSERT(xFrame.is());
-        const css::uno::Reference< css::frame::XModel2 > xModel(xDocShRef->GetModel(), css::uno::UNO_QUERY);
-        CPPUNIT_ASSERT(xModel.is());
-        const css::uno::Reference< css::frame::XController2 > xController(xModel->createViewController(
-            "Default",
-            css::uno::Sequence< css::beans::PropertyValue >(),
-            xFrame
-            ), css::uno::UNO_QUERY);
-        CPPUNIT_ASSERT(xController.is());
-        xController->attachModel(xModel.get());
-        xModel->connectController(xController.get());
-        xFrame->setComponent(xController->getComponentWindow(), xController.get());
-        xController->attachFrame(xFrame);
-        xModel->setCurrentController(xController.get());
-
-        uno::Reference < uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
+        uno::Reference<lang::XComponent> xComponent
+            = loadFromDesktop(m_directories.getURLFromSrc(filenames[i]),
+                              "com.sun.star.presentation.PresentationDocument");
+
+        uno::Reference<uno::XComponentContext> xContext = getComponentContext();
         CPPUNIT_ASSERT(xContext.is());
         uno::Reference< drawing::XGraphicExportFilter > xGraphicExporter = drawing::GraphicExportFilter::create(xContext);
         CPPUNIT_ASSERT(xGraphicExporter.is());
@@ -1416,7 +1411,10 @@ void SdImportTest::testTdf99729()
         aDescriptor[2].Name = "FilterData";
         aDescriptor[2].Value <<= aFilterData;
 
-        uno::Reference< lang::XComponent > xPage(getPage(0, xDocShRef), uno::UNO_QUERY);
+        uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(xComponent, uno::UNO_QUERY);
+        uno::Reference<lang::XComponent> xPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
+                                               uno::UNO_QUERY);
+        CPPUNIT_ASSERT(xPage.is());
         xGraphicExporter->setSourceDocument(xPage);
         xGraphicExporter->filter(aDescriptor);
 
@@ -1434,8 +1432,7 @@ void SdImportTest::testTdf99729()
                     ++nonwhitecounts[i];
             }
         }
-        xController->dispose();
-        xFrame->dispose();
+        xComponent->dispose();
     }
     // The numbers 1-9 should be above the Text Box in rectangle 154,16 - 170,112.
     // If text alignment is wrong, the rectangle will be white.


More information about the Libreoffice-commits mailing list