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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Tue May 12 10:23:23 UTC 2020


 uitest/mass-testing/run.py    |   40 ++++++++++-----------
 uitest/mass-testing/writer.py |   77 ++----------------------------------------
 2 files changed, 24 insertions(+), 93 deletions(-)

New commits:
commit 5f97b55c1cd78a69dc1434be22cfb542d6a361fb
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Tue May 12 11:57:38 2020 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue May 12 12:17:24 2020 +0200

    mass-uitesting: remove unneeded tests
    
    Change-Id: I1e8cdb4557b67add41619cf415ca8232f9b1fe5d

diff --git a/uitest/mass-testing/writer.py b/uitest/mass-testing/writer.py
index 92f8d17..5603186 100755
--- a/uitest/mass-testing/writer.py
+++ b/uitest/mass-testing/writer.py
@@ -148,73 +148,4 @@ class massTesting(UITestCase):
 
         self.ui_test.close_doc()
 
-    def test_change_text_formatting_and_undo(self):
-        xEdit = self.load_file()
-        if xEdit:
-            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.ui_test.close_doc()
-
-    def test_default_bullet_list_and_undo(self):
-        xEdit = self.load_file()
-        if xEdit:
-            self.xUITest.executeCommand(".uno:SelectAll")
-            self.xUITest.executeCommand(".uno:DefaultBullet")
-            self.xUITest.executeCommand(".uno:Undo")
-
-        self.ui_test.close_doc()
-
-    def test_change_alignment_and_undo(self):
-        xEdit = self.load_file()
-        if xEdit:
-            self.xUITest.executeCommand(".uno:SelectAll")
-            self.xUITest.executeCommand(".uno:CommonAlignLeft")
-            self.xUITest.executeCommand(".uno:Undo")
-            self.xUITest.executeCommand(".uno:CommonAlignHorizontalCenter")
-            self.xUITest.executeCommand(".uno:Undo")
-            self.xUITest.executeCommand(".uno:CommonAlignRight")
-            self.xUITest.executeCommand(".uno:Undo")
-            self.xUITest.executeCommand(".uno:CommonAlignJustified")
-            self.xUITest.executeCommand(".uno:Undo")
-
-        self.ui_test.close_doc()
-
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
commit 4c315059aad3df8971a15253634ee343772c5ce7
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Tue May 12 11:55:08 2020 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue May 12 12:17:13 2020 +0200

    mass-uitesting: fix insert header and footer
    
    Change-Id: I66ffeac9b0140e93a3a2b9dde856134dc952ed45

diff --git a/uitest/mass-testing/writer.py b/uitest/mass-testing/writer.py
index dbae5ce..92f8d17 100755
--- a/uitest/mass-testing/writer.py
+++ b/uitest/mass-testing/writer.py
@@ -79,13 +79,13 @@ class massTesting(UITestCase):
             #Insert Default header if it doesn't exists
             if not document.StyleFamilies.PageStyles.Standard.HeaderIsOn:
                 self.xUITest.executeCommand(
-                        ".uno:InsertPageHeader?PageStyle:string=Default%20Style&On:bool=true")
+                        ".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=true")
 
             self.assertEqual(document.StyleFamilies.PageStyles.Standard.HeaderIsOn, True)
 
             # Delete the header
             self.ui_test.execute_dialog_through_command(
-                    ".uno:InsertPageHeader?PageStyle:string=Default%20Style&On:bool=false")
+                    ".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=false")
 
             xDialog = self.xUITest.getTopFocusWindow()  #question dialog
             xOption = xDialog.getChild("yes")
@@ -118,13 +118,13 @@ class massTesting(UITestCase):
             #Insert Default footer if it doesn't exists
             if not document.StyleFamilies.PageStyles.Standard.FooterIsOn:
                 self.xUITest.executeCommand(
-                        ".uno:InsertPageFooter?PageStyle:string=Default%20Style&On:bool=true")
+                        ".uno:InsertPageFooter?PageStyle:string=Default%20Page%20Style&On:bool=true")
 
             self.assertEqual(document.StyleFamilies.PageStyles.Standard.FooterIsOn, True)
 
             # Delete the header
             self.ui_test.execute_dialog_through_command(
-                    ".uno:InsertPageFooter?PageStyle:string=Default%20Style&On:bool=false")
+                    ".uno:InsertPageFooter?PageStyle:string=Default%20Page%20Style&On:bool=false")
 
             xDialog = self.xUITest.getTopFocusWindow()  #question dialog
             xOption = xDialog.getChild("yes")
