1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 from uitest
.framework
import UITestCase
10 from uitest
.uihelper
.calc
import enter_text_to_cell
11 from uitest
.uihelper
.common
import select_by_text
, select_pos
13 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
16 class DetectiveCircle(UITestCase
):
18 def test_delete_circle_at_formula(self
):
19 with self
.ui_test
.create_doc_in_start_center("calc") as document
:
20 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
21 gridwin
= xCalcDoc
.getChild("grid_window")
22 enter_text_to_cell(gridwin
, "A1", "1")
23 enter_text_to_cell(gridwin
, "A2", "3")
24 enter_text_to_cell(gridwin
, "A3", "=SUM(A1:A2)")
26 #Select the cells to be validated
27 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A3"}))
28 #Apply Data > Validity ... > Whole Numbers
29 with self
.ui_test
.execute_dialog_through_command(".uno:Validation") as xDialog
:
30 xTabs
= xDialog
.getChild("tabcontrol")
31 select_pos(xTabs
, "0")
32 xallow
= xDialog
.getChild("allow")
33 xallowempty
= xDialog
.getChild("allowempty")
34 xdata
= xDialog
.getChild("data")
35 xmin
= xDialog
.getChild("min")
37 select_by_text(xallow
, "Whole Numbers")
38 xallowempty
.executeAction("CLICK", tuple())
39 select_by_text(xdata
, "equal")
40 xmin
.executeAction("TYPE", mkPropertyValues({"TEXT":"5"}))
42 self
.xUITest
.executeCommand(".uno:ShowInvalid")
44 detectiveCircle1
= document
.Sheets
.getByName("Sheet1").DrawPage
.getCount()
45 #There should be 1 detective circle object!
46 self
.assertEqual(detectiveCircle1
, 1)
48 enter_text_to_cell(gridwin
, "A1", "2")
50 detectiveCircle2
= document
.Sheets
.getByName("Sheet1").DrawPage
.getCount()
51 #There should not be a detective circle object!
52 self
.assertEqual(detectiveCircle2
, 0)
55 # vim: set shiftwidth=4 softtabstop=4 expandtab: