summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-06-25 19:39:17 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-06-26 07:25:59 +0200
commit1db375e06516d0532f01f9585986617aa3079866 (patch)
treeea65aaa7220940510f86c37533e1c6d89b3c89e1
parentf2e781c92bb96d626cf7a75c134f339a8a95d183 (diff)
uitest: introduce load_empty_file
to make sure the documents are closed in inverse order when different documents are used in the same test Change-Id: I97ff33f9f91423d06f4e74bba6fc6a5312b24a17 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117914 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--sc/qa/uitest/calc_tests8/tdf114710.py35
-rw-r--r--sc/qa/uitest/calc_tests8/tdf118308.py47
-rw-r--r--sc/qa/uitest/calc_tests9/tdf113571.py19
-rw-r--r--sc/qa/uitest/calc_tests9/tdf125440.py26
-rw-r--r--sc/qa/uitest/chart/copyPaste.py53
-rw-r--r--sc/qa/uitest/chart/tdf107097.py41
-rw-r--r--sc/qa/uitest/chart/tdf120348.py38
-rw-r--r--sc/qa/uitest/chart/tdf136011.py21
-rw-r--r--sc/qa/uitest/chart/tdf62057.py26
-rw-r--r--sc/qa/uitest/chart/tdf98690.py29
-rw-r--r--sc/qa/uitest/conditional_format/tdf117899.py32
-rw-r--r--sw/qa/uitest/writer_tests6/tdf118883.py18
-rw-r--r--uitest/uitest/test.py13
13 files changed, 181 insertions, 217 deletions
diff --git a/sc/qa/uitest/calc_tests8/tdf114710.py b/sc/qa/uitest/calc_tests8/tdf114710.py
index a4989a72de58..34ab90f56a5c 100644
--- a/sc/qa/uitest/calc_tests8/tdf114710.py
+++ b/sc/qa/uitest/calc_tests8/tdf114710.py
@@ -19,32 +19,29 @@ class tdf114710(UITestCase):
gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:O7"}))
self.xUITest.executeCommand(".uno:Copy")
- self.xUITest.executeCommand(".uno:CloseDoc")
+ with self.ui_test.load_empty_file("writer") as writer_document:
- self.ui_test.create_doc_in_start_center("writer")
+ self.xUITest.getTopFocusWindow()
- self.xUITest.getTopFocusWindow()
+ self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
+ xDialog = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
- xDialog = self.xUITest.getTopFocusWindow()
+ xList = xDialog.getChild('list')
- xList = xDialog.getChild('list')
+ for childName in xList.getChildren():
+ xChild = xList.getChild(childName)
+ if get_state_as_dict(xChild)['Text'] == "Graphics Device Interface metafile (GDI)":
+ break
- for childName in xList.getChildren():
- xChild = xList.getChild(childName)
- if get_state_as_dict(xChild)['Text'] == "Graphics Device Interface metafile (GDI)":
- break
+ xChild.executeAction("SELECT", tuple())
+ self.assertEqual(
+ get_state_as_dict(xList)['SelectEntryText'], "Graphics Device Interface metafile (GDI)")
- xChild.executeAction("SELECT", tuple())
- self.assertEqual(
- get_state_as_dict(xList)['SelectEntryText'], "Graphics Device Interface metafile (GDI)")
+ xOkBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOkBtn)
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
-
- # Without the fix in place, this test would have crashed here
- document = self.ui_test.get_component()
- self.assertEqual(1, document.GraphicObjects.getCount())
+ # Without the fix in place, this test would have crashed here
+ self.assertEqual(1, writer_document.GraphicObjects.getCount())
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests8/tdf118308.py b/sc/qa/uitest/calc_tests8/tdf118308.py
index 2c38cd11394d..7a99d5aedac3 100644
--- a/sc/qa/uitest/calc_tests8/tdf118308.py
+++ b/sc/qa/uitest/calc_tests8/tdf118308.py
@@ -22,40 +22,33 @@ class tdf118308(UITestCase):
gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
self.xUITest.executeCommand(".uno:Copy")
- self.ui_test.execute_dialog_through_command(".uno:CloseDoc")
- xDialog = self.xUITest.getTopFocusWindow()
- xDiscardBtn = xDialog.getChild("discard")
- self.ui_test.close_dialog_through_button(xDiscardBtn)
+ with self.ui_test.load_empty_file("calc") as calc_document:
- 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()
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
- self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
- xDialog = self.xUITest.getTopFocusWindow()
+ self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
+ xDialog = self.xUITest.getTopFocusWindow()
- # Without the fix in place, this test would have failed here
- # since a different dialog would have been opened and the children
- # wouldn't have been found
- xText = xDialog.getChild("text")
- xNumbers = xDialog.getChild("numbers")
- xDatetime = xDialog.getChild("datetime")
- xFormats = xDialog.getChild("formats")
+ # Without the fix in place, this test would have failed here
+ # since a different dialog would have been opened and the children
+ # wouldn't have been found
+ xText = xDialog.getChild("text")
+ xNumbers = xDialog.getChild("numbers")
+ xDatetime = xDialog.getChild("datetime")
+ xFormats = xDialog.getChild("formats")
- self.assertEqual("true", get_state_as_dict(xText)["Selected"])
- self.assertEqual("true", get_state_as_dict(xNumbers)["Selected"])
- self.assertEqual("true", get_state_as_dict(xDatetime)["Selected"])
- self.assertEqual("false", get_state_as_dict(xFormats)["Selected"])
+ self.assertEqual("true", get_state_as_dict(xText)["Selected"])
+ self.assertEqual("true", get_state_as_dict(xNumbers)["Selected"])
+ self.assertEqual("true", get_state_as_dict(xDatetime)["Selected"])
+ self.assertEqual("false", get_state_as_dict(xFormats)["Selected"])
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
+ xOkBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOkBtn)
- self.assertEqual("A", get_cell_by_position(document, 0, 0, 0).getString())
- self.ui_test.close_doc()
+ self.assertEqual("A", get_cell_by_position(calc_document, 0, 0, 0).getString())
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests9/tdf113571.py b/sc/qa/uitest/calc_tests9/tdf113571.py
index 48657e37e60d..4122a46c0a87 100644
--- a/sc/qa/uitest/calc_tests9/tdf113571.py
+++ b/sc/qa/uitest/calc_tests9/tdf113571.py
@@ -20,18 +20,15 @@ class Tdf113571(UITestCase):
self.xUITest.executeCommand(".uno:Copy")
- # Close the document
- self.xUITest.executeCommand(".uno:CloseDoc")
+ with self.ui_test.load_empty_file("writer") as writer_document:
- self.ui_test.create_doc_in_start_center("writer")
+ self.xUITest.getTopFocusWindow()
- self.xUITest.executeCommand(".uno:PasteUnformatted")
+ self.xUITest.executeCommand(".uno:PasteUnformatted")
- document = self.ui_test.get_component()
-
- # Without the fix in place, this test would have failed with
- # AssertionError: '<?xml version="1.0" encoding="UTF-8"?>\n<[34 chars]est>' !=
- # '"<?xml version=""1.0"" encoding=""UTF-8""[40 chars]st>"'
- self.assertEqual('<?xml version="1.0" encoding="UTF-8"?>\n<test>\n <hello>world</hello>\n</test>',
- document.Text.String)
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '<?xml version="1.0" encoding="UTF-8"?>\n<[34 chars]est>' !=
+ # '"<?xml version=""1.0"" encoding=""UTF-8""[40 chars]st>"'
+ self.assertEqual('<?xml version="1.0" encoding="UTF-8"?>\n<test>\n <hello>world</hello>\n</test>',
+ writer_document.Text.String)
diff --git a/sc/qa/uitest/calc_tests9/tdf125440.py b/sc/qa/uitest/calc_tests9/tdf125440.py
index 82accfb11942..9a16f069c968 100644
--- a/sc/qa/uitest/calc_tests9/tdf125440.py
+++ b/sc/qa/uitest/calc_tests9/tdf125440.py
@@ -19,23 +19,19 @@ class Tdf1254400(UITestCase):
self.xUITest.executeCommand(".uno:SelectAll")
self.xUITest.executeCommand(".uno:Copy")
- # Close the document
- self.xUITest.executeCommand(".uno:CloseDoc")
+ with self.ui_test.load_empty_file("calc") as calc_document:
- calc_doc = self.ui_test.create_doc_in_start_center("calc")
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ self.xUITest.executeCommand(".uno:PasteUnformatted")
- self.xUITest.executeCommand(".uno:PasteUnformatted")
-
- # Without the fix in place, this test would have failed with
- # AssertionError: 'Row' != '"Row"'
- self.assertEqual("Row", get_cell_by_position(document, 0, 0, 0).getString())
- self.assertEqual("", get_cell_by_position(document, 0, 1, 0).getString())
- self.assertEqual("", get_cell_by_position(document, 0, 2, 0).getString())
- self.assertEqual("50", get_cell_by_position(document, 0, 3, 0).getString())
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'Row' != '"Row"'
+ self.assertEqual("Row", get_cell_by_position(calc_document, 0, 0, 0).getString())
+ self.assertEqual("", get_cell_by_position(calc_document, 0, 1, 0).getString())
+ self.assertEqual("", get_cell_by_position(calc_document, 0, 2, 0).getString())
+ self.assertEqual("50", get_cell_by_position(calc_document, 0, 3, 0).getString())
diff --git a/sc/qa/uitest/chart/copyPaste.py b/sc/qa/uitest/chart/copyPaste.py
index 5294022bfdac..c0e3bb14fe33 100644
--- a/sc/qa/uitest/chart/copyPaste.py
+++ b/sc/qa/uitest/chart/copyPaste.py
@@ -37,41 +37,38 @@ class CopyPaste(UITestCase):
self.xUITest.executeCommand(".uno:Copy")
- self.xUITest.executeCommand(".uno:CloseDoc")
+ with self.ui_test.load_empty_file("calc") as calc_document:
- self.ui_test.create_doc_in_start_center("calc")
- document = self.ui_test.get_component()
+ # Rename the sheet to match the same name as the first document
+ self.ui_test.execute_dialog_through_command(".uno:RenameTable")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xname_entry = xDialog.getChild("name_entry")
- # Rename the sheet to match the same name as the first document
- self.ui_test.execute_dialog_through_command(".uno:RenameTable")
- xDialog = self.xUITest.getTopFocusWindow()
- xname_entry = xDialog.getChild("name_entry")
+ xname_entry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xname_entry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xname_entry.executeAction("TYPE", mkPropertyValues({"TEXT":"Sheet.1"}))
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- xname_entry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xname_entry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- xname_entry.executeAction("TYPE", mkPropertyValues({"TEXT":"Sheet.1"}))
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ self.xUITest.executeCommand(".uno:Paste")
- self.xUITest.executeCommand(".uno:Paste")
+ xChart = calc_document.Sheets[0].Charts[0]
+ xDataSeries = xChart.getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
- xChart = document.Sheets[0].Charts[0]
- xDataSeries = xChart.getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
-
- self.assertEqual(4, len(xDataSeries))
+ self.assertEqual(4, len(xDataSeries))
- xNewSheetRanges = []
- for i in range(4):
- xRow = []
- xDS = xDataSeries[i].DataSequences
+ xNewSheetRanges = []
+ for i in range(4):
+ xRow = []
+ xDS = xDataSeries[i].DataSequences
- self.assertEqual(1, len(xDS))
- xRow.append(xDS[0].Values.SourceRangeRepresentation)
- xNewSheetRanges.append(xRow)
+ self.assertEqual(1, len(xDS))
+ xRow.append(xDS[0].Values.SourceRangeRepresentation)
+ xNewSheetRanges.append(xRow)
- # Without the fix in place, this test would have failed with
- # ["$'Sheet.1'.$B$12:$B$18"]
- # ["'file:///home/<user>/Documents/Sheet.1'#$Sheet1.$B$12:$B$18"]
- self.assertEqual(xOldSheetRanges, xNewSheetRanges)
+ # Without the fix in place, this test would have failed with
+ # ["$'Sheet.1'.$B$12:$B$18"]
+ # ["'file:///home/<user>/Documents/Sheet.1'#$Sheet1.$B$12:$B$18"]
+ self.assertEqual(xOldSheetRanges, xNewSheetRanges)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/tdf107097.py b/sc/qa/uitest/chart/tdf107097.py
index 09db67f197cc..06bcdc488875 100644
--- a/sc/qa/uitest/chart/tdf107097.py
+++ b/sc/qa/uitest/chart/tdf107097.py
@@ -31,33 +31,30 @@ class tdf107097(UITestCase):
self.xUITest.executeCommand(".uno:Copy")
- self.xUITest.executeCommand(".uno:CloseDoc")
+ with self.ui_test.load_empty_file("calc") as calc_document:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
- self.ui_test.create_doc_in_start_center("calc")
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ self.xUITest.executeCommand(".uno:Paste")
- self.xUITest.executeCommand(".uno:Paste")
+ xData = calc_document.Sheets[0].Charts[0].getEmbeddedObject().Data
- xData = document.Sheets[0].Charts[0].getEmbeddedObject().Data
-
- xSecondMatrix = []
- for row in xData.Data:
- xRow = []
- for value in row:
- xRow.append(value)
- xSecondMatrix.append(xRow)
+ xSecondMatrix = []
+ for row in xData.Data:
+ xRow = []
+ for value in row:
+ xRow.append(value)
+ xSecondMatrix.append(xRow)
- self.assertEqual(xFirstMatrix, xSecondMatrix)
+ self.assertEqual(xFirstMatrix, xSecondMatrix)
- aExpectedColumnDescriptions = ('Sum - Sales T1', 'Sum - Sales T2',
- 'Sum - Sales T3', 'Sum - Sales T4')
- aExpectedRowDescriptions = ('DE Berlin A', 'DE Berlin B', 'DE Munich A',
- 'DE Munich B', 'EN Glasgow A', 'EN Liverpool B', 'EN London A',
- 'EN London B', 'FR Nantes A', 'FR Nantes B', 'FR Paris A', 'FR Paris B')
+ aExpectedColumnDescriptions = ('Sum - Sales T1', 'Sum - Sales T2',
+ 'Sum - Sales T3', 'Sum - Sales T4')
+ aExpectedRowDescriptions = ('DE Berlin A', 'DE Berlin B', 'DE Munich A',
+ 'DE Munich B', 'EN Glasgow A', 'EN Liverpool B', 'EN London A',
+ 'EN London B', 'FR Nantes A', 'FR Nantes B', 'FR Paris A', 'FR Paris B')
- self.assertEqual(aExpectedColumnDescriptions, xData.ColumnDescriptions)
- self.assertEqual(aExpectedRowDescriptions, xData.RowDescriptions)
+ self.assertEqual(aExpectedColumnDescriptions, xData.ColumnDescriptions)
+ self.assertEqual(aExpectedRowDescriptions, xData.RowDescriptions)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/tdf120348.py b/sc/qa/uitest/chart/tdf120348.py
index 0685ab7c0f63..43aa61bd99d4 100644
--- a/sc/qa/uitest/chart/tdf120348.py
+++ b/sc/qa/uitest/chart/tdf120348.py
@@ -30,32 +30,30 @@ class tdf120348(UITestCase):
self.xUITest.executeCommand(".uno:Copy")
- self.xUITest.executeCommand(".uno:CloseDoc")
+ with self.ui_test.load_empty_file("calc") as calc_document:
- self.ui_test.create_doc_in_start_center("calc")
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
- self.xUITest.executeCommand(".uno:Paste")
+ self.xUITest.executeCommand(".uno:Paste")
- xData = document.Sheets[0].Charts[0].getEmbeddedObject().Data
+ xData = calc_document.Sheets[0].Charts[0].getEmbeddedObject().Data
- columnNames = ('Finland', 'Sweden', 'Poland', '')
- self.assertEqual(columnNames, xData.ColumnDescriptions)
+ columnNames = ('Finland', 'Sweden', 'Poland', '')
+ self.assertEqual(columnNames, xData.ColumnDescriptions)
- xSecondMatrix = []
- for row in xData.Data:
- xRow = []
- for value in row:
- xRow.append(round(value, 5))
- xSecondMatrix.append(xRow)
+ xSecondMatrix = []
+ for row in xData.Data:
+ xRow = []
+ for value in row:
+ xRow.append(round(value, 5))
+ xSecondMatrix.append(xRow)
- # Without the fix in place, this test would have failed with
- # First differing element 51:
- # [3.31618, 3.65089, 3.33626, 0.0]
- # [3.31618, 3.65089, 0.0, 0.0]
+ # Without the fix in place, this test would have failed with
+ # First differing element 51:
+ # [3.31618, 3.65089, 3.33626, 0.0]
+ # [3.31618, 3.65089, 0.0, 0.0]
- self.assertEqual(xFirstMatrix, xSecondMatrix)
+ self.assertEqual(xFirstMatrix, xSecondMatrix)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/tdf136011.py b/sc/qa/uitest/chart/tdf136011.py
index a523b8ecaa0e..a3dce1d6e9e6 100644
--- a/sc/qa/uitest/chart/tdf136011.py
+++ b/sc/qa/uitest/chart/tdf136011.py
@@ -36,21 +36,18 @@ class tdf136011(UITestCase):
self.xUITest.executeCommand(".uno:Copy")
- self.xUITest.executeCommand(".uno:CloseDoc")
+ with self.ui_test.load_empty_file("calc") as calc_document:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
- self.ui_test.create_doc_in_start_center("calc")
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- self.xUITest.executeCommand(".uno:Paste")
+ self.xUITest.executeCommand(".uno:Paste")
- xData = document.Sheets[0].Charts[0].getEmbeddedObject().Data
+ xData = calc_document.Sheets[0].Charts[0].getEmbeddedObject().Data
- self.assertEqual(xColumnNames, list(xData.ColumnDescriptions))
+ self.assertEqual(xColumnNames, list(xData.ColumnDescriptions))
- # Without the fix in place, the numbers in the categories in chart
- # 'Object 2' wouldn't have been pasted to the new document
- self.assertEqual(xExpectedResults, list(xData.RowDescriptions))
+ # Without the fix in place, the numbers in the categories in chart
+ # 'Object 2' wouldn't have been pasted to the new document
+ self.assertEqual(xExpectedResults, list(xData.RowDescriptions))
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/tdf62057.py b/sc/qa/uitest/chart/tdf62057.py
index 6cb1ef8cdd21..915fa8f02e11 100644
--- a/sc/qa/uitest/chart/tdf62057.py
+++ b/sc/qa/uitest/chart/tdf62057.py
@@ -33,25 +33,23 @@ class tdf62057(UITestCase):
self.xUITest.executeCommand(".uno:Copy")
- self.xUITest.executeCommand(".uno:CloseDoc")
+ with self.ui_test.load_empty_file("calc") as calc_document:
- self.ui_test.create_doc_in_start_center("calc")
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
- self.xUITest.executeCommand(".uno:Paste")
+ self.xUITest.executeCommand(".uno:Paste")
- xData = document.Sheets[0].Charts[0].getEmbeddedObject().Data
+ xData = calc_document.Sheets[0].Charts[0].getEmbeddedObject().Data
- xNewDataMatrix = []
- xNewDataMatrix.append([round(item[0], 5) for item in xData.Data])
- xNewDataMatrix.append([round(item[1], 5) for item in xData.Data])
+ xNewDataMatrix = []
+ xNewDataMatrix.append([round(item[0], 5) for item in xData.Data])
+ xNewDataMatrix.append([round(item[1], 5) for item in xData.Data])
- # Without the fix in place, this test would have failed with
- # AssertionError: Lists differ: ['10m', '11v', '12m', '13m', '14m', '15v'] != ['55.3796', '35.0989']
- self.assertEqual(xRowDescriptions, list(xData.RowDescriptions))
+ # Without the fix in place, this test would have failed with
+ # AssertionError: Lists differ: ['10m', '11v', '12m', '13m', '14m', '15v'] != ['55.3796', '35.0989']
+ self.assertEqual(xRowDescriptions, list(xData.RowDescriptions))
- self.assertEqual(xDataMatrix, xNewDataMatrix)
+ self.assertEqual(xDataMatrix, xNewDataMatrix)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/tdf98690.py b/sc/qa/uitest/chart/tdf98690.py
index f99009206bb4..4afcd033883e 100644
--- a/sc/qa/uitest/chart/tdf98690.py
+++ b/sc/qa/uitest/chart/tdf98690.py
@@ -19,25 +19,22 @@ class tdf98690(UITestCase):
self.xUITest.executeCommand(".uno:Copy")
- self.xUITest.executeCommand(".uno:CloseDoc")
+ with self.ui_test.load_empty_file("calc") as calc_document:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
- self.ui_test.create_doc_in_start_center("calc")
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- self.xUITest.executeCommand(".uno:Paste")
+ self.xUITest.executeCommand(".uno:Paste")
- xData = document.Sheets[0].Charts[0].getEmbeddedObject().Data
+ xData = calc_document.Sheets[0].Charts[0].getEmbeddedObject().Data
- aExpectedRowDescriptions = tuple(str(i) for i in range(1, 14))
- aExpectedColumnDescriptions = ('Column D Column D', 'cc_girder2', 'Column S Column S',
- 'Column S Column S', 'Column D Column D', 'clexrfdon', 'Column S Column S',
- 'Column S Column S', 'Column D', 'clexrfdoff', 'Column S Column S', 'Column S Column S')
+ aExpectedRowDescriptions = tuple(str(i) for i in range(1, 14))
+ aExpectedColumnDescriptions = ('Column D Column D', 'cc_girder2', 'Column S Column S',
+ 'Column S Column S', 'Column D Column D', 'clexrfdon', 'Column S Column S',
+ 'Column S Column S', 'Column D', 'clexrfdoff', 'Column S Column S', 'Column S Column S')
- # Without the fix in place, this test would have failed here,
- # since the pasted chart wouldn't have had any data
- self.assertEqual(aExpectedRowDescriptions, xData.RowDescriptions)
- self.assertEqual(aExpectedColumnDescriptions, xData.ColumnDescriptions)
+ # Without the fix in place, this test would have failed here,
+ # since the pasted chart wouldn't have had any data
+ self.assertEqual(aExpectedRowDescriptions, xData.RowDescriptions)
+ self.assertEqual(aExpectedColumnDescriptions, xData.ColumnDescriptions)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/conditional_format/tdf117899.py b/sc/qa/uitest/conditional_format/tdf117899.py
index bec007993e6c..389ff3cb4c34 100644
--- a/sc/qa/uitest/conditional_format/tdf117899.py
+++ b/sc/qa/uitest/conditional_format/tdf117899.py
@@ -36,32 +36,28 @@ class Tdf117899(UITestCase):
self.xUITest.executeCommand(".uno:Copy")
- # Close the Calc document
- self.xUITest.executeCommand(".uno:CloseDoc")
-
with TemporaryDirectory() as tempdir:
xFilePath = os.path.join(tempdir, "tdf117899-temp.ods")
- self.ui_test.create_doc_in_start_center("writer")
+ with self.ui_test.load_empty_file("writer"):
- # Paste as an OLE spreadsheet
- formatProperty = mkPropertyValues({"SelectedFormat": 85})
- self.xUITest.executeCommandWithParameters(".uno:ClipboardFormatItems", formatProperty)
+ self.xUITest.getTopFocusWindow()
- # Save Copy as
- self.ui_test.execute_dialog_through_command(".uno:ObjectMenue?VerbID:short=-8")
- xDialog = self.xUITest.getTopFocusWindow()
+ # Paste as an OLE spreadsheet
+ formatProperty = mkPropertyValues({"SelectedFormat": 85})
+ self.xUITest.executeCommandWithParameters(".uno:ClipboardFormatItems", formatProperty)
- xFileName = xDialog.getChild("file_name")
- xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath}))
+ # Save Copy as
+ self.ui_test.execute_dialog_through_command(".uno:ObjectMenue?VerbID:short=-8")
+ xDialog = self.xUITest.getTopFocusWindow()
- xOpenBtn = xDialog.getChild("open")
- self.ui_test.close_dialog_through_button(xOpenBtn)
+ xFileName = xDialog.getChild("file_name")
+ xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath}))
- # Close the Writer document
- self.ui_test.close_doc()
+ xOpenBtn = xDialog.getChild("open")
+ self.ui_test.close_dialog_through_button(xOpenBtn)
with self.ui_test.load_file(systemPathToFileUrl(xFilePath)):
diff --git a/sw/qa/uitest/writer_tests6/tdf118883.py b/sw/qa/uitest/writer_tests6/tdf118883.py
index 9a7397d413b1..65a8ada64885 100644
--- a/sw/qa/uitest/writer_tests6/tdf118883.py
+++ b/sw/qa/uitest/writer_tests6/tdf118883.py
@@ -21,20 +21,12 @@ class Tdf118883(UITestCase):
self.xUITest.executeCommand(".uno:Copy")
- self.ui_test.execute_dialog_through_command(".uno:CloseDoc")
- xDialog = self.xUITest.getTopFocusWindow()
- xDiscardBtn = xDialog.getChild("discard")
- self.ui_test.close_dialog_through_button(xDiscardBtn)
+ with self.ui_test.load_empty_file("calc") as calc_document:
- calc_doc = self.ui_test.create_doc_in_start_center("calc")
+ self.xUITest.executeCommand(".uno:Paste")
- self.xUITest.executeCommand(".uno:Paste")
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 1 != 0
+ self.assertEqual(1, calc_document.DrawPages[0].getCount())
- calc_document = self.ui_test.get_component()
-
- # Without the fix in place, this test would have failed with
- # AssertionError: 1 != 0
- self.assertEqual(1, calc_document.DrawPages[0].getCount())
-
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/uitest/test.py b/uitest/uitest/test.py
index e8238f790d6b..633e6816e7fd 100644
--- a/uitest/uitest/test.py
+++ b/uitest/uitest/test.py
@@ -74,8 +74,8 @@ class UITest(object):
raise Exception("Property not updated: " + childName)
@contextmanager
- def wait_until_component_loaded(self):
- with EventListener(self._xContext, "OnLoad") as event:
+ def wait_until_component_loaded(self, eventName="OnLoad"):
+ with EventListener(self._xContext, eventName) as event:
yield
time_ = 0
while time_ < MAX_WAIT:
@@ -99,6 +99,15 @@ class UITest(object):
finally:
self.close_doc()
+ # Calls UITest.close_doc at exit
+ @contextmanager
+ def load_empty_file(self, app):
+ try:
+ with self.wait_until_component_loaded("OnNew"):
+ yield self.get_desktop().loadComponentFromURL("private:factory/s" + app, "_blank", 0, tuple())
+ finally:
+ self.close_doc()
+
def execute_dialog_through_command(self, command, printNames=False):
with EventListener(self._xContext, "DialogExecute", printNames=printNames) as event:
if not self._xUITest.executeDialog(command):