summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannah Meeks <hmeeks4135@gmail.com>2022-04-16 18:07:54 +0100
committerIlmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>2022-04-19 17:12:30 +0200
commit182833b893ae4ad7430479f2dfebcc9c130cf27c (patch)
tree23032e877047c0a0aedaea80702e36c483337ba6
parentc929c563e2029bbb969dc417a688cca8934e69b0 (diff)
tdf#97361 - make unit tests more pythonic.
Change-Id: I853cda76522ebf3c9a8f7389d5b2b6fc9611f502 Signed-off-by: Hannah Meeks <hmeeks4135@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133136 Tested-by: Jenkins Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
-rw-r--r--cui/qa/uitest/dialogs/chardlg.py4
-rw-r--r--sc/qa/uitest/calc_tests3/insertQrCodeGen.py2
-rw-r--r--sc/qa/uitest/calc_tests4/exportToPDF.py6
-rw-r--r--sc/qa/uitest/calc_tests8/tdf144940.py4
4 files changed, 8 insertions, 8 deletions
diff --git a/cui/qa/uitest/dialogs/chardlg.py b/cui/qa/uitest/dialogs/chardlg.py
index 21a1582567a0..c52664f36d0e 100644
--- a/cui/qa/uitest/dialogs/chardlg.py
+++ b/cui/qa/uitest/dialogs/chardlg.py
@@ -35,8 +35,8 @@ class Test(UITestCase):
xFontTransparency.executeAction("UP", tuple())
# Verify the result.
- drawPage = component.getDrawPages().getByIndex(0)
- shape = drawPage.getByIndex(0)
+ drawPage = component.getDrawPages()[0]
+ shape = drawPage[0]
# Without the accompanying fix in place, this test would have failed with:
# AssertionError: 100 != 5
diff --git a/sc/qa/uitest/calc_tests3/insertQrCodeGen.py b/sc/qa/uitest/calc_tests3/insertQrCodeGen.py
index 2594b66c2dea..7337962c23ba 100644
--- a/sc/qa/uitest/calc_tests3/insertQrCodeGen.py
+++ b/sc/qa/uitest/calc_tests3/insertQrCodeGen.py
@@ -30,7 +30,7 @@ class insertQrCode(UITestCase):
xBorder.executeAction("DOWN", tuple())
# check the QR code in the document
- element = document.Sheets.getByIndex(0).DrawPage.getByIndex(0)
+ element = document.Sheets[0].DrawPage[0]
self.assertEqual(element.BarCodeProperties.Payload, "www.libreoffice.org")
self.assertEqual(element.BarCodeProperties.ErrorCorrection, 1)
self.assertEqual(element.BarCodeProperties.Border, 1)
diff --git a/sc/qa/uitest/calc_tests4/exportToPDF.py b/sc/qa/uitest/calc_tests4/exportToPDF.py
index 3cf589bbb9c3..565a5337e9ee 100644
--- a/sc/qa/uitest/calc_tests4/exportToPDF.py
+++ b/sc/qa/uitest/calc_tests4/exportToPDF.py
@@ -71,8 +71,8 @@ class exportToPDF(UITestCase):
with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document:
- self.assertEqual("Sheet1", document.DrawPages[0].getByIndex(0).String)
- self.assertEqual("Page 1", document.DrawPages[0].getByIndex(1).String)
- self.assertEqual("Hello World", document.DrawPages[0].getByIndex(2).String)
+ self.assertEqual("Sheet1", document.DrawPages[0][0].String)
+ self.assertEqual("Page 1", document.DrawPages[0][1].String)
+ self.assertEqual("Hello World", document.DrawPages[0][2].String)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests8/tdf144940.py b/sc/qa/uitest/calc_tests8/tdf144940.py
index b117b56d2a9b..ab47384311ad 100644
--- a/sc/qa/uitest/calc_tests8/tdf144940.py
+++ b/sc/qa/uitest/calc_tests8/tdf144940.py
@@ -50,8 +50,8 @@ class tdf144940(UITestCase):
with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document:
- xPageStyles = document.StyleFamilies.getByIndex(1)
- xDefaultPageStyle = xPageStyles.getByIndex(0)
+ xPageStyles = document.StyleFamilies[1]
+ xDefaultPageStyle = xPageStyles[0]
# Without the fix in place, this test would have failed with
# AssertionError: False is not true