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>
This commit is contained in:
Chenxiong Qi 2023-12-20 20:54:05 +08:00 committed by Hossein
parent 3a20c691ab
commit 74de0ebb81
70 changed files with 320 additions and 343 deletions

View file

@ -54,7 +54,7 @@ class Test(UITestCase):
editWin = doc.getChild("impress_win")
# Set theme colors.
drawPage = component.getDrawPages().getByIndex(0)
drawPage = component.getDrawPages()[0]
master = drawPage.MasterPage
theme = mkPropertyValues({
"Name": "nameA",
@ -98,8 +98,8 @@ class Test(UITestCase):
colorSet.executeAction("CHOOSE", mkPropertyValues({"POS": "16"}))
# Then make sure the doc model has the correct color theme index:
drawPage = component.getDrawPages().getByIndex(0)
shape = drawPage.getByIndex(0)
drawPage = component.getDrawPages()[0]
shape = drawPage[0]
paragraphs = shape.createEnumeration()
paragraph = paragraphs.nextElement()
portions = paragraph.createEnumeration()

View file

@ -21,7 +21,7 @@ class Test(UITestCase):
doc = self.xUITest.getTopFocusWindow()
editWin = doc.getChild("impress_win")
# Set theme colors.
drawPage = component.getDrawPages().getByIndex(0)
drawPage = component.getDrawPages()[0]
master = drawPage.MasterPage
theme = mkPropertyValues({
"Name": "nameA",
@ -59,7 +59,7 @@ class Test(UITestCase):
colorSelector.executeAction("CHOOSE", mkPropertyValues({"POS": "4"}))
# Then make sure the doc model is updated accordingly:
shape = drawPage.getByIndex(0)
shape = drawPage[0]
# Without the accompanying fix in place, this test would have failed with:
# AssertionError: -1 != 3
# i.e. the theme metadata of the selected fill color was lost.

View file

@ -64,8 +64,8 @@ class TestXIndexContainer(CollectionsTestBase):
else:
# expected is list
self.assertEqual(None, captured)
self.assertEqual(len(expected), property_values.getCount())
for i in range(property_values.getCount()):
self.assertEqual(len(expected), len(property_values))
for i in range(len(property_values)):
self.assertEqual(to_compare[i][0].Name, property_values[i][0].Name)
def deleteValuesTestFixture(self, count, key, expected):
@ -89,8 +89,8 @@ class TestXIndexContainer(CollectionsTestBase):
else:
# expected is list
self.assertEqual(None, captured)
self.assertEqual(len(expected), property_values.getCount())
for i in range(property_values.getCount()):
self.assertEqual(len(expected), len(property_values))
for i in range(len(property_values)):
self.assertEqual(to_compare[i][0].Name, property_values[i][0].Name)
# Tests syntax:

View file

@ -21,29 +21,29 @@ class calcSheetDelete(UITestCase):
xGridWindow = xCalcDoc.getChild("grid_window")
xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "L12"}))
nrSheets = document.Sheets.getCount() #default number
nrSheets = len(document.Sheets) #default number
with self.ui_test.execute_dialog_through_command(".uno:Insert"):
pass
self.assertEqual(document.Sheets.getCount(), nrSheets + 1)
self.assertEqual(len(document.Sheets), nrSheets + 1)
self.xUITest.executeCommand(".uno:Remove")
xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
xToolkit.processEventsToIdle()
self.assertEqual(document.Sheets.getCount(), nrSheets)
self.assertEqual(len(document.Sheets), nrSheets)
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.Sheets.getCount(), nrSheets + 1)
self.assertEqual(len(document.Sheets), nrSheets + 1)
self.xUITest.executeCommand(".uno:Redo")
self.assertEqual(document.Sheets.getCount(), nrSheets)
self.assertEqual(len(document.Sheets), nrSheets)
def test_tdf43078_insert_and_delete_sheet_insert_text(self):
with self.ui_test.create_doc_in_start_center("calc") as document:
nrSheets = document.Sheets.getCount() #default number of sheets
nrSheets = len(document.Sheets) #default number of sheets
with self.ui_test.execute_dialog_through_command(".uno:Insert"):
pass
@ -53,7 +53,7 @@ class calcSheetDelete(UITestCase):
xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
xToolkit.processEventsToIdle()
self.assertEqual(document.Sheets.getCount(), nrSheets + 2)
self.assertEqual(len(document.Sheets), nrSheets + 2)
xCalcDoc = self.xUITest.getTopFocusWindow()
xGridWindow = xCalcDoc.getChild("grid_window")
enter_text_to_cell(xGridWindow, "B2", "abcd")
@ -61,23 +61,23 @@ class calcSheetDelete(UITestCase):
with self.ui_test.execute_dialog_through_command(".uno:Remove", close_button="yes"):
pass
self.assertEqual(document.Sheets.getCount(), nrSheets + 1)
self.assertEqual(len(document.Sheets), nrSheets + 1)
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.Sheets.getCount(), nrSheets + 2)
self.assertEqual(len(document.Sheets), nrSheets + 2)
self.xUITest.executeCommand(".uno:Redo")
self.assertEqual(document.Sheets.getCount(), nrSheets + 1)
self.assertEqual(len(document.Sheets), nrSheets + 1)
def test_delete_more_sheets_at_once(self):
with self.ui_test.create_doc_in_start_center("calc") as document:
nrSheets = document.Sheets.getCount() #default number
nrSheets = len(document.Sheets) #default number
i = 0
while i < 6:
with self.ui_test.execute_dialog_through_command(".uno:Insert"):
pass
i = i + 1
self.assertEqual(document.Sheets.getCount(), nrSheets + 6)
self.assertEqual(len(document.Sheets), nrSheets + 6)
i = 0
while i < 5:
@ -88,17 +88,17 @@ class calcSheetDelete(UITestCase):
xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
xToolkit.processEventsToIdle()
self.assertEqual(document.Sheets.getCount(), nrSheets)
self.assertEqual(len(document.Sheets), nrSheets)
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.Sheets.getCount(), nrSheets + 6)
self.assertEqual(len(document.Sheets), nrSheets + 6)
self.xUITest.executeCommand(".uno:Redo")
self.assertEqual(document.Sheets.getCount(), nrSheets)
self.assertEqual(len(document.Sheets), nrSheets)
def test_tdf105105_delete_lots_of_sheets_at_once(self):
with self.ui_test.create_doc_in_start_center("calc") as document:
nrSheets = document.Sheets.getCount() #default number
nrSheets = len(document.Sheets) #default number
i = 0
while i < 100:
with self.ui_test.execute_dialog_through_command(".uno:Insert"):
@ -106,7 +106,7 @@ class calcSheetDelete(UITestCase):
i = i + 1
xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
xToolkit.processEventsToIdle()
self.assertEqual(document.Sheets.getCount(), nrSheets + 100)
self.assertEqual(len(document.Sheets), nrSheets + 100)
i = 0
while i < 99:
@ -115,10 +115,10 @@ class calcSheetDelete(UITestCase):
self.xUITest.executeCommand(".uno:Remove")
self.assertEqual(document.Sheets.getCount(), nrSheets)
self.assertEqual(len(document.Sheets), nrSheets)
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.Sheets.getCount(), nrSheets + 100)
self.assertEqual(len(document.Sheets), nrSheets + 100)
self.xUITest.executeCommand(".uno:Redo")
self.assertEqual(document.Sheets.getCount(), nrSheets)
self.assertEqual(len(document.Sheets), nrSheets)
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -16,8 +16,8 @@ class tdf114992(UITestCase):
with self.ui_test.load_file(get_url_for_data_file("tdf114992.ods")) as calc_doc:
self.xUITest.executeCommand(".uno:Remove")
self.assertEqual(calc_doc.Sheets.getCount(), 1)
self.assertEqual(len(calc_doc.Sheets), 1)
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(calc_doc.Sheets.getCount(), 2)
self.assertEqual(len(calc_doc.Sheets), 2)
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -22,7 +22,7 @@ class moveCopySheet(UITestCase):
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)
self.assertEqual(len(document.Sheets), 2)
# dialog move/copy sheet ; Copy is selected; Select move and -move to end position - ; New Name = moveName
with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog:
xMoveButton = xDialog.getChild("move")
@ -38,7 +38,7 @@ class moveCopySheet(UITestCase):
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(len(document.Sheets), 2)
self.assertEqual(document.Sheets[0].Name, "Sheet1")
self.assertEqual(document.Sheets[1].Name, "moveName")
@ -47,7 +47,7 @@ class moveCopySheet(UITestCase):
with self.ui_test.execute_dialog_through_command(".uno:Move", close_button="cancel"):
pass
self.assertEqual(document.Sheets.getCount(), 2)
self.assertEqual(len(document.Sheets), 2)
self.assertEqual(document.Sheets[0].Name, "Sheet1")
self.assertEqual(document.Sheets[1].Name, "moveName")
@ -60,7 +60,7 @@ class moveCopySheet(UITestCase):
self.assertEqual(get_state_as_dict(newName)["Text"], sheetName)
self.assertEqual(document.Sheets.getCount(), 3)
self.assertEqual(len(document.Sheets), 3)
self.assertEqual(document.Sheets[0].Name, sheetName)
self.assertEqual(document.Sheets[1].Name, "Sheet1")
self.assertEqual(document.Sheets[2].Name, "moveName")

