[Libreoffice-commits] dev-tools.git: 3 commits - uitest/mass-testing

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Apr 24 12:17:41 UTC 2019


 uitest/mass-testing/calc.py |  194 ++++++++++++++++++++++++++------------------
 uitest/mass-testing/run.py  |   11 +-
 2 files changed, 127 insertions(+), 78 deletions(-)

New commits:
commit ed1ccab0acf93bb91158f656ccd8c8f96f5cc9ae
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Wed Apr 24 11:20:54 2019 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Wed Apr 24 11:20:54 2019 +0200

    mass-uitesting: keep results if resume is used

diff --git a/uitest/mass-testing/run.py b/uitest/mass-testing/run.py
index 40d88c6..18f45a7 100755
--- a/uitest/mass-testing/run.py
+++ b/uitest/mass-testing/run.py
@@ -91,12 +91,15 @@ def run_tests_and_get_results(liboPath, listFiles, isDebug, isResume):
                 filesRun = pickle.load(pickle_in)
 
         if sourceHash not in filesRun:
-            filesRun[sourceHash] = []
+            filesRun[sourceHash] = {'files': []}
+
+        if 'results' in filesRun[sourceHash]:
+            results = filesRun[sourceHash]['results']
 
     for fileName in listFiles:
 
         if isResume:
-            if fileName in filesRun[sourceHash]:
+            if fileName in filesRun[sourceHash]['files']:
                 print("SKIP: " + fileName)
                 continue
 
@@ -193,7 +196,9 @@ def run_tests_and_get_results(liboPath, listFiles, isDebug, isResume):
                 break
 
         if isResume:
-            filesRun[sourceHash].append(fileName)
+            filesRun[sourceHash]['files'].append(fileName)
+
+            filesRun[sourceHash]['results'] = results
 
             with open(pklFile, 'wb') as pickle_out:
                 pickle.dump(filesRun, pickle_out)
commit 94d928c4859f964f184cfb46e5e4040898038f9f
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Wed Apr 24 02:24:51 2019 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Wed Apr 24 10:57:42 2019 +0200

    mass-uitesting: Perform all tests in more sheets

diff --git a/uitest/mass-testing/calc.py b/uitest/mass-testing/calc.py
index d6f0122..a6911ad 100755
--- a/uitest/mass-testing/calc.py
+++ b/uitest/mass-testing/calc.py
@@ -10,6 +10,9 @@ from uitest.framework import UITestCase
 from libreoffice.uno.propertyvalue import mkPropertyValues
 import time
 
+#Max number of sheets to jump to
+maxSheets = 10
+
 class massTesting(UITestCase):
 
     def load_file(self):
@@ -40,91 +43,126 @@ class massTesting(UITestCase):
 
         return xEdit
 
+    def go_to_first_sheet(self):
+        document = self.ui_test.get_component()
+        nrSheets = document.Sheets.getCount()  #number of sheets in the document
+        #go to first sheet
+        for i in range(nrSheets - 1):
+            self.xUITest.executeCommand(".uno:JumpToPrevTable")
+
+            # Make sure all sheets are visible
+            self.xUITest.executeCommand(".uno:Hide")
+            self.xUITest.executeCommand(".uno:Show")
+            xDialog = self.xUITest.getTopFocusWindow()
+            xOKBtn = xDialog.getChild("ok")
+            self.ui_test.close_dialog_through_button(xOKBtn)
+
+        return nrSheets
+
     def test_remove_all_and_undo(self):
         xEdit = self.load_file()
         if xEdit:
-            self.xUITest.executeCommand(".uno:SelectAll")
-            xEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DELETE"}))
+            nrSheets = self.go_to_first_sheet()
 
-            self.xUITest.executeCommand(".uno:Undo")
+            for i in range(nrSheets)[:maxSheets]:
+                self.xUITest.executeCommand(".uno:SelectAll")
+                xEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DELETE"}))
+
+                self.xUITest.executeCommand(".uno:Undo")
+                self.xUITest.executeCommand(".uno:JumpToNextTable")
 
         self.ui_test.close_doc()
 
     def test_insert_column_and_undo(self):
         xEdit = self.load_file()
         if xEdit:
-            self.xUITest.executeCommand(".uno:InsertColumnsBefore")
-            self.xUITest.executeCommand(".uno:Undo")
+            nrSheets = self.go_to_first_sheet()
+
+            for i in range(nrSheets)[:maxSheets]:
+                self.xUITest.executeCommand(".uno:InsertColumnsBefore")
+                self.xUITest.executeCommand(".uno:Undo")
+                self.xUITest.executeCommand(".uno:JumpToNextTable")
 
         self.ui_test.close_doc()
 
     def test_insert_row_and_undo(self):
         xEdit = self.load_file()
         if xEdit:
-            self.xUITest.executeCommand(".uno:InsertRowsBefore")
-            self.xUITest.executeCommand(".uno:Undo")
+            nrSheets = self.go_to_first_sheet()
+
+            for i in range(nrSheets)[:maxSheets]:
+                self.xUITest.executeCommand(".uno:InsertRowsBefore")
+                self.xUITest.executeCommand(".uno:Undo")
+                self.xUITest.executeCommand(".uno:JumpToNextTable")
 
         self.ui_test.close_doc()
 
     def test_copy_all_paste_undo(self):
         xEdit = self.load_file()
         if xEdit:
-            self.xUITest.executeCommand(".uno:SelectAll")
+            nrSheets = self.go_to_first_sheet()
 
-            self.xUITest.executeCommand(".uno:Copy")
+            for i in range(nrSheets)[:maxSheets]:
+                self.xUITest.executeCommand(".uno:SelectAll")
 
-            for i in range(5):
-                self.xUITest.executeCommand(".uno:Paste")
+                self.xUITest.executeCommand(".uno:Copy")
 
-            for i in range(5):
-                self.xUITest.executeCommand(".uno:Undo")
+                for i in range(5):
+                    self.xUITest.executeCommand(".uno:Paste")
+
+                for i in range(5):
+                    self.xUITest.executeCommand(".uno:Undo")
+
+                self.xUITest.executeCommand(".uno:JumpToNextTable")
 
         self.ui_test.close_doc()
 
     def test_print_preview(self):
         xEdit = self.load_file()
         if xEdit:
-            self.xUITest.executeCommand(".uno:PrintPreview")  #open print preview
-            self.xUITest.executeCommand(".uno:ClosePreview")  # close print preview
+            nrSheets = self.go_to_first_sheet()
 
-            self.xUITest.getTopFocusWindow()
+            for i in range(nrSheets)[:maxSheets]:
+                self.xUITest.executeCommand(".uno:PrintPreview")  #open print preview
+                self.xUITest.executeCommand(".uno:ClosePreview")  # close print preview
+                self.xUITest.executeCommand(".uno:JumpToNextTable")
+
+                self.xUITest.getTopFocusWindow()
 
         self.ui_test.close_doc()
 
     def test_hide_column_and_undo(self):
         xEdit = self.load_file()
         if xEdit:
-            self.xUITest.executeCommand(".uno:HideColumn")
-            self.xUITest.executeCommand(".uno:Undo")
+            nrSheets = self.go_to_first_sheet()
+
+            for i in range(nrSheets)[:maxSheets]:
+                self.xUITest.executeCommand(".uno:HideColumn")
+                self.xUITest.executeCommand(".uno:Undo")
+                self.xUITest.executeCommand(".uno:JumpToNextTable")
 
         self.ui_test.close_doc()
 
     def test_hide_row_and_undo(self):
         xEdit = self.load_file()
         if xEdit:
-            self.xUITest.executeCommand(".uno:HideRow")
-            self.xUITest.executeCommand(".uno:Undo")
+            nrSheets = self.go_to_first_sheet()
+
+            for i in range(nrSheets)[:maxSheets]:
+                self.xUITest.executeCommand(".uno:HideRow")
+                self.xUITest.executeCommand(".uno:Undo")
+                self.xUITest.executeCommand(".uno:JumpToNextTable")
 
         self.ui_test.close_doc()
 
     def test_copy_sheet_undo_delete_sheet(self):
         xEdit = self.load_file()
         if xEdit:
-            document = self.ui_test.get_component()
-            nrSheets = document.Sheets.getCount()  #number of sheets in the document
-            #go to first sheet
-            for i in range(nrSheets - 1):
-                self.xUITest.executeCommand(".uno:JumpToPrevTable")
-
-                # Make sure all sheets are visible
-                self.xUITest.executeCommand(".uno:Hide")
-                self.xUITest.executeCommand(".uno:Show")
-                xDialog = self.xUITest.getTopFocusWindow()
-                xOKBtn = xDialog.getChild("ok")
-                self.ui_test.close_dialog_through_button(xOKBtn)
+            nrSheets = self.go_to_first_sheet()
 
             ignoreSheets = 0
-            for i in range(nrSheets):
+            document = self.ui_test.get_component()
+            for i in range(nrSheets)[:maxSheets]:
                 #copy sheet, undo and delete
                 self.ui_test.execute_dialog_through_command(".uno:Move")
                 xDialog = self.xUITest.getTopFocusWindow()
@@ -148,62 +186,61 @@ class massTesting(UITestCase):
                         xOKButton = xDialog.getChild("yes")
                         xOKButton.executeAction("CLICK", tuple())
 
-            self.assertEqual(document.Sheets.getCount(), 1 + ignoreSheets)
+            self.assertEqual(document.Sheets.getCount(), 1 + ignoreSheets + len(range(nrSheets)[maxSheets + 1:]))
 
         self.ui_test.close_doc()
 
     def test_change_text_formatting_and_undo(self):
         xEdit = self.load_file()
         if xEdit:
-            document = self.ui_test.get_component()
-            nrSheets = document.Sheets.getCount()  #number of sheets in the document
+            nrSheets = self.go_to_first_sheet()
 
-            #go to first sheet
-            for i in range(nrSheets - 1):
-                self.xUITest.executeCommand(".uno:JumpToPrevTable")
-
-            if not document.Sheets[0].isProtected():
-                self.xUITest.executeCommand(".uno:SelectAll")
-                self.xUITest.executeCommand(".uno:Bold")
-                self.xUITest.executeCommand(".uno:Undo")
-                self.xUITest.executeCommand(".uno:Italic")
-                self.xUITest.executeCommand(".uno:Undo")
-                self.xUITest.executeCommand(".uno:Underline")
-                self.xUITest.executeCommand(".uno:Undo")
-                self.xUITest.executeCommand(".uno:UnderlineDouble")
-                self.xUITest.executeCommand(".uno:Undo")
-                self.xUITest.executeCommand(".uno:Strikeout")
-                self.xUITest.executeCommand(".uno:Undo")
-                self.xUITest.executeCommand(".uno:Overline")
-                self.xUITest.executeCommand(".uno:Undo")
-                self.xUITest.executeCommand(".uno:SuperScript")
-                self.xUITest.executeCommand(".uno:Undo")
-                self.xUITest.executeCommand(".uno:SubScript")
-                self.xUITest.executeCommand(".uno:Undo")
-                self.xUITest.executeCommand(".uno:Shadowed")
-                self.xUITest.executeCommand(".uno:Undo")
-                self.xUITest.executeCommand(".uno:OutlineFont")
-                self.xUITest.executeCommand(".uno:Undo")
-                self.xUITest.executeCommand(".uno:Grow")
-                self.xUITest.executeCommand(".uno:Undo")
-                self.xUITest.executeCommand(".uno:Shrink")
-                self.xUITest.executeCommand(".uno:Undo")
-                self.xUITest.executeCommand(".uno:ChangeCaseToUpper")
-                self.xUITest.executeCommand(".uno:Undo")
-                self.xUITest.executeCommand(".uno:ChangeCaseToLower")
-                self.xUITest.executeCommand(".uno:Undo")
-                self.xUITest.executeCommand(".uno:ChangeCaseRotateCase")
-                self.xUITest.executeCommand(".uno:Undo")
-                self.xUITest.executeCommand(".uno:ChangeCaseToSentenceCase")
-                self.xUITest.executeCommand(".uno:Undo")
-                self.xUITest.executeCommand(".uno:ChangeCaseToTitleCase")
-                self.xUITest.executeCommand(".uno:Undo")
-                self.xUITest.executeCommand(".uno:ChangeCaseToToggleCase")
-                self.xUITest.executeCommand(".uno:Undo")
-                self.xUITest.executeCommand(".uno:SmallCaps")
-                self.xUITest.executeCommand(".uno:Undo")
-                self.xUITest.executeCommand(".uno:StyleApply?Style:string=Heading%202&FamilyName:string=ParagraphStyles")
-                self.xUITest.executeCommand(".uno:Undo")
+            document = self.ui_test.get_component()
+            for i in range(nrSheets)[:maxSheets]:
+                if not document.Sheets[i].isProtected():
+                    self.xUITest.executeCommand(".uno:SelectAll")
+                    self.xUITest.executeCommand(".uno:Bold")
+                    self.xUITest.executeCommand(".uno:Undo")
+                    self.xUITest.executeCommand(".uno:Italic")
+                    self.xUITest.executeCommand(".uno:Undo")
+                    self.xUITest.executeCommand(".uno:Underline")
+                    self.xUITest.executeCommand(".uno:Undo")
+                    self.xUITest.executeCommand(".uno:UnderlineDouble")
+                    self.xUITest.executeCommand(".uno:Undo")
+                    self.xUITest.executeCommand(".uno:Strikeout")
+                    self.xUITest.executeCommand(".uno:Undo")
+                    self.xUITest.executeCommand(".uno:Overline")
+                    self.xUITest.executeCommand(".uno:Undo")
+                    self.xUITest.executeCommand(".uno:SuperScript")
+                    self.xUITest.executeCommand(".uno:Undo")
+                    self.xUITest.executeCommand(".uno:SubScript")
+                    self.xUITest.executeCommand(".uno:Undo")
+                    self.xUITest.executeCommand(".uno:Shadowed")
+                    self.xUITest.executeCommand(".uno:Undo")
+                    self.xUITest.executeCommand(".uno:OutlineFont")
+                    self.xUITest.executeCommand(".uno:Undo")
+                    self.xUITest.executeCommand(".uno:Grow")
+                    self.xUITest.executeCommand(".uno:Undo")
+                    self.xUITest.executeCommand(".uno:Shrink")
+                    self.xUITest.executeCommand(".uno:Undo")
+                    self.xUITest.executeCommand(".uno:ChangeCaseToUpper")
+                    self.xUITest.executeCommand(".uno:Undo")
+                    self.xUITest.executeCommand(".uno:ChangeCaseToLower")
+                    self.xUITest.executeCommand(".uno:Undo")
+                    self.xUITest.executeCommand(".uno:ChangeCaseRotateCase")
+                    self.xUITest.executeCommand(".uno:Undo")
+                    self.xUITest.executeCommand(".uno:ChangeCaseToSentenceCase")
+                    self.xUITest.executeCommand(".uno:Undo")
+                    self.xUITest.executeCommand(".uno:ChangeCaseToTitleCase")
+                    self.xUITest.executeCommand(".uno:Undo")
+                    self.xUITest.executeCommand(".uno:ChangeCaseToToggleCase")
+                    self.xUITest.executeCommand(".uno:Undo")
+                    self.xUITest.executeCommand(".uno:SmallCaps")
+                    self.xUITest.executeCommand(".uno:Undo")
+                    self.xUITest.executeCommand(".uno:StyleApply?Style:string=Heading%202&FamilyName:string=ParagraphStyles")
+                    self.xUITest.executeCommand(".uno:Undo")
+
+                    self.xUITest.executeCommand(".uno:JumpToNextTable")
 
         self.ui_test.close_doc()
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
commit b4b045fa3f40b09221997562a6b5acc81589e4d2
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Tue Apr 23 22:47:39 2019 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Apr 23 22:47:39 2019 +0200

    mass-uitesting: it fails if sheets are not visible

diff --git a/uitest/mass-testing/calc.py b/uitest/mass-testing/calc.py
index f1ac576..d6f0122 100755
--- a/uitest/mass-testing/calc.py
+++ b/uitest/mass-testing/calc.py
@@ -116,6 +116,13 @@ class massTesting(UITestCase):
             for i in range(nrSheets - 1):
                 self.xUITest.executeCommand(".uno:JumpToPrevTable")
 
+                # Make sure all sheets are visible
+                self.xUITest.executeCommand(".uno:Hide")
+                self.xUITest.executeCommand(".uno:Show")
+                xDialog = self.xUITest.getTopFocusWindow()
+                xOKBtn = xDialog.getChild("ok")
+                self.ui_test.close_dialog_through_button(xOKBtn)
+
             ignoreSheets = 0
             for i in range(nrSheets):
                 #copy sheet, undo and delete


More information about the Libreoffice-commits mailing list