[Libreoffice-commits] core.git: uitest/loginterpreter.py
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Aug 27 07:33:23 UTC 2018
uitest/loginterpreter.py | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
New commits:
commit db68a9c002314e17c2b1d1748269af4d1851ef48
Author: Saurav Chirania <saurav.chir at gmail.com>
AuthorDate: Mon Jul 30 21:13:34 2018 +0530
Commit: Saurav Chirania <saurav.chir at gmail.com>
CommitDate: Mon Aug 27 09:33:03 2018 +0200
uitest interpreter: some improvements
Change-Id: I7b768694ba5a82f7273fd7641fae5c3fc84233a6
Reviewed-on: https://gerrit.libreoffice.org/58340
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
Tested-by: Jenkins
diff --git a/uitest/loginterpreter.py b/uitest/loginterpreter.py
index becd8b322937..770beb966064 100644
--- a/uitest/loginterpreter.py
+++ b/uitest/loginterpreter.py
@@ -16,14 +16,15 @@ def parse_line(line):
This function parses a line from log file
and returns the parsed values as a python dictionary
"""
- if (line == "" or line.startswith("Action on element")):
+ if (line == ""):
return
dict = {}
if "{" in line:
start_index_of_parameters = line.find("{")
end_index_of_parameters = line.find("}") + 1
parameters = line[start_index_of_parameters:end_index_of_parameters]
- dict["parameters"] = parameters
+ if parameters != "":
+ dict["parameters"] = parameters
line = line[:start_index_of_parameters-1]
word_list = line.split()
dict["keyword"] = word_list[0]
@@ -54,7 +55,7 @@ def get_log_file(input_address):
print("Use " + os.path.basename(sys.argv[0]) + " -h to get usage instructions")
sys.exit(1)
- content = [x.strip() for x in content]
+ content = [x.strip() for x in content if not x.startswith("Action on element")]
return content
def initiate_test_generation(address):
@@ -65,6 +66,7 @@ def initiate_test_generation(address):
print("Use " + os.path.basename(sys.argv[0]) + " -h to get usage instructions")
sys.exit(1)
initial_text = \
+ "# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-\n\n" + \
"from uitest.framework import UITestCase\n" + \
"from libreoffice.uno.propertyvalue import mkPropertyValues\n" + \
"import importlib\n\n" + \
@@ -135,8 +137,18 @@ def get_test_line_from_one_log_line(log_line):
test_line += ",tuple())\n"
return test_line
elif action_dict["keyword"] == "CommandSent":
- test_line += "self.xUITest.executeCommand(\"" + \
- action_dict["Name"] + "\")\n"
+ if "parameters" not in action_dict:
+ test_line += "self.xUITest.executeCommand(\"" + \
+ action_dict["Name"] + "\")\n"
+ return test_line
+ else:
+ test_line += "self.xUITest.executeCommandWithParameters(\"" + \
+ action_dict["Name"] + "\", mkPropertyValues(" + action_dict["parameters"] + \
+ "))\n"
+ return test_line
+ elif action_dict["keyword"] == "ModalDialogExecuted" or \
+ action_dict["keyword"] == "ModelessDialogConstructed":
+ test_line += action_dict["Id"] + " = " + "self.xUITest.getTopFocusWindow()\n"
return test_line
return ""
@@ -187,6 +199,7 @@ def main():
output_stream.write(test_line)
line_number += 2
output_stream.write(" self.ui_test.close_doc()")
+ output_stream.write("\n\n# vim: set shiftwidth=4 softtabstop=4 expandtab:")
output_stream.close()
if __name__ == '__main__':
More information about the Libreoffice-commits
mailing list