View file

@ -19,6 +19,6 @@ class tdf124896(UITestCase):
pass
#verify; no crashes
self.assertEqual(calc_doc.Sheets.getCount(), 2)
self.assertEqual(len(calc_doc.Sheets), 2)
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -21,6 +21,6 @@ class tdf124829(UITestCase):
self.xUITest.executeCommand(".uno:Undo")
#verify; no crashes
self.assertEqual(calc_doc.Sheets.getCount(), 6)
self.assertEqual(len(calc_doc.Sheets), 6)
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -26,7 +26,7 @@ class tdf54768(UITestCase):
# tdf#155863: Without the fix in place, the image stays cropped,
# but stretches to the size of original image
self.assertEqual(7988, document.DrawPages[0].getByIndex(0).Size.Width)
self.assertEqual(3005, document.DrawPages[0].getByIndex(0).Size.Height)
self.assertEqual(7988, document.DrawPages[0][0].Size.Width)
self.assertEqual(3005, document.DrawPages[0][0].Size.Height)
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -47,7 +47,7 @@ class tdf148437(UITestCase):
xCell = get_cell_by_position(document, 0, 0, 0)
self.assertEqual(xCell.getString(), "LibreOffice Document Foundation")
xTextFields = xCell.getTextFields()
self.assertEqual(xTextFields.getCount(), 1)
self.assertEqual(xTextFields.getByIndex(0).URL, "https://www.documentfoundation.org/")
self.assertEqual(len(xTextFields), 1)
self.assertEqual(xTextFields[0].URL, "https://www.documentfoundation.org/")
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -114,10 +114,10 @@ class tdf156611(UITestCase):
# 1. run: "eeee" last hyperlink insertion overwritten the whole cell text with "eeee"
# 2. run: "aaa cccc eeee" as every hyperlink insertion only overwritten the actually selected text
xTextFields = xCell.getTextFields()
self.assertEqual(xTextFields.getCount(), i+1)
self.assertEqual(xTextFields.getByIndex(i).URL, "https://aWrongLink/")
self.assertEqual(len(xTextFields), i+1)
self.assertEqual(xTextFields[i].URL, "https://aWrongLink/")
if (i==1):
self.assertEqual(xTextFields.getByIndex(0).URL, "https://www.documentfoundation.org/")
self.assertEqual(xTextFields[0].URL, "https://www.documentfoundation.org/")
# 1. run: only the last inserted hyperlink will remain: "https://aWrongLink/"
# 2. run: both links will be in the cell

View file

@ -43,8 +43,8 @@ class tdf80043(UITestCase):
xCell = get_cell_by_position(document, 0, 0, 0)
self.assertEqual(xCell.getString(), "LibreOffice")
xTextFields = xCell.getTextFields()
self.assertEqual(xTextFields.getCount(), 1)
self.assertEqual(xTextFields.getByIndex(0).URL, "http://www.libreoffice.org/")
self.assertEqual(len(xTextFields), 1)
self.assertEqual(xTextFields[0].URL, "http://www.libreoffice.org/")
# Reopen hyperlink dialog and check the target and the indication of the hyperlink
with self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog", close_button="cancel") as xDialog:
@ -88,8 +88,8 @@ class tdf80043(UITestCase):
xCell = get_cell_by_position(document, 0, 0, 0)
self.assertEqual(xCell.getString(), "LibreOffice")
xTextFields = xCell.getTextFields()
self.assertEqual(xTextFields.getCount(), 1)
self.assertEqual(xTextFields.getByIndex(0).URL, "http://www.libreoffice.org/")
self.assertEqual(len(xTextFields), 1)
self.assertEqual(xTextFields[0].URL, "http://www.libreoffice.org/")
# Reopen hyperlink dialog and check the target and the indication of the hyperlink
with self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog", close_button="cancel") as xDialog:
@ -137,8 +137,8 @@ class tdf80043(UITestCase):
xCell = get_cell_by_position(document, 0, 0, 0)
self.assertEqual(xCell.getString(), "LibreOffice Document Foundation")
xTextFields = xCell.getTextFields()
self.assertEqual(xTextFields.getCount(), 1)
self.assertEqual(xTextFields.getByIndex(0).URL, "http://www.libreoffice.org/")
self.assertEqual(len(xTextFields), 1)
self.assertEqual(xTextFields[0].URL, "http://www.libreoffice.org/")
# Move focus to ensure cell is not in edit mode
xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A2"}))
@ -161,8 +161,8 @@ class tdf80043(UITestCase):
xCell = get_cell_by_position(document, 0, 0, 0)
self.assertEqual(xCell.getString(), "LibreOffice Document Foundation")
xTextFields = xCell.getTextFields()
self.assertEqual(xTextFields.getCount(), 1)
self.assertEqual(xTextFields.getByIndex(0).URL, "https://www.documentfoundation.org/")
self.assertEqual(len(xTextFields), 1)
self.assertEqual(xTextFields[0].URL, "https://www.documentfoundation.org/")
def test_tdf80043_link_link_cell(self):
with self.ui_test.create_doc_in_start_center("calc") as document:
@ -213,9 +213,9 @@ class tdf80043(UITestCase):
xCell = get_cell_by_position(document, 0, 0, 0)
self.assertEqual(xCell.getString(), "LibreOffice Document Foundation")
xTextFields = xCell.getTextFields()
self.assertEqual(xTextFields.getCount(), 2)
self.assertEqual(xTextFields.getByIndex(0).URL, "http://www.libreoffice.org/")
self.assertEqual(xTextFields.getByIndex(1).URL, "https://www.documentfoundation.org/")
self.assertEqual(len(xTextFields), 2)
self.assertEqual(xTextFields[0].URL, "http://www.libreoffice.org/")
self.assertEqual(xTextFields[1].URL, "https://www.documentfoundation.org/")
# Move focus to ensure cell is not in edit mode
xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A2"}))
@ -237,7 +237,7 @@ class tdf80043(UITestCase):
xCell = get_cell_by_position(document, 0, 0, 0)
self.assertEqual(xCell.getString(), "LibreOffice Document Foundation")
xTextFields = xCell.getTextFields()
self.assertEqual(xTextFields.getCount(), 1)
self.assertEqual(xTextFields.getByIndex(0).URL, "https://wiki.documentfoundation.org/Main_Page")
self.assertEqual(len(xTextFields), 1)
self.assertEqual(xTextFields[0].URL, "https://wiki.documentfoundation.org/Main_Page")
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -27,7 +27,7 @@ class Tdf43175(UITestCase):
aSheetNames = ['Blad1', 'Blad2', 'Blad1_2', 'Blad2_2']
self.assertEqual(4, document.Sheets.getCount())
self.assertEqual(4, len(document.Sheets))
for i in range(4):
self.assertEqual(aSheetNames[i], document.Sheets[i].Name)

View file

@ -39,6 +39,6 @@ class tdf114710(UITestCase):
# Without the fix in place, this test would have crashed here
self.assertEqual(1, writer_document.GraphicObjects.getCount())
self.assertEqual(1, len(writer_document.GraphicObjects))
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -33,7 +33,7 @@ class insertSignatureLineCalc(UITestCase):
xInstructions.executeAction("TYPE", mkPropertyValues({"TEXT":"Instructions"}))
#check the signature Line in the document
element = document.Sheets.getByIndex(0).DrawPage.getByIndex(0)
element = document.Sheets[0].DrawPage[0]
self.assertEqual(element.SignatureLineSuggestedSignerName, "Name")
self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title")
self.assertEqual(element.SignatureLineSuggestedSignerEmail, "Email")

View file

@ -41,13 +41,13 @@ class DetectiveCircle(UITestCase):
self.xUITest.executeCommand(".uno:ShowInvalid")
detectiveCircle1 = document.Sheets.getByName("Sheet1").DrawPage.getCount()
detectiveCircle1 = len(document.Sheets.getByName("Sheet1").DrawPage)
#There should be 1 detective circle object!
self.assertEqual(detectiveCircle1, 1)
enter_text_to_cell(gridwin, "A1", "2")
detectiveCircle2 = document.Sheets.getByName("Sheet1").DrawPage.getCount()
detectiveCircle2 = len(document.Sheets.getByName("Sheet1").DrawPage)
#There should not be a detective circle object!
self.assertEqual(detectiveCircle2, 0)

View file

@ -17,10 +17,10 @@ class findReplace(UITestCase):
# check current slide is 1
self.assertEqual(impress_doc.CurrentController.getCurrentPage().Number, 1)
self.assertEqual("First first first", impress_doc.DrawPages[0].getByIndex(1).String)
self.assertEqual("second", impress_doc.DrawPages[1].getByIndex(1).String)
self.assertEqual("Third", impress_doc.DrawPages[2].getByIndex(1).String)
self.assertEqual("Text size 16", impress_doc.DrawPages[3].getByIndex(1).String)
self.assertEqual("First first first", impress_doc.DrawPages[0][1].String)
self.assertEqual("second", impress_doc.DrawPages[1][1].String)
self.assertEqual("Third", impress_doc.DrawPages[2][1].String)
self.assertEqual("Text size 16", impress_doc.DrawPages[3][1].String)
# search for string "second"
with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog:
@ -41,10 +41,10 @@ class findReplace(UITestCase):
#verify we moved to slide 3
self.assertEqual(impress_doc.CurrentController.getCurrentPage().Number, 3) #3rd slide
self.assertEqual("First first first", impress_doc.DrawPages[0].getByIndex(1).String)
self.assertEqual("second", impress_doc.DrawPages[1].getByIndex(1).String)
self.assertEqual("Third", impress_doc.DrawPages[2].getByIndex(1).String)
self.assertEqual("Text size 16", impress_doc.DrawPages[3].getByIndex(1).String)
self.assertEqual("First first first", impress_doc.DrawPages[0][1].String)
self.assertEqual("second", impress_doc.DrawPages[1][1].String)
self.assertEqual("Third", impress_doc.DrawPages[2][1].String)
self.assertEqual("Text size 16", impress_doc.DrawPages[3][1].String)
# now open dialog and verify find="third" (remember last value);
# replace value with "First" (click match case) with word "Replace"
@ -80,11 +80,11 @@ class findReplace(UITestCase):
matchcase = xDialog.getChild("matchcase")
matchcase.executeAction("CLICK", tuple()) # uncheck match case
self.assertEqual("Replace first first", impress_doc.DrawPages[0].getByIndex(1).String)
self.assertEqual("second", impress_doc.DrawPages[1].getByIndex(1).String)
self.assertEqual("Replace first first", impress_doc.DrawPages[0][1].String)
self.assertEqual("second", impress_doc.DrawPages[1][1].String)
# tdf#145868 - Third was search for earlier, but never should have been replaced
self.assertEqual("Third", impress_doc.DrawPages[2].getByIndex(1).String)
self.assertEqual("Text size 16", impress_doc.DrawPages[3].getByIndex(1).String)
self.assertEqual("Third", impress_doc.DrawPages[2][1].String)
self.assertEqual("Text size 16", impress_doc.DrawPages[3][1].String)
replaceterm = xDialog.getChild("replaceterm")
replaceterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
@ -97,9 +97,9 @@ class findReplace(UITestCase):
# tdf#122788: Without the fix in place, this test would have failed with
# AssertionError: 'Replace aaa aaa' != 'Replace first first'
self.assertEqual("Replace aaa aaa", impress_doc.DrawPages[0].getByIndex(1).String)
self.assertEqual("second", impress_doc.DrawPages[1].getByIndex(1).String)
self.assertEqual("Third", impress_doc.DrawPages[2].getByIndex(1).String)
self.assertEqual("Text size 16", impress_doc.DrawPages[3].getByIndex(1).String)
self.assertEqual("Replace aaa aaa", impress_doc.DrawPages[0][1].String)
self.assertEqual("second", impress_doc.DrawPages[1][1].String)
self.assertEqual("Third", impress_doc.DrawPages[2][1].String)
self.assertEqual("Text size 16", impress_doc.DrawPages[3][1].String)
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -74,9 +74,9 @@ class exportToPDF(UITestCase):
with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document:
self.assertEqual("", document.DrawPages[0].getByIndex(0).String)
self.assertEqual(" ", document.DrawPages[0].getByIndex(1).String)
self.assertEqual(" ", document.DrawPages[0].getByIndex(2).String)
self.assertEqual("Hello World", document.DrawPages[0].getByIndex(3).String)
self.assertEqual("", document.DrawPages[0][0].String)
self.assertEqual(" ", document.DrawPages[0][1].String)
self.assertEqual(" ", document.DrawPages[0][2].String)
self.assertEqual("Hello World", document.DrawPages[0][3].String)
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -18,33 +18,33 @@ class insertSlide(UITestCase):
xTemplateDlg = self.xUITest.getTopFocusWindow()
xCancelBtn = xTemplateDlg.getChild("close")
self.ui_test.close_dialog_through_button(xCancelBtn)
self.assertEqual(document.DrawPages.getCount(), 1) #nr. of pages
self.assertEqual(len(document.DrawPages), 1) #nr. of pages
self.xUITest.executeCommand(".uno:InsertPage")
#verify
self.assertEqual(document.DrawPages.getCount(), 2) #nr. of pages
self.assertEqual(len(document.DrawPages), 2) #nr. of pages
#undo
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.DrawPages.getCount(), 1) #nr. of pages
self.assertEqual(len(document.DrawPages), 1) #nr. of pages
def test_tdf85360_insert_4th_slide(self):
with self.ui_test.create_doc_in_start_center("impress") as document:
xTemplateDlg = self.xUITest.getTopFocusWindow()
xCancelBtn = xTemplateDlg.getChild("close")
self.ui_test.close_dialog_through_button(xCancelBtn)
self.assertEqual(document.DrawPages.getCount(), 1) #nr. of pages
self.assertEqual(len(document.DrawPages), 1) #nr. of pages
self.xUITest.executeCommand(".uno:InsertPage")
self.xUITest.executeCommand(".uno:InsertPage")
self.xUITest.executeCommand(".uno:InsertPage")
self.xUITest.executeCommand(".uno:InsertPage")
#verify
self.assertEqual(document.DrawPages.getCount(), 5) #nr. of pages
self.assertEqual(len(document.DrawPages), 5) #nr. of pages
#undo
self.xUITest.executeCommand(".uno:Undo")
self.xUITest.executeCommand(".uno:Undo")
self.xUITest.executeCommand(".uno:Undo")
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.DrawPages.getCount(), 1) #nr. of pages
self.assertEqual(len(document.DrawPages), 1) #nr. of pages
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -42,18 +42,12 @@ class TestClass(UITestCase):
btncolor = DrawPageDialog.getChild("btncolor")
btncolor.executeAction("CLICK",tuple())
self.assertEqual(
document.DrawPages.getByIndex(0).Background.FillStyle, SOLID)
self.assertEqual(
document.DrawPages.getByIndex(0).BorderLeft, 1016)
self.assertEqual(
document.DrawPages.getByIndex(0).BorderRight, 762)
self.assertEqual(
document.DrawPages.getByIndex(0).BorderTop, 508)
self.assertEqual(
document.DrawPages.getByIndex(0).BorderBottom, 254)
self.assertEqual(
document.MasterPages.getByIndex(0).BackgroundFullSize, False)
self.assertEqual(document.DrawPages[0].Background.FillStyle, SOLID)
self.assertEqual(document.DrawPages[0].BorderLeft, 1016)
self.assertEqual(document.DrawPages[0].BorderRight, 762)
self.assertEqual(document.DrawPages[0].BorderTop, 508)
self.assertEqual(document.DrawPages[0].BorderBottom, 254)
self.assertEqual(document.MasterPages[0].BackgroundFullSize, False)
# check it
with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as DrawPageDialog:
@ -63,18 +57,12 @@ class TestClass(UITestCase):
self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "false")
checkBackgroundFullSize.executeAction("CLICK",tuple())
self.assertEqual(
document.DrawPages.getByIndex(0).Background.FillStyle, SOLID)
self.assertEqual(
document.DrawPages.getByIndex(0).BorderLeft, 1016)
self.assertEqual(
document.DrawPages.getByIndex(0).BorderRight, 762)
self.assertEqual(
document.DrawPages.getByIndex(0).BorderTop, 508)
self.assertEqual(
document.DrawPages.getByIndex(0).BorderBottom, 254)
self.assertEqual(
document.MasterPages.getByIndex(0).BackgroundFullSize, True)
self.assertEqual(document.DrawPages[0].Background.FillStyle, SOLID)
self.assertEqual(document.DrawPages[0].BorderLeft, 1016)
self.assertEqual(document.DrawPages[0].BorderRight, 762)
self.assertEqual(document.DrawPages[0].BorderTop, 508)
self.assertEqual(document.DrawPages[0].BorderBottom, 254)
self.assertEqual(document.MasterPages[0].BackgroundFullSize, True)
# uncheck it again
with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as DrawPageDialog:
@ -84,18 +72,12 @@ class TestClass(UITestCase):
self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "true")
checkBackgroundFullSize.executeAction("CLICK",tuple())
self.assertEqual(
document.DrawPages.getByIndex(0).Background.FillStyle, SOLID)
self.assertEqual(
document.DrawPages.getByIndex(0).BorderLeft, 1016)
self.assertEqual(
document.DrawPages.getByIndex(0).BorderRight, 762)
self.assertEqual(
document.DrawPages.getByIndex(0).BorderTop, 508)
self.assertEqual(
document.DrawPages.getByIndex(0).BorderBottom, 254)
self.assertEqual(
document.MasterPages.getByIndex(0).BackgroundFullSize, False)
self.assertEqual(document.DrawPages[0].Background.FillStyle, SOLID)
self.assertEqual(document.DrawPages[0].BorderLeft, 1016)
self.assertEqual(document.DrawPages[0].BorderRight, 762)
self.assertEqual(document.DrawPages[0].BorderTop, 508)
self.assertEqual(document.DrawPages[0].BorderBottom, 254)
self.assertEqual(document.MasterPages[0].BackgroundFullSize, False)
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -34,18 +34,18 @@ class tdf137729(UITestCase):
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, 152)
document.DrawPages[0].Background.FillHatch.Distance, 152)
self.assertEqual(
document.DrawPages.getByIndex(0).Background.FillHatch.Angle, 0)
document.DrawPages[0].Background.FillHatch.Angle, 0)
# Without the patch in place, this test would have failed with
# AssertionError: '' != 'hatch'
self.assertEqual(
document.DrawPages.getByIndex(0).Background.FillHatchName, 'hatch')
document.DrawPages[0].Background.FillHatchName, 'hatch')
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -28,7 +28,7 @@ class tdf155863(UITestCase):
self.xUITest.executeCommand(".uno:OriginalSize")
# tdf#155863: Without the fix in place, the image will be distorted due to the wrong size.
self.assertEqual(3597, document.DrawPages[0].getByIndex(0).Size.Width)
self.assertEqual(3998, document.DrawPages[0].getByIndex(0).Size.Height)
self.assertEqual(3597, document.DrawPages[0][0].Size.Width)
self.assertEqual(3998, document.DrawPages[0][0].Size.Height)
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -34,26 +34,26 @@ class tdf125449(UITestCase):
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, 450)
document.DrawPages[0].Background.FillGradient.Angle, 450)
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)
# Without the patch in place, this test would have failed with
# AssertionError: '' != 'gradient'
self.assertEqual(
document.DrawPages.getByIndex(0).Background.FillGradientName, 'gradient')
document.DrawPages[0].Background.FillGradientName, 'gradient')
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -19,8 +19,8 @@ class tdf127900(UITestCase):
with self.ui_test.load_file(get_url_for_data_file("tdf127900.fodp")) as doc:
xMasterLang = doc.MasterPages.getByIndex(0).getByIndex(1).CharLocale.Language
xSlideLang = doc.DrawPages.getByIndex(1).getByIndex(1).CharLocale.Language
xMasterLang = doc.MasterPages[0][1].CharLocale.Language
xSlideLang = doc.DrawPages[1][1].CharLocale.Language
self.assertEqual(xMasterLang, xSlideLang)
@ -35,8 +35,8 @@ class tdf127900(UITestCase):
select_pos(xDlg.getChild("cbWestLanguage"), "10")
xMasterLang = doc.MasterPages.getByIndex(0).getByIndex(1).CharLocale.Language
xSlideLang = doc.DrawPages.getByIndex(1).getByIndex(1).CharLocale.Language
xMasterLang = doc.MasterPages[0][1].CharLocale.Language
xSlideLang = doc.DrawPages[1][1].CharLocale.Language
self.assertEqual(xMasterLang, xSlideLang)

View file

@ -46,8 +46,8 @@ class Tdf133713(UITestCase):
self.assertEqual("0", get_state_as_dict(xIndent)["Value"])
self.assertEqual("45%", get_state_as_dict(xRelSize)["Text"])
drawPage = document.getDrawPages().getByIndex(0)
shape = drawPage.getByIndex(1)
drawPage = document.getDrawPages()[0]
shape = drawPage[1]
xEnumeration = shape.Text.createEnumeration()
# Without the fix in place, this test would have failed with

View file

@ -23,8 +23,8 @@ class tdf139511(UITestCase):
self.xUITest.executeCommand(".uno:InsertTable?Columns:short=4&Rows:short=4")
self.assertEqual(3885, document.DrawPages[0].getByIndex(2).BoundRect.Height)
self.assertEqual(14136, document.DrawPages[0].getByIndex(2).BoundRect.Width)
self.assertEqual(3885, document.DrawPages[0][2].BoundRect.Height)
self.assertEqual(14136, document.DrawPages[0][2].BoundRect.Width)
with self.ui_test.execute_dialog_through_command(".uno:TransformDialog") as xDialog:
@ -44,8 +44,8 @@ class tdf139511(UITestCase):
# Without the fix in place, this test would have failed with
# AssertionError: 5037 != 8036
self.assertEqual(5037, document.DrawPages[0].getByIndex(2).BoundRect.Height)
self.assertEqual(10037, document.DrawPages[0].getByIndex(2).BoundRect.Width)
self.assertEqual(5037, document.DrawPages[0][2].BoundRect.Height)
self.assertEqual(10037, document.DrawPages[0][2].BoundRect.Width)
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -28,8 +28,7 @@ class tdf146019(UITestCase):
# Before the fix, a dialog was displayed at this point
# Check the shape is rotated, height > width
drawPage = document.getDrawPages().getByIndex(0)
shape = drawPage.getByIndex(2)
shape = document.getDrawPages()[0][2]
self.assertEqual(8996, shape.getSize().Width)
self.assertEqual(11745, shape.getSize().Height)

View file

@ -25,12 +25,12 @@ class tdf91762(UITestCase):
self.assertEqual('5', get_state_as_dict(xDialog.getChild('columns'))['Text'])
self.assertEqual('2', get_state_as_dict(xDialog.getChild('rows'))['Text'])
self.assertEqual(1961, document.DrawPages[0].getByIndex(1).BoundRect.Height)
self.assertEqual(25198, document.DrawPages[0].getByIndex(1).Size.Width)
self.assertEqual(1923, document.DrawPages[0].getByIndex(1).Size.Height)
self.assertEqual(1961, document.DrawPages[0][1].BoundRect.Height)
self.assertEqual(25198, document.DrawPages[0][1].Size.Width)
self.assertEqual(1923, document.DrawPages[0][1].Size.Height)
self.assertEqual(1400, document.DrawPages[0].getByIndex(1).Position.X)
self.assertEqual(3685, document.DrawPages[0].getByIndex(1).Position.Y)
self.assertEqual(1400, document.DrawPages[0][1].Position.X)
self.assertEqual(3685, document.DrawPages[0][1].Position.Y)
xDoc = self.xUITest.getTopFocusWindow()
xEdit = xDoc.getChild("impress_win")
@ -39,7 +39,7 @@ class tdf91762(UITestCase):
xEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
# tdf#138011: Without the fix in place, it will be much lower
self.assertEqual(5466, document.DrawPages[0].getByIndex(1).BoundRect.Height)
self.assertEqual(5466, document.DrawPages[0][1].BoundRect.Height)
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -30,8 +30,7 @@ class SvxTableControllerTest(UITestCase):
shadowCheckbox.executeAction("CLICK", tuple())
# Check if the shadow was enabled.
drawPage = component.getDrawPages().getByIndex(0)
shape = drawPage.getByIndex(0)
shape = component.getDrawPages()[0][0]
# Without the accompanying fix in place, this test would have failed with:
# AssertionError: False != True
# i.e. the table still had no shadow.

View file

@ -62,8 +62,8 @@ class CheckStyle(unittest.TestCase):
with self.assertRaises(NoSuchElementException):
xFamily.getByName("foobarbaz")
with self.assertRaises(IndexOutOfBoundsException):
xFamily.getByIndex(-1)
with self.assertRaises(IndexError):
xFamily[len(xFamily) + 1]
for sStylename in xFamily.ElementNames:
self.assertTrue(xFamily.hasByName(sStylename))

View file

@ -91,11 +91,11 @@ class TestXTextRange(unittest.TestCase):
def test_textRangesCompare(self):
doc = self._uno.getDoc()
# Bookmark in body text
bookmark1 = doc.getBookmarks().getByIndex(0).getAnchor()
bookmark1 = doc.getBookmarks()[0].getAnchor()
# Bookmarks in table
bookmark2 = doc.getBookmarks().getByIndex(1).getAnchor()
bookmark3 = doc.getBookmarks().getByIndex(2).getAnchor()
bookmark2 = doc.getBookmarks()[1].getAnchor()
bookmark3 = doc.getBookmarks()[2].getAnchor()
res = doc.Text.compareRegionStarts(bookmark1, bookmark2)
self.assertEqual(res, 1)

View file

@ -59,7 +59,7 @@ class LibreLogoTest(UITestCase):
# drawing, ie. in this example, three line shapes
# instead of a single one. See its fix in
# commit 502e8785085f9e8b54ee383080442c2dcaf95b15)
self.assertEqual(document.DrawPage.getCount(), 2)
self.assertEqual(len(document.DrawPage), 2)
# check formatting by "magic wand"
self.logo("__translate__")
@ -98,7 +98,7 @@ x 3 ; draw only a few levels
pass
# new shape + previous two ones = 3
# disable unreliable test. Depending on how busy the machine is, this may produce 3 or 4
# self.assertEqual(document.DrawPage.getCount(), 3)
# self.assertEqual(len(document.DrawPage), 3)
def check_label(self, hasCustomLock):
sLock = "CLEARSCREEN "
@ -119,8 +119,8 @@ x 3 ; draw only a few levels
pass
# turtle and text shape
self.assertEqual(document.DrawPage.getCount(), 2)
textShape = document.DrawPage.getByIndex(1)
self.assertEqual(len(document.DrawPage), 2)
textShape = document.DrawPage[1]
# text in the text shape
self.assertEqual(textShape.getString(), "Hello, World!")
@ -133,8 +133,8 @@ x 3 ; draw only a few levels
pass
# turtle and text shape
self.assertEqual(document.DrawPage.getCount(), 2)
textShape = document.DrawPage.getByIndex(1)
self.assertEqual(len(document.DrawPage), 2)
textShape = document.DrawPage[1]
# text in the text shape
self.assertEqual(textShape.getString(), "Hello, World!")
# check portion formatting
@ -184,8 +184,8 @@ x 3 ; draw only a few levels
pass
# turtle and text shape
self.assertEqual(document.DrawPage.getCount(), 2)
textShape = document.DrawPage.getByIndex(1)
self.assertEqual(len(document.DrawPage), 2)
textShape = document.DrawPage[1]
# text in the text shape
self.assertEqual(textShape.getString(), "x, x, x, x, x...")
# check portion formatting
@ -240,8 +240,8 @@ x 3 ; draw only a few levels
pass
# turtle and text shape
self.assertEqual(document.DrawPage.getCount(), 2)
textShape = document.DrawPage.getByIndex(1)
self.assertEqual(len(document.DrawPage), 2)
textShape = document.DrawPage[1]
# text in the text shape
self.assertEqual(textShape.getString(), "x, x, x, x, x, x...")
# check portion formatting
@ -290,8 +290,8 @@ x 3 ; draw only a few levels
pass
# turtle and text shape
self.assertEqual(document.DrawPage.getCount(), 2)
textShape = document.DrawPage.getByIndex(1)
self.assertEqual(len(document.DrawPage), 2)
textShape = document.DrawPage[1]
# text in the text shape
self.assertEqual(textShape.getString(), "a smcp 11 11...")
# check portion formatting

View file

@ -22,7 +22,7 @@ class XSelectionChangeListenerExtended(unohelper.Base, XSelectionChangeListener)
global selectionChangedResult
selection = event.Source.getSelection()
if selection.supportsService("com.sun.star.text.TextRanges"):
textRange = selection.getByIndex(0)
textRange = selection[0]
if textRange.getString() == "foo":
selectionChangedResult = 1
else:

View file

@ -22,7 +22,7 @@ class sheetToTable(UITestCase):
with self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) as writer_doc:
self.xUITest.executeCommand(".uno:Paste")
#verify (don't copy hidden cells)
self.assertEqual(writer_doc.TextTables.getCount(), 1)
self.assertEqual(len(writer_doc.TextTables), 1)
table = writer_doc.getTextTables()[0]
# This was 3 (copied hidden row)
self.assertEqual(len(table.getRows()), 2)
@ -48,7 +48,7 @@ class sheetToTable(UITestCase):
self.xUITest.executeCommand(".uno:Paste")
#verify also tdf#124646 (don't copy hidden cells)
self.assertEqual(writer_doc.TextTables.getCount(), 1)
self.assertEqual(len(writer_doc.TextTables), 1)
table = writer_doc.getTextTables()[0]
# This was 3 (copied hidden row)
self.assertEqual(len(table.getRows()), 2)
@ -78,7 +78,7 @@ class sheetToTable(UITestCase):
self.xUITest.executeCommand(".uno:Paste")
self.assertEqual(writer_doc.TextTables.getCount(), 1)
self.assertEqual(len(writer_doc.TextTables), 1)
table = writer_doc.getTextTables()[0]
self.assertEqual(len(table.getRows()), 4)
self.assertEqual(table.getCellByName("A1").getString(), "Test 1")
@ -106,7 +106,7 @@ class sheetToTable(UITestCase):
# Without the fix in place, this test would have failed with
# AssertionError: 0 != 1
self.assertEqual(writer_doc.TextTables.getCount(), 1)
self.assertEqual(len(writer_doc.TextTables), 1)
table = writer_doc.getTextTables()[0]
self.assertEqual(len(table.getRows()), 4)
self.assertEqual(table.getCellByName("A1").getString(), "Test 1")
@ -140,7 +140,7 @@ class sheetToTable(UITestCase):
# This was freezing
self.xUITest.executeCommand(".uno:Paste")
self.assertEqual(writer_doc.TextTables.getCount(), 1)
self.assertEqual(len(writer_doc.TextTables), 1)
table = writer_doc.getTextTables()[0]
self.assertEqual(len(table.getRows()), 4)
self.assertEqual(table.getCellByName("A1").getString(), "Test 1")

View file

