From 21248f909e890df8ad50a0d9c18876125bb12c90 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Sat, 14 Jan 2017 10:47:15 +0100 Subject: uitest: document more UNO helper methods Change-Id: I941f5ba20a7e3176e8d9f5f64c64ada6551d533a --- uitest/libreoffice/calc/conditional_format.py | 4 ++++ uitest/libreoffice/calc/document.py | 16 +++++++++++++++- uitest/libreoffice/uno/propertyvalue.py | 2 ++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/uitest/libreoffice/calc/conditional_format.py b/uitest/libreoffice/calc/conditional_format.py index 5acd3c168de0..40e766943893 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 a75324299575..aff34020a650 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 25f22adabd07..a05c6a967714 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 -- cgit