[Libreoffice-commits] core.git: 2 commits - uitest/libreoffice

Markus Mohrhard markus.mohrhard at googlemail.com
Tue Jan 24 23:36:49 UTC 2017


 uitest/libreoffice/calc/conditional_format.py |    4 ++++
 uitest/libreoffice/calc/document.py           |   16 +++++++++++++++-
 uitest/libreoffice/connection.py              |   13 +++++++++----
 uitest/libreoffice/uno/propertyvalue.py       |    2 ++
 4 files changed, 30 insertions(+), 5 deletions(-)

New commits:
commit 6c98339f7523db93ff8064282c19ab285d80612a
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Jan 14 10:59:16 2017 +0100

    uitest: some pep8 fixes
    
    Change-Id: Ib889604f1b6d11e874c27fb5d2757a792a687366

diff --git a/uitest/libreoffice/connection.py b/uitest/libreoffice/connection.py
index c717632..64f1dd9 100644
--- a/uitest/libreoffice/connection.py
+++ b/uitest/libreoffice/connection.py
@@ -22,6 +22,7 @@ except ImportError:
     print("URE_BOOTSTRAP=file:///installation/opt/program/fundamentalrc")
     raise
 
+
 class OfficeConnection:
     def __init__(self, args):
         self.args = args
@@ -50,10 +51,10 @@ class OfficeConnection:
         self.xContext = self.connect(socket)
 
     def bootstrap(self, soffice, userdir, socket):
-        argv = [ soffice, "--accept=" + socket + ";urp",
+        argv = [soffice, "--accept=" + socket + ";urp",
                 "-env:UserInstallation=" + userdir,
                 "--quickstart=no", "--nofirststartwizard",
-                "--norestore", "--nologo" ]
+                "--norestore", "--nologo"]
         if "--valgrind" in self.args:
             argv.append("--valgrind")
 
@@ -80,7 +81,6 @@ class OfficeConnection:
             try:
                 xContext = xUnoResolver.resolve(url)
                 return xContext
-#            except com.sun.star.connection.NoConnectException
             except pyuno.getClass("com.sun.star.connection.NoConnectException"):
                 print("NoConnectException: sleeping...")
                 time.sleep(1)
@@ -95,7 +95,6 @@ class OfficeConnection:
                             "com.sun.star.frame.Desktop", self.xContext)
                     xDesktop.terminate()
                     print("...done")
-#                except com.sun.star.lang.DisposedException:
                 except pyuno.getClass("com.sun.star.beans.UnknownPropertyException"):
                     print("caught UnknownPropertyException while TearDown")
                     pass # ignore, also means disposed
@@ -144,23 +143,29 @@ class PersistentConnection:
     def __init__(self, args):
         self.args = args
         self.connection = None
+
     def getContext(self):
         return self.connection.xContext
+
     def setUp(self):
         assert(not self.connection)
         conn = OfficeConnection(self.args)
         conn.setUp()
         self.connection = conn
+
     def preTest(self):
         assert(self.connection)
+
     def postTest(self):
         assert(self.connection)
+
     def tearDown(self):
         if self.connection:
             try:
                 self.connection.tearDown()
             finally:
                 self.connection = None
+
     def kill(self):
         if self.connection and self.connection.soffice:
             self.connection.soffice.kill()
commit 21248f909e890df8ad50a0d9c18876125bb12c90
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Jan 14 10:47:15 2017 +0100

    uitest: document more UNO helper methods
    
    Change-Id: I941f5ba20a7e3176e8d9f5f64c64ada6551d533a

diff --git a/uitest/libreoffice/calc/conditional_format.py b/uitest/libreoffice/calc/conditional_format.py
index 5acd3c1..40e7669 100644
--- a/uitest/libreoffice/calc/conditional_format.py
+++ b/uitest/libreoffice/calc/conditional_format.py
@@ -8,6 +8,10 @@
 # this file provides methods to interact with the new conditional format API
 
 def get_conditional_format_from_sheet(sheet):
+    """ Returns a conditional format object belonging to a sheet
+
+    Keyword arguments:
+    sheet -- a XSheet object"""
     return sheet.getPropertyValue("ConditionalFormats")
 
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/libreoffice/calc/document.py b/uitest/libreoffice/calc/document.py
index a753242..aff3402 100644
--- a/uitest/libreoffice/calc/document.py
+++ b/uitest/libreoffice/calc/document.py
@@ -5,10 +5,24 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
 
-def get_sheet_from_doc(document, index):
+def get_sheet_from_doc(document, index=None, name=None):
+    """ Returns a sheet object for a Spreadsheet document
+
+    Keyword arguments:
+    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)
 
 def get_cell_by_position(document, tab, column, row):
+    """ Get the cell object through its position in a document
+
+    Keyword arguments:
+    document -- The document that should be used
+    tab -- The 0-based sheet number
+    column -- The 0-based column number
+    row -- THe 0-based row number
+    """
     sheet = get_sheet_from_doc(document, tab)
     return sheet.getCellByPosition(column, row)
 
diff --git a/uitest/libreoffice/uno/propertyvalue.py b/uitest/libreoffice/uno/propertyvalue.py
index 25f22ad..a05c6a9 100644
--- a/uitest/libreoffice/uno/propertyvalue.py
+++ b/uitest/libreoffice/uno/propertyvalue.py
@@ -27,6 +27,8 @@ def mkPropertyValues(vals):
     return tuple([mkPropertyValue(name, value) for (name, value) in vals.items()])
 
 def convert_property_values_to_dict(propMap):
+    """ Create a dictionary from a sequence of property values
+    """
     ret = {}
     for entry in propMap:
         name = entry.Name


More information about the Libreoffice-commits mailing list