sc/Module_sc.mk                    |    1 
 sc/UITest_hide_cols.mk             |   15 -------------
 sc/qa/uitest/hide_cols/tdf95306.py |   41 -------------------------------------
 sc/qa/unit/uicalc/uicalc.cxx       |   38 ++++++++++++++++++++++++++++++++++
 4 files changed, 38 insertions(+), 57 deletions(-)

New commits:
commit d8138eaa3934c1797422ff28cae31100c02b376c
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri Jan 13 13:54:34 2023 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Fri Jan 13 15:37:01 2023 +0000

    tdf#95306: move UItest to CppUnittest
    
    Change-Id: Ic999c9d10d9a3ae16de0df70b435a5d822035193
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145471
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index c829ee0ae3ca..98d555316f9c 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -250,7 +250,6 @@ $(eval $(call gb_Module_add_screenshot_targets,sc,\
 $(eval $(call gb_Module_add_uicheck_targets,sc,\
        UITest_conditional_format \
        UITest_range_name \
-       UITest_hide_cols \
        UITest_autofilter \
        UITest_autofilter2 \
        UITest_search_replace \
diff --git a/sc/UITest_hide_cols.mk b/sc/UITest_hide_cols.mk
deleted file mode 100644
index b265505cec1a..000000000000
--- a/sc/UITest_hide_cols.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# 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/.
-#
-
-$(eval $(call gb_UITest_UITest,hide_cols))
-
-$(eval $(call gb_UITest_add_modules,hide_cols,$(SRCDIR)/sc/qa/uitest,\
-       hide_cols/ \
-))
-# vim: set noet sw=4 ts=4:
diff --git a/sc/qa/uitest/hide_cols/tdf95306.py 
b/sc/qa/uitest/hide_cols/tdf95306.py
deleted file mode 100644
index 222e8ee3093d..000000000000
--- a/sc/qa/uitest/hide_cols/tdf95306.py
+++ /dev/null
@@ -1,41 +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 libreoffice.calc.document import get_column
-from libreoffice.uno.propertyvalue import mkPropertyValues
-
-
-def get_column_hidden(doc, index):
-    column = get_column(doc, index)
-    val = column.getPropertyValue("IsVisible")
-    return not val
-
-class HideDisjointColumns(UITestCase):
-
-    def test_hide_columns(self):
-        with self.ui_test.create_doc_in_start_center("calc") as doc:
-            xTopWindow = self.xUITest.getTopFocusWindow()
-
-            gridwin = xTopWindow.getChild("grid_window")
-            gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"}))
-            gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1", 
"EXTEND":"true"}))
-
-            self.assertFalse(get_column_hidden(doc, 1))
-            self.assertFalse(get_column_hidden(doc, 3))
-            self.ui_test._xUITest.executeCommand(".uno:HideColumn")
-            self.assertTrue(get_column_hidden(doc, 1))
-            self.assertTrue(get_column_hidden(doc, 3))
-            self.ui_test._xUITest.executeCommand(".uno:Undo")
-            self.assertFalse(get_column_hidden(doc, 1))
-            self.assertFalse(get_column_hidden(doc, 3))
-
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 30c42f98beaa..b3cb2a6b82eb 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -1304,6 +1304,44 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf146994)
     CPPUNIT_ASSERT_EQUAL(OUString("Sheet1.D3:Sheet1.D4"), aMarkedAreaString);
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf95306)
+{
+    createScDoc();
+    ScDocument* pDoc = getScDoc();
+
+    // Use Adding Selection
+    dispatchCommand(mxComponent, ".uno:StatusSelectionModeExp", {});
+    Scheduler::ProcessEventsToIdle();
+
+    goToCell("B1");
+    dispatchCommand(mxComponent, ".uno:SelectColumn", {});
+    Scheduler::ProcessEventsToIdle();
+
+    dispatchCommand(mxComponent, ".uno:GoRight", {});
+    dispatchCommand(mxComponent, ".uno:GoRight", {});
+
+    dispatchCommand(mxComponent, ".uno:SelectColumn", {});
+    Scheduler::ProcessEventsToIdle();
+
+    dispatchCommand(mxComponent, ".uno:HideColumn", {});
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT(!pDoc->ColHidden(0, 0));
+    CPPUNIT_ASSERT(pDoc->ColHidden(1, 0));
+    CPPUNIT_ASSERT(!pDoc->ColHidden(2, 0));
+    CPPUNIT_ASSERT(pDoc->ColHidden(3, 0));
+    CPPUNIT_ASSERT(!pDoc->ColHidden(4, 0));
+
+    dispatchCommand(mxComponent, ".uno:Undo", {});
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT(!pDoc->ColHidden(0, 0));
+    CPPUNIT_ASSERT(!pDoc->ColHidden(1, 0));
+    CPPUNIT_ASSERT(!pDoc->ColHidden(2, 0));
+    CPPUNIT_ASSERT(!pDoc->ColHidden(3, 0));
+    CPPUNIT_ASSERT(!pDoc->ColHidden(4, 0));
+}
+
 CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf45020)
 {
     createScDoc();

Reply via email to