summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-06-23 16:16:58 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-06-27 21:45:32 +0200
commiteef1a5f3aa0f1b11024aa6760cf92181b9bf0a96 (patch)
treed4e46ce25ba5214a6e5820712c84e55035e8874e /sw
parent241c37a6ad2a444ddf2eb48385041318d4e7e8ee (diff)
uitest: remove duplicated calls to get_component()
after 8298aa62726312eee6f8fbb64a9fc9b12680447f < uitest: guard execute_blocking_action > Change-Id: I954c11c42620660afd48a585f5c59ff2196f4b6a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117738 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/uitest/chapterNumbering/tdf123547.py3
-rw-r--r--sw/qa/uitest/findReplace/findReplace.py9
-rw-r--r--sw/qa/uitest/findReplace/tdf118208.py3
-rw-r--r--sw/qa/uitest/findSimilarity/findSimilarity.py1
-rw-r--r--sw/qa/uitest/navigator/tdf40427.py4
-rw-r--r--sw/qa/uitest/table/sheetToTable.py15
-rw-r--r--sw/qa/uitest/table/splitTable.py21
-rw-r--r--sw/qa/uitest/table/tableProperties.py1
-rw-r--r--sw/qa/uitest/table/tableToText.py25
-rw-r--r--sw/qa/uitest/table/tdf134881_colProportionalAdjust.py1
-rw-r--r--sw/qa/uitest/table/tdf81292.py3
-rw-r--r--sw/qa/uitest/table/tdf99334.py3
-rw-r--r--sw/qa/uitest/table/textToTable.py9
-rw-r--r--sw/qa/uitest/writer_tests/compareDocuments.py2
-rw-r--r--sw/qa/uitest/writer_tests/trackedChanges.py6
-rw-r--r--sw/qa/uitest/writer_tests/versionDialog.py1
-rw-r--r--sw/qa/uitest/writer_tests/wordCount.py2
-rw-r--r--sw/qa/uitest/writer_tests4/spellDialog.py3
-rw-r--r--sw/qa/uitest/writer_tests4/tdf113284.py5
-rw-r--r--sw/qa/uitest/writer_tests4/tdf122449.py1
-rw-r--r--sw/qa/uitest/writer_tests4/tdf134439.py4
-rw-r--r--sw/qa/uitest/writer_tests4/tdf135636.py4
-rw-r--r--sw/qa/uitest/writer_tests4/tdf136578.py3
-rw-r--r--sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py5
-rw-r--r--sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py4
-rw-r--r--sw/qa/uitest/writer_tests5/tdf117039.py3
-rw-r--r--sw/qa/uitest/writer_tests5/tdf118540.py3
-rw-r--r--sw/qa/uitest/writer_tests5/titlePageWizard.py3
-rw-r--r--sw/qa/uitest/writer_tests5/titlePageWizard2.py3
-rw-r--r--sw/qa/uitest/writer_tests6/tdf120731.py3
-rw-r--r--sw/qa/uitest/writer_tests6/tdf124586.py3
-rw-r--r--sw/qa/uitest/writer_tests6/tdf124675.py7
-rw-r--r--sw/qa/uitest/writer_tests6/tdf126017.py3
-rw-r--r--sw/qa/uitest/writer_tests6/tdf126627.py3
-rw-r--r--sw/qa/uitest/writer_tests7/forms.py3
-rw-r--r--sw/qa/uitest/writer_tests7/tdf132169.py3
-rw-r--r--sw/qa/uitest/writer_tests7/tdf137802.py3
-rw-r--r--sw/qa/uitest/writer_tests7/tdf137803.py3
-rw-r--r--sw/qa/uitest/writer_tests7/tdf140117.py3
-rw-r--r--sw/qa/uitest/writer_tests7/tdf90401.py6
40 files changed, 66 insertions, 124 deletions
diff --git a/sw/qa/uitest/chapterNumbering/tdf123547.py b/sw/qa/uitest/chapterNumbering/tdf123547.py
index 135db13fe927..a9b97d1be9f4 100644
--- a/sw/qa/uitest/chapterNumbering/tdf123547.py
+++ b/sw/qa/uitest/chapterNumbering/tdf123547.py
@@ -13,7 +13,6 @@ from uitest.uihelper.common import select_pos
class tdf123547(UITestCase):
def test_tdf123547_numbering_dialog_crash(self):
with self.ui_test.load_file(get_url_for_data_file("tdf123547.docx")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog")
@@ -23,6 +22,6 @@ class tdf123547(UITestCase):
xokbtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xokbtn)
#verify we didn't crash
- self.assertEqual(document.CurrentController.PageCount, 1)
+ self.assertEqual(writer_doc.CurrentController.PageCount, 1)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/findReplace/findReplace.py b/sw/qa/uitest/findReplace/findReplace.py
index 0ef4f22ac1d9..68f9f882b3e9 100644
--- a/sw/qa/uitest/findReplace/findReplace.py
+++ b/sw/qa/uitest/findReplace/findReplace.py
@@ -12,7 +12,6 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, typ
class findReplace(UITestCase):
def test_find_writer(self):
with self.ui_test.load_file(get_url_for_data_file("findReplace.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
@@ -51,7 +50,7 @@ class findReplace(UITestCase):
replace.executeAction("CLICK", tuple())
replace.executeAction("CLICK", tuple()) #click twice Replace button
#verify
- self.assertEqual(document.Text.String[0:19], "Replace first first")
+ self.assertEqual(writer_doc.Text.String[0:19], "Replace first first")
#now replace first (uncheck match case) with word "aaa" - click once Replace All button, check "Replace aaa aaa"
replaceterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
@@ -61,7 +60,7 @@ class findReplace(UITestCase):
replaceall = xDialog.getChild("replaceall")
replaceall.executeAction("CLICK", tuple())
#verify
- self.assertEqual(document.Text.String[0:15], "Replace aaa aaa")
+ self.assertEqual(writer_doc.Text.String[0:15], "Replace aaa aaa")
#now delete strings in textbox Find and textbox Replace, click button Format, select Size=16 pt, Close OK, Find Next; verify Page=2;
#click No format button; close dialog
@@ -123,7 +122,6 @@ class findReplace(UITestCase):
#tdf116242 ţ ț
def test_tdf116242_replace_t_with_cedilla(self):
with self.ui_test.load_file(get_url_for_data_file("tdf116242.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
@@ -138,7 +136,7 @@ class findReplace(UITestCase):
replaceall = xDialog.getChild("replaceall")
replaceall.executeAction("CLICK", tuple())
#verify
- self.assertEqual(document.Text.String[0:13], "țoootdf116242")
+ self.assertEqual(writer_doc.Text.String[0:13], "țoootdf116242")
xcloseBtn = xDialog.getChild("close")
self.ui_test.close_dialog_through_button(xcloseBtn)
@@ -146,7 +144,6 @@ class findReplace(UITestCase):
#Bug 98417 - FIND & REPLACE: Add 'Find Previous' button
def test_tdf98417_find_previous_writer(self):
with self.ui_test.load_file(get_url_for_data_file("findReplace.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
diff --git a/sw/qa/uitest/findReplace/tdf118208.py b/sw/qa/uitest/findReplace/tdf118208.py
index 79c38315898f..d46ed7ae8f02 100644
--- a/sw/qa/uitest/findReplace/tdf118208.py
+++ b/sw/qa/uitest/findReplace/tdf118208.py
@@ -15,7 +15,6 @@ class tdf118208(UITestCase):
def test_tdf118208_search_dialog_format_crash(self):
with self.ui_test.load_file(get_url_for_data_file("tdf118208.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
# 1. Open the attached file.
# 2. Press ctrl-H to show the search and replace dialog.
@@ -49,7 +48,7 @@ class tdf118208(UITestCase):
pass
#verify
- self.assertEqual(document.Text.String[0:14], "Aaaaaaaaaaaaaa")
+ self.assertEqual(writer_doc.Text.String[0:14], "Aaaaaaaaaaaaaa")
xcloseBtn = xDialog.getChild("close")
self.ui_test.close_dialog_through_button(xcloseBtn)
diff --git a/sw/qa/uitest/findSimilarity/findSimilarity.py b/sw/qa/uitest/findSimilarity/findSimilarity.py
index da5066e8ec91..e637d60baffb 100644
--- a/sw/qa/uitest/findSimilarity/findSimilarity.py
+++ b/sw/qa/uitest/findSimilarity/findSimilarity.py
@@ -13,7 +13,6 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class findSimilarities(UITestCase):
def test_find_similarities(self):
with self.ui_test.load_file(get_url_for_data_file("findReplace.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
#verify: we are on page 1
diff --git a/sw/qa/uitest/navigator/tdf40427.py b/sw/qa/uitest/navigator/tdf40427.py
index a3aa1dfa8d10..58f59b430643 100644
--- a/sw/qa/uitest/navigator/tdf40427.py
+++ b/sw/qa/uitest/navigator/tdf40427.py
@@ -14,11 +14,11 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class tdf40427(UITestCase):
def test_tdf40427(self):
- with self.ui_test.load_file(get_url_for_data_file("tdf40427_SectionPositions.odt")):
+ with self.ui_test.load_file(get_url_for_data_file("tdf40427_SectionPositions.odt")) as document:
xMainWindow = self.xUITest.getTopFocusWindow()
xWriterEdit = xMainWindow.getChild("writer_edit")
- self.assertEqual(2, self.ui_test.get_component().CurrentController.PageCount)
+ self.assertEqual(2, document.CurrentController.PageCount)
# Make sure that the view is 2 pages side-by-side - look at dialog View-Zoom-Zoom
self.ui_test.execute_dialog_through_command(".uno:Zoom")
diff --git a/sw/qa/uitest/table/sheetToTable.py b/sw/qa/uitest/table/sheetToTable.py
index 4f48eeb644db..1beafa67214d 100644
--- a/sw/qa/uitest/table/sheetToTable.py
+++ b/sw/qa/uitest/table/sheetToTable.py
@@ -19,12 +19,11 @@ class sheetToTable(UITestCase):
self.xUITest.executeCommand(".uno:Copy")
with self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
self.xUITest.executeCommand(".uno:Paste")
#verify (don't copy hidden cells)
- self.assertEqual(document.TextTables.getCount(), 1)
- table = document.getTextTables()[0]
+ self.assertEqual(writer_doc.TextTables.getCount(), 1)
+ table = writer_doc.getTextTables()[0]
# This was 3 (copied hidden row)
self.assertEqual(len(table.getRows()), 2)
self.assertEqual(table.getCellByName("A1").getString(), "1")
@@ -38,7 +37,6 @@ class sheetToTable(UITestCase):
self.xUITest.executeCommand(".uno:Copy")
with self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
# set numbering in the paragraph after the table
@@ -52,8 +50,8 @@ class sheetToTable(UITestCase):
self.xUITest.executeCommand(".uno:Paste")
#verify also tdf#124646 (don't copy hidden cells)
- self.assertEqual(document.TextTables.getCount(), 1)
- table = document.getTextTables()[0]
+ self.assertEqual(writer_doc.TextTables.getCount(), 1)
+ table = writer_doc.getTextTables()[0]
# This was 3 (copied hidden row)
self.assertEqual(len(table.getRows()), 2)
self.assertEqual(table.getCellByName("A1").getString(), "1")
@@ -79,13 +77,12 @@ class sheetToTable(UITestCase):
self.ui_test.close_doc()
with self.ui_test.load_file(get_url_for_data_file("tdf129083.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
self.xUITest.executeCommand(".uno:Paste")
- self.assertEqual(document.TextTables.getCount(), 1)
- table = document.getTextTables()[0]
+ self.assertEqual(writer_doc.TextTables.getCount(), 1)
+ table = writer_doc.getTextTables()[0]
self.assertEqual(len(table.getRows()), 4)
self.assertEqual(table.getCellByName("A1").getString(), "Test 1")
self.assertEqual(table.getCellByName("A2").getString(), "Test 2")
diff --git a/sw/qa/uitest/table/splitTable.py b/sw/qa/uitest/table/splitTable.py
index e4fdecac6fa0..1efea8380b91 100644
--- a/sw/qa/uitest/table/splitTable.py
+++ b/sw/qa/uitest/table/splitTable.py
@@ -12,7 +12,6 @@ from uitest.uihelper.common import get_url_for_data_file
class splitTable(UITestCase):
def test_split_table(self):
with self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
#go to row 2
self.xUITest.executeCommand(".uno:GoDown")
@@ -25,17 +24,16 @@ class splitTable(UITestCase):
copyheading.executeAction("CLICK", tuple())
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
- self.assertEqual(document.TextTables.getCount(), 2)
- tables = document.getTextTables()
+ self.assertEqual(writer_doc.TextTables.getCount(), 2)
+ tables = writer_doc.getTextTables()
self.assertEqual(len(tables[0].getRows()), 2)
self.assertEqual(len(tables[1].getRows()), 5)
#undo -> verify 1 tables
self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.TextTables.getCount(), 1)
+ self.assertEqual(writer_doc.TextTables.getCount(), 1)
#dialog Split table, check Custom heading, OK -> verify 2 tables, 1st has 2 rows, second has 4 rows
with self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
#go to row 2
self.xUITest.executeCommand(".uno:GoDown")
@@ -47,17 +45,16 @@ class splitTable(UITestCase):
customheading.executeAction("CLICK", tuple())
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
- self.assertEqual(document.TextTables.getCount(), 2)
- tables = document.getTextTables()
+ self.assertEqual(writer_doc.TextTables.getCount(), 2)
+ tables = writer_doc.getTextTables()
self.assertEqual(len(tables[0].getRows()), 2)
self.assertEqual(len(tables[1].getRows()), 4)
#undo -> verify 1 tables
self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.TextTables.getCount(), 1)
+ self.assertEqual(writer_doc.TextTables.getCount(), 1)
#dialog Split table, check No heading, OK -> verify 2 tables, 1st has 2 rows, second has 4 rows
with self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
#go to row 2
self.xUITest.executeCommand(".uno:GoDown")
@@ -69,12 +66,12 @@ class splitTable(UITestCase):
noheading.executeAction("CLICK", tuple())
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
- self.assertEqual(document.TextTables.getCount(), 2)
- tables = document.getTextTables()
+ self.assertEqual(writer_doc.TextTables.getCount(), 2)
+ tables = writer_doc.getTextTables()
self.assertEqual(len(tables[0].getRows()), 2)
self.assertEqual(len(tables[1].getRows()), 4)
#undo -> verify 1 tables
self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.TextTables.getCount(), 1)
+ self.assertEqual(writer_doc.TextTables.getCount(), 1)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/table/tableProperties.py b/sw/qa/uitest/table/tableProperties.py
index 4c2b34ab0a16..15c15865b4f2 100644
--- a/sw/qa/uitest/table/tableProperties.py
+++ b/sw/qa/uitest/table/tableProperties.py
@@ -16,7 +16,6 @@ from uitest.uihelper.common import change_measurement_unit
class tableProperties(UITestCase):
def test_table_properties(self):
with self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
change_measurement_unit(self, "Centimeter")
diff --git a/sw/qa/uitest/table/tableToText.py b/sw/qa/uitest/table/tableToText.py
index 110a3e0837d6..10a48fbdceaf 100644
--- a/sw/qa/uitest/table/tableToText.py
+++ b/sw/qa/uitest/table/tableToText.py
@@ -13,7 +13,6 @@ from uitest.uihelper.common import get_url_for_data_file
class tableToText(UITestCase):
def test_table_to_text(self):
with self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
#dialog Table to text - Tabs; verify
self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText")
@@ -23,11 +22,11 @@ class tableToText(UITestCase):
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
#verify
- self.assertEqual(document.Text.String[0:3], "a\ta")
- self.assertEqual(document.TextTables.getCount(), 0)
+ self.assertEqual(writer_doc.Text.String[0:3], "a\ta")
+ self.assertEqual(writer_doc.TextTables.getCount(), 0)
#undo
self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.TextTables.getCount(), 1)
+ self.assertEqual(writer_doc.TextTables.getCount(), 1)
#dialog Table to text - Paragraph; verify
self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText")
@@ -37,11 +36,11 @@ class tableToText(UITestCase):
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
#verify
- self.assertEqual(document.Text.String.replace('\r\n', '\n')[0:4], "a\na\n")
- self.assertEqual(document.TextTables.getCount(), 0)
+ self.assertEqual(writer_doc.Text.String.replace('\r\n', '\n')[0:4], "a\na\n")
+ self.assertEqual(writer_doc.TextTables.getCount(), 0)
#undo
self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.TextTables.getCount(), 1)
+ self.assertEqual(writer_doc.TextTables.getCount(), 1)
#dialog Table to text - Semicolons; verify
self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText")
@@ -51,11 +50,11 @@ class tableToText(UITestCase):
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
#verify
- self.assertEqual(document.Text.String.replace('\r\n', '\n')[0:6], "a;a\n;\n")
- self.assertEqual(document.TextTables.getCount(), 0)
+ self.assertEqual(writer_doc.Text.String.replace('\r\n', '\n')[0:6], "a;a\n;\n")
+ self.assertEqual(writer_doc.TextTables.getCount(), 0)
#undo
self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.TextTables.getCount(), 1)
+ self.assertEqual(writer_doc.TextTables.getCount(), 1)
#dialog Table to text - other; verify
self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText")
@@ -69,10 +68,10 @@ class tableToText(UITestCase):
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
#verify
- self.assertEqual(document.Text.String.replace('\r\n', '\n')[0:6], "a:a\n:\n")
- self.assertEqual(document.TextTables.getCount(), 0)
+ self.assertEqual(writer_doc.Text.String.replace('\r\n', '\n')[0:6], "a:a\n:\n")
+ self.assertEqual(writer_doc.TextTables.getCount(), 0)
#undo
self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.TextTables.getCount(), 1)
+ self.assertEqual(writer_doc.TextTables.getCount(), 1)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/table/tdf134881_colProportionalAdjust.py b/sw/qa/uitest/table/tdf134881_colProportionalAdjust.py
index ff34dd75e9d0..fdde40f672bf 100644
--- a/sw/qa/uitest/table/tdf134881_colProportionalAdjust.py
+++ b/sw/qa/uitest/table/tdf134881_colProportionalAdjust.py
@@ -15,7 +15,6 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf134881(UITestCase):
def test_tdf134881(self):
with self.ui_test.load_file(get_url_for_data_file("tdf134881_colProportionalAdjust.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
change_measurement_unit(self, "Centimeter")
diff --git a/sw/qa/uitest/table/tdf81292.py b/sw/qa/uitest/table/tdf81292.py
index 50996861d6ac..e0be6fd8c2f2 100644
--- a/sw/qa/uitest/table/tdf81292.py
+++ b/sw/qa/uitest/table/tdf81292.py
@@ -13,7 +13,6 @@ class tdf81292(UITestCase):
def test_tdf81292_table_sort(self):
with self.ui_test.load_file(get_url_for_data_file("tdf81292.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
#select whole table
self.xUITest.executeCommand(".uno:SelectTable")
@@ -25,7 +24,7 @@ class tdf81292(UITestCase):
xOK = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOK)
#verify
- tables = document.getTextTables()
+ tables = writer_doc.getTextTables()
table = tables[0]
tableText = table.getCellByName("B3")
b3 = tableText.getString()
diff --git a/sw/qa/uitest/table/tdf99334.py b/sw/qa/uitest/table/tdf99334.py
index 9e1b649becbe..a696c0be06ca 100644
--- a/sw/qa/uitest/table/tdf99334.py
+++ b/sw/qa/uitest/table/tdf99334.py
@@ -13,7 +13,6 @@ class tdf99334(UITestCase):
def test_tdf99334_table_sort_umlauts(self):
with self.ui_test.load_file(get_url_for_data_file("tdf99334.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
#select whole table
self.xUITest.executeCommand(".uno:SelectTable")
@@ -25,7 +24,7 @@ class tdf99334(UITestCase):
xOK = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOK)
#verify
- tables = document.getTextTables()
+ tables = writer_doc.getTextTables()
table = tables[0]
tableText = table.getCellByName("B1")
b1 = tableText.getString()
diff --git a/sw/qa/uitest/table/textToTable.py b/sw/qa/uitest/table/textToTable.py
index 2b820b360653..644a2a25254a 100644
--- a/sw/qa/uitest/table/textToTable.py
+++ b/sw/qa/uitest/table/textToTable.py
@@ -39,7 +39,6 @@ class textToTable(UITestCase):
def test_text_to_table_header(self):
with self.ui_test.load_file(get_url_for_data_file("textToTable.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
#open file; select all text ; dialog Text to table - other ":"; verify
@@ -57,13 +56,13 @@ class textToTable(UITestCase):
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
#verify
- self.assertEqual(document.TextTables.getCount(), 1)
- tables = document.getTextTables()
+ self.assertEqual(writer_doc.TextTables.getCount(), 1)
+ tables = writer_doc.getTextTables()
self.assertEqual(len(tables[0].getRows()), 4)
self.assertEqual(len(tables[0].getColumns()), 3)
#undo
self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.TextTables.getCount(), 0)
- self.assertEqual(document.Text.String[0:5], "A:B:C")
+ self.assertEqual(writer_doc.TextTables.getCount(), 0)
+ self.assertEqual(writer_doc.Text.String[0:5], "A:B:C")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests/compareDocuments.py b/sw/qa/uitest/writer_tests/compareDocuments.py
index ba308974d79f..caac05e583a6 100644
--- a/sw/qa/uitest/writer_tests/compareDocuments.py
+++ b/sw/qa/uitest/writer_tests/compareDocuments.py
@@ -18,7 +18,6 @@ class compareDocuments(UITestCase):
with self.ui_test.load_file(get_url_for_data_file("tdf130960.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
self.ui_test.execute_dialog_through_command(".uno:CompareDocuments")
@@ -51,7 +50,6 @@ class compareDocuments(UITestCase):
with self.ui_test.load_file(get_url_for_data_file("tdf137855.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
self.ui_test.execute_dialog_through_command(".uno:CompareDocuments")
diff --git a/sw/qa/uitest/writer_tests/trackedChanges.py b/sw/qa/uitest/writer_tests/trackedChanges.py
index 366954d76d16..b723b0c445dc 100644
--- a/sw/qa/uitest/writer_tests/trackedChanges.py
+++ b/sw/qa/uitest/writer_tests/trackedChanges.py
@@ -151,10 +151,9 @@ class trackedchanges(UITestCase):
self.ui_test.close_doc()
def test_list_of_changes(self):
- with self.ui_test.load_file(get_url_for_data_file("trackedChanges.odt")):
+ with self.ui_test.load_file(get_url_for_data_file("trackedChanges.odt")) as document:
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
- document = self.ui_test.get_component()
listText = [
"Unknown Author\t01/24/2020 16:19:32\t",
@@ -219,10 +218,9 @@ class trackedchanges(UITestCase):
xcloseBtn.executeAction("CLICK", tuple())
def test_tdf135018(self):
- with self.ui_test.load_file(get_url_for_data_file("tdf135018.odt")):
+ with self.ui_test.load_file(get_url_for_data_file("tdf135018.odt")) as document:
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
- document = self.ui_test.get_component()
self.assertEqual(5, document.CurrentController.PageCount)
diff --git a/sw/qa/uitest/writer_tests/versionDialog.py b/sw/qa/uitest/writer_tests/versionDialog.py
index 6ab12611c2bc..df8d09102f1f 100644
--- a/sw/qa/uitest/writer_tests/versionDialog.py
+++ b/sw/qa/uitest/writer_tests/versionDialog.py
@@ -16,7 +16,6 @@ class versionDialog(UITestCase):
with self.ui_test.load_file(get_url_for_data_file("tdf131931.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
self.ui_test.execute_dialog_through_command(".uno:VersionDialog")
diff --git a/sw/qa/uitest/writer_tests/wordCount.py b/sw/qa/uitest/writer_tests/wordCount.py
index 9d8b3a6cba0a..0ed42d1563c3 100644
--- a/sw/qa/uitest/writer_tests/wordCount.py
+++ b/sw/qa/uitest/writer_tests/wordCount.py
@@ -51,7 +51,6 @@ class writerWordCount(UITestCase):
with self.ui_test.load_file(get_url_for_data_file("tdf68347.odt")) as writer_doc:
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
- document = self.ui_test.get_component()
xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "24", "END_POS": "39"})) #select two words
@@ -242,7 +241,6 @@ class writerWordCount(UITestCase):
with self.ui_test.load_file(get_url_for_data_file("tdf51816.odt")) as writer_doc:
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
- document = self.ui_test.get_component()
#1. Open attached document
#2. Tools> Word count
self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog")
diff --git a/sw/qa/uitest/writer_tests4/spellDialog.py b/sw/qa/uitest/writer_tests4/spellDialog.py
index fea337bd2c3f..0ef25c2d413d 100644
--- a/sw/qa/uitest/writer_tests4/spellDialog.py
+++ b/sw/qa/uitest/writer_tests4/spellDialog.py
@@ -105,7 +105,6 @@ frog, dogg, catt"""
if not supported_locale:
self.skipTest("no dictionary support for en_US available")
with self.ui_test.load_file(get_url_for_data_file("tdf66043.fodt")) as writer_doc:
- document = self.ui_test.get_component()
# Step 1: Initiate spellchecking, and make sure "Check grammar" is
# unchecked
spell_dialog = self.launch_dialog()
@@ -122,7 +121,7 @@ frog, dogg, catt"""
xCloseBtn = spell_dialog.getChild("close")
xCloseBtn.executeAction("CLICK", tuple())
- output_text = document.Text.getString().replace('\r\n', '\n')
+ output_text = writer_doc.Text.getString().replace('\r\n', '\n')
# This was "gooodgood baaad eeend" ("goood" is a deletion,
# "good" is an insertion by fixing the first misspelling),
# but now "goood" is not a misspelling because it is accepted
diff --git a/sw/qa/uitest/writer_tests4/tdf113284.py b/sw/qa/uitest/writer_tests4/tdf113284.py
index 70bacd60ac77..1edc923ebe28 100644
--- a/sw/qa/uitest/writer_tests4/tdf113284.py
+++ b/sw/qa/uitest/writer_tests4/tdf113284.py
@@ -11,14 +11,13 @@ class tdf113284(UITestCase):
def test_tdf113284(self):
with self.ui_test.load_file(get_url_for_data_file("tdf113284.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
xToolkit.processEventsToIdle()
- xPageCount = document.CurrentController.PageCount
+ xPageCount = writer_doc.CurrentController.PageCount
self.ui_test.execute_dialog_through_command(".uno:GotoPage")
xDialog = self.xUITest.getTopFocusWindow()
xPageText = xDialog.getChild("page")
@@ -37,6 +36,6 @@ class tdf113284(UITestCase):
#page count is not constant
#self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "66") #page 66 start of the Index
#pagecount unchanged
- self.assertEqual(document.CurrentController.PageCount, xPageCount)
+ self.assertEqual(writer_doc.CurrentController.PageCount, xPageCount)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/tdf122449.py b/sw/qa/uitest/writer_tests4/tdf122449.py
index b893f4f643e1..0ef066eb372a 100644
--- a/sw/qa/uitest/writer_tests4/tdf122449.py
+++ b/sw/qa/uitest/writer_tests4/tdf122449.py
@@ -15,7 +15,6 @@ class tdf122449(UITestCase):
def test_tdf122449_crash_edit_index_entry(self):
with self.ui_test.load_file(get_url_for_data_file("tdf122449.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
#search word Autocorrect (second find) .uno:SearchDialog
diff --git a/sw/qa/uitest/writer_tests4/tdf134439.py b/sw/qa/uitest/writer_tests4/tdf134439.py
index 8d2d7a1a62f9..6ba7727e426d 100644
--- a/sw/qa/uitest/writer_tests4/tdf134439.py
+++ b/sw/qa/uitest/writer_tests4/tdf134439.py
@@ -13,9 +13,7 @@ class tdf134439(UITestCase):
def test_tdf134439(self):
- with self.ui_test.load_file(get_url_for_data_file("tdf134439.odt")):
-
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf134439.odt")) as document:
self.assertEqual(document.CurrentController.PageCount, 3)
diff --git a/sw/qa/uitest/writer_tests4/tdf135636.py b/sw/qa/uitest/writer_tests4/tdf135636.py
index 70f2e4e239dc..af38565c33cf 100644
--- a/sw/qa/uitest/writer_tests4/tdf135636.py
+++ b/sw/qa/uitest/writer_tests4/tdf135636.py
@@ -11,9 +11,7 @@ class tdf135636(UITestCase):
def test_tdf135636(self):
- with self.ui_test.load_file(get_url_for_data_file("tdf135636.odt")):
-
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf135636.odt")) as document:
self.assertEqual(document.CurrentController.PageCount, 2)
diff --git a/sw/qa/uitest/writer_tests4/tdf136578.py b/sw/qa/uitest/writer_tests4/tdf136578.py
index 4380a394a11e..122b1243ca87 100644
--- a/sw/qa/uitest/writer_tests4/tdf136578.py
+++ b/sw/qa/uitest/writer_tests4/tdf136578.py
@@ -11,9 +11,8 @@ class tdf136578(UITestCase):
def test_tdf136578(self):
- with self.ui_test.load_file(get_url_for_data_file("tdf136578.odt")):
+ with self.ui_test.load_file(get_url_for_data_file("tdf136578.odt")) as document:
- document = self.ui_test.get_component()
self.assertEqual(document.CurrentController.PageCount, 2)
xPageBreak = self.ui_test.wait_until_child_is_available('PageBreak')
diff --git a/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py b/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py
index 021084932f9a..c3a48302dc18 100644
--- a/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py
+++ b/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py
@@ -12,7 +12,6 @@ class dateFormFieldDialog(UITestCase):
def test_setting_date_format(self):
# open a file with a date form field
with self.ui_test.load_file(get_url_for_data_file("date_form_field.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
# open the dialog (cursor is at the field)
@@ -44,7 +43,6 @@ class dateFormFieldDialog(UITestCase):
def test_date_field_with_custom_format(self):
# open a file with a date form field
with self.ui_test.load_file(get_url_for_data_file("date_form_field_custom_format.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
# open the dialog (cursor is at the field)
@@ -63,7 +61,6 @@ class dateFormFieldDialog(UITestCase):
def test_date_reformat(self):
# open a file with a date form field
with self.ui_test.load_file(get_url_for_data_file("date_form_field.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
self.assertEqual(writer_doc.getText().getString(), "07/17/19")
@@ -90,7 +87,6 @@ class dateFormFieldDialog(UITestCase):
def test_date_field_with_placeholder(self):
# open a file with a date form field
with self.ui_test.load_file(get_url_for_data_file("date_form_field_with_placeholder.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
self.assertEqual(writer_doc.getText().getString(), "[select date]")
@@ -120,7 +116,6 @@ class dateFormFieldDialog(UITestCase):
# open a file with a date form field
with self.ui_test.load_file(get_url_for_data_file("date_form_field_without_current_date.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
self.assertEqual(writer_doc.getText().getString(), "07/17/19")
diff --git a/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py b/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py
index b3274b124dac..00bd01acf785 100644
--- a/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py
+++ b/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py
@@ -14,7 +14,6 @@ class dropDownFormFieldDialog(UITestCase):
# open a file with an empty form field
with self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
# open the dialog (cursor is at the field)
@@ -70,7 +69,6 @@ class dropDownFormFieldDialog(UITestCase):
# open a file with an empty form field
with self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
# open the dialog (cursor is at the field)
@@ -147,7 +145,6 @@ class dropDownFormFieldDialog(UITestCase):
# open a file with an empty form field
with self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
# open the dialog (cursor is at the field)
@@ -237,7 +234,6 @@ class dropDownFormFieldDialog(UITestCase):
for file in files:
# open a file with a drop-down for field with items and selection
with self.ui_test.load_file(get_url_for_data_file(file)) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
# open the dialog (cursor is at the field)
diff --git a/sw/qa/uitest/writer_tests5/tdf117039.py b/sw/qa/uitest/writer_tests5/tdf117039.py
index 49de2b42efaf..a08885308989 100644
--- a/sw/qa/uitest/writer_tests5/tdf117039.py
+++ b/sw/qa/uitest/writer_tests5/tdf117039.py
@@ -15,13 +15,12 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf117039(UITestCase):
def test_tdf117039_preview_signed_document(self):
with self.ui_test.load_file(get_url_for_data_file("tdf117039.odt")) as writer_doc:
- document = self.ui_test.get_component()
self.xUITest.executeCommand(".uno:PrintPreview") #open print preview
self.xUITest.executeCommand(".uno:ClosePreview") # close print preview
self.xUITest.getTopFocusWindow() #Get focus after closing preview
#verify
- self.assertEqual(document.Text.String[0:22], "Test digital signature")
+ self.assertEqual(writer_doc.Text.String[0:22], "Test digital signature")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf118540.py b/sw/qa/uitest/writer_tests5/tdf118540.py
index 56dae2d761b1..e64ab5229761 100644
--- a/sw/qa/uitest/writer_tests5/tdf118540.py
+++ b/sw/qa/uitest/writer_tests5/tdf118540.py
@@ -15,7 +15,6 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf118540(UITestCase):
def test_tdf118540_preview_document_properties(self):
with self.ui_test.load_file(get_url_for_data_file("tdf118540.docx")) as writer_doc:
- document = self.ui_test.get_component()
self.xUITest.executeCommand(".uno:PrintPreview") #open print preview
self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") #open properties dialog
xDialog = self.xUITest.getTopFocusWindow()
@@ -26,6 +25,6 @@ class tdf118540(UITestCase):
self.xUITest.getTopFocusWindow() #Get focus after closing preview
#verify
- self.assertEqual(document.Text.String[0:4], "Test")
+ self.assertEqual(writer_doc.Text.String[0:4], "Test")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/titlePageWizard.py b/sw/qa/uitest/writer_tests5/titlePageWizard.py
index a69658ec9260..a3e4bd8729d4 100644
--- a/sw/qa/uitest/writer_tests5/titlePageWizard.py
+++ b/sw/qa/uitest/writer_tests5/titlePageWizard.py
@@ -13,8 +13,7 @@ from uitest.uihelper.common import get_url_for_data_file
# and inserting at the very end of the document.
class tdf138907(UITestCase):
def test_tdf138907(self):
- with self.ui_test.load_file(get_url_for_data_file("tdf138907_titlePageDialog.odt")):
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf138907_titlePageDialog.odt")) as document:
# Confirm the starting state. Just a page break, without a valid restart page number on page 2
self.assertEqual(document.CurrentController.PageCount, 5)
diff --git a/sw/qa/uitest/writer_tests5/titlePageWizard2.py b/sw/qa/uitest/writer_tests5/titlePageWizard2.py
index 2838c7ae2343..fa03a76f51dd 100644
--- a/sw/qa/uitest/writer_tests5/titlePageWizard2.py
+++ b/sw/qa/uitest/writer_tests5/titlePageWizard2.py
@@ -10,8 +10,7 @@ from uitest.uihelper.common import get_url_for_data_file
# This tests both an edge cases, and some more realistic situations.
class tdf138907(UITestCase):
def test_tdf138907(self):
- with self.ui_test.load_file(get_url_for_data_file("tdf138907_titlePageDialog.odt")):
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf138907_titlePageDialog.odt")) as document:
# Test an undefined situation - try to modify pages beyond the end of the document.
diff --git a/sw/qa/uitest/writer_tests6/tdf120731.py b/sw/qa/uitest/writer_tests6/tdf120731.py
index d9415d9aa7e8..c81553266a1f 100644
--- a/sw/qa/uitest/writer_tests6/tdf120731.py
+++ b/sw/qa/uitest/writer_tests6/tdf120731.py
@@ -12,7 +12,6 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf120731(UITestCase):
def test_tdf120731_crash_open_char_dialog(self):
with self.ui_test.load_file(get_url_for_data_file("tdf120731.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
self.xUITest.executeCommand(".uno:SelectAll")
@@ -20,5 +19,5 @@ class tdf120731(UITestCase):
xDialog = self.xUITest.getTopFocusWindow()
xOK = xDialog.getChild("ok")
xOK.executeAction("CLICK", tuple())
- self.assertEqual(document.Text.String[0:5], "Lorem")
+ self.assertEqual(writer_doc.Text.String[0:5], "Lorem")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf124586.py b/sw/qa/uitest/writer_tests6/tdf124586.py
index 35e255c0cd39..ee5e37d8371f 100644
--- a/sw/qa/uitest/writer_tests6/tdf124586.py
+++ b/sw/qa/uitest/writer_tests6/tdf124586.py
@@ -13,7 +13,6 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class tdf124586(UITestCase):
def test_tdf124586_crash_switch_outline_numbering(self):
with self.ui_test.load_file(get_url_for_data_file("tdf124586.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
#Goto Tools > Chapter Numbering.
@@ -24,7 +23,7 @@ class tdf124586(UITestCase):
xOK = xDialog.getChild("ok")
xOK.executeAction("CLICK", tuple())
- self.assertEqual(document.Text.String[0:8], "Schritte")
+ self.assertEqual(writer_doc.Text.String[0:8], "Schritte")
self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog")
xDialog = self.xUITest.getTopFocusWindow()
diff --git a/sw/qa/uitest/writer_tests6/tdf124675.py b/sw/qa/uitest/writer_tests6/tdf124675.py
index 200255e159fc..4889d3124df3 100644
--- a/sw/qa/uitest/writer_tests6/tdf124675.py
+++ b/sw/qa/uitest/writer_tests6/tdf124675.py
@@ -13,23 +13,22 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class tdf124675(UITestCase):
def test_tdf124675_crash_moving_SwTextFrame_previous_page(self):
with self.ui_test.load_file(get_url_for_data_file("tdf124675.docx")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
- self.assertEqual(document.CurrentController.PageCount, 2)
+ self.assertEqual(writer_doc.CurrentController.PageCount, 2)
self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
for i in range(52):
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
- self.assertEqual(document.CurrentController.PageCount, 4)
+ self.assertEqual(writer_doc.CurrentController.PageCount, 4)
self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
for i in range(52):
self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.CurrentController.PageCount, 2)
+ self.assertEqual(writer_doc.CurrentController.PageCount, 2)
self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf126017.py b/sw/qa/uitest/writer_tests6/tdf126017.py
index 640c9bf8c236..0dcbebcad4b5 100644
--- a/sw/qa/uitest/writer_tests6/tdf126017.py
+++ b/sw/qa/uitest/writer_tests6/tdf126017.py
@@ -13,7 +13,6 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf126017(UITestCase):
def test_tdf126017_crash_after_undo(self):
with self.ui_test.load_file(get_url_for_data_file("tdf126017.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
#go to TOC
@@ -45,6 +44,6 @@ class tdf126017(UITestCase):
self.xUITest.executeCommand(".uno:Undo")
self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.Text.String.replace('\r\n', '\n')[1:7], "CRASHY")
+ self.assertEqual(writer_doc.Text.String.replace('\r\n', '\n')[1:7], "CRASHY")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf126627.py b/sw/qa/uitest/writer_tests6/tdf126627.py
index 2da4c6d89fde..b5a6d61f9955 100644
--- a/sw/qa/uitest/writer_tests6/tdf126627.py
+++ b/sw/qa/uitest/writer_tests6/tdf126627.py
@@ -13,7 +13,6 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class tdf126627(UITestCase):
def test_tdf126627_crash_undo_deletion(self):
with self.ui_test.load_file(get_url_for_data_file("tdf126627.odt")) as writer_doc:
- document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
@@ -35,7 +34,7 @@ class tdf126627(UITestCase):
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
- self.assertEqual(document.Text.String[0:6], "foobar")
+ self.assertEqual(writer_doc.Text.String[0:6], "foobar")
#4. Undo once-> Crash
self.xUITest.executeCommand(".uno:Undo")
#verify that we have now two words
diff --git a/sw/qa/uitest/writer_tests7/forms.py b/sw/qa/uitest/writer_tests7/forms.py
index d58d9a15ae91..8bf828f2e704 100644
--- a/sw/qa/uitest/writer_tests7/forms.py
+++ b/sw/qa/uitest/writer_tests7/forms.py
@@ -125,13 +125,12 @@ class Forms(UITestCase):
def test_tdf139486(self):
# Reuse file from another test
- with self.ui_test.load_file(get_url_for_data_file("tdf140198.odt")):
+ with self.ui_test.load_file(get_url_for_data_file("tdf140198.odt")) as document:
change_measurement_unit(self, "Centimeter")
self.xUITest.executeCommand(".uno:JumpToNextFrame")
- document = self.ui_test.get_component()
drawPage = document.getDrawPages().getByIndex(0)
shape = drawPage.getByIndex(0)
self.assertEqual(13996, shape.getSize().Width)
diff --git a/sw/qa/uitest/writer_tests7/tdf132169.py b/sw/qa/uitest/writer_tests7/tdf132169.py
index ef1ec666c029..e535ebbc3326 100644
--- a/sw/qa/uitest/writer_tests7/tdf132169.py
+++ b/sw/qa/uitest/writer_tests7/tdf132169.py
@@ -35,8 +35,7 @@ class tdf132169(UITestCase):
xLineMetric.executeAction("UP", tuple())
- document = self.ui_test.get_component()
- drawPage = document.getDrawPages().getByIndex(0)
+ drawPage = writer_doc.getDrawPages().getByIndex(0)
shape = drawPage.getByIndex(0)
#Without the fix in place, it would have been 310
diff --git a/sw/qa/uitest/writer_tests7/tdf137802.py b/sw/qa/uitest/writer_tests7/tdf137802.py
index 99c6085f29dd..df7deea94522 100644
--- a/sw/qa/uitest/writer_tests7/tdf137802.py
+++ b/sw/qa/uitest/writer_tests7/tdf137802.py
@@ -13,11 +13,10 @@ class tdf137802(UITestCase):
def test_tdf137802(self):
- with self.ui_test.load_file(get_url_for_data_file("tdf137802.odt")):
+ with self.ui_test.load_file(get_url_for_data_file("tdf137802.odt")) as document:
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
- document = self.ui_test.get_component()
self.assertEqual(document.DrawPage.getCount(), 2)
self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType)
diff --git a/sw/qa/uitest/writer_tests7/tdf137803.py b/sw/qa/uitest/writer_tests7/tdf137803.py
index 3549cc9d0b77..3116dd609dd9 100644
--- a/sw/qa/uitest/writer_tests7/tdf137803.py
+++ b/sw/qa/uitest/writer_tests7/tdf137803.py
@@ -11,8 +11,7 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf137803(UITestCase):
def test_tdf137803(self):
# load the sample file
- with self.ui_test.load_file(get_url_for_data_file("tdf137803.odt")):
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf137803.odt")) as document:
# select the shape
self.xUITest.executeCommand(".uno:JumpToNextFrame")
diff --git a/sw/qa/uitest/writer_tests7/tdf140117.py b/sw/qa/uitest/writer_tests7/tdf140117.py
index a1790e642a64..e0d79893f188 100644
--- a/sw/qa/uitest/writer_tests7/tdf140117.py
+++ b/sw/qa/uitest/writer_tests7/tdf140117.py
@@ -13,10 +13,9 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf140117(UITestCase):
def test_tdf140117(self):
# load the sample file
- with self.ui_test.load_file(get_url_for_data_file("tdf140117.fodt")):
+ with self.ui_test.load_file(get_url_for_data_file("tdf140117.fodt")) as document:
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
- document = self.ui_test.get_component()
for i in range(3):
xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"}))
diff --git a/sw/qa/uitest/writer_tests7/tdf90401.py b/sw/qa/uitest/writer_tests7/tdf90401.py
index cb70c401b142..b6d100cb6241 100644
--- a/sw/qa/uitest/writer_tests7/tdf90401.py
+++ b/sw/qa/uitest/writer_tests7/tdf90401.py
@@ -25,7 +25,6 @@ class tdf90401(UITestCase):
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild('writer_edit')
- document = self.ui_test.get_component()
selection = self.xUITest.executeCommand('.uno:SelectAll')
self.xUITest.executeCommand('.uno:InsertAnnotation')
@@ -72,12 +71,11 @@ class tdf90401(UITestCase):
# Close the Writer document
self.ui_test.close_doc()
- with self.ui_test.load_file(systemPathToFileUrl(xFilePath)):
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as writer_doc2:
# check removed personal info on comments
- textfields = document.getTextFields()
+ textfields = writer_doc2.getTextFields()
author = ""
year = -1
for textfield in textfields: