From 58814d047be09d6bd31da5dfd0efe3bae593c4d5 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Mon, 1 Feb 2021 14:13:30 +0100 Subject: tdf#139996: sd_uiimpress: Add unittest Change-Id: If4a8e415fadb1d004166b2a7428aff775bc37634 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110254 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sd/qa/unit/uiimpress.cxx | 33 ++++++++++++++++++++++ .../slidesorter/inc/controller/SlsPageSelector.hxx | 2 +- 2 files changed, 34 insertions(+), 1 deletion(-) (limited to 'sd') diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx index 83eb2a39cd13..8b444d7f3674 100644 --- a/sd/qa/unit/uiimpress.cxx +++ b/sd/qa/unit/uiimpress.cxx @@ -235,6 +235,39 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf126197) pViewShell2->GetViewFrame()->GetDispatcher()->Execute(SID_DELETE, SfxCallMode::SYNCHRON); } +CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf139996) +{ + mxComponent = loadFromDesktop("private:factory/simpress", + "com.sun.star.presentation.PresentationDocument"); + + CPPUNIT_ASSERT(mxComponent.is()); + + sd::slidesorter::SlideSorterViewShell* pSSVS = getSlideSorterViewShell(); + auto& rSSController = pSSVS->GetSlideSorter().GetController(); + auto& rPageSelector = rSSController.GetPageSelector(); + + CPPUNIT_ASSERT_EQUAL(1, rPageSelector.GetSelectedPageCount()); + + rPageSelector.DeselectAllPages(); + + CPPUNIT_ASSERT_EQUAL(0, rPageSelector.GetSelectedPageCount()); + + // Without the fix in place, this test would have crashed here + dispatchCommand(mxComponent, ".uno:MovePageUp", {}); + Scheduler::ProcessEventsToIdle(); + + dispatchCommand(mxComponent, ".uno:MovePageDown", {}); + Scheduler::ProcessEventsToIdle(); + + dispatchCommand(mxComponent, ".uno:MovePageTop", {}); + Scheduler::ProcessEventsToIdle(); + + dispatchCommand(mxComponent, ".uno:MovePageBottom", {}); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_EQUAL(0, rPageSelector.GetSelectedPageCount()); +} + CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf128651) { // Error was, that undo and redo changes size of the shape. Affected actions were e.g. diff --git a/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx b/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx index 5993618db157..51123f752ea9 100644 --- a/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx +++ b/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx @@ -60,7 +60,7 @@ public: // Exported for unit test SD_DLLPUBLIC void SelectAllPages(); - void DeselectAllPages(); + SD_DLLPUBLIC void DeselectAllPages(); /** Update the selection state of all page descriptors to be the same as that of the corresponding pages of the SdPage objects and issue -- cgit