[Libreoffice-commits] core.git: sc/qa sw/qa

Mayank Suman (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 24 12:25:15 UTC 2019


 sc/qa/python/CalcRTL.py                      |    2 +-
 sc/qa/uitest/calc_tests6/moveCopySheet.py    |   12 ++++++------
 sw/qa/python/check_styles.py                 |    8 ++++----
 sw/qa/python/var_fields.py                   |    2 +-
 sw/qa/uitest/writer_tests/insertCaption.py   |   10 +++++-----
 sw/qa/uitest/writer_tests2/insertFootnote.py |    8 ++++----
 sw/qa/uitest/writer_tests2/tdf116474.py      |    8 ++++----
 sw/qa/uitest/writer_tests3/insertEndnote.py  |    8 ++++----
 sw/qa/uitest/writer_tests6/tdf107975.py      |    2 +-
 sw/qa/uitest/writer_tests6/tdf44837.py       |    2 +-
 10 files changed, 31 insertions(+), 31 deletions(-)

New commits:
commit d5dc19402e2b390aedd92ed94d0cd2444fd4478f
Author:     Mayank Suman <mayanksuman at live.com>
AuthorDate: Thu Oct 3 19:37:36 2019 +0530
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Thu Oct 24 14:23:45 2019 +0200

    tdf#97361: Removed getByIndex in calc and writer
    
    Change-Id: I477e1129d7b8deb91920b3ffd715bc217e606d20
    Reviewed-on: https://gerrit.libreoffice.org/80140
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/sc/qa/python/CalcRTL.py b/sc/qa/python/CalcRTL.py
index 065cc596eabf..6c8e3e9b4a64 100644
--- a/sc/qa/python/CalcRTL.py
+++ b/sc/qa/python/CalcRTL.py
@@ -70,7 +70,7 @@ class CalcRTL(unittest.TestCase):
         return worked
 
     def getSpreadsheet(self):
-        return self.xSheetDoc.getSheets().getByIndex(0)
+        return self.xSheetDoc.getSheets()[0]
 
 if __name__ == '__main__':
     unittest.main()
diff --git a/sc/qa/uitest/calc_tests6/moveCopySheet.py b/sc/qa/uitest/calc_tests6/moveCopySheet.py
index 7c5d50256f51..be9abaecb1fb 100644
--- a/sc/qa/uitest/calc_tests6/moveCopySheet.py
+++ b/sc/qa/uitest/calc_tests6/moveCopySheet.py
@@ -46,21 +46,21 @@ class moveCopySheet(UITestCase):
         newName.executeAction("TYPE", mkPropertyValues({"TEXT":"moveName"}))
         xOKBtn = xDialog.getChild("ok")
         self.ui_test.close_dialog_through_button(xOKBtn)
-        #verify, the file has 2 sheets; first one is "Sheet1" ; second one is "moveName"
+        # Verify, the file has 2 sheets; first one is "Sheet1" ; second one is "moveName"
         self.assertEqual(document.Sheets.getCount(), 2)
 
-        self.assertEqual(document.Sheets.getByIndex(0).Name, "Sheet1")
-        self.assertEqual(document.Sheets.getByIndex(1).Name, "moveName")
+        self.assertEqual(document.Sheets[0].Name, "Sheet1")
+        self.assertEqual(document.Sheets[1].Name, "moveName")
 
-        #verify that the cancel button does not do anything
+        # Verify that the cancel button does not do anything
         self.ui_test.execute_dialog_through_command(".uno:Move")
         xDialog = self.xUITest.getTopFocusWindow()
         xCancelBtn = xDialog.getChild("cancel")
         self.ui_test.close_dialog_through_button(xCancelBtn)
 
         self.assertEqual(document.Sheets.getCount(), 2)
-        self.assertEqual(document.Sheets.getByIndex(0).Name, "Sheet1")
-        self.assertEqual(document.Sheets.getByIndex(1).Name, "moveName")
+        self.assertEqual(document.Sheets[0].Name, "Sheet1")
+        self.assertEqual(document.Sheets[1].Name, "moveName")
 
         self.ui_test.close_doc()
 
diff --git a/sw/qa/python/check_styles.py b/sw/qa/python/check_styles.py
index 8746c479fbbe..c0c3a24e2a02 100644
--- a/sw/qa/python/check_styles.py
+++ b/sw/qa/python/check_styles.py
@@ -77,10 +77,10 @@ class CheckStyle(unittest.TestCase):
         self.assertListEqual(vNames, vExpectedNames)
 
     def __test_StyleFamilyIndex(self, xFamily, vExpectedNames, sElementImplName):
-        self.assertEqual(xFamily.Count, len(vExpectedNames))
+        self.assertEqual(len(xFamily), len(vExpectedNames))
 
-        for nIndex in range(xFamily.Count):
-            xStyle = xFamily.getByIndex(nIndex)
+        for nIndex in range(len(xFamily)):
+            xStyle = xFamily[nIndex]
             self.assertEqual(xStyle.ImplementationName, sElementImplName)
             self.assertIn(xStyle.Name, vExpectedNames)
             self.assertFalse(xStyle.isUserDefined())
@@ -176,7 +176,7 @@ class CheckStyle(unittest.TestCase):
             self.assertIsNotNone(xTableStyles.getByName(sStyleName))
         #check SwXTextCellStyles
         vCellStyles = ["first-row", "last-row", "first-column", "last-column", "body", "even-rows", "odd-rows", "even-columns", "odd-columns", "background"]
-        xDefaultTableStyle = xTableStyles.getByIndex(0)
+        xDefaultTableStyle = xTableStyles[0]
         for sCellStyle in vCellStyles:
             xCellStyle = xDefaultTableStyle.getByName(sCellStyle)
             self.assertIsNotNone(xCellStyle.getPropertyValue("BackColor"))
diff --git a/sw/qa/python/var_fields.py b/sw/qa/python/var_fields.py
index e793aaa5f7ec..0c88b5357732 100644
--- a/sw/qa/python/var_fields.py
+++ b/sw/qa/python/var_fields.py
@@ -126,7 +126,7 @@ class TestVarFields(unittest.TestCase):
         xDoc.storeToURL(url, tuple(list(range(0))))
 
         # 19. retrieve the section
-        xSection = xDoc.getTextSections().getByIndex(0)
+        xSection = xDoc.getTextSections()[0]
 
         # 20. retrieve the condition property of that section
         read_content = xSection.getPropertyValue("Condition")
diff --git a/sw/qa/uitest/writer_tests/insertCaption.py b/sw/qa/uitest/writer_tests/insertCaption.py
index 6cf30022cf64..b516cf9b16db 100644
--- a/sw/qa/uitest/writer_tests/insertCaption.py
+++ b/sw/qa/uitest/writer_tests/insertCaption.py
@@ -41,9 +41,9 @@ class insertCaption(UITestCase):
         xOkBtn=xDialogCaption.getChild("ok")
         xOkBtn.executeAction("CLICK", tuple())
 
-        xFrame = document.TextFrames.getByIndex(0)
+        xFrame = document.TextFrames[0]
 
-        self.assertEqual(document.TextFrames.getByIndex(0).Text.String, "\nText 1: Caption")
+        self.assertEqual(document.TextFrames[0].Text.String, "\nText 1: Caption")
 
         self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog")   # 2nd caption
         xDialogCaption = self.xUITest.getTopFocusWindow()
@@ -55,7 +55,7 @@ class insertCaption(UITestCase):
         xOkBtn=xDialogCaption.getChild("ok")
         xOkBtn.executeAction("CLICK", tuple())
 
-        self.assertEqual(document.TextFrames.getByIndex(0).Text.String, "\nText 1: Caption\nText 2-: Caption2")
+        self.assertEqual(document.TextFrames[0].Text.String, "\nText 1: Caption\nText 2-: Caption2")
 
         self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog")   # 3. caption
         xDialogCaption = self.xUITest.getTopFocusWindow()
@@ -69,8 +69,8 @@ class insertCaption(UITestCase):
         xOkBtn=xDialogCaption.getChild("ok")
         xOkBtn.executeAction("CLICK", tuple())
 
-        self.assertEqual(document.TextFrames.getByIndex(0).Text.String, "\nText 1: Caption\nText 2-: Caption2\nText 3--: Caption3")
+        self.assertEqual(document.TextFrames[0].Text.String, "\nText 1: Caption\nText 2-: Caption2\nText 3--: Caption3")
 
         self.ui_test.close_doc()
 
-# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/insertFootnote.py b/sw/qa/uitest/writer_tests2/insertFootnote.py
index 77da452c4c26..6bd4db73f0bc 100644
--- a/sw/qa/uitest/writer_tests2/insertFootnote.py
+++ b/sw/qa/uitest/writer_tests2/insertFootnote.py
@@ -21,18 +21,18 @@ class insertFootnote(UITestCase):
         self.xUITest.executeCommand(".uno:InsertFootnote")
 
         type_text(xWriterEdit, "LibreOffice")
-        self.assertEqual(document.Footnotes.getByIndex(0).String, "LibreOffice")
+        self.assertEqual(document.Footnotes[0].String, "LibreOffice")
         self.assertEqual(document.Footnotes.getCount(), 1)
 
         self.xUITest.executeCommand(".uno:Undo")
-        self.assertEqual(document.Footnotes.getByIndex(0).String, "")
+        self.assertEqual(document.Footnotes[0].String, "")
         self.xUITest.executeCommand(".uno:Undo")
         self.assertEqual(document.Footnotes.getCount(), 0)
         self.xUITest.executeCommand(".uno:Redo")
-        self.assertEqual(document.Footnotes.getByIndex(0).String, "")
+        self.assertEqual(document.Footnotes[0].String, "")
         self.assertEqual(document.Footnotes.getCount(), 1)
         self.xUITest.executeCommand(".uno:Redo")
-        self.assertEqual(document.Footnotes.getByIndex(0).String, "LibreOffice")
+        self.assertEqual(document.Footnotes[0].String, "LibreOffice")
 
         self.ui_test.close_doc()
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/tdf116474.py b/sw/qa/uitest/writer_tests2/tdf116474.py
index 2d6ddb251cab..e85943d77043 100644
--- a/sw/qa/uitest/writer_tests2/tdf116474.py
+++ b/sw/qa/uitest/writer_tests2/tdf116474.py
@@ -29,7 +29,7 @@ class tdf116474(UITestCase):
         textGraphic.Graphic = graphic
         text.insertTextContent(cursor, textGraphic, False)
         #select image
-        document.getCurrentController().select(document.getDrawPage().getByIndex(0))
+        document.getCurrentController().select(document.getDrawPage()[0])
 
         self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog")   #  caption
         xDialogCaption = self.xUITest.getTopFocusWindow()
@@ -40,14 +40,14 @@ class tdf116474(UITestCase):
         xOkBtn=xDialogCaption.getChild("ok")
         xOkBtn.executeAction("CLICK", tuple())
 
-        xFrame = document.TextFrames.getByIndex(0)
-        self.assertEqual(document.TextFrames.getByIndex(0).Text.String, "\nFigure 1: Caption")
+        xFrame = document.TextFrames[0]
+        self.assertEqual(document.TextFrames[0].Text.String, "\nFigure 1: Caption")
         self.assertEqual(document.GraphicObjects.getCount(), 1)  #nr. of images
         #Undo, redo
         self.xUITest.executeCommand(".uno:Undo")
         self.xUITest.executeCommand(".uno:Redo")
         #Verify
-        self.assertEqual(document.TextFrames.getByIndex(0).Text.String, "\nFigure 1: Caption")
+        self.assertEqual(document.TextFrames[0].Text.String, "\nFigure 1: Caption")
         self.assertEqual(document.GraphicObjects.getCount(), 1)  #nr. of images
 
         self.ui_test.close_doc()
diff --git a/sw/qa/uitest/writer_tests3/insertEndnote.py b/sw/qa/uitest/writer_tests3/insertEndnote.py
index 4dec491781cf..705fce6cef54 100644
--- a/sw/qa/uitest/writer_tests3/insertEndnote.py
+++ b/sw/qa/uitest/writer_tests3/insertEndnote.py
@@ -22,17 +22,17 @@ class insertEndnote(UITestCase):
 
         type_text(xWriterEdit, "LibreOffice")
 
-        self.assertEqual(document.Endnotes.getByIndex(0).String, "LibreOffice")
+        self.assertEqual(document.Endnotes[0].String, "LibreOffice")
         self.assertEqual(document.Endnotes.getCount(), 1)
         self.xUITest.executeCommand(".uno:Undo")
-        self.assertEqual(document.Endnotes.getByIndex(0).String, "")
+        self.assertEqual(document.Endnotes[0].String, "")
         self.xUITest.executeCommand(".uno:Undo")
         self.assertEqual(document.Endnotes.getCount(), 0)
         self.xUITest.executeCommand(".uno:Redo")
-        self.assertEqual(document.Endnotes.getByIndex(0).String, "")
+        self.assertEqual(document.Endnotes[0].String, "")
         self.assertEqual(document.Endnotes.getCount(), 1)
         self.xUITest.executeCommand(".uno:Redo")
-        self.assertEqual(document.Endnotes.getByIndex(0).String, "LibreOffice")
+        self.assertEqual(document.Endnotes[0].String, "LibreOffice")
 
         self.ui_test.close_doc()
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf107975.py b/sw/qa/uitest/writer_tests6/tdf107975.py
index 333c0f77b820..9dea24dd57d3 100644
--- a/sw/qa/uitest/writer_tests6/tdf107975.py
+++ b/sw/qa/uitest/writer_tests6/tdf107975.py
@@ -51,7 +51,7 @@ class tdf107975(UITestCase):
         self.assertEqual(writer_doc.getGraphicObjects().getCount(), 1)
 
         # try again with anchor at start of doc which is another special case
-        xShape = writer_doc.getGraphicObjects().getByIndex(0)
+        xShape = writer_doc.getGraphicObjects()[0]
         xStart = writer_doc.getText().getStart()
         xShape.attach(xStart)
 
diff --git a/sw/qa/uitest/writer_tests6/tdf44837.py b/sw/qa/uitest/writer_tests6/tdf44837.py
index 73d30be0e65c..8354709da8ab 100644
--- a/sw/qa/uitest/writer_tests6/tdf44837.py
+++ b/sw/qa/uitest/writer_tests6/tdf44837.py
@@ -39,7 +39,7 @@ class tdf44837(UITestCase):
         self.ui_test.close_dialog_through_button(xcloseBtn)
 
         self.assertEqual(document.Text.String[0:8], "bsd bsd")
-        self.assertEqual(len(document.CurrentSelection.getByIndex(0).String) > 1, True)
+        self.assertEqual(len(document.CurrentSelection[0].String) > 1, True)
         #follow-up bug 125663
         self.ui_test.close_doc()
 


More information about the Libreoffice-commits mailing list