summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-02-18 18:48:31 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2022-02-18 20:20:29 +0100
commitbebf2433ba1b7797bddddb06bdeec7975250181c (patch)
treebfb4ab7402cd4441336f63387d3d7f64c0319ea2
parentqt a11y: Map CARET_CHANGED event to Qt equivalent (diff)
downloadcore-bebf2433ba1b7797bddddb06bdeec7975250181c.tar.gz
core-bebf2433ba1b7797bddddb06bdeec7975250181c.zip
tdf#124818: sc: move UItest to CppUnittest
The original UItest is just wrong. The report talks about Select all - Cut - Undo and no cut and not undo is done there Change-Id: I53b925f86aa01fd4f161ec3180b2d7471baff09f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130172 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--sc/qa/uitest/calc_tests7/tdf124818.py28
-rw-r--r--sc/qa/unit/uicalc/data/tdf124818.xls (renamed from sc/qa/uitest/data/tdf124818.xls)bin17920 -> 17920 bytes
-rw-r--r--sc/qa/unit/uicalc/uicalc.cxx30
3 files changed, 30 insertions, 28 deletions
diff --git a/sc/qa/uitest/calc_tests7/tdf124818.py b/sc/qa/uitest/calc_tests7/tdf124818.py
deleted file mode 100644
index 1b131288313c..000000000000
--- a/sc/qa/uitest/calc_tests7/tdf124818.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-from uitest.framework import UITestCase
-from uitest.uihelper.common import get_url_for_data_file
-
-#Bug 124818 - CRASH: selecting all and switching spreadsheet
-
-class tdf124818(UITestCase):
- def test_tdf124818_crash_select_all_and_switch_spreadsheet(self):
- with self.ui_test.load_file(get_url_for_data_file("tdf124818.xls")) as calc_doc:
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
-
- #Select all ( Ctrl + A );Go to sheet Graph2;Select all;Crash
- self.xUITest.executeCommand(".uno:SelectAll")
- self.xUITest.executeCommand(".uno:JumpToPrevTable")
- self.xUITest.executeCommand(".uno:SelectAll")
-
- #verify; no crashes
- self.assertEqual(calc_doc.Sheets.getCount(), 3)
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/tdf124818.xls b/sc/qa/unit/uicalc/data/tdf124818.xls
index 2e5656978a9d..2e5656978a9d 100644
--- a/sc/qa/uitest/data/tdf124818.xls
+++ b/sc/qa/unit/uicalc/data/tdf124818.xls
Binary files differ
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 15d34995c4b2..0861d04fc4a6 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -1478,6 +1478,36 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf126904)
}
}
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf124818)
+{
+ ScModelObj* pModelObj = createDoc("tdf124818.xls");
+ ScDocument* pDoc = pModelObj->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(2), ScDocShell::GetViewData()->GetTabNo());
+
+ dispatchCommand(mxComponent, ".uno:JumpToPrevTable", {});
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(1), ScDocShell::GetViewData()->GetTabNo());
+
+ ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+ SdrPage* pPage = pDrawLayer->GetPage(1);
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pPage->GetObjCount());
+
+ dispatchCommand(mxComponent, ".uno:SelectAll", {});
+ Scheduler::ProcessEventsToIdle();
+
+ dispatchCommand(mxComponent, ".uno:Cut", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), pPage->GetObjCount());
+
+ dispatchCommand(mxComponent, ".uno:Undo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pPage->GetObjCount());
+}
+
CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf124816)
{
ScModelObj* pModelObj = createDoc("tdf124816.xlsx");