summaryrefslogtreecommitdiff
path: root/sc/qa/uitest/calc_tests6
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-06-30 11:01:58 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-06-30 13:17:54 +0200
commit57e8d25a40d7c053fef8ecb452e159264c659604 (patch)
tree9b7ca9fc7cbe8972d1caba9e583fc77f6c5a91b1 /sc/qa/uitest/calc_tests6
parentadf59322c651e8e6740a8d97d963dcf0972bdc54 (diff)
uitest: guard create_doc_in_start_center in sc
Mostly done by a script for motivation, see 89aaa17a0a4413f07da2bc5084b0164f15dc01ac < UITest: introduce guarded context managers > Change-Id: I9392c56e6efccde958f0cdd497376b3939b75be4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118152 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc/qa/uitest/calc_tests6')
-rw-r--r--sc/qa/uitest/calc_tests6/autoFormat.py92
-rw-r--r--sc/qa/uitest/calc_tests6/autocorrectOptions.py162
-rw-r--r--sc/qa/uitest/calc_tests6/hideShowSheet.py56
-rw-r--r--sc/qa/uitest/calc_tests6/moveCopySheet.py88
-rw-r--r--sc/qa/uitest/calc_tests6/multipleOperations.py194
-rw-r--r--sc/qa/uitest/calc_tests6/scenarios.py54
-rw-r--r--sc/qa/uitest/calc_tests6/shareSpreadsheet.py20
-rw-r--r--sc/qa/uitest/calc_tests6/tdf104378.py24
-rw-r--r--sc/qa/uitest/calc_tests6/tdf116996.py70
-rw-r--r--sc/qa/uitest/calc_tests6/tdf121263.py34
-rw-r--r--sc/qa/uitest/calc_tests6/tdf91726.py56
11 files changed, 413 insertions, 437 deletions
diff --git a/sc/qa/uitest/calc_tests6/autoFormat.py b/sc/qa/uitest/calc_tests6/autoFormat.py
index 5547f81956cc..17fb31049720 100644
--- a/sc/qa/uitest/calc_tests6/autoFormat.py
+++ b/sc/qa/uitest/calc_tests6/autoFormat.py
@@ -11,59 +11,57 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
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
- with self.ui_test.execute_dialog_through_command(".uno:AutoFormat") as xDialog:
+ with self.ui_test.create_doc_in_start_center_guarded("calc"):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ #select A1:C5
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C5"}))
+ #AutoFormat Styles
+ with self.ui_test.execute_dialog_through_command(".uno:AutoFormat") as xDialog:
- 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")
+ 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")
- entry = formatlb.getChild("7") #Financial
- entry.executeAction("SELECT", tuple())
- numformatcb.executeAction("CLICK", tuple())
- bordercb.executeAction("CLICK", tuple())
- fontcb.executeAction("CLICK", tuple())
- patterncb.executeAction("CLICK", tuple())
- alignmentcb.executeAction("CLICK", tuple())
- autofitcb.executeAction("CLICK", tuple())
+ entry = formatlb.getChild("7") #Financial
+ entry.executeAction("SELECT", tuple())
+ numformatcb.executeAction("CLICK", tuple())
+ bordercb.executeAction("CLICK", tuple())
+ fontcb.executeAction("CLICK", tuple())
+ patterncb.executeAction("CLICK", tuple())
+ alignmentcb.executeAction("CLICK", tuple())
+ autofitcb.executeAction("CLICK", tuple())
- #verify
- with self.ui_test.execute_dialog_through_command(".uno:AutoFormat") as xDialog:
+ #verify
+ with self.ui_test.execute_dialog_through_command(".uno:AutoFormat") as xDialog:
- 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")
+ 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")
- entry = formatlb.getChild("7") #Financial
- entry.executeAction("SELECT", tuple())
- 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())
+ entry = formatlb.getChild("7") #Financial
+ entry.executeAction("SELECT", tuple())
+ 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())
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/autocorrectOptions.py b/sc/qa/uitest/calc_tests6/autocorrectOptions.py
index 158b738baf63..f79a07a78906 100644
--- a/sc/qa/uitest/calc_tests6/autocorrectOptions.py
+++ b/sc/qa/uitest/calc_tests6/autocorrectOptions.py
@@ -12,87 +12,85 @@ from uitest.uihelper.common import select_pos
class autocorrectOptions(UITestCase):
def test_autocorrect_options_calc(self):
- self.ui_test.create_doc_in_start_center("calc")
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- with self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg", close_button="cancel") as xDialog:
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "0") #tab replace
- origtext = xDialog.getChild("origtext")
- newtext = xDialog.getChild("newtext")
- xnew = xDialog.getChild("new")
- xdelete = xDialog.getChild("delete")
- xtabview = xDialog.getChild("tabview")
- xreset = xDialog.getChild("reset")
- nrRows = get_state_as_dict(xtabview)["VisibleCount"]
-
- self.assertTrue(int(nrRows) > 0)
-
- #add new rule
- origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"}))
- newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"}))
- xnew.executeAction("CLICK", tuple())
- nrRowsNew = get_state_as_dict(xtabview)["VisibleCount"]
- nrRowsDiff = int(nrRowsNew) - int(nrRows)
- self.assertEqual(nrRowsDiff, 1) #we have +1 rule
- #delete rule
- origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"}))
- newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"}))
- xdelete.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(xtabview)["VisibleCount"], nrRows) #we have default nr of rules
-
- select_pos(xTabs, "1") #tab Exceptions
- #abbreviations
- abbrev = xDialog.getChild("abbrev")
- newabbrev = xDialog.getChild("newabbrev")
- delabbrev = xDialog.getChild("delabbrev")
- abbrevlist = xDialog.getChild("abbrevlist")
-
- nrRowsAbb = get_state_as_dict(abbrevlist)["VisibleCount"]
-
- self.assertTrue(int(nrRowsAbb) > 0)
-
- abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- abbrev.executeAction("TYPE", mkPropertyValues({"TEXT":"qqqqq"}))
- newabbrev.executeAction("CLICK", tuple())
- nrRowsAbbNew = get_state_as_dict(abbrevlist)["VisibleCount"]
- nrRowsAbbDiff = int(nrRowsAbbNew) - int(nrRowsAbb)
- self.assertEqual(nrRowsAbbDiff, 1) #we have +1 rule
- delabbrev.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(abbrevlist)["VisibleCount"], nrRowsAbb) #we have default nr of rules
-
- #words with two initial capitals
- double = xDialog.getChild("double")
- newdouble = xDialog.getChild("newdouble")
- deldouble = xDialog.getChild("deldouble")
- doublelist = xDialog.getChild("doublelist")
-
- nrRowsDouble = get_state_as_dict(doublelist)["VisibleCount"]
-
- self.assertTrue(int(nrRowsDouble) > 0)
-
- double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- double.executeAction("TYPE", mkPropertyValues({"TEXT":"QQqqq"}))
- newdouble.executeAction("CLICK", tuple())
- nrRowsDoubleNew = get_state_as_dict(doublelist)["VisibleCount"]
- nrRowsDoubleDiff = int(nrRowsDoubleNew) - int(nrRowsDouble) #convert string and
- self.assertEqual(nrRowsDoubleDiff, 1) #we have +1 rule
- deldouble.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(doublelist)["VisibleCount"], nrRowsDouble) #we have default nr of rules
-
-
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("calc"):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+
+ with self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0") #tab replace
+ origtext = xDialog.getChild("origtext")
+ newtext = xDialog.getChild("newtext")
+ xnew = xDialog.getChild("new")
+ xdelete = xDialog.getChild("delete")
+ xtabview = xDialog.getChild("tabview")
+ xreset = xDialog.getChild("reset")
+ nrRows = get_state_as_dict(xtabview)["VisibleCount"]
+
+ self.assertTrue(int(nrRows) > 0)
+
+ #add new rule
+ origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"}))
+ xnew.executeAction("CLICK", tuple())
+ nrRowsNew = get_state_as_dict(xtabview)["VisibleCount"]
+ nrRowsDiff = int(nrRowsNew) - int(nrRows)
+ self.assertEqual(nrRowsDiff, 1) #we have +1 rule
+ #delete rule
+ origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"}))
+ xdelete.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(xtabview)["VisibleCount"], nrRows) #we have default nr of rules
+
+ select_pos(xTabs, "1") #tab Exceptions
+ #abbreviations
+ abbrev = xDialog.getChild("abbrev")
+ newabbrev = xDialog.getChild("newabbrev")
+ delabbrev = xDialog.getChild("delabbrev")
+ abbrevlist = xDialog.getChild("abbrevlist")
+
+ nrRowsAbb = get_state_as_dict(abbrevlist)["VisibleCount"]
+
+ self.assertTrue(int(nrRowsAbb) > 0)
+
+ abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ abbrev.executeAction("TYPE", mkPropertyValues({"TEXT":"qqqqq"}))
+ newabbrev.executeAction("CLICK", tuple())
+ nrRowsAbbNew = get_state_as_dict(abbrevlist)["VisibleCount"]
+ nrRowsAbbDiff = int(nrRowsAbbNew) - int(nrRowsAbb)
+ self.assertEqual(nrRowsAbbDiff, 1) #we have +1 rule
+ delabbrev.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(abbrevlist)["VisibleCount"], nrRowsAbb) #we have default nr of rules
+
+ #words with two initial capitals
+ double = xDialog.getChild("double")
+ newdouble = xDialog.getChild("newdouble")
+ deldouble = xDialog.getChild("deldouble")
+ doublelist = xDialog.getChild("doublelist")
+
+ nrRowsDouble = get_state_as_dict(doublelist)["VisibleCount"]
+
+ self.assertTrue(int(nrRowsDouble) > 0)
+
+ double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ double.executeAction("TYPE", mkPropertyValues({"TEXT":"QQqqq"}))
+ newdouble.executeAction("CLICK", tuple())
+ nrRowsDoubleNew = get_state_as_dict(doublelist)["VisibleCount"]
+ nrRowsDoubleDiff = int(nrRowsDoubleNew) - int(nrRowsDouble) #convert string and
+ self.assertEqual(nrRowsDoubleDiff, 1) #we have +1 rule
+ deldouble.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(doublelist)["VisibleCount"], nrRowsDouble) #we have default nr of rules
+
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/hideShowSheet.py b/sc/qa/uitest/calc_tests6/hideShowSheet.py
index 303c2cc5dce3..ec517fd3e5f2 100644
--- a/sc/qa/uitest/calc_tests6/hideShowSheet.py
+++ b/sc/qa/uitest/calc_tests6/hideShowSheet.py
@@ -11,35 +11,33 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class hideShowSheet(UITestCase):
def test_hide_show_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()
- #insert sheet
- with self.ui_test.execute_dialog_through_command(".uno:Insert"):
- pass
- #select sheet
- gridwin.executeAction("SELECT", mkPropertyValues({"TABLE":"1"}))
- self.assertEqual(get_state_as_dict(gridwin)["SelectedTable"], "1")
- #hide sheet
- self.xUITest.executeCommand(".uno:Hide")
- #show sheet Dialog
- with self.ui_test.execute_dialog_through_command(".uno:Show", close_button="cancel") as xDialog:
- treeview = xDialog.getChild("treeview")
- self.assertEqual(get_state_as_dict(treeview)["Children"], "1")
- #insert 2nd sheet
- with self.ui_test.execute_dialog_through_command(".uno:Insert"):
- pass
- #select sheet
- gridwin.executeAction("SELECT", mkPropertyValues({"TABLE":"2"}))
- self.assertEqual(get_state_as_dict(gridwin)["SelectedTable"], "1")
- #hide sheet
- self.xUITest.executeCommand(".uno:Hide")
- #show sheet Dialog
- with self.ui_test.execute_dialog_through_command(".uno:Show", close_button="cancel") as xDialog:
- treeview = xDialog.getChild("treeview")
- self.assertEqual(get_state_as_dict(treeview)["Children"], "2")
+ with self.ui_test.create_doc_in_start_center_guarded("calc"):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ #insert sheet
+ with self.ui_test.execute_dialog_through_command(".uno:Insert"):
+ pass
+ #select sheet
+ gridwin.executeAction("SELECT", mkPropertyValues({"TABLE":"1"}))
+ self.assertEqual(get_state_as_dict(gridwin)["SelectedTable"], "1")
+ #hide sheet
+ self.xUITest.executeCommand(".uno:Hide")
+ #show sheet Dialog
+ with self.ui_test.execute_dialog_through_command(".uno:Show", close_button="cancel") as xDialog:
+ treeview = xDialog.getChild("treeview")
+ self.assertEqual(get_state_as_dict(treeview)["Children"], "1")
+ #insert 2nd sheet
+ with self.ui_test.execute_dialog_through_command(".uno:Insert"):
+ pass
+ #select sheet
+ gridwin.executeAction("SELECT", mkPropertyValues({"TABLE":"2"}))
+ self.assertEqual(get_state_as_dict(gridwin)["SelectedTable"], "1")
+ #hide sheet
+ self.xUITest.executeCommand(".uno:Hide")
+ #show sheet Dialog
+ with self.ui_test.execute_dialog_through_command(".uno:Show", close_button="cancel") as xDialog:
+ treeview = xDialog.getChild("treeview")
+ self.assertEqual(get_state_as_dict(treeview)["Children"], "2")
- 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
index 7b038d8d9bde..27f293755b22 100644
--- a/sc/qa/uitest/calc_tests6/moveCopySheet.py
+++ b/sc/qa/uitest/calc_tests6/moveCopySheet.py
@@ -11,59 +11,57 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
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
- with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog:
- #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"}))
- #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
- with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog:
- insertBefore = xDialog.getChild("insertBefore")
+ with self.ui_test.create_doc_in_start_center_guarded("calc") as document:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ #default - 1 sheet; select the sheet (is selected), dialog move/copy sheet
+ with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog:
+ #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"}))
+ #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
+ with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog:
+ insertBefore = xDialog.getChild("insertBefore")
- xTreeEntry = insertBefore.getChild('2')
- xTreeEntry.executeAction("SELECT", tuple())
+ 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"}))
- # Verify, the file has 2 sheets; first one is "Sheet1" ; second one is "moveName"
- self.assertEqual(document.Sheets.getCount(), 2)
+ 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"}))
+ # Verify, the file has 2 sheets; first one is "Sheet1" ; second one is "moveName"
+ self.assertEqual(document.Sheets.getCount(), 2)
- self.assertEqual(document.Sheets[0].Name, "Sheet1")
- self.assertEqual(document.Sheets[1].Name, "moveName")
+ self.assertEqual(document.Sheets[0].Name, "Sheet1")
+ self.assertEqual(document.Sheets[1].Name, "moveName")
- # Verify that the cancel button does not do anything
- with self.ui_test.execute_dialog_through_command(".uno:Move", close_button="cancel"):
- pass
+ # Verify that the cancel button does not do anything
+ with self.ui_test.execute_dialog_through_command(".uno:Move", close_button="cancel"):
+ pass
- self.assertEqual(document.Sheets.getCount(), 2)
- self.assertEqual(document.Sheets[0].Name, "Sheet1")
- self.assertEqual(document.Sheets[1].Name, "moveName")
+ self.assertEqual(document.Sheets.getCount(), 2)
+ self.assertEqual(document.Sheets[0].Name, "Sheet1")
+ self.assertEqual(document.Sheets[1].Name, "moveName")
- #Check copy option
- with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog:
- xCopy = xDialog.getChild("copy")
- xCopy.executeAction("CLICK", tuple())
- sheetName = "moveName_2"
- newName = xDialog.getChild("newName")
- self.assertEqual(get_state_as_dict(newName)["Text"], sheetName)
+ #Check copy option
+ with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog:
+ xCopy = xDialog.getChild("copy")
+ xCopy.executeAction("CLICK", tuple())
+ sheetName = "moveName_2"
+ newName = xDialog.getChild("newName")
+ self.assertEqual(get_state_as_dict(newName)["Text"], sheetName)
- self.assertEqual(document.Sheets.getCount(), 3)
- self.assertEqual(document.Sheets[0].Name, sheetName)
- self.assertEqual(document.Sheets[1].Name, "Sheet1")
- self.assertEqual(document.Sheets[2].Name, "moveName")
+ self.assertEqual(document.Sheets.getCount(), 3)
+ self.assertEqual(document.Sheets[0].Name, sheetName)
+ self.assertEqual(document.Sheets[1].Name, "Sheet1")
+ self.assertEqual(document.Sheets[2].Name, "moveName")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/multipleOperations.py b/sc/qa/uitest/calc_tests6/multipleOperations.py
index 1f60937b056a..83868c824aa5 100644
--- a/sc/qa/uitest/calc_tests6/multipleOperations.py
+++ b/sc/qa/uitest/calc_tests6/multipleOperations.py
@@ -14,112 +14,108 @@ from uitest.uihelper.calc import enter_text_to_cell
class multipleOperations(UITestCase):
def test_multiple_operations_one_variable(self):
- self.ui_test.create_doc_in_start_center("calc")
- xCalcDoc = self.xUITest.getTopFocusWindow()
- xGridWindow = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.create_doc_in_start_center_guarded("calc") as document:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xGridWindow = xCalcDoc.getChild("grid_window")
- #enter data
- enter_text_to_cell(xGridWindow, "B1", "10")
- enter_text_to_cell(xGridWindow, "B2", "2")
- enter_text_to_cell(xGridWindow, "B3", "10000")
- enter_text_to_cell(xGridWindow, "B4", "2000")
- enter_text_to_cell(xGridWindow, "B5", "=B4*(B1-B2)-B3")
+ #enter data
+ enter_text_to_cell(xGridWindow, "B1", "10")
+ enter_text_to_cell(xGridWindow, "B2", "2")
+ enter_text_to_cell(xGridWindow, "B3", "10000")
+ enter_text_to_cell(xGridWindow, "B4", "2000")
+ enter_text_to_cell(xGridWindow, "B5", "=B4*(B1-B2)-B3")
- enter_text_to_cell(xGridWindow, "D2", "500")
- enter_text_to_cell(xGridWindow, "D3", "1000")
- enter_text_to_cell(xGridWindow, "D4", "1500")
- enter_text_to_cell(xGridWindow, "D5", "2000")
- enter_text_to_cell(xGridWindow, "D6", "2500")
- enter_text_to_cell(xGridWindow, "D7", "3000")
- enter_text_to_cell(xGridWindow, "D8", "3500")
- enter_text_to_cell(xGridWindow, "D9", "4000")
- enter_text_to_cell(xGridWindow, "D10", "4500")
- enter_text_to_cell(xGridWindow, "D11", "5000")
- #Select the range D2:E11
- xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "D2:E11"}))
- #Choose Data > Multiple Operations.
- self.ui_test.execute_modeless_dialog_through_command(".uno:TableOperationDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- #Formulas = B5 ; Column input cell = B4
- formulas = xDialog.getChild("formulas")
- col = xDialog.getChild("col")
- formulas.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$5"}))
- col.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$4"}))
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- #verify
- self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), -6000)
- self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), -2000)
- self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 2000)
- self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 6000)
- self.assertEqual(get_cell_by_position(document, 0, 4, 5).getValue(), 10000)
- self.assertEqual(get_cell_by_position(document, 0, 4, 6).getValue(), 14000)
- self.assertEqual(get_cell_by_position(document, 0, 4, 7).getValue(), 18000)
- self.assertEqual(get_cell_by_position(document, 0, 4, 8).getValue(), 22000)
- self.assertEqual(get_cell_by_position(document, 0, 4, 9).getValue(), 26000)
- self.assertEqual(get_cell_by_position(document, 0, 4, 10).getValue(), 30000)
+ enter_text_to_cell(xGridWindow, "D2", "500")
+ enter_text_to_cell(xGridWindow, "D3", "1000")
+ enter_text_to_cell(xGridWindow, "D4", "1500")
+ enter_text_to_cell(xGridWindow, "D5", "2000")
+ enter_text_to_cell(xGridWindow, "D6", "2500")
+ enter_text_to_cell(xGridWindow, "D7", "3000")
+ enter_text_to_cell(xGridWindow, "D8", "3500")
+ enter_text_to_cell(xGridWindow, "D9", "4000")
+ enter_text_to_cell(xGridWindow, "D10", "4500")
+ enter_text_to_cell(xGridWindow, "D11", "5000")
+ #Select the range D2:E11
+ xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "D2:E11"}))
+ #Choose Data > Multiple Operations.
+ self.ui_test.execute_modeless_dialog_through_command(".uno:TableOperationDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Formulas = B5 ; Column input cell = B4
+ formulas = xDialog.getChild("formulas")
+ col = xDialog.getChild("col")
+ formulas.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$5"}))
+ col.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$4"}))
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #verify
+ self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), -6000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), -2000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 2000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 6000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 5).getValue(), 10000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 6).getValue(), 14000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 7).getValue(), 18000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 8).getValue(), 22000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 9).getValue(), 26000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 10).getValue(), 30000)
- self.ui_test.close_doc()
def test_multiple_operations_several_formulas(self):
- self.ui_test.create_doc_in_start_center("calc")
- xCalcDoc = self.xUITest.getTopFocusWindow()
- xGridWindow = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.create_doc_in_start_center_guarded("calc") as document:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xGridWindow = xCalcDoc.getChild("grid_window")
- #enter data
- enter_text_to_cell(xGridWindow, "B1", "10")
- enter_text_to_cell(xGridWindow, "B2", "2")
- enter_text_to_cell(xGridWindow, "B3", "10000")
- enter_text_to_cell(xGridWindow, "B4", "2000")
- enter_text_to_cell(xGridWindow, "B5", "=B4*(B1-B2)-B3")
- enter_text_to_cell(xGridWindow, "C5", "=B5/B4")
+ #enter data
+ enter_text_to_cell(xGridWindow, "B1", "10")
+ enter_text_to_cell(xGridWindow, "B2", "2")
+ enter_text_to_cell(xGridWindow, "B3", "10000")
+ enter_text_to_cell(xGridWindow, "B4", "2000")
+ enter_text_to_cell(xGridWindow, "B5", "=B4*(B1-B2)-B3")
+ enter_text_to_cell(xGridWindow, "C5", "=B5/B4")
- enter_text_to_cell(xGridWindow, "D2", "500")
- enter_text_to_cell(xGridWindow, "D3", "1000")
- enter_text_to_cell(xGridWindow, "D4", "1500")
- enter_text_to_cell(xGridWindow, "D5", "2000")
- enter_text_to_cell(xGridWindow, "D6", "2500")
- enter_text_to_cell(xGridWindow, "D7", "3000")
- enter_text_to_cell(xGridWindow, "D8", "3500")
- enter_text_to_cell(xGridWindow, "D9", "4000")
- enter_text_to_cell(xGridWindow, "D10", "4500")
- enter_text_to_cell(xGridWindow, "D11", "5000")
- #Select the range D2:F11
- xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "D2:F11"}))
- #Choose Data > Multiple Operations.
- self.ui_test.execute_modeless_dialog_through_command(".uno:TableOperationDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- #Formulas = B5 ; Column input cell = B4
- formulas = xDialog.getChild("formulas")
- col = xDialog.getChild("col")
- formulas.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$5:$C$5"}))
- col.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$4"}))
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- #verify
- self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), -6000)
- self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), -2000)
- self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 2000)
- self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 6000)
- self.assertEqual(get_cell_by_position(document, 0, 4, 5).getValue(), 10000)
- self.assertEqual(get_cell_by_position(document, 0, 4, 6).getValue(), 14000)
- self.assertEqual(get_cell_by_position(document, 0, 4, 7).getValue(), 18000)
- self.assertEqual(get_cell_by_position(document, 0, 4, 8).getValue(), 22000)
- self.assertEqual(get_cell_by_position(document, 0, 4, 9).getValue(), 26000)
- self.assertEqual(get_cell_by_position(document, 0, 4, 10).getValue(), 30000)
+ enter_text_to_cell(xGridWindow, "D2", "500")
+ enter_text_to_cell(xGridWindow, "D3", "1000")
+ enter_text_to_cell(xGridWindow, "D4", "1500")
+ enter_text_to_cell(xGridWindow, "D5", "2000")
+ enter_text_to_cell(xGridWindow, "D6", "2500")
+ enter_text_to_cell(xGridWindow, "D7", "3000")
+ enter_text_to_cell(xGridWindow, "D8", "3500")
+ enter_text_to_cell(xGridWindow, "D9", "4000")
+ enter_text_to_cell(xGridWindow, "D10", "4500")
+ enter_text_to_cell(xGridWindow, "D11", "5000")
+ #Select the range D2:F11
+ xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "D2:F11"}))
+ #Choose Data > Multiple Operations.
+ self.ui_test.execute_modeless_dialog_through_command(".uno:TableOperationDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Formulas = B5 ; Column input cell = B4
+ formulas = xDialog.getChild("formulas")
+ col = xDialog.getChild("col")
+ formulas.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$5:$C$5"}))
+ col.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$4"}))
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #verify
+ self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), -6000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), -2000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 2000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 6000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 5).getValue(), 10000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 6).getValue(), 14000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 7).getValue(), 18000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 8).getValue(), 22000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 9).getValue(), 26000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 10).getValue(), 30000)
- self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), -12)
- self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), -2)
- self.assertEqual(round(get_cell_by_position(document, 0, 5, 3).getValue(),2), 1.33)
- self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 5, 5).getValue(), 4)
- self.assertEqual(round(get_cell_by_position(document, 0, 5, 6).getValue(),2), 4.67)
- self.assertEqual(round(get_cell_by_position(document, 0, 5, 7).getValue(),2), 5.14)
- self.assertEqual(get_cell_by_position(document, 0, 5, 8).getValue(), 5.5)
- self.assertEqual(round(get_cell_by_position(document, 0, 5, 9).getValue(),2), 5.78)
- self.assertEqual(get_cell_by_position(document, 0, 5, 10).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), -12)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), -2)
+ self.assertEqual(round(get_cell_by_position(document, 0, 5, 3).getValue(),2), 1.33)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 5).getValue(), 4)
+ self.assertEqual(round(get_cell_by_position(document, 0, 5, 6).getValue(),2), 4.67)
+ self.assertEqual(round(get_cell_by_position(document, 0, 5, 7).getValue(),2), 5.14)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 8).getValue(), 5.5)
+ self.assertEqual(round(get_cell_by_position(document, 0, 5, 9).getValue(),2), 5.78)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 10).getValue(), 6)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/scenarios.py b/sc/qa/uitest/calc_tests6/scenarios.py
index e4b10b449624..9063762a629b 100644
--- a/sc/qa/uitest/calc_tests6/scenarios.py
+++ b/sc/qa/uitest/calc_tests6/scenarios.py
@@ -13,32 +13,30 @@ from uitest.uihelper.calc import enter_text_to_cell
class scenarios(UITestCase):
def test_scenarios(self):
- self.ui_test.create_doc_in_start_center("calc")
- xCalcDoc = self.xUITest.getTopFocusWindow()
- xGridWindow = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- #fill B1:B4 with 1, select B1:B4;
- enter_text_to_cell(xGridWindow, "B1", "1")
- enter_text_to_cell(xGridWindow, "B2", "1")
- enter_text_to_cell(xGridWindow, "B3", "1")
- enter_text_to_cell(xGridWindow, "B4", "1")
- xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:B4"}))
- #scenarios - scenario A1
- with self.ui_test.execute_dialog_through_command(".uno:ScenarioManager") as xDialog:
-
- name = xDialog.getChild("name")
- name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- name.executeAction("TYPE", mkPropertyValues({"TEXT":"A1"}))
-
- #next scenarios - scenario B1
- with self.ui_test.execute_dialog_through_command(".uno:ScenarioManager") as xDialog:
-
- name = xDialog.getChild("name")
- name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- name.executeAction("TYPE", mkPropertyValues({"TEXT":"B1"}))
-
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("calc"):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xGridWindow = xCalcDoc.getChild("grid_window")
+
+ #fill B1:B4 with 1, select B1:B4;
+ enter_text_to_cell(xGridWindow, "B1", "1")
+ enter_text_to_cell(xGridWindow, "B2", "1")
+ enter_text_to_cell(xGridWindow, "B3", "1")
+ enter_text_to_cell(xGridWindow, "B4", "1")
+ xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:B4"}))
+ #scenarios - scenario A1
+ with self.ui_test.execute_dialog_through_command(".uno:ScenarioManager") as xDialog:
+
+ name = xDialog.getChild("name")
+ name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ name.executeAction("TYPE", mkPropertyValues({"TEXT":"A1"}))
+
+ #next scenarios - scenario B1
+ with self.ui_test.execute_dialog_through_command(".uno:ScenarioManager") as xDialog:
+
+ name = xDialog.getChild("name")
+ name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ name.executeAction("TYPE", mkPropertyValues({"TEXT":"B1"}))
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/shareSpreadsheet.py b/sc/qa/uitest/calc_tests6/shareSpreadsheet.py
index a7d1b762752a..21f2443db596 100644
--- a/sc/qa/uitest/calc_tests6/shareSpreadsheet.py
+++ b/sc/qa/uitest/calc_tests6/shareSpreadsheet.py
@@ -12,18 +12,16 @@ from uitest.uihelper.common import get_state_as_dict
class shareSpreadsheet(UITestCase):
def test_share_spreadsheet(self):
- self.ui_test.create_doc_in_start_center("calc")
- xCalcDoc = self.xUITest.getTopFocusWindow()
- xGridWindow = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.create_doc_in_start_center_guarded("calc"):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xGridWindow = xCalcDoc.getChild("grid_window")
- #dialog shareSpreadsheet
- with self.ui_test.execute_dialog_through_command(".uno:ShareDocument", close_button="cancel") as xDialog:
+ #dialog shareSpreadsheet
+ with self.ui_test.execute_dialog_through_command(".uno:ShareDocument", close_button="cancel") as xDialog:
- share = xDialog.getChild("share")
- share.executeAction("CLICK", tuple())
- users = xDialog.getChild("users")
- self.assertEqual(get_state_as_dict(users)["Children"], "1")
+ share = xDialog.getChild("share")
+ share.executeAction("CLICK", tuple())
+ users = xDialog.getChild("users")
+ self.assertEqual(get_state_as_dict(users)["Children"], "1")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/tdf104378.py b/sc/qa/uitest/calc_tests6/tdf104378.py
index a210306f3193..99fb75ee50db 100644
--- a/sc/qa/uitest/calc_tests6/tdf104378.py
+++ b/sc/qa/uitest/calc_tests6/tdf104378.py
@@ -11,23 +11,21 @@ from libreoffice.calc.document import get_cell_by_position
class tdf104378(UITestCase):
def test_tdf104378(self):
- calc_doc = self.ui_test.create_doc_in_start_center("calc")
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
+ with self.ui_test.create_doc_in_start_center_guarded("calc") as document:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
- enter_text_to_cell(gridwin, "A1", "遠程MySQL連接遠程MySQL連接遠程MySQL連接")
+ enter_text_to_cell(gridwin, "A1", "遠程MySQL連接遠程MySQL連接遠程MySQL連接")
- with self.ui_test.execute_dialog_through_command(".uno:ChineseConversion"):
- pass
+ with self.ui_test.execute_dialog_through_command(".uno:ChineseConversion"):
+ pass
- document = self.ui_test.get_component()
- # Without the fix in place, this test would have failed with
- # - 远程MySQL連接遠程MySQL連接遠程MySQL連接
- # + 远程MySQL连接远程MySQL连接远程MySQL连接
- self.assertEqual(get_cell_by_position(
- document, 0, 0, 0).getString(), "远程MySQL连接远程MySQL连接远程MySQL连接")
+ # Without the fix in place, this test would have failed with
+ # - 远程MySQL連接遠程MySQL連接遠程MySQL連接
+ # + 远程MySQL连接远程MySQL连接远程MySQL连接
+ self.assertEqual(get_cell_by_position(
+ document, 0, 0, 0).getString(), "远程MySQL连接远程MySQL连接远程MySQL连接")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/tdf116996.py b/sc/qa/uitest/calc_tests6/tdf116996.py
index 9552b7ccc26a..6f28b7d9bb72 100644
--- a/sc/qa/uitest/calc_tests6/tdf116996.py
+++ b/sc/qa/uitest/calc_tests6/tdf116996.py
@@ -11,40 +11,38 @@ from uitest.uihelper.common import get_state_as_dict
class tdf116996(UITestCase):
def test_tdf116996_enable_experimental_feature(self):
- calc_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()
-
- with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog", close_button="") as xDialogOpt:
- xPages = xDialogOpt.getChild("pages")
- xLOEntry = xPages.getChild('0') # Libreoffice
- xLOEntry.executeAction("EXPAND", tuple())
- xAdvancedEntry = xLOEntry.getChild('10')
- xAdvancedEntry.executeAction("SELECT", tuple()) #Libreoffice / Advanced
- xexperimental = xDialogOpt.getChild("experimental")
- xexperimental.executeAction("CLICK", tuple()) #enable experimental features
-
- xOKBtn = xDialogOpt.getChild("ok")
-
- with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), close_button="no"):
- pass
-
- #reopen options dialog and verify
- with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog", close_button="") as xDialogOpt:
- xPages = xDialogOpt.getChild("pages")
- xLOEntry = xPages.getChild('0') # Libreoffice
- xLOEntry.executeAction("EXPAND", tuple())
- xAdvancedEntry = xLOEntry.getChild('10')
- xAdvancedEntry.executeAction("SELECT", tuple()) #Libreoffice / Advanced
- xexperimental = xDialogOpt.getChild("experimental")
-
- self.assertEqual(get_state_as_dict(xexperimental)["Selected"], "true")
- xexperimental.executeAction("CLICK", tuple()) #disable experimental features
- xOKBtn = xDialogOpt.getChild("ok")
-
- with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), close_button="no"):
- pass
-
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center_guarded("calc"):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+
+ with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog", close_button="") as xDialogOpt:
+ xPages = xDialogOpt.getChild("pages")
+ xLOEntry = xPages.getChild('0') # Libreoffice
+ xLOEntry.executeAction("EXPAND", tuple())
+ xAdvancedEntry = xLOEntry.getChild('10')
+ xAdvancedEntry.executeAction("SELECT", tuple()) #Libreoffice / Advanced
+ xexperimental = xDialogOpt.getChild("experimental")
+ xexperimental.executeAction("CLICK", tuple()) #enable experimental features
+
+ xOKBtn = xDialogOpt.getChild("ok")
+
+ with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), close_button="no"):
+ pass
+
+ #reopen options dialog and verify
+ with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog", close_button="") as xDialogOpt:
+ xPages = xDialogOpt.getChild("pages")
+ xLOEntry = xPages.getChild('0') # Libreoffice
+ xLOEntry.executeAction("EXPAND", tuple())
+ xAdvancedEntry = xLOEntry.getChild('10')
+ xAdvancedEntry.executeAction("SELECT", tuple()) #Libreoffice / Advanced
+ xexperimental = xDialogOpt.getChild("experimental")
+
+ self.assertEqual(get_state_as_dict(xexperimental)["Selected"], "true")
+ xexperimental.executeAction("CLICK", tuple()) #disable experimental features
+ xOKBtn = xDialogOpt.getChild("ok")
+
+ with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), close_button="no"):
+ pass
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/tdf121263.py b/sc/qa/uitest/calc_tests6/tdf121263.py
index 1a3776f811d9..b8db6a19811b 100644
--- a/sc/qa/uitest/calc_tests6/tdf121263.py
+++ b/sc/qa/uitest/calc_tests6/tdf121263.py
@@ -13,27 +13,25 @@ from uitest.uihelper.common import get_state_as_dict
class tdf121263(UITestCase):
def test_tdf121263_hide_more_sheets(self):
- calc_doc = self.ui_test.create_doc_in_start_center("calc")
- xTopWindow = self.xUITest.getTopFocusWindow()
- document = self.ui_test.get_component()
- gridwin = xTopWindow.getChild("grid_window")
+ with self.ui_test.create_doc_in_start_center_guarded("calc"):
+ xTopWindow = self.xUITest.getTopFocusWindow()
+ gridwin = xTopWindow.getChild("grid_window")
- with self.ui_test.execute_dialog_through_command(".uno:Insert"):
- pass
- with self.ui_test.execute_dialog_through_command(".uno:Insert"):
- pass
+ with self.ui_test.execute_dialog_through_command(".uno:Insert"):
+ pass
+ with self.ui_test.execute_dialog_through_command(".uno:Insert"):
+ pass
- gridwin.executeAction("SELECT", mkPropertyValues({"TABLE": "2"}))
- #select previous sheet
- self.xUITest.executeCommand(".uno:JumpToPrevTableSel")
+ gridwin.executeAction("SELECT", mkPropertyValues({"TABLE": "2"}))
+ #select previous sheet
+ self.xUITest.executeCommand(".uno:JumpToPrevTableSel")
- #hide sheet
- self.xUITest.executeCommand(".uno:Hide")
+ #hide sheet
+ self.xUITest.executeCommand(".uno:Hide")
- #show sheet Dialog
- with self.ui_test.execute_dialog_through_command(".uno:Show", close_button="cancel") as xDialog:
- treeview = xDialog.getChild("treeview")
- self.assertEqual(get_state_as_dict(treeview)["Children"], "2")
+ #show sheet Dialog
+ with self.ui_test.execute_dialog_through_command(".uno:Show", close_button="cancel") as xDialog:
+ treeview = xDialog.getChild("treeview")
+ self.assertEqual(get_state_as_dict(treeview)["Children"], "2")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/tdf91726.py b/sc/qa/uitest/calc_tests6/tdf91726.py
index 4f64d9588202..a688751f6e0b 100644
--- a/sc/qa/uitest/calc_tests6/tdf91726.py
+++ b/sc/qa/uitest/calc_tests6/tdf91726.py
@@ -11,40 +11,38 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf91726(UITestCase):
def test_tdf91726_new_style(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:E9
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:E9"}))
- #AutoFormat Styles
- with self.ui_test.execute_dialog_through_command(".uno:AutoFormat", close_button="") as xDialog:
- #add new style "Default"
- xadd = xDialog.getChild("add")
-
- # Use empty close_button to open consecutive dialogs
- with self.ui_test.execute_blocking_action(
- xadd.executeAction, args=('CLICK', ()), close_button="") as dialog:
- nameEntry = dialog.getChild("name_entry")
- nameEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"Default"}))
- xOKBtn = dialog.getChild("ok")
+ with self.ui_test.create_doc_in_start_center_guarded("calc"):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ #select A1:E9
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:E9"}))
+ #AutoFormat Styles
+ with self.ui_test.execute_dialog_through_command(".uno:AutoFormat", close_button="") as xDialog:
+ #add new style "Default"
+ xadd = xDialog.getChild("add")
+ # Use empty close_button to open consecutive dialogs
with self.ui_test.execute_blocking_action(
- xOKBtn.executeAction, args=('CLICK', ()), close_button="") as dialog2:
- #Error message: You have entered an invalid name.
- #AutoFormat could not be created.
- #Try again using a different name.
- xOKBtn2 = dialog2.getChild("ok")
+ xadd.executeAction, args=('CLICK', ()), close_button="") as dialog:
+ nameEntry = dialog.getChild("name_entry")
+ nameEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"Default"}))
+ xOKBtn = dialog.getChild("ok")
with self.ui_test.execute_blocking_action(
- xOKBtn2.executeAction, args=('CLICK', ()), close_button="cancel") as dialog3:
- nameEntry = dialog3.getChild("name_entry")
- #back to name dialog, LO should not crash
- self.assertEqual(get_state_as_dict(nameEntry)["Text"], "Default")
+ xOKBtn.executeAction, args=('CLICK', ()), close_button="") as dialog2:
+ #Error message: You have entered an invalid name.
+ #AutoFormat could not be created.
+ #Try again using a different name.
+ xOKBtn2 = dialog2.getChild("ok")
+
+ with self.ui_test.execute_blocking_action(
+ xOKBtn2.executeAction, args=('CLICK', ()), close_button="cancel") as dialog3:
+ nameEntry = dialog3.getChild("name_entry")
+ #back to name dialog, LO should not crash
+ self.assertEqual(get_state_as_dict(nameEntry)["Text"], "Default")
- xCanceltn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCanceltn)
+ xCanceltn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCanceltn)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab: