diff --git a/cui/qa/uitest/dialogs/chardlg.py b/cui/qa/uitest/dialogs/chardlg.py index 6da1e21e2162..686cb6472ac8 100644 --- a/cui/qa/uitest/dialogs/chardlg.py +++ b/cui/qa/uitest/dialogs/chardlg.py @@ -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() diff --git a/cui/qa/uitest/tabpages/tpcolor.py b/cui/qa/uitest/tabpages/tpcolor.py index 820ffa634eb1..4e7b8261ff83 100644 --- a/cui/qa/uitest/tabpages/tpcolor.py +++ b/cui/qa/uitest/tabpages/tpcolor.py @@ -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. diff --git a/pyuno/qa/pytests/testcollections_XIndexContainer.py b/pyuno/qa/pytests/testcollections_XIndexContainer.py index 1df5f07740cb..45cf509889a4 100644 --- a/pyuno/qa/pytests/testcollections_XIndexContainer.py +++ b/pyuno/qa/pytests/testcollections_XIndexContainer.py @@ -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: diff --git a/sc/qa/uitest/calc_tests/calcSheetDelete.py b/sc/qa/uitest/calc_tests/calcSheetDelete.py index 380d6766943e..ecd3a2494fc7 100644 --- a/sc/qa/uitest/calc_tests/calcSheetDelete.py +++ b/sc/qa/uitest/calc_tests/calcSheetDelete.py @@ -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: diff --git a/sc/qa/uitest/calc_tests2/tdf114992.py b/sc/qa/uitest/calc_tests2/tdf114992.py index 6f1b888d616c..50adb56f74aa 100644 --- a/sc/qa/uitest/calc_tests2/tdf114992.py +++ b/sc/qa/uitest/calc_tests2/tdf114992.py @@ -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: diff --git a/sc/qa/uitest/calc_tests6/moveCopySheet.py b/sc/qa/uitest/calc_tests6/moveCopySheet.py index 5b21e6e86cb0..42aed623edda 100644 --- a/sc/qa/uitest/calc_tests6/moveCopySheet.py +++ b/sc/qa/uitest/calc_tests6/moveCopySheet.py @@ -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") diff --git a/sc/qa/uitest/calc_tests7/tdf124896.py b/sc/qa/uitest/calc_tests7/tdf124896.py index 44c6ba4b28a1..573a1b4d86b4 100644 --- a/sc/qa/uitest/calc_tests7/tdf124896.py +++ b/sc/qa/uitest/calc_tests7/tdf124896.py @@ -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: diff --git a/sc/qa/uitest/calc_tests8/tdf124829.py b/sc/qa/uitest/calc_tests8/tdf124829.py index f515b265f9a3..8f5972710be0 100644 --- a/sc/qa/uitest/calc_tests8/tdf124829.py +++ b/sc/qa/uitest/calc_tests8/tdf124829.py @@ -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: diff --git a/sc/qa/uitest/calc_tests8/tdf54768.py b/sc/qa/uitest/calc_tests8/tdf54768.py index a4342fb8e238..c72a0e02b8fc 100644 --- a/sc/qa/uitest/calc_tests8/tdf54768.py +++ b/sc/qa/uitest/calc_tests8/tdf54768.py @@ -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: diff --git a/sc/qa/uitest/calc_tests9/tdf148437.py b/sc/qa/uitest/calc_tests9/tdf148437.py index d457b2324892..532c44b40c09 100644 --- a/sc/qa/uitest/calc_tests9/tdf148437.py +++ b/sc/qa/uitest/calc_tests9/tdf148437.py @@ -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: diff --git a/sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py b/sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py index 87ee09aa5d71..6cf81940d55c 100644 --- a/sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py +++ b/sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py @@ -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 diff --git a/sc/qa/uitest/calc_tests9/tdf80043.py b/sc/qa/uitest/calc_tests9/tdf80043.py index eb99f0038871..4cca6ffc3502 100644 --- a/sc/qa/uitest/calc_tests9/tdf80043.py +++ b/sc/qa/uitest/calc_tests9/tdf80043.py @@ -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: diff --git a/sc/qa/uitest/chart/tdf43175.py b/sc/qa/uitest/chart/tdf43175.py index 9851515da130..2dfddfa78504 100644 --- a/sc/qa/uitest/chart/tdf43175.py +++ b/sc/qa/uitest/chart/tdf43175.py @@ -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) diff --git a/sc/qa/uitest/pasteSpecial/tdf114710.py b/sc/qa/uitest/pasteSpecial/tdf114710.py index cb6fb3654a3a..4b0c6bef44fc 100644 --- a/sc/qa/uitest/pasteSpecial/tdf114710.py +++ b/sc/qa/uitest/pasteSpecial/tdf114710.py @@ -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: diff --git a/sc/qa/uitest/signatureLine/insertSignatureLine.py b/sc/qa/uitest/signatureLine/insertSignatureLine.py index 5bed522440e4..41be0956b761 100644 --- a/sc/qa/uitest/signatureLine/insertSignatureLine.py +++ b/sc/qa/uitest/signatureLine/insertSignatureLine.py @@ -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") diff --git a/sc/qa/uitest/validity/tdf138134.py b/sc/qa/uitest/validity/tdf138134.py index c16bdc8d06b4..b13da491eb40 100644 --- a/sc/qa/uitest/validity/tdf138134.py +++ b/sc/qa/uitest/validity/tdf138134.py @@ -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) diff --git a/sd/qa/uitest/findReplace/findReplace.py b/sd/qa/uitest/findReplace/findReplace.py index 130765a865bb..055a59f0d61f 100644 --- a/sd/qa/uitest/findReplace/findReplace.py +++ b/sd/qa/uitest/findReplace/findReplace.py @@ -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: diff --git a/sd/qa/uitest/impress_tests/exportToPDF.py b/sd/qa/uitest/impress_tests/exportToPDF.py index e654f608947b..8e7466823b8e 100644 --- a/sd/qa/uitest/impress_tests/exportToPDF.py +++ b/sd/qa/uitest/impress_tests/exportToPDF.py @@ -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: diff --git a/sd/qa/uitest/impress_tests/insertSlide.py b/sd/qa/uitest/impress_tests/insertSlide.py index 83f33c59782c..b1c6139a645d 100644 --- a/sd/qa/uitest/impress_tests/insertSlide.py +++ b/sd/qa/uitest/impress_tests/insertSlide.py @@ -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: diff --git a/sd/qa/uitest/impress_tests/tdf134734.py b/sd/qa/uitest/impress_tests/tdf134734.py index 07985e8f6b43..cd8f9c8d5dd6 100644 --- a/sd/qa/uitest/impress_tests/tdf134734.py +++ b/sd/qa/uitest/impress_tests/tdf134734.py @@ -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: diff --git a/sd/qa/uitest/impress_tests/tdf137729.py b/sd/qa/uitest/impress_tests/tdf137729.py index 4362b056e156..1769b0510452 100644 --- a/sd/qa/uitest/impress_tests/tdf137729.py +++ b/sd/qa/uitest/impress_tests/tdf137729.py @@ -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: diff --git a/sd/qa/uitest/impress_tests/tdf155863.py b/sd/qa/uitest/impress_tests/tdf155863.py index bce8936a3d40..79fd3be9750e 100644 --- a/sd/qa/uitest/impress_tests/tdf155863.py +++ b/sd/qa/uitest/impress_tests/tdf155863.py @@ -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: diff --git a/sd/qa/uitest/impress_tests2/tdf125449.py b/sd/qa/uitest/impress_tests2/tdf125449.py index 242a79e65787..65e245b7a8dc 100644 --- a/sd/qa/uitest/impress_tests2/tdf125449.py +++ b/sd/qa/uitest/impress_tests2/tdf125449.py @@ -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: diff --git a/sd/qa/uitest/impress_tests2/tdf127900.py b/sd/qa/uitest/impress_tests2/tdf127900.py index e32b76591aad..cb4149c10c9f 100644 --- a/sd/qa/uitest/impress_tests2/tdf127900.py +++ b/sd/qa/uitest/impress_tests2/tdf127900.py @@ -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) diff --git a/sd/qa/uitest/impress_tests2/tdf133713.py b/sd/qa/uitest/impress_tests2/tdf133713.py index a4195fd2b268..da84ae94fbeb 100644 --- a/sd/qa/uitest/impress_tests2/tdf133713.py +++ b/sd/qa/uitest/impress_tests2/tdf133713.py @@ -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 diff --git a/sd/qa/uitest/impress_tests2/tdf139511.py b/sd/qa/uitest/impress_tests2/tdf139511.py index 52e54d291516..1b5febe80df9 100644 --- a/sd/qa/uitest/impress_tests2/tdf139511.py +++ b/sd/qa/uitest/impress_tests2/tdf139511.py @@ -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: diff --git a/sd/qa/uitest/impress_tests2/tdf146019.py b/sd/qa/uitest/impress_tests2/tdf146019.py index 16e0290ab1bf..86b8ed48180f 100644 --- a/sd/qa/uitest/impress_tests2/tdf146019.py +++ b/sd/qa/uitest/impress_tests2/tdf146019.py @@ -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) diff --git a/sd/qa/uitest/impress_tests2/tdf91762.py b/sd/qa/uitest/impress_tests2/tdf91762.py index e36baec62094..441971601c4c 100644 --- a/sd/qa/uitest/impress_tests2/tdf91762.py +++ b/sd/qa/uitest/impress_tests2/tdf91762.py @@ -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: diff --git a/svx/qa/uitest/table/tablecontroller.py b/svx/qa/uitest/table/tablecontroller.py index 26390cb5c963..e523ae055d9b 100644 --- a/svx/qa/uitest/table/tablecontroller.py +++ b/svx/qa/uitest/table/tablecontroller.py @@ -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. diff --git a/sw/qa/python/check_styles.py b/sw/qa/python/check_styles.py index aca3d8f0486e..59e9637d56a9 100644 --- a/sw/qa/python/check_styles.py +++ b/sw/qa/python/check_styles.py @@ -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)) diff --git a/sw/qa/python/xtextrange.py b/sw/qa/python/xtextrange.py index 583cabc30aba..a0b7925b9ff9 100644 --- a/sw/qa/python/xtextrange.py +++ b/sw/qa/python/xtextrange.py @@ -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) diff --git a/sw/qa/uitest/librelogo/run.py b/sw/qa/uitest/librelogo/run.py index 4c5c13549184..9f670e3d60ed 100644 --- a/sw/qa/uitest/librelogo/run.py +++ b/sw/qa/uitest/librelogo/run.py @@ -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 diff --git a/sw/qa/uitest/navigator/tdf154521.py b/sw/qa/uitest/navigator/tdf154521.py index 65a86e7be613..3990a7091a11 100644 --- a/sw/qa/uitest/navigator/tdf154521.py +++ b/sw/qa/uitest/navigator/tdf154521.py @@ -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: diff --git a/sw/qa/uitest/table/sheetToTable.py b/sw/qa/uitest/table/sheetToTable.py index 4a40b6966935..372ea46884ac 100644 --- a/sw/qa/uitest/table/sheetToTable.py +++ b/sw/qa/uitest/table/sheetToTable.py @@ -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") diff --git a/sw/qa/uitest/table/splitTable.py b/sw/qa/uitest/table/splitTable.py index 06af8ee6c89d..b5b3c8cf4bf0 100644 --- a/sw/qa/uitest/table/splitTable.py +++ b/sw/qa/uitest/table/splitTable.py @@ -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")): diff --git a/sw/qa/uitest/table/tableToText.py b/sw/qa/uitest/table/tableToText.py index 0816cda7e607..2735285fc2c5 100644 --- a/sw/qa/uitest/table/tableToText.py +++ b/sw/qa/uitest/table/tableToText.py @@ -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: diff --git a/sw/qa/uitest/table/tdf51352.py b/sw/qa/uitest/table/tdf51352.py index 4a2fa79d5578..f8e741c19b25 100644 --- a/sw/qa/uitest/table/tdf51352.py +++ b/sw/qa/uitest/table/tdf51352.py @@ -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: diff --git a/sw/qa/uitest/table/tdf53460.py b/sw/qa/uitest/table/tdf53460.py index b0e8fcabaaf1..866dcaaddfbc 100644 --- a/sw/qa/uitest/table/tdf53460.py +++ b/sw/qa/uitest/table/tdf53460.py @@ -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: diff --git a/sw/qa/uitest/table/textToTable.py b/sw/qa/uitest/table/textToTable.py index 5b70b89cc978..bde7433b4315 100644 --- a/sw/qa/uitest/table/textToTable.py +++ b/sw/qa/uitest/table/textToTable.py @@ -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: diff --git a/sw/qa/uitest/ui/frmdlg/frmdlg.py b/sw/qa/uitest/ui/frmdlg/frmdlg.py index f7e91269c299..aa2d4fba7aff 100644 --- a/sw/qa/uitest/ui/frmdlg/frmdlg.py +++ b/sw/qa/uitest/ui/frmdlg/frmdlg.py @@ -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: diff --git a/sw/qa/uitest/writer_tests/insertCaption.py b/sw/qa/uitest/writer_tests/insertCaption.py index e2ed71e2459e..7002c748bd8d 100644 --- a/sw/qa/uitest/writer_tests/insertCaption.py +++ b/sw/qa/uitest/writer_tests/insertCaption.py @@ -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: diff --git a/sw/qa/uitest/writer_tests2/insertFootnote.py b/sw/qa/uitest/writer_tests2/insertFootnote.py index 176794684051..adbf1235767c 100644 --- a/sw/qa/uitest/writer_tests2/insertFootnote.py +++ b/sw/qa/uitest/writer_tests2/insertFootnote.py @@ -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") diff --git a/sw/qa/uitest/writer_tests2/tdf116474.py b/sw/qa/uitest/writer_tests2/tdf116474.py index f24746c12280..aebd1123d6b3 100644 --- a/sw/qa/uitest/writer_tests2/tdf116474.py +++ b/sw/qa/uitest/writer_tests2/tdf116474.py @@ -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: diff --git a/sw/qa/uitest/writer_tests2/tdf133299.py b/sw/qa/uitest/writer_tests2/tdf133299.py index 154cf456a4a2..ca32f251bfbb 100644 --- a/sw/qa/uitest/writer_tests2/tdf133299.py +++ b/sw/qa/uitest/writer_tests2/tdf133299.py @@ -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' diff --git a/sw/qa/uitest/writer_tests3/insertEndnote.py b/sw/qa/uitest/writer_tests3/insertEndnote.py index 46226499d409..11795c489616 100644 --- a/sw/qa/uitest/writer_tests3/insertEndnote.py +++ b/sw/qa/uitest/writer_tests3/insertEndnote.py @@ -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") diff --git a/sw/qa/uitest/writer_tests3/insertFootEndnote.py b/sw/qa/uitest/writer_tests3/insertFootEndnote.py index d9ca31f36e38..e398a356769c 100644 --- a/sw/qa/uitest/writer_tests3/insertFootEndnote.py +++ b/sw/qa/uitest/writer_tests3/insertFootEndnote.py @@ -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"): diff --git a/sw/qa/uitest/writer_tests3/insertQrCodeGen.py b/sw/qa/uitest/writer_tests3/insertQrCodeGen.py index 241d87eccdbc..14856fd8da6b 100644 --- a/sw/qa/uitest/writer_tests3/insertQrCodeGen.py +++ b/sw/qa/uitest/writer_tests3/insertQrCodeGen.py @@ -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) diff --git a/sw/qa/uitest/writer_tests3/insertSignatureLine.py b/sw/qa/uitest/writer_tests3/insertSignatureLine.py index 03e87daf2ffe..80d1b4edc4dd 100644 --- a/sw/qa/uitest/writer_tests3/insertSignatureLine.py +++ b/sw/qa/uitest/writer_tests3/insertSignatureLine.py @@ -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") diff --git a/sw/qa/uitest/writer_tests3/tdf79236.py b/sw/qa/uitest/writer_tests3/tdf79236.py index d7b59da19f63..45ca76f7b35f 100644 --- a/sw/qa/uitest/writer_tests3/tdf79236.py +++ b/sw/qa/uitest/writer_tests3/tdf79236.py @@ -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: diff --git a/sw/qa/uitest/writer_tests4/exportToPDF.py b/sw/qa/uitest/writer_tests4/exportToPDF.py index a075e6a4c773..7d747d269a64 100644 --- a/sw/qa/uitest/writer_tests4/exportToPDF.py +++ b/sw/qa/uitest/writer_tests4/exportToPDF.py @@ -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: diff --git a/sw/qa/uitest/writer_tests5/tdf106899.py b/sw/qa/uitest/writer_tests5/tdf106899.py index 3a81913e96ac..38f2b715104b 100644 --- a/sw/qa/uitest/writer_tests5/tdf106899.py +++ b/sw/qa/uitest/writer_tests5/tdf106899.py @@ -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() diff --git a/sw/qa/uitest/writer_tests5/tdf138531.py b/sw/qa/uitest/writer_tests5/tdf138531.py index d2a86864288c..f4c4ae2994e7 100644 --- a/sw/qa/uitest/writer_tests5/tdf138531.py +++ b/sw/qa/uitest/writer_tests5/tdf138531.py @@ -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()) diff --git a/sw/qa/uitest/writer_tests5/tdf142847.py b/sw/qa/uitest/writer_tests5/tdf142847.py index 54cbf8291dbc..332e95051f52 100644 --- a/sw/qa/uitest/writer_tests5/tdf142847.py +++ b/sw/qa/uitest/writer_tests5/tdf142847.py @@ -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() diff --git a/sw/qa/uitest/writer_tests5/tdf145326.py b/sw/qa/uitest/writer_tests5/tdf145326.py index 7df98e825d17..6a4d9e361495 100644 --- a/sw/qa/uitest/writer_tests5/tdf145326.py +++ b/sw/qa/uitest/writer_tests5/tdf145326.py @@ -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) diff --git a/sw/qa/uitest/writer_tests5/tdf147935.py b/sw/qa/uitest/writer_tests5/tdf147935.py index eef8d143ab9f..f1d8c399b5d9 100644 --- a/sw/qa/uitest/writer_tests5/tdf147935.py +++ b/sw/qa/uitest/writer_tests5/tdf147935.py @@ -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()) diff --git a/sw/qa/uitest/writer_tests5/tdf150151.py b/sw/qa/uitest/writer_tests5/tdf150151.py index 3b7bd21f5e71..9e51fa3546b8 100644 --- a/sw/qa/uitest/writer_tests5/tdf150151.py +++ b/sw/qa/uitest/writer_tests5/tdf150151.py @@ -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: diff --git a/sw/qa/uitest/writer_tests6/tdf107847.py b/sw/qa/uitest/writer_tests6/tdf107847.py index 5905cd6d7da4..41e6433cfca1 100644 --- a/sw/qa/uitest/writer_tests6/tdf107847.py +++ b/sw/qa/uitest/writer_tests6/tdf107847.py @@ -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: diff --git a/sw/qa/uitest/writer_tests6/tdf118883.py b/sw/qa/uitest/writer_tests6/tdf118883.py index 20e58c32d4bb..316120b80065 100644 --- a/sw/qa/uitest/writer_tests6/tdf118883.py +++ b/sw/qa/uitest/writer_tests6/tdf118883.py @@ -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: diff --git a/sw/qa/uitest/writer_tests6/tdf126168.py b/sw/qa/uitest/writer_tests6/tdf126168.py index 16e5fc6fbc2c..cea599f0ac21 100644 --- a/sw/qa/uitest/writer_tests6/tdf126168.py +++ b/sw/qa/uitest/writer_tests6/tdf126168.py @@ -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") diff --git a/sw/qa/uitest/writer_tests7/forms.py b/sw/qa/uitest/writer_tests7/forms.py index 3d6cbf410888..621c5f0afdfa 100644 --- a/sw/qa/uitest/writer_tests7/forms.py +++ b/sw/qa/uitest/writer_tests7/forms.py @@ -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) diff --git a/sw/qa/uitest/writer_tests7/tdf132169.py b/sw/qa/uitest/writer_tests7/tdf132169.py index 75a4f27bd4c7..134ee44864d1 100644 --- a/sw/qa/uitest/writer_tests7/tdf132169.py +++ b/sw/qa/uitest/writer_tests7/tdf132169.py @@ -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) diff --git a/sw/qa/uitest/writer_tests7/tdf132714.py b/sw/qa/uitest/writer_tests7/tdf132714.py index d2a71587ed77..fdeb4301d299 100644 --- a/sw/qa/uitest/writer_tests7/tdf132714.py +++ b/sw/qa/uitest/writer_tests7/tdf132714.py @@ -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() diff --git a/sw/qa/uitest/writer_tests7/tdf137802.py b/sw/qa/uitest/writer_tests7/tdf137802.py index 8616e52553a5..d545d406db37 100644 --- a/sw/qa/uitest/writer_tests7/tdf137802.py +++ b/sw/qa/uitest/writer_tests7/tdf137802.py @@ -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: diff --git a/sw/qa/uitest/writer_tests7/tdf137803.py b/sw/qa/uitest/writer_tests7/tdf137803.py index 3954caca1bc2..f987cdee5477 100644 --- a/sw/qa/uitest/writer_tests7/tdf137803.py +++ b/sw/qa/uitest/writer_tests7/tdf137803.py @@ -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() diff --git a/sw/qa/uitest/writer_tests7/tdf140117.py b/sw/qa/uitest/writer_tests7/tdf140117.py index 835d99219fae..5d83e39fb9c7 100644 --- a/sw/qa/uitest/writer_tests7/tdf140117.py +++ b/sw/qa/uitest/writer_tests7/tdf140117.py @@ -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 diff --git a/sw/qa/uitest/writer_tests7/tdf141158.py b/sw/qa/uitest/writer_tests7/tdf141158.py index 8691d801ebc9..9e2e7f0c3c13 100644 --- a/sw/qa/uitest/writer_tests7/tdf141158.py +++ b/sw/qa/uitest/writer_tests7/tdf141158.py @@ -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) diff --git a/sw/qa/uitest/writer_tests7/tdf141557.py b/sw/qa/uitest/writer_tests7/tdf141557.py index 50c12949c040..9178e9d2c7a1 100644 --- a/sw/qa/uitest/writer_tests7/tdf141557.py +++ b/sw/qa/uitest/writer_tests7/tdf141557.py @@ -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: diff --git a/sw/qa/uitest/writer_tests7/tdf46561.py b/sw/qa/uitest/writer_tests7/tdf46561.py index 575053a4f2af..72d54ae2b6dd 100644 --- a/sw/qa/uitest/writer_tests7/tdf46561.py +++ b/sw/qa/uitest/writer_tests7/tdf46561.py @@ -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) 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