@ -22,13 +22,13 @@ class splitTable(UITestCase):
copyheading = xDialog.getChild("copyheading")
copyheading.executeAction("CLICK", tuple())
self.assertEqual(writer_doc.TextTables.getCount(), 2)
self.assertEqual(len(writer_doc.TextTables), 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(writer_doc.TextTables.getCount(), 1)
self.assertEqual(len(writer_doc.TextTables), 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:
@ -39,13 +39,13 @@ class splitTable(UITestCase):
customheading = xDialog.getChild("customheading")
customheading.executeAction("CLICK", tuple())
self.assertEqual(writer_doc.TextTables.getCount(), 2)
self.assertEqual(len(writer_doc.TextTables), 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(writer_doc.TextTables.getCount(), 1)
self.assertEqual(len(writer_doc.TextTables), 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:
@ -56,13 +56,13 @@ class splitTable(UITestCase):
noheading = xDialog.getChild("noheading")
noheading.executeAction("CLICK", tuple())
self.assertEqual(writer_doc.TextTables.getCount(), 2)
self.assertEqual(len(writer_doc.TextTables), 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(writer_doc.TextTables.getCount(), 1)
self.assertEqual(len(writer_doc.TextTables), 1)
def test_tdf115572_remember_split_table_option(self):
with self.ui_test.load_file(get_url_for_data_file("splitTable.odt")):

View file

@ -21,10 +21,10 @@ class tableToText(UITestCase):
tabs.executeAction("CLICK", tuple())
#verify
self.assertEqual(writer_doc.Text.String[0:3], "a\ta")
self.assertEqual(writer_doc.TextTables.getCount(), 0)
self.assertEqual(len(writer_doc.TextTables), 0)
#undo
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(writer_doc.TextTables.getCount(), 1)
self.assertEqual(len(writer_doc.TextTables), 1)
#dialog Table to text - Paragraph; verify
with self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText") as xDialog:
@ -32,10 +32,10 @@ class tableToText(UITestCase):
paragraph.executeAction("CLICK", tuple())
#verify
self.assertEqual(writer_doc.Text.String.replace('\r\n', '\n')[0:4], "a\na\n")
self.assertEqual(writer_doc.TextTables.getCount(), 0)
self.assertEqual(len(writer_doc.TextTables), 0)
#undo
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(writer_doc.TextTables.getCount(), 1)
self.assertEqual(len(writer_doc.TextTables), 1)
#dialog Table to text - Semicolons; verify
with self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText") as xDialog:
@ -43,10 +43,10 @@ class tableToText(UITestCase):
semicolons.executeAction("CLICK", tuple())
#verify
self.assertEqual(writer_doc.Text.String.replace('\r\n', '\n')[0:6], "a;a\n;\n")
self.assertEqual(writer_doc.TextTables.getCount(), 0)
self.assertEqual(len(writer_doc.TextTables), 0)
#undo
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(writer_doc.TextTables.getCount(), 1)
self.assertEqual(len(writer_doc.TextTables), 1)
#dialog Table to text - other; verify
with self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText") as xDialog:
@ -58,9 +58,9 @@ class tableToText(UITestCase):
othered.executeAction("TYPE", mkPropertyValues({"TEXT":":"}))
#verify
self.assertEqual(writer_doc.Text.String.replace('\r\n', '\n')[0:6], "a:a\n:\n")
self.assertEqual(writer_doc.TextTables.getCount(), 0)
self.assertEqual(len(writer_doc.TextTables), 0)
#undo
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(writer_doc.TextTables.getCount(), 1)
self.assertEqual(len(writer_doc.TextTables), 1)
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -32,15 +32,15 @@ class tdf51352(UITestCase):
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
self.assertEqual(document.TextTables.getCount(), 2)
self.assertEqual(len(document.TextTables), 2)
#4. From menu "Table->Convert->Table to Text
with self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText"):
pass
self.assertEqual(document.TextTables.getCount(), 0)
self.assertEqual(len(document.TextTables), 0)
#5. Undo/Redo
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.TextTables.getCount(), 2)
self.assertEqual(len(document.TextTables), 2)
self.xUITest.executeCommand(".uno:Redo")
self.assertEqual(document.TextTables.getCount(), 0)
self.assertEqual(len(document.TextTables), 0)
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -70,5 +70,5 @@ class tdf53460(UITestCase):
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"}))
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+LEFT"}))
self.assertEqual(document.TextTables.getCount(), 2)
self.assertEqual(len(document.TextTables), 2)
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -24,13 +24,13 @@ class textToTable(UITestCase):
semicolons = xDialog.getChild("semicolons")
semicolons.executeAction("CLICK", tuple())
#verify
self.assertEqual(document.TextTables.getCount(), 1)
self.assertEqual(len(document.TextTables), 1)
tables = document.getTextTables()
self.assertEqual(len(tables[0].getRows()), 1)
self.assertEqual(len(tables[0].getColumns()), 3)
#undo
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.TextTables.getCount(), 0)
self.assertEqual(len(document.TextTables), 0)
self.assertEqual(document.Text.String[0:5], "A;B;C")
@ -48,13 +48,13 @@ class textToTable(UITestCase):
headingcb = xDialog.getChild("headingcb")
headingcb.executeAction("CLICK", tuple())
#verify
self.assertEqual(writer_doc.TextTables.getCount(), 1)
self.assertEqual(len(writer_doc.TextTables), 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(writer_doc.TextTables.getCount(), 0)
self.assertEqual(len(writer_doc.TextTables), 0)
self.assertEqual(writer_doc.Text.String[0:5], "A:B:C")
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -127,7 +127,7 @@ class Test(UITestCase):
# Cut it from the body text:
self.xUITest.executeCommand(".uno:Cut")
# Select the shape:
xComponent.CurrentController.select(xComponent.DrawPage.getByIndex(0))
xComponent.CurrentController.select(xComponent.DrawPage[0])
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
# Begin text edit on the shape:

View file

@ -26,7 +26,7 @@ class insertCaption(UITestCase):
xHeight.executeAction("UP", tuple())
self.assertEqual(document.TextFrames.getCount(), 1)
self.assertEqual(len(document.TextFrames), 1)
with self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") as xDialogCaption:

View file

@ -21,15 +21,15 @@ class insertFootnote(UITestCase):
type_text(xWriterEdit, "LibreOffice")
self.assertEqual(document.Footnotes[0].String, "LibreOffice")
self.assertEqual(document.Footnotes.getCount(), 1)
self.assertEqual(len(document.Footnotes), 1)
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.Footnotes[0].String, "")
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.Footnotes.getCount(), 0)
self.assertEqual(len(document.Footnotes), 0)
self.xUITest.executeCommand(".uno:Redo")
self.assertEqual(document.Footnotes[0].String, "")
self.assertEqual(document.Footnotes.getCount(), 1)
self.assertEqual(len(document.Footnotes), 1)
self.xUITest.executeCommand(".uno:Redo")
self.assertEqual(document.Footnotes[0].String, "LibreOffice")

View file

@ -34,12 +34,12 @@ class tdf116474(UITestCase):
self.assertEqual(document.TextFrames[0].Text.String, "Figure 1: Caption")
self.assertEqual(document.GraphicObjects.getCount(), 1) #nr. of images
self.assertEqual(len(document.GraphicObjects), 1) #nr. of images
#Undo, redo
self.xUITest.executeCommand(".uno:Undo")
self.xUITest.executeCommand(".uno:Redo")
#Verify
self.assertEqual(document.TextFrames[0].Text.String, "Figure 1: Caption")
self.assertEqual(document.GraphicObjects.getCount(), 1) #nr. of images
self.assertEqual(len(document.GraphicObjects), 1) #nr. of images
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -31,7 +31,7 @@ class tdf133299(UITestCase):
self.xUITest.executeCommand(".uno:Paste")
xShape = calc_document.Sheets.getByIndex(0).DrawPage.getByIndex(0)
xShape = calc_document.Sheets[0].DrawPage[0]
# Without the fix in place, this test would have failed with
# AssertionError: 'ScCellObj' != 'ScTableSheetObj'

View file

@ -22,14 +22,14 @@ class insertEndnote(UITestCase):
type_text(xWriterEdit, "LibreOffice")
self.assertEqual(document.Endnotes[0].String, "LibreOffice")
self.assertEqual(document.Endnotes.getCount(), 1)
self.assertEqual(len(document.Endnotes), 1)
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.Endnotes[0].String, "")
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.Endnotes.getCount(), 0)
self.assertEqual(len(document.Endnotes), 0)
self.xUITest.executeCommand(".uno:Redo")
self.assertEqual(document.Endnotes[0].String, "")
self.assertEqual(document.Endnotes.getCount(), 1)
self.assertEqual(len(document.Endnotes), 1)
self.xUITest.executeCommand(".uno:Redo")
self.assertEqual(document.Endnotes[0].String, "LibreOffice")

View file

@ -19,17 +19,17 @@ class insertFootEndnote(UITestCase):
with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog"):
pass
self.assertEqual(document.Footnotes.getCount(), 1)
self.assertEqual(len(document.Footnotes), 1)
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.Footnotes.getCount(), 0)
self.assertEqual(len(document.Footnotes), 0)
#Automatic - Endnote
with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") as xDialog:
xEndnote = xDialog.getChild("endnote")
xEndnote.executeAction("CLICK", tuple())
self.assertEqual(document.Endnotes.getCount(), 1)
self.assertEqual(len(document.Endnotes), 1)
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.Endnotes.getCount(), 0)
self.assertEqual(len(document.Endnotes), 0)
#Character - Footnote
with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") as xDialog:
xChar = xDialog.getChild("character")
@ -37,9 +37,9 @@ class insertFootEndnote(UITestCase):
xCharentry = xDialog.getChild("characterentry")
xCharentry.executeAction("TYPE", mkPropertyValues({"TEXT":"A"}))
self.assertEqual(document.Footnotes.getCount(), 1)
self.assertEqual(len(document.Footnotes), 1)
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.Footnotes.getCount(), 0)
self.assertEqual(len(document.Footnotes), 0)
#Character - Endnote
with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") as xDialog:
@ -51,9 +51,9 @@ class insertFootEndnote(UITestCase):
xEndnote = xDialog.getChild("endnote")
xEndnote.executeAction("CLICK", tuple())
self.assertEqual(document.Endnotes.getCount(), 1)
self.assertEqual(len(document.Endnotes), 1)
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.Endnotes.getCount(), 0)
self.assertEqual(len(document.Endnotes), 0)
#Cancel button
with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog", close_button="cancel"):

View file

@ -28,7 +28,7 @@ class insertQrCode(UITestCase):
xBorder.executeAction("DOWN", tuple())
# check the QR code in the document
element = document.DrawPage.getByIndex(0)
element = document.DrawPage[0]
self.assertEqual(element.BarCodeProperties.Payload, "www.libreoffice.org")
self.assertEqual(element.BarCodeProperties.ErrorCorrection, 1)
self.assertEqual(element.BarCodeProperties.Border, 1)

View file

@ -31,7 +31,7 @@ class insertSignatureLine(UITestCase):
xInstructions.executeAction("TYPE", mkPropertyValues({"TEXT":"Instructions"}))
#check the signature Line in the document
element = document.DrawPage.getByIndex(0)
element = document.DrawPage[0]
self.assertEqual(element.SignatureLineSuggestedSignerName, "Name")
self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title")
self.assertEqual(element.SignatureLineSuggestedSignerEmail, "Email")

View file

@ -24,13 +24,13 @@ class tdf79236(UITestCase):
self.xUITest.executeCommand(".uno:SelectAll")
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 0)
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 0)
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 0)
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 0)
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 0)
self.assertEqual(document.CurrentSelection[0].ParaLeftMargin, 0)
self.assertEqual(document.CurrentSelection[0].ParaRightMargin, 0)
self.assertEqual(document.CurrentSelection[0].ParaTopMargin, 0)
self.assertEqual(document.CurrentSelection[0].ParaBottomMargin, 0)
self.assertEqual(document.CurrentSelection[0].ParaFirstLineIndent, 0)
self.assertEqual(document.CurrentSelection.getByIndex(0).String, "Test for tdf79236")
self.assertEqual(document.CurrentSelection[0].String, "Test for tdf79236")
with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xParagraphDlg:
@ -59,11 +59,11 @@ class tdf79236(UITestCase):
xTopSpnBtn.executeAction("UP", tuple())
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 1016)
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 1016)
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 1016)
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 1016)
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 1016)
self.assertEqual(document.CurrentSelection[0].ParaLeftMargin, 1016)
self.assertEqual(document.CurrentSelection[0].ParaRightMargin, 1016)
self.assertEqual(document.CurrentSelection[0].ParaTopMargin, 1016)
self.assertEqual(document.CurrentSelection[0].ParaBottomMargin, 1016)
self.assertEqual(document.CurrentSelection[0].ParaFirstLineIndent, 1016)
with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xParagraphDlg:
@ -90,29 +90,29 @@ class tdf79236(UITestCase):
xTopSpnBtn.executeAction("DOWN", tuple())
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 0)
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 0)
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 0)
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 0)
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 0)
self.assertEqual(document.CurrentSelection[0].ParaLeftMargin, 0)
self.assertEqual(document.CurrentSelection[0].ParaRightMargin, 0)
self.assertEqual(document.CurrentSelection[0].ParaTopMargin, 0)
self.assertEqual(document.CurrentSelection[0].ParaBottomMargin, 0)
self.assertEqual(document.CurrentSelection[0].ParaFirstLineIndent, 0)
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 1016)
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 1016)
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 1016)
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 1016)
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 1016)
self.assertEqual(document.CurrentSelection[0].ParaLeftMargin, 1016)
self.assertEqual(document.CurrentSelection[0].ParaRightMargin, 1016)
self.assertEqual(document.CurrentSelection[0].ParaTopMargin, 1016)
self.assertEqual(document.CurrentSelection[0].ParaBottomMargin, 1016)
self.assertEqual(document.CurrentSelection[0].ParaFirstLineIndent, 1016)
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 0)
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 0)
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 0)
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 0)
self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 0)
self.assertEqual(document.CurrentSelection[0].ParaLeftMargin, 0)
self.assertEqual(document.CurrentSelection[0].ParaRightMargin, 0)
self.assertEqual(document.CurrentSelection[0].ParaTopMargin, 0)
self.assertEqual(document.CurrentSelection[0].ParaBottomMargin, 0)
self.assertEqual(document.CurrentSelection[0].ParaFirstLineIndent, 0)
self.assertEqual(document.CurrentSelection.getByIndex(0).String, "Test for tdf79236")
self.assertEqual(document.CurrentSelection[0].String, "Test for tdf79236")
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -70,6 +70,6 @@ class exportToPDF(UITestCase):
with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document:
self.assertEqual("Hello World", document.DrawPages[0].getByIndex(0).String)
self.assertEqual("Hello World", document.DrawPages[0][0].String)
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -20,7 +20,7 @@ class tdf106899(UITestCase):
# Update the alphabetical index and check if it contains the utf8 index entry
xDocumentIndexes = document.DocumentIndexes
self.assertEqual(xDocumentIndexes.getCount(), 1)
self.assertEqual(len(xDocumentIndexes), 1)
self.assertEqual(xDocumentIndexes.hasByName("Alphabetical Index1"), True)
xDocumentIndex = xDocumentIndexes.getByName("Alphabetical Index1")
xIndexAnchor = xDocumentIndex.getAnchor()

View file

@ -35,7 +35,7 @@ class Tdf138531(UITestCase):
formatProperty = mkPropertyValues({"SelectedFormat": 59})
self.xUITest.executeCommandWithParameters(".uno:ClipboardFormatItems", formatProperty)
self.assertEqual(1, writer_doc.TextTables.getCount())
self.assertEqual(1, len(writer_doc.TextTables))
table = writer_doc.getTextTables()[0]
self.assertEqual("First", table.getCellByName("A1").getString())
self.assertEqual("Second", table.getCellByName("A2").getString())

View file

@ -16,7 +16,7 @@ class tdf142847(UITestCase):
document = self.ui_test.get_component()
# get the shape
shape = document.DrawPage.getByIndex(0)
shape = document.DrawPage[0]
# get the textbox
frame = shape.getText()

View file

@ -70,7 +70,7 @@ class Tdf145326(UITestCase):
self.assertTrue(sBreakLink not in xMainWin.getChildren())
self.assertTrue("writer_edit" in xMainWin.getChildren())
self.assertEqual(doc2.TextTables.getCount(), 1)
self.assertEqual(len(doc2.TextTables), 1)
table = doc2.getTextTables()[0]
self.assertEqual(len(table.getRows()), 7)

View file

@ -35,7 +35,7 @@ class Tdf147935(UITestCase):
# Without the fix in place, this test would have failed because the warning message
# "A table with no rows or no cells cannot be inserted" would have been displayed
self.assertEqual(1, writer_doc.TextTables.getCount())
self.assertEqual(1, len(writer_doc.TextTables))
table = writer_doc.getTextTables()[0]
self.assertEqual("DDE", table.getCellByName("A1").getString())

View file

