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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 7 19:06:25 UTC 2021


 sc/qa/uitest/autofilter/autofilter.py                 |    7 +------
 sc/qa/uitest/autofilter/tdf117276.py                  |    7 +------
 sc/qa/uitest/autofilter/tdf117276_autofilter_reset.py |    7 +------
 sc/qa/uitest/autofilter/tdf122260.py                  |    7 +------
 sc/qa/uitest/autofilter/tdf126306.py                  |    5 ++---
 sc/qa/uitest/autofilter/tdf130070.py                  |    7 +------
 sc/qa/uitest/autofilter/tdf92767.py                   |    7 +------
 sc/qa/uitest/search_replace/replace.py                |    1 -
 uitest/libreoffice/calc/document.py                   |   12 ++++++++++++
 9 files changed, 20 insertions(+), 40 deletions(-)

New commits:
commit dbd06d22ad3c1db87ed210092d6a54fbb5c5000a
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Wed Apr 7 20:01:44 2021 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Wed Apr 7 21:05:45 2021 +0200

    uitest: factor out common code
    
    Change-Id: I4ca17db1ff7221290fedb94700bfb2257e9c647e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113749
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py
index 5d0a7036d314..ccfd23a9d295 100644
--- a/sc/qa/uitest/autofilter/autofilter.py
+++ b/sc/qa/uitest/autofilter/autofilter.py
@@ -8,14 +8,9 @@
 from uitest.framework import UITestCase
 from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
 from libreoffice.uno.propertyvalue import mkPropertyValues
-from libreoffice.calc.document import get_row
+from libreoffice.calc.document import is_row_hidden
 from uitest.uihelper.calc import enter_text_to_cell
 
-def is_row_hidden(doc, index):
-    row = get_row(doc, index)
-    val = row.getPropertyValue("IsVisible")
-    return not val
-
 class AutofilterTest(UITestCase):
 
     def test_tdf106214(self):
diff --git a/sc/qa/uitest/autofilter/tdf117276.py b/sc/qa/uitest/autofilter/tdf117276.py
index b4e71ed6d9f3..9f2fa71ee69a 100644
--- a/sc/qa/uitest/autofilter/tdf117276.py
+++ b/sc/qa/uitest/autofilter/tdf117276.py
@@ -6,14 +6,9 @@
 #
 from uitest.framework import UITestCase
 from libreoffice.uno.propertyvalue import mkPropertyValues
-from libreoffice.calc.document import get_row
+from libreoffice.calc.document import is_row_hidden
 from uitest.uihelper.common import get_url_for_data_file
 
-def is_row_hidden(doc, index):
-    row = get_row(doc, index)
-    val = row.getPropertyValue("IsVisible")
-    return not val
-
 #Bug 117276 - Autofilter settings being reset in some cases
 
 class tdf117276(UITestCase):
diff --git a/sc/qa/uitest/autofilter/tdf117276_autofilter_reset.py b/sc/qa/uitest/autofilter/tdf117276_autofilter_reset.py
index ef900f77040f..5a22fe8071c2 100644
--- a/sc/qa/uitest/autofilter/tdf117276_autofilter_reset.py
+++ b/sc/qa/uitest/autofilter/tdf117276_autofilter_reset.py
@@ -7,14 +7,9 @@
 from uitest.framework import UITestCase
 from uitest.uihelper.calc import enter_text_to_cell
 from libreoffice.uno.propertyvalue import mkPropertyValues
-from libreoffice.calc.document import get_row
+from libreoffice.calc.document import is_row_hidden
 from uitest.uihelper.common import get_url_for_data_file
 
-def is_row_hidden(doc, index):
-    row = get_row(doc, index)
-    val = row.getPropertyValue("IsVisible")
-    return not val
-
 #Bug 117276 - Autofilter settings being reset in some cases
 
 class tdf117276_autofilter_reset(UITestCase):
diff --git a/sc/qa/uitest/autofilter/tdf122260.py b/sc/qa/uitest/autofilter/tdf122260.py
index 7e2b8f8d3e39..00c141e3195f 100644
--- a/sc/qa/uitest/autofilter/tdf122260.py
+++ b/sc/qa/uitest/autofilter/tdf122260.py
@@ -6,14 +6,9 @@
 #
 from uitest.framework import UITestCase
 from libreoffice.uno.propertyvalue import mkPropertyValues
-from libreoffice.calc.document import get_row
+from libreoffice.calc.document import is_row_hidden
 from uitest.uihelper.common import get_url_for_data_file
 
