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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Mon Feb 1 11:52:00 UTC 2021


 sd/qa/unit/uiimpress.cxx |   64 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

New commits:
commit f32b0e54c4993ebfba3e55ccc75a034736645fe2
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Mon Feb 1 10:14:39 2021 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Mon Feb 1 12:51:18 2021 +0100

    sd_uiimpress: Add unittest for move pages
    
    Change-Id: I7e860d84288f3921f74cb47ebd1354c2470a0b31
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110241
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx
index ce2ca269e56c..7bfe6e42ac87 100644
--- a/sd/qa/unit/uiimpress.cxx
+++ b/sd/qa/unit/uiimpress.cxx
@@ -233,6 +233,70 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf129346)
     checkCurrentPageNumber(1);
 }
 
+CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testmoveSlides)
+{
+    mxComponent = loadFromDesktop("private:factory/simpress",
+                                  "com.sun.star.presentation.PresentationDocument");
+
+    CPPUNIT_ASSERT(mxComponent.is());
+
+    auto pXImpressDocument = dynamic_cast<SdXImpressDocument*>(mxComponent.get());
+    sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
+
+    uno::Sequence<beans::PropertyValue> aArgs(
+        comphelper::InitPropertySequence({ { "PageName", uno::makeAny(OUString("Test 1")) },
+                                           { "WhatLayout", uno::makeAny(sal_Int32(1)) },
+                                           { "IsPageBack", uno::makeAny(false) },
+                                           { "IsPageObj", uno::makeAny(false) } }));
+
+    dispatchCommand(mxComponent, ".uno:InsertPage", aArgs);
+    Scheduler::ProcessEventsToIdle();
+    checkCurrentPageNumber(2);
+
+    CPPUNIT_ASSERT_EQUAL(OUString("Test 1"), pViewShell->GetActualPage()->GetName());
+
+    aArgs = comphelper::InitPropertySequence({ { "PageName", uno::makeAny(OUString("Test 2")) },
+                                               { "WhatLayout", uno::makeAny(sal_Int32(1)) },
+                                               { "IsPageBack", uno::makeAny(false) },
+                                               { "IsPageObj", uno::makeAny(false) } });
+
+    dispatchCommand(mxComponent, ".uno:InsertPage", aArgs);
+    Scheduler::ProcessEventsToIdle();
+    checkCurrentPageNumber(3);
+
+    CPPUNIT_ASSERT_EQUAL(OUString("Test 2"), pViewShell->GetActualPage()->GetName());
+
+    // Move slide 'Test 2' up
+    for (size_t i = 2; i > 0; --i)
+    {
+        dispatchCommand(mxComponent, ".uno:MovePageUp", {});
+        Scheduler::ProcessEventsToIdle();
+        checkCurrentPageNumber(i);
+        CPPUNIT_ASSERT_EQUAL(OUString("Test 2"), pViewShell->GetActualPage()->GetName());
+    }
+
+    // Move slide 'Test 2' down
+    for (size_t i = 2; i < 4; ++i)
+    {
+        dispatchCommand(mxComponent, ".uno:MovePageDown", {});
+        Scheduler::ProcessEventsToIdle();
+        checkCurrentPageNumber(i);
+        CPPUNIT_ASSERT_EQUAL(OUString("Test 2"), pViewShell->GetActualPage()->GetName());
+    }
+
+    // Move slide 'Test 2' to the top
+    dispatchCommand(mxComponent, ".uno:MovePageFirst", {});
+    Scheduler::ProcessEventsToIdle();
+    checkCurrentPageNumber(1);
+    CPPUNIT_ASSERT_EQUAL(OUString("Test 2"), pViewShell->GetActualPage()->GetName());
+
+    // Move slide 'Test 2' to the bottom
+    dispatchCommand(mxComponent, ".uno:MovePageLast", {});
+    Scheduler::ProcessEventsToIdle();
+    checkCurrentPageNumber(3);
+    CPPUNIT_ASSERT_EQUAL(OUString("Test 2"), pViewShell->GetActualPage()->GetName());
+}
+
 CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf127481)
 {
     mxComponent = loadFromDesktop("private:factory/simpress",


More information about the Libreoffice-commits mailing list