@ -40,6 +40,6 @@ class Tdf150151(UITestCase):
# Without the fix in place, this test would have failed with
# AssertionError: 'Šđčćž ŠĐČĆŽ !”#$%&/()=?*,.-;:_ ° ~ˇ^˘°˛`˙’˝”¸' != 'Š !#$%&/()=?*,.-;:_ ~^`'
self.assertEqual(sText, document.DrawPages[0].getByIndex(1).String)
self.assertEqual(sText, document.DrawPages[0][1].String)
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -27,7 +27,7 @@ class tdf107847(UITestCase):
select_pos(xTabs, "7")
select_pos(xTabs, "8") #tab Macro
self.assertEqual(document.TextFrames.getCount(), 1)
self.assertEqual(len(document.TextFrames), 1)
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.TextFrames.getCount(), 0)
self.assertEqual(len(document.TextFrames), 0)
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -19,7 +19,7 @@ class Tdf118883(UITestCase):
xArgs = mkPropertyValues({"KeyModifier": 8192})
self.xUITest.executeCommandWithParameters(".uno:BasicShapes.rectangle", xArgs)
self.assertEqual(1, writer_document.DrawPage.getCount())
self.assertEqual(1, len(writer_document.DrawPage))
self.xUITest.executeCommand(".uno:Copy")
@ -29,6 +29,6 @@ class Tdf118883(UITestCase):
# Without the fix in place, this test would have failed with
# AssertionError: 1 != 0
self.assertEqual(1, calc_document.DrawPages[0].getCount())
self.assertEqual(1, len(calc_document.DrawPages[0]))
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -20,7 +20,7 @@ class tdf126168(UITestCase):
#3) Press OK in Frame dialog
with self.ui_test.execute_dialog_through_command(".uno:InsertFrame"):
pass
self.assertEqual(document.TextFrames.getCount(), 1)
self.assertEqual(len(document.TextFrames), 1)
#New Style from Selection [uno:StyleNewByExample]
with self.ui_test.execute_dialog_through_command(".uno:StyleNewByExample") as xDialog:
#5) Enter a name in the Create Style dialog and press OK
@ -30,7 +30,7 @@ class tdf126168(UITestCase):
self.xUITest.executeCommand(".uno:Undo")
self.xUITest.executeCommand(".uno:Undo")
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.TextFrames.getCount(), 0)
self.assertEqual(len(document.TextFrames), 0)
#7) shift+ctrl+z 3 times
self.xUITest.executeCommand(".uno:Redo")
self.xUITest.executeCommand(".uno:Redo")

View file

@ -132,8 +132,7 @@ class Forms(UITestCase):
self.xUITest.executeCommand(".uno:JumpToNextFrame")
drawPage = document.getDrawPages().getByIndex(0)
shape = drawPage.getByIndex(0)
shape = document.getDrawPages()[0][0]
self.assertEqual(13996, shape.getSize().Width)
self.assertEqual(2408, shape.getSize().Height)

View file

@ -33,8 +33,7 @@ class tdf132169(UITestCase):
xLineMetric.executeAction("UP", tuple())
drawPage = writer_doc.getDrawPages().getByIndex(0)
shape = drawPage.getByIndex(0)
shape = writer_doc.getDrawPages()[0][0]
#Without the fix in place, it would have been 310
self.assertEqual(shape.LineWidth, 176)

View file

@ -33,8 +33,8 @@ class tdf132714(UITestCase):
self.xUITest.executeCommand(".uno:DeleteTable")
# select embedded chart
self.assertEqual(1, document.EmbeddedObjects.Count)
document.CurrentController.select(document.getEmbeddedObjects().getByIndex(0))
self.assertEqual(1, len(document.EmbeddedObjects))
document.CurrentController.select(document.getEmbeddedObjects()[0])
self.assertEqual("SwXTextEmbeddedObject", document.CurrentSelection.getImplementationName())
xChartMainTop = self.xUITest.getTopFocusWindow()
@ -76,8 +76,8 @@ class tdf132714(UITestCase):
self.xUITest.executeCommand(".uno:DeleteTable")
# select embedded chart
self.assertEqual(1, document.EmbeddedObjects.Count)
document.CurrentController.select(document.getEmbeddedObjects().getByIndex(0))
self.assertEqual(1, len(document.EmbeddedObjects))
document.CurrentController.select(document.EmbeddedObjects[0])
self.assertEqual("SwXTextEmbeddedObject", document.CurrentSelection.getImplementationName())
xChartMainTop = self.xUITest.getTopFocusWindow()

View file

@ -20,8 +20,8 @@ class tdf137802(UITestCase):
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
self.assertEqual(document.DrawPage.getCount(), 2)
self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType)
self.assertEqual(len(document.DrawPage), 2)
self.assertEqual(AT_PARAGRAPH, document.DrawPage[0].AnchorType)
self.xUITest.executeCommand(".uno:JumpToNextFrame")
@ -33,9 +33,9 @@ class tdf137802(UITestCase):
xDialog.getChild('topage').executeAction("CLICK", tuple())
self.assertEqual(AT_PAGE, document.DrawPage.getByIndex(0).AnchorType)
self.assertEqual(AT_PAGE, document.DrawPage[0].AnchorType)
self.assertEqual(document.DrawPage.getCount(), 2)
self.assertEqual(len(document.DrawPage), 2)
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
@ -55,23 +55,23 @@ class tdf137802(UITestCase):
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "SHIFT+LEFT"}))
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
self.assertEqual(document.DrawPage.getCount(), 1)
self.assertEqual(len(document.DrawPage), 1)
self.xUITest.executeCommand(".uno:JumpToNextFrame")
self.xUITest.executeCommand(".uno:Delete")
self.assertEqual(document.DrawPage.getCount(), 0)
self.assertEqual(len(document.DrawPage), 0)
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.DrawPage.getCount(), 1)
self.assertEqual(len(document.DrawPage), 1)
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(document.DrawPage.getCount(), 2)
self.assertEqual(len(document.DrawPage), 2)
self.xUITest.executeCommand(".uno:Undo")
self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType)
self.assertEqual(AT_PARAGRAPH, document.DrawPage[0].AnchorType)
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -27,8 +27,7 @@ class tdf137803(UITestCase):
TSB_AUTOGROW_SIZE.executeAction("CLICK",tuple())
# get the shape
drawPage = document.getDrawPages().getByIndex(0)
shape = drawPage.getByIndex(0)
shape = document.getDrawPages()[0][0]
# and the textbox
frame = shape.getText()

View file

@ -24,10 +24,10 @@ class tdf140117(UITestCase):
self.xUITest.executeCommand(".uno:JumpToHeader")
xPageSytle = document.getStyleFamilies().getByIndex(2)
xHeaderText = xPageSytle.getByIndex(0).HeaderText.String
xHeaderLeftText = xPageSytle.getByIndex(0).HeaderTextLeft.String
xHeaderRightText = xPageSytle.getByIndex(0).HeaderTextRight.String
xPageSytle = document.getStyleFamilies()[2]
xHeaderText = xPageSytle[0].HeaderText.String
xHeaderLeftText = xPageSytle[0].HeaderTextLeft.String
xHeaderRightText = xPageSytle[0].HeaderTextRight.String
# Option "same content on left and right pages" is false,
# insert text "XXXX" before actual header text "left" on page 2

View file

@ -30,8 +30,8 @@ class TestTdf141158(UITestCase):
xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"}))
self.xUITest.executeCommand(".uno:JumpToHeader")
# get the text of the header
xPageSytle = document.getStyleFamilies().getByIndex(2)
xHeaderLeftText = xPageSytle.getByIndex(0).HeaderTextLeft.String
xPageSytle = document.getStyleFamilies()[2]
xHeaderLeftText = xPageSytle[0].HeaderTextLeft.String
# without the fix in place it was "Right Header" (lost hidden left header),
# with the fix it should pass...
self.assertEqual("Left Header", xHeaderLeftText)

View file

@ -16,7 +16,7 @@ class tdf141557(UITestCase):
with self.ui_test.load_file(get_url_for_data_file("tdf141557.docx")):
document = self.ui_test.get_component()
self.assertEqual(AS_CHARACTER, document.DrawPage.getByIndex(0).AnchorType)
self.assertEqual(AS_CHARACTER, document.DrawPage[0].AnchorType)
self.xUITest.executeCommand(".uno:JumpToNextFrame")
@ -29,6 +29,6 @@ class tdf141557(UITestCase):
# Without the fix in place, at this point crash occurs.
self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType)
self.assertEqual(AT_PARAGRAPH, document.DrawPage[0].AnchorType)
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -15,11 +15,11 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf46561(UITestCase):
def check_header_texts(self, master="", first="", left="", right=""):
# Get the current header style and its text contents
xPageStyle = self.document.getStyleFamilies().getByIndex(2)
xHeaderText = xPageStyle.getByIndex(0).HeaderText.String
xHeaderTextFirst = xPageStyle.getByIndex(0).HeaderTextFirst.String
xHeaderTextLeft = xPageStyle.getByIndex(0).HeaderTextLeft.String
xHeaderTextRight = xPageStyle.getByIndex(0).HeaderTextRight.String
xPageStyle = self.document.getStyleFamilies()[2]
xHeaderText = xPageStyle[0].HeaderText.String
xHeaderTextFirst = xPageStyle[0].HeaderTextFirst.String
xHeaderTextLeft = xPageStyle[0].HeaderTextLeft.String
xHeaderTextRight = xPageStyle[0].HeaderTextRight.String
# Check the current values
self.assertEqual(master, xHeaderText)

View file

@ -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):

View file

@ -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