summaryrefslogtreecommitdiff
path: root/uitest
diff options
context:
space:
mode:
authorChenxiong Qi <qcxhome@gmail.com>2023-12-20 20:54:05 +0800
committerHossein <hossein@libreoffice.org>2024-01-23 14:00:46 +0100
commit74de0ebb810f3e13c45f01c63067cb8de794ce3c (patch)
treeb5f069ad74d12b5ce095b4ad9159861fd1445614 /uitest
parent3a20c691ab1d6a16ad0fc144926b22c098552be4 (diff)
tdf#97361 Make unittests more pythonic: XIndexAccess
Change-Id: I05ef274dd0ad5dc35b5455cfc01feabc6c0820a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161276 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
Diffstat (limited to 'uitest')
-rw-r--r--uitest/impress_tests/backgrounds.py82
-rw-r--r--uitest/libreoffice/calc/document.py6
2 files changed, 44 insertions, 44 deletions
diff --git a/uitest/impress_tests/backgrounds.py b/uitest/impress_tests/backgrounds.py
index e427995bfac2..1bfeab320ecc 100644
--- a/uitest/impress_tests/backgrounds.py
+++ b/uitest/impress_tests/backgrounds.py
@@ -19,91 +19,91 @@ class ImpressBackgrounds(UITestCase):
def checkDefaultBackground(self, btn):
document = self.ui_test.get_component()
if btn == 'btnnone':
- self.assertEqual(document.DrawPages.getByIndex(0).Background, None)
+ self.assertEqual(document.DrawPages[0].Background, None)
elif btn == 'btncolor':
self.assertEqual(
- hex(document.DrawPages.getByIndex(0).Background.FillColor), '0x729fcf')
+ hex(document.DrawPages[0].Background.FillColor), '0x729fcf')
self.assertEqual(
- hex(document.DrawPages.getByIndex(0).Background.FillColor), '0x729fcf')
+ hex(document.DrawPages[0].Background.FillColor), '0x729fcf')
elif btn == 'btngradient':
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillGradient.Style, LINEAR)
+ document.DrawPages[0].Background.FillGradient.Style, LINEAR)
self.assertEqual(
- hex(document.DrawPages.getByIndex(0).Background.FillGradient.StartColor), '0xdde8cb')
+ hex(document.DrawPages[0].Background.FillGradient.StartColor), '0xdde8cb')
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillGradient.Angle, 300)
+ document.DrawPages[0].Background.FillGradient.Angle, 300)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillGradient.Border, 0)
+ document.DrawPages[0].Background.FillGradient.Border, 0)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillGradient.XOffset, 0)
+ document.DrawPages[0].Background.FillGradient.XOffset, 0)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillGradient.YOffset, 0)
+ document.DrawPages[0].Background.FillGradient.YOffset, 0)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillGradient.StartIntensity, 100)
+ document.DrawPages[0].Background.FillGradient.StartIntensity, 100)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillGradient.EndIntensity, 100)
+ document.DrawPages[0].Background.FillGradient.EndIntensity, 100)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillGradientName, 'Pastel Bouquet')
+ document.DrawPages[0].Background.FillGradientName, 'Pastel Bouquet')
elif btn == 'btnhatch':
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillHatch.Style, SINGLE )
+ document.DrawPages[0].Background.FillHatch.Style, SINGLE )
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillHatch.Color, 0)
+ document.DrawPages[0].Background.FillHatch.Color, 0)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillHatch.Distance, 102)
+ document.DrawPages[0].Background.FillHatch.Distance, 102)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillHatch.Angle, 0)
+ document.DrawPages[0].Background.FillHatch.Angle, 0)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillHatchName, 'Black 0 Degrees')
+ document.DrawPages[0].Background.FillHatchName, 'Black 0 Degrees')
elif btn == 'btnbitmap':
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillBitmapMode, REPEAT)
+ document.DrawPages[0].Background.FillBitmapMode, REPEAT)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillBitmapPositionOffsetX, 0)
+ document.DrawPages[0].Background.FillBitmapPositionOffsetX, 0)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillBitmapPositionOffsetY, 0)
+ document.DrawPages[0].Background.FillBitmapPositionOffsetY, 0)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillBitmapRectanglePoint, MIDDLE_MIDDLE)
+ document.DrawPages[0].Background.FillBitmapRectanglePoint, MIDDLE_MIDDLE)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillBitmapStretch, False)
+ document.DrawPages[0].Background.FillBitmapStretch, False)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillBitmapTile, True)
+ document.DrawPages[0].Background.FillBitmapTile, True)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillBitmapOffsetX, 0)
+ document.DrawPages[0].Background.FillBitmapOffsetX, 0)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillBitmapOffsetY, 0)
+ document.DrawPages[0].Background.FillBitmapOffsetY, 0)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillBitmapLogicalSize, True)
+ document.DrawPages[0].Background.FillBitmapLogicalSize, True)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillBitmapSizeX, 2540)
+ document.DrawPages[0].Background.FillBitmapSizeX, 2540)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillBitmapSizeY, 2540)
- self.assertEqual(document.DrawPages.getByIndex(0).Background.FillBitmapName, 'Painted White')
+ document.DrawPages[0].Background.FillBitmapSizeY, 2540)
+ self.assertEqual(document.DrawPages[0].Background.FillBitmapName, 'Painted White')
elif btn == 'btnpattern':
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillBitmapMode, REPEAT)
+ document.DrawPages[0].Background.FillBitmapMode, REPEAT)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillBitmapPositionOffsetX, 0)
+ document.DrawPages[0].Background.FillBitmapPositionOffsetX, 0)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillBitmapPositionOffsetY, 0)
+ document.DrawPages[0].Background.FillBitmapPositionOffsetY, 0)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillBitmapRectanglePoint, MIDDLE_MIDDLE)
+ document.DrawPages[0].Background.FillBitmapRectanglePoint, MIDDLE_MIDDLE)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillBitmapStretch, True)
+ document.DrawPages[0].Background.FillBitmapStretch, True)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillBitmapTile, True)
+ document.DrawPages[0].Background.FillBitmapTile, True)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillBitmapOffsetX, 0)
+ document.DrawPages[0].Background.FillBitmapOffsetX, 0)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillBitmapOffsetY, 0)
+ document.DrawPages[0].Background.FillBitmapOffsetY, 0)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillBitmapLogicalSize, True)
+ document.DrawPages[0].Background.FillBitmapLogicalSize, True)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillBitmapSizeX, 0)
+ document.DrawPages[0].Background.FillBitmapSizeX, 0)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillBitmapSizeY, 0)
+ document.DrawPages[0].Background.FillBitmapSizeY, 0)
self.assertEqual(
- document.DrawPages.getByIndex(0).Background.FillBitmapName, '5 Percent')
+ document.DrawPages[0].Background.FillBitmapName, '5 Percent')
def test_background_dialog(self):
diff --git a/uitest/libreoffice/calc/document.py b/uitest/libreoffice/calc/document.py
index b837bda72521..7bd8e5feef46 100644
--- a/uitest/libreoffice/calc/document.py
+++ b/uitest/libreoffice/calc/document.py
@@ -12,7 +12,7 @@ def get_sheet_from_doc(document, index=None, name=None):
index -- the 0-based index of the sheet (may not be used together with name)
name -- the name of the sheet (may not be used together with index)
"""
- return document.getSheets().getByIndex(index)
+ return document.getSheets()[index]
def get_cell_by_position(document, tab, column, row):
""" Get the cell object through its position in a document
@@ -35,7 +35,7 @@ def get_column(document, column, tab = 0):
column -- The 0-based column number
"""
sheet = get_sheet_from_doc(document, tab)
- return sheet.getColumns().getByIndex(column)
+ return sheet.getColumns()[column]
def get_row(document, row, tab = 0):
""" Get the row object through the row index
@@ -46,7 +46,7 @@ def get_row(document, row, tab = 0):
column -- The 0-based row number
"""
sheet = get_sheet_from_doc(document, tab)
- return sheet.getRows().getByIndex(row)
+ return sheet.getRows()[row]
def is_row_hidden(document, row, tab = 0):
""" Check whether a row object is hidden