-def is_row_hidden(doc, index):
-    row = get_row(doc, index)
-    val = row.getPropertyValue("IsVisible")
-    return not val
-
 #Bug 122260 - EDITING Autofilters not properly cleared
 class tdf122260(UITestCase):
     def check_value_in_AutoFilter(self, gridwin, columnIndex, valueIndex):
diff --git a/sc/qa/uitest/autofilter/tdf126306.py b/sc/qa/uitest/autofilter/tdf126306.py
index 5a1a6ab7b053..73f8d83f8b85 100644
--- a/sc/qa/uitest/autofilter/tdf126306.py
+++ b/sc/qa/uitest/autofilter/tdf126306.py
@@ -8,7 +8,7 @@ from uitest.framework import UITestCase
 from uitest.uihelper.calc import enter_text_to_cell
 from libreoffice.uno.propertyvalue import mkPropertyValues
 from libreoffice.calc.document import get_cell_by_position
-from libreoffice.calc.document import get_row
+from libreoffice.calc.document import is_row_hidden
 
 class tdf126306(UITestCase):
     def check_values(self, document, results):
@@ -17,8 +17,7 @@ class tdf126306(UITestCase):
 
     def check_row_hidden(self, document, results = [True] * 14):
         for i, value in enumerate(results, start=1):
-            row = get_row(document, i)
-            bVisible = row.getPropertyValue("IsVisible")
+            bVisible = not is_row_hidden(document, i)
             self.assertEqual(bVisible, value)
 
     def test_run(self):
diff --git a/sc/qa/uitest/autofilter/tdf130070.py b/sc/qa/uitest/autofilter/tdf130070.py
index e74bd035f2fe..227355626a75 100644
--- a/sc/qa/uitest/autofilter/tdf130070.py
+++ b/sc/qa/uitest/autofilter/tdf130070.py
@@ -6,14 +6,9 @@
 #
 from uitest.framework import UITestCase
 from libreoffice.uno.propertyvalue import mkPropertyValues
-from libreoffice.calc.document import get_row
+from libreoffice.calc.document import is_row_hidden
 from uitest.uihelper.common import get_url_for_data_file
 
-def is_row_hidden(doc, index):
-    row = get_row(doc, index)
-    val = row.getPropertyValue("IsVisible")
-    return not val
-
 #Bug 130770 - Autofilter not updated on data change (automatically or manually)
 
 class tdf130770(UITestCase):
diff --git a/sc/qa/uitest/autofilter/tdf92767.py b/sc/qa/uitest/autofilter/tdf92767.py
index 859620b73a8a..e846e0bcfb40 100644
--- a/sc/qa/uitest/autofilter/tdf92767.py
+++ b/sc/qa/uitest/autofilter/tdf92767.py
@@ -6,14 +6,9 @@
 #
 from uitest.framework import UITestCase
 from libreoffice.uno.propertyvalue import mkPropertyValues
-from libreoffice.calc.document import get_row
+from libreoffice.calc.document import is_row_hidden
 from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
 
-def is_row_hidden(doc, index):
-    row = get_row(doc, index)
-    val = row.getPropertyValue("IsVisible")
-    return not val
-
 class tdf92767(UITestCase):
 
     def test_tdf92767(self):
diff --git a/sc/qa/uitest/search_replace/replace.py b/sc/qa/uitest/search_replace/replace.py
index d2f2636c2889..867482fbeaea 100644
--- a/sc/qa/uitest/search_replace/replace.py
+++ b/sc/qa/uitest/search_replace/replace.py
@@ -7,7 +7,6 @@
 
 from uitest.framework import UITestCase
 from libreoffice.uno.propertyvalue import mkPropertyValues
-from libreoffice.calc.document import get_row
 from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
 
 class ReplaceTest(UITestCase):
diff --git a/uitest/libreoffice/calc/document.py b/uitest/libreoffice/calc/document.py
index c4eac000ae67..40a2ec635e3c 100644
--- a/uitest/libreoffice/calc/document.py
+++ b/uitest/libreoffice/calc/document.py
@@ -48,4 +48,16 @@ def get_row(document, row, tab = 0):
     sheet = get_sheet_from_doc(document, tab)
     return sheet.getRows().getByIndex(row)
 
+def is_row_hidden(document, row, tab = 0):
+    """ Check whether a row object is hidden
+
+    Keyword arguments:
+    document -- The document that should be used
+    tab -- The 0-based sheet number
+    column -- The 0-based row number
+    """
+    xRow = get_row(document, row, tab)
+    bVisible = xRow.getPropertyValue("IsVisible")
+    return not bVisible
+
 # vim: set shiftwidth=4 softtabstop=4 expandtab:


More information about the Libreoffice-commits mailing list