sd/CppunitTest_sd_tiledrendering.mk          |    1 
 sd/qa/unit/tiledrendering/tiledrendering.cxx |   51 +++++++++------------------
 2 files changed, 19 insertions(+), 33 deletions(-)

New commits:
commit faff1af1a1506825b930428bdd126cf1a2c2b2d1
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Wed Oct 26 11:34:30 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Oct 26 14:03:03 2022 +0200

    CppunitTest_sd_tiledrendering: inherit from UnoApiTest
    
    Before it was inheriting from SdModelTestBase for no real
    reason
    
    Change-Id: I51ecb82a5e867808c5fd39d2a0aa093ad097cb1f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141868
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sd/CppunitTest_sd_tiledrendering.mk 
b/sd/CppunitTest_sd_tiledrendering.mk
index a408aa4d7aa2..1fcfbf881292 100644
--- a/sd/CppunitTest_sd_tiledrendering.mk
+++ b/sd/CppunitTest_sd_tiledrendering.mk
@@ -26,6 +26,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sd_tiledrendering, 
\
     editeng \
     sal \
     sfx \
+    subsequenttest \
     svl \
     svt \
     svxcore \
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index db770887c999..a0b6ff4cd9e5 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -7,7 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#include "../sdmodeltestbase.hxx"
+#include <test/unoapi_test.hxx>
 
 #include <app.hrc>
 #include <test/bootstrapfixture.hxx>
@@ -64,18 +64,13 @@
 
 using namespace css;
 
-namespace
-{
-    constexpr OUStringLiteral DATA_DIRECTORY = 
u"/sd/qa/unit/tiledrendering/data/";
-}
-
 static std::ostream& operator<<(std::ostream& os, ViewShellId id)
 {
     os << static_cast<sal_Int32>(id);
     return os;
 }
 
-class SdTiledRenderingTest : public SdModelTestBase, public XmlTestTools
+class SdTiledRenderingTest : public UnoApiTest, public XmlTestTools
 {
 public:
     SdTiledRenderingTest();
@@ -207,7 +202,6 @@ private:
     void callbackImpl(int nType, const char* pPayload);
     xmlDocUniquePtr parseXmlDump();
 
-    uno::Reference<lang::XComponent> mxComponent;
     ::tools::Rectangle m_aInvalidation;
     std::vector<::tools::Rectangle> m_aSelection;
     bool m_bFound;
@@ -224,7 +218,8 @@ private:
 };
 
 SdTiledRenderingTest::SdTiledRenderingTest()
-    : m_bFound(true),
+    : UnoApiTest("/sd/qa/unit/tiledrendering/data/"),
+      m_bFound(true),
       m_nPart(0),
       m_nSelectionBeforeSearchResult(0),
       m_nSelectionAfterSearchResult(0),
@@ -235,19 +230,20 @@ SdTiledRenderingTest::SdTiledRenderingTest()
 
 void SdTiledRenderingTest::setUp()
 {
-    test::BootstrapFixture::setUp();
+    UnoApiTest::setUp();
 
     // prevent showing warning message box
     setenv("OOX_NO_SMARTART_WARNING", "1", 1);
     comphelper::LibreOfficeKit::setActive(true);
-
-    
mxDesktop.set(css::frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory())));
 }
 
 void SdTiledRenderingTest::tearDown()
 {
     if (mxComponent.is())
+    {
         mxComponent->dispose();
+        mxComponent.clear();
+    }
 
     if (m_pXmlBuffer)
         xmlBufferFree(m_pXmlBuffer);
@@ -255,14 +251,12 @@ void SdTiledRenderingTest::tearDown()
     m_callbackWrapper.clear();
     comphelper::LibreOfficeKit::setActive(false);
 
-    test::BootstrapFixture::tearDown();
+    UnoApiTest::tearDown();
 }
 
 SdXImpressDocument* SdTiledRenderingTest::createDoc(const char* pName, const 
uno::Sequence<beans::PropertyValue>& rArguments)
 {
-    if (mxComponent.is())
-        mxComponent->dispose();
-    mxComponent = loadFromDesktop(m_directories.getURLFromSrc(DATA_DIRECTORY) 
+ OUString::createFromAscii(pName), 
"com.sun.star.presentation.PresentationDocument");
+    loadFromURL(OUString::createFromAscii(pName));
     SdXImpressDocument* pImpressDocument = 
dynamic_cast<SdXImpressDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pImpressDocument);
     pImpressDocument->initializeForTiledRendering(rArguments);
@@ -1391,9 +1385,6 @@ void SdTiledRenderingTest::testUndoLimiting()
         pViewShell1->ExecuteSlot(aReq1);
         CPPUNIT_ASSERT(aReq1.IsDone());
     }
-
-    mxComponent->dispose();
-    mxComponent.clear();
 }
 
 void SdTiledRenderingTest::testCreateViewGraphicSelection()
@@ -1727,18 +1718,13 @@ void SdTiledRenderingTest::testTdf81754()
     Scheduler::ProcessEventsToIdle();
 
     // now save, reload, and assert that we did not lose the edit
-    ::sd::DrawDocShellRef xDocShRef = 
saveAndReload(pXImpressDocument->GetDocShell(), PPTX);
-
-    const SdrPage* pPage = GetPage(1, xDocShRef);
-    SdrTextObj* pTextObject = dynamic_cast<SdrTextObj*>(pPage->GetObj(1));
-    CPPUNIT_ASSERT(pTextObject);
-
-    OutlinerParaObject* pOutlinerParagraphObject = 
pTextObject->GetOutlinerParaObject();
-    const EditTextObject& aEdit = pOutlinerParagraphObject->GetTextObject();
+    saveAndReload("Impress Office Open XML");
 
-    CPPUNIT_ASSERT_EQUAL(OUString("Somethingxx"), aEdit.GetText(0));
-
-    xDocShRef->DoClose();
+    uno::Reference<drawing::XDrawPagesSupplier> 
xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<drawing::XDrawPage> 
xPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
+                                             uno::UNO_QUERY);
+    uno::Reference<text::XTextRange> xShape(xPage->getByIndex(1), 
uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(OUString(u"Somethingxx"), xShape->getString());
 }
 
 void SdTiledRenderingTest::testTdf105502()
@@ -2276,9 +2262,8 @@ void SdTiledRenderingTest::testLanguageAllText()
     uno::Reference<drawing::XDrawPagesSupplier> 
xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
     uno::Reference<drawing::XDrawPage> 
xPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
                                              uno::UNO_QUERY);
-    uno::Reference<beans::XPropertySet> xShape(xPage->getByIndex(0), 
uno::UNO_QUERY);
-    uno::Reference<beans::XPropertySet> xRun(
-        getRunFromParagraph(0, getParagraphFromShape(0, xShape)), 
uno::UNO_QUERY);
+    uno::Reference<text::XTextRange> xShape(xPage->getByIndex(0), 
uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xRun(xShape, uno::UNO_QUERY_THROW);
     lang::Locale aLocale;
     xRun->getPropertyValue("CharLocale") >>= aLocale;
     // Without the accompanying fix in place, this test would have failed with 
'Expected: en;

Reply via email to