commit e4a8a2b82bc661b65f8972ee59bd07d7cacadd65
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Tue May 12 11:39:06 2020 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue May 12 12:17:00 2020 +0200

    mass-uitesting: remove component argument
    
    Change-Id: I63f26c87bb1f0c9276cead48e30e0fa57b124a0d

diff --git a/uitest/mass-testing/run.py b/uitest/mass-testing/run.py
index 4262393..7f9efab 100755
--- a/uitest/mass-testing/run.py
+++ b/uitest/mass-testing/run.py
@@ -35,12 +35,12 @@ class DefaultHelpParser(argparse.ArgumentParser):
         self.print_help()
         sys.exit(2)
 
-def start_logger(component):
+def start_logger():
     rootLogger = logging.getLogger()
     rootLogger.setLevel(os.environ.get("LOGLEVEL", "INFO"))
 
     logFormatter = logging.Formatter("%(asctime)s %(message)s")
-    fileHandler = logging.FileHandler("./logs/" + component + ".log")
+    fileHandler = logging.FileHandler("./log")
     fileHandler.setFormatter(logFormatter)
     rootLogger.addHandler(fileHandler)
 
@@ -49,17 +49,15 @@ def start_logger(component):
 
     return rootLogger
 
-def get_file_names(component, filesPath):
+def get_file_names(filesPath):
     auxNames = []
     for fileName in os.listdir(filesPath):
-        for ext in extensions[component]:
-            if fileName.endswith(ext):
-                auxNames.append("file:///" + filesPath + fileName)
+        auxNames.append("file:///" + filesPath + fileName)
 
-                #Remove previous lock files
-                lockFilePath = filesPath + '.~lock.' + fileName + '#'
-                if os.path.isfile(lockFilePath):
-                    os.remove(lockFilePath)
+        #Remove previous lock files
+        lockFilePath = filesPath + '.~lock.' + fileName + '#'
+        if os.path.isfile(lockFilePath):
+            os.remove(lockFilePath)
 
     return auxNames
 
@@ -80,7 +78,7 @@ def run_tests_and_get_results(liboPath, listFiles, isDebug, isResume):
     filesRun = {}
 
     if isResume:
-        pklFile = './logs/' + component + '.pkl'
+        pklFile = './resume.pkl'
         if os.path.exists(pklFile):
             with open(pklFile, 'rb') as pickle_in:
                 filesRun = pickle.load(pickle_in)
@@ -92,6 +90,15 @@ def run_tests_and_get_results(liboPath, listFiles, isDebug, isResume):
             results = filesRun[sourceHash]['results']
 
     for fileName in listFiles:
+        extension = os.path.splitext(fileName)[1][1:]
+
+        component = ""
+        for key, val in extensions.items():
+            if extension in val:
+                component = key
+
+        if not component:
+            continue
 
         if isResume:
             if fileName in filesRun[sourceHash]['files']:
@@ -228,16 +235,9 @@ if __name__ == '__main__':
             '--debug', action='store_true', help="Flag to print output")
     parser.add_argument(
             '--resume', action='store_true', help="Flag to resume previous runs")
-    parser.add_argument(
-            '--component', required=True, help="The component to be used. Options: " + \
-                    " ".join("[" + x + "]" for x in extensions.keys()))
 
     argument = parser.parse_args()
 
-    component = argument.component.lower()
-    if component not in extensions.keys():
-        parser.error(component + " is an invalid component.")
-
     filesPath = os.path.join(argument.dir, '')
     if not os.path.exists(filesPath):
         parser.error(filesPath + " is an invalid directory path")
@@ -253,9 +253,9 @@ if __name__ == '__main__':
     if not os.path.exists('./logs'):
         os.makedirs('./logs')
 
-    logger = start_logger(component)
+    logger = start_logger()
 
-    listFiles = get_file_names(component, filesPath)
+    listFiles = get_file_names(filesPath)
     listFiles.sort()
 
     run_tests_and_get_results(liboPath, listFiles, argument.debug, argument.resume)


More information about the Libreoffice-commits mailing list