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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Nov 19 18:19:01 UTC 2018


 sc/qa/uitest/calc_tests6/autoFormat.py    |   80 ++++++++++++++++++++++++++++++
 sc/qa/uitest/calc_tests6/moveCopySheet.py |   57 +++++++++++++++++++++
 2 files changed, 137 insertions(+)

New commits:
commit 7903848d5984bc997491acc55085de8275ec3b73
Author:     Zdeněk Crhonek <zcrhonek at gmail.com>
AuthorDate: Mon Nov 19 17:00:16 2018 +0100
Commit:     Zdenek Crhonek <zcrhonek at gmail.com>
CommitDate: Mon Nov 19 19:18:40 2018 +0100

    uitest for Calc- AutoFormat and move/copy sheet dialogs
    
    Change-Id: Ic13f33d37d9f8e472bde5a2708a8a7cbdc6d26f4
    Reviewed-on: https://gerrit.libreoffice.org/63583
    Tested-by: Jenkins
    Reviewed-by: Zdenek Crhonek <zcrhonek at gmail.com>

diff --git a/sc/qa/uitest/calc_tests6/autoFormat.py b/sc/qa/uitest/calc_tests6/autoFormat.py
new file mode 100644
index 000000000000..e5ecb485e935
--- /dev/null
+++ b/sc/qa/uitest/calc_tests6/autoFormat.py
@@ -0,0 +1,80 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# 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_state_as_dict
+from uitest.uihelper.common import select_pos
+from uitest.uihelper.calc import enter_text_to_cell
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+#uitest sc / AutoFormat Styles
+
+class autoFormat(UITestCase):
+    def test_autoformat_styles(self):
+        writer_doc = self.ui_test.create_doc_in_start_center("calc")
+        xCalcDoc = self.xUITest.getTopFocusWindow()
+        gridwin = xCalcDoc.getChild("grid_window")
+        document = self.ui_test.get_component()
+        #select A1:C5
+        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C5"}))
+        #AutoFormat Styles
+        self.ui_test.execute_dialog_through_command(".uno:AutoFormat")
+        xDialog = self.xUITest.getTopFocusWindow()
+
+        formatlb = xDialog.getChild("formatlb")
+        numformatcb = xDialog.getChild("numformatcb")
+        bordercb = xDialog.getChild("bordercb")
+        fontcb = xDialog.getChild("fontcb")
+        patterncb = xDialog.getChild("patterncb")
+        alignmentcb = xDialog.getChild("alignmentcb")
+        autofitcb = xDialog.getChild("autofitcb")
+
+        props = {"TEXT": "Financial"}
+        actionProps = mkPropertyValues(props)
+        formatlb.executeAction("SELECT", actionProps)
+        numformatcb.executeAction("CLICK", tuple())
+        bordercb.executeAction("CLICK", tuple())
+        fontcb.executeAction("CLICK", tuple())
+        patterncb.executeAction("CLICK", tuple())
+        alignmentcb.executeAction("CLICK", tuple())
+        autofitcb.executeAction("CLICK", tuple())
+
+        xOKBtn = xDialog.getChild("ok")
+        self.ui_test.close_dialog_through_button(xOKBtn)
+
+        #verify
+        self.ui_test.execute_dialog_through_command(".uno:AutoFormat")
+        xDialog = self.xUITest.getTopFocusWindow()
+
+        formatlb = xDialog.getChild("formatlb")
+        numformatcb = xDialog.getChild("numformatcb")
+        bordercb = xDialog.getChild("bordercb")
+        fontcb = xDialog.getChild("fontcb")
+        patterncb = xDialog.getChild("patterncb")
+        alignmentcb = xDialog.getChild("alignmentcb")
+        autofitcb = xDialog.getChild("autofitcb")
+
+        props = {"TEXT": "Financial"}
+        actionProps = mkPropertyValues(props)
+        formatlb.executeAction("SELECT", actionProps)
+        self.assertEqual(get_state_as_dict(numformatcb)["Selected"], "false")
+        self.assertEqual(get_state_as_dict(bordercb)["Selected"], "false")
+        self.assertEqual(get_state_as_dict(fontcb)["Selected"], "false")
+        self.assertEqual(get_state_as_dict(patterncb)["Selected"], "false")
+        self.assertEqual(get_state_as_dict(alignmentcb)["Selected"], "false")
+        self.assertEqual(get_state_as_dict(autofitcb)["Selected"], "false")
+        numformatcb.executeAction("CLICK", tuple())
+        bordercb.executeAction("CLICK", tuple())
+        fontcb.executeAction("CLICK", tuple())
+        patterncb.executeAction("CLICK", tuple())
+        alignmentcb.executeAction("CLICK", tuple())
+        autofitcb.executeAction("CLICK", tuple())
+        xOKBtn = xDialog.getChild("ok")
+        self.ui_test.close_dialog_through_button(xOKBtn)
+
+        self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/moveCopySheet.py b/sc/qa/uitest/calc_tests6/moveCopySheet.py
new file mode 100644
index 000000000000..8660e167fa3f
--- /dev/null
+++ b/sc/qa/uitest/calc_tests6/moveCopySheet.py
@@ -0,0 +1,57 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# 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_state_as_dict
+from uitest.uihelper.common import select_pos
+from uitest.debug import sleep
+from uitest.uihelper.calc import enter_text_to_cell
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+#uitest sc - move/copy sheet dialog
+
+class moveCopySheet(UITestCase):
+    def test_copy_move_sheet(self):
+        writer_doc = self.ui_test.create_doc_in_start_center("calc")
+        xCalcDoc = self.xUITest.getTopFocusWindow()
+        gridwin = xCalcDoc.getChild("grid_window")
+        document = self.ui_test.get_component()
+        #default - 1 sheet; select the sheet (is selected), dialog move/copy sheet
+        self.ui_test.execute_dialog_through_command(".uno:Move")
+        xDialog = self.xUITest.getTopFocusWindow()
+        #new name = newName
+        newName = xDialog.getChild("newName")
+        newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+        newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+        newName.executeAction("TYPE", mkPropertyValues({"TEXT":"newName"}))
+        xOKBtn = xDialog.getChild("ok")
+        self.ui_test.close_dialog_through_button(xOKBtn)
+        #verify, the file has 2 sheets; first one "newName" is selected
+        self.assertEqual(document.Sheets.getCount(), 2)
+        # dialog move/copy sheet ; Move is selected; select -move to end position - ; New Name = moveName
+        self.ui_test.execute_dialog_through_command(".uno:Move")
+        xDialog = self.xUITest.getTopFocusWindow()
+        insertBefore = xDialog.getChild("insertBefore")
+
+        xTreeEntry = insertBefore.getChild('2')
+        xTreeEntry.executeAction("SELECT", tuple())
+
+        newName = xDialog.getChild("newName")
+        self.assertEqual(get_state_as_dict(newName)["Text"], "newName")
+        newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+        newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+        newName.executeAction("TYPE", mkPropertyValues({"TEXT":"moveName"}))
+        xOKBtn = xDialog.getChild("ok")
+        self.ui_test.close_dialog_through_button(xOKBtn)
+        #verify, the file has 2 sheets; first one is "Sheet1" ; second one is "moveName"
+        self.assertEqual(document.Sheets.getCount(), 2)
+
+        self.assertEqual(document.Sheets.getByIndex(0).Name, "Sheet1")
+        self.assertEqual(document.Sheets.getByIndex(1).Name, "moveName")
+
+        self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:


More information about the Libreoffice-commits mailing list