sd/qa/unit/uiimpress.cxx |   20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

New commits:
commit fd361874d5c4da99dec763dfdc9c4dd21dfe34a6
Author:     Andreas Heinisch <andreas.heini...@yahoo.de>
AuthorDate: Mon Jul 17 10:57:56 2023 +0200
Commit:     Andreas Heinisch <andreas.heini...@yahoo.de>
CommitDate: Wed Jul 19 10:12:41 2023 +0200

    tdf#130581 - Improve unit test of undo command for hide/show slides
    
    The test has the following structure:
    
    1. The first slide will be selected and set to hidden
    2. Then, the test checks if the slide is hidden and
    if there is the undo command for hiding the slide
    
    3. Second, hiding the slide will be undone
    4. Again, the test checks if the slide is visible and
    if there is the redo command for hiding the slide
    
    Finally, the same actions will be tested using the show slide command
    where the tests checks for two undo actions, i.e., show and hide slide.
    
    Change-Id: I8e9c4905f4ebbb45d872f5e6ca76179dbfae3a31
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154464
    Tested-by: Andreas Heinisch <andreas.heini...@yahoo.de>
    Reviewed-by: Andreas Heinisch <andreas.heini...@yahoo.de>

diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx
index 3a1c2ad911aa..acc3fabe5494 100644
--- a/sd/qa/unit/uiimpress.cxx
+++ b/sd/qa/unit/uiimpress.cxx
@@ -493,7 +493,7 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf100950)
     CPPUNIT_ASSERT(rPageSelector.IsPageSelected(2));
 }
 
-CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf130581)
+CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf130581_undo_hide_show_slide)
 {
     createSdImpressDoc();
 
@@ -505,9 +505,7 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf130581)
     auto pXImpressDocument = 
dynamic_cast<SdXImpressDocument*>(mxComponent.get());
     SdDrawDocument* pDocument = pXImpressDocument->GetDoc();
     sd::UndoManager* pUndoManager = pDocument->GetUndoManager();
-    // Without the fix in place, this test would have failed with
-    // - Expected: 1
-    // - Actual  : 0
+    // Check if there is the correct undo action, i.e., hide slide
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), 
pUndoManager->GetUndoActionCount());
     CPPUNIT_ASSERT_EQUAL(SdResId(STR_UNDO_HIDE_SLIDE), 
pUndoManager->GetUndoActionComment());
     sd::slidesorter::SlideSorterViewShell* pSSVS = getSlideSorterViewShell();
@@ -518,10 +516,8 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf130581)
     CPPUNIT_ASSERT_EQUAL(true, rPageSelector.IsPageExcluded(0));
 
     // Undo hide slide action and check the number of available redo actions
+    // including the correct undo action, i.e., hide slide
     dispatchCommand(mxComponent, ".uno:Undo", {});
-    // Without the fix in place, this test would have failed with
-    // - Expected: 1
-    // - Actual  : 0
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), 
pUndoManager->GetRedoActionCount());
     CPPUNIT_ASSERT_EQUAL(SdResId(STR_UNDO_HIDE_SLIDE), 
pUndoManager->GetRedoActionComment());
     CPPUNIT_ASSERT_EQUAL(false, rPageSelector.IsPageExcluded(0));
@@ -530,18 +526,14 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf130581)
     dispatchCommand(mxComponent, ".uno:Redo", {});
     CPPUNIT_ASSERT_EQUAL(true, rPageSelector.IsPageExcluded(0));
     dispatchCommand(mxComponent, ".uno:ShowSlide", {});
-    // Without the fix in place, this test would have failed with
-    // - Expected: 2
-    // - Actual  : 0
+    // There should be two undo actions, i.e., show and hide slide
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), 
pUndoManager->GetUndoActionCount());
     CPPUNIT_ASSERT_EQUAL(SdResId(STR_UNDO_SHOW_SLIDE), 
pUndoManager->GetUndoActionComment());
     CPPUNIT_ASSERT_EQUAL(false, rPageSelector.IsPageExcluded(0));
 
-    // Undo show slide action and check the number of available undo/redo 
actions
+    // Undo show slide and check the number of available undo/redo actions
     dispatchCommand(mxComponent, ".uno:Undo", {});
-    // Without the fix in place, this test would have failed with
-    // - Expected: 1
-    // - Actual  : 0
+    // There should be one undo action, i.e., hide slide, and one redo action, 
i.e., show slide
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), 
pUndoManager->GetUndoActionCount());
     CPPUNIT_ASSERT_EQUAL(SdResId(STR_UNDO_HIDE_SLIDE), 
pUndoManager->GetUndoActionComment());
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), 
pUndoManager->GetRedoActionCount());

Reply via email to