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
.common
import get_state_as_dict
, get_url_for_data_file
12 from libreoffice
.calc
.document
import get_cell_by_position
13 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
16 # Bug 35020 - Find and Replace changes case of sheet name in formulas
17 class tdf35020(UITestCase
):
18 def test_tdf39959_find_replace_all_sheets(self
):
19 with self
.ui_test
.load_file(get_url_for_data_file("tdf35020.ods")) as calc_doc
:
20 with self
.ui_test
.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button
="close") as xDialog
:
21 searchterm
= xDialog
.getChild("searchterm")
22 searchterm
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
23 searchterm
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
24 searchterm
.executeAction("TYPE", mkPropertyValues({"TEXT":"X6"}))
25 replaceterm
= xDialog
.getChild("replaceterm")
26 replaceterm
.executeAction("TYPE", mkPropertyValues({"TEXT":"A6"})) #replace textbox
27 allsheets
= xDialog
.getChild("allsheets")
28 allsheets
.executeAction("CLICK", tuple())
29 calcsearchin
= xDialog
.getChild("calcsearchin")
30 self
.assertEqual("Formulas", get_state_as_dict(calcsearchin
)['SelectEntryText'])
31 replaceall
= xDialog
.getChild("replaceall")
32 replaceall
.executeAction("CLICK", tuple())
34 #verify Sheet1.A13 A14 = 2
35 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 12).getValue(), 2)
36 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 13).getValue(), 2)
38 self
.xUITest
.executeCommand(".uno:Undo")
39 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 12).getValue(), 1)
40 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 13).getValue(), 1)
41 # vim: set shiftwidth=4 softtabstop=4 expandtab: