[Libreoffice-commits] core.git: sc/qa sd/qa sfx2/qa sw/qa uitest/demo_ui uitest/uitest

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 22 12:47:25 UTC 2021


 sc/qa/uitest/autofilter/autofilter.py                           |  561 ++----
 sc/qa/uitest/autofilter/autofilterBugs.py                       |  298 +--
 sc/qa/uitest/autofilter/tdf101165.py                            |   21 
 sc/qa/uitest/autofilter/tdf117276.py                            |  161 -
 sc/qa/uitest/autofilter/tdf122260.py                            |   46 
 sc/qa/uitest/autofilter/tdf130070.py                            |   77 
 sc/qa/uitest/autofilter/tdf140754.py                            |  132 -
 sc/qa/uitest/autofilter/tdf92767.py                             |   72 
 sc/qa/uitest/autofilter/tdf97340.py                             |   39 
 sc/qa/uitest/calc_tests/autofill.py                             |  208 +-
 sc/qa/uitest/calc_tests/autosum.py                              |  414 ++--
 sc/qa/uitest/calc_tests/mergedRowsColumns.py                    |  315 +--
 sc/qa/uitest/calc_tests/tdf133855.py                            |   50 
 sc/qa/uitest/calc_tests2/consolidate.py                         |  178 -
 sc/qa/uitest/calc_tests2/standardFilter.py                      |  233 +-
 sc/qa/uitest/calc_tests2/tdf114992.py                           |   26 
 sc/qa/uitest/calc_tests2/tdf37623.py                            |   33 
 sc/qa/uitest/calc_tests3/tdf57274.py                            |   41 
 sc/qa/uitest/calc_tests3/tdf62267.py                            |   62 
 sc/qa/uitest/calc_tests3/tdf63805.py                            |   77 
 sc/qa/uitest/calc_tests3/tdf65856.py                            |  136 -
 sc/qa/uitest/calc_tests3/tdf69981.py                            |  110 -
 sc/qa/uitest/calc_tests3/tdf77509.py                            |  102 -
 sc/qa/uitest/calc_tests4/tdf131170.py                           |   56 
 sc/qa/uitest/calc_tests4/tdf138089.py                           |   60 
 sc/qa/uitest/calc_tests4/tdf141547.py                           |   48 
 sc/qa/uitest/calc_tests4/tdf85403.py                            |   34 
 sc/qa/uitest/calc_tests4/tdf85979.py                            |   66 
 sc/qa/uitest/calc_tests4/tdf86253.py                            |   84 
 sc/qa/uitest/calc_tests4/tdf89958.py                            |   82 
 sc/qa/uitest/calc_tests4/tdf99386.py                            |   18 
 sc/qa/uitest/calc_tests4/textToColumns.py                       |  933 ++++------
 sc/qa/uitest/calc_tests4/trackedChanges.py                      |   76 
 sc/qa/uitest/calc_tests6/tdf107267.py                           |  102 -
 sc/qa/uitest/calc_tests6/tdf107869.py                           |  136 -
 sc/qa/uitest/calc_tests6/tdf118638.py                           |   74 
 sc/qa/uitest/calc_tests7/tdf122509.py                           |   63 
 sc/qa/uitest/calc_tests7/tdf124818.py                           |   21 
 sc/qa/uitest/calc_tests7/tdf124896.py                           |   23 
 sc/qa/uitest/calc_tests7/tdf137397.py                           |   30 
 sc/qa/uitest/calc_tests7/tdf31805.py                            |   45 
 sc/qa/uitest/calc_tests7/tdf91425.py                            |   35 
 sc/qa/uitest/calc_tests8/navigator.py                           |  207 +-
 sc/qa/uitest/calc_tests8/tdf114710.py                           |   50 
 sc/qa/uitest/calc_tests8/tdf119343.py                           |   25 
 sc/qa/uitest/calc_tests8/tdf124829.py                           |   21 
 sc/qa/uitest/calc_tests9/forms.py                               |   18 
 sc/qa/uitest/calc_tests9/pivotTable.py                          |   64 
 sc/qa/uitest/calc_tests9/tdf113571.py                           |   31 
 sc/qa/uitest/calc_tests9/tdf124318.py                           |   28 
 sc/qa/uitest/calc_tests9/tdf125440.py                           |   35 
 sc/qa/uitest/calc_tests9/tdf126673.py                           |   52 
 sc/qa/uitest/calc_tests9/tdf130371.py                           |  100 -
 sc/qa/uitest/calc_tests9/tdf137446.py                           |   52 
 sc/qa/uitest/calc_tests9/tdf91217.py                            |   34 
 sc/qa/uitest/chart/chartArea.py                                 |  299 +--
 sc/qa/uitest/chart/chartAxes.py                                 |   79 
 sc/qa/uitest/chart/chartDataLabels.py                           |  563 ++----
 sc/qa/uitest/chart/chartGrid.py                                 |  425 ++--
 sc/qa/uitest/chart/chartGrids.py                                |  151 -
 sc/qa/uitest/chart/chartLegend.py                               |    4 
 sc/qa/uitest/chart/chartTitles.py                               |  197 +-
 sc/qa/uitest/chart/chartWall.py                                 |  329 +--
 sc/qa/uitest/chart/chartXAxis.py                                |  483 ++---
 sc/qa/uitest/chart/chartYAxis.py                                |  487 ++---
 sc/qa/uitest/chart/copyPaste.py                                 |   84 
 sc/qa/uitest/chart/formatDataSeries.py                          |  181 -
 sc/qa/uitest/chart/tdf101894.py                                 |  120 -
 sc/qa/uitest/chart/tdf107097.py                                 |   68 
 sc/qa/uitest/chart/tdf120348.py                                 |   65 
 sc/qa/uitest/chart/tdf122398.py                                 |  135 -
 sc/qa/uitest/chart/tdf123013.py                                 |   75 
 sc/qa/uitest/chart/tdf123231.py                                 |  111 -
 sc/qa/uitest/chart/tdf123520.py                                 |  107 -
 sc/qa/uitest/chart/tdf124111.py                                 |   95 -
 sc/qa/uitest/chart/tdf129587.py                                 |   63 
 sc/qa/uitest/chart/tdf133630.py                                 |   75 
 sc/qa/uitest/chart/tdf134059.py                                 |   34 
 sc/qa/uitest/chart/tdf136011.py                                 |   43 
 sc/qa/uitest/chart/tdf43175.py                                  |   46 
 sc/qa/uitest/chart/tdf62057.py                                  |   60 
 sc/qa/uitest/chart/tdf62349.py                                  |   42 
 sc/qa/uitest/chart/tdf93506_trendline.py                        |  889 ++++-----
 sc/qa/uitest/chart/tdf96432.py                                  |  101 -
 sc/qa/uitest/chart/tdf98690.py                                  |   42 
 sc/qa/uitest/chart/tdf99069.py                                  |   93 
 sc/qa/uitest/conditional_format/tdf100793.py                    |  154 -
 sc/qa/uitest/conditional_format/tdf104026.py                    |   20 
 sc/qa/uitest/conditional_format/tdf105544.py                    |   70 
 sc/qa/uitest/conditional_format/tdf117899.py                    |   59 
 sc/qa/uitest/conditional_format/tdf118206.py                    |   45 
 sc/qa/uitest/conditional_format/tdf81696.py                     |   43 
 sc/qa/uitest/conditional_format/tdf96453.py                     |   72 
 sc/qa/uitest/function_wizard/tdf123479.py                       |   41 
 sc/qa/uitest/goalSeek/goalSeek.py                               |   37 
 sc/qa/uitest/goalSeek/tdf37341.py                               |   35 
 sc/qa/uitest/goalSeek/tdf43693.py                               |   35 
 sc/qa/uitest/key_f4/tdf102525.py                                |   40 
 sc/qa/uitest/manual_tests/calc.py                               |   20 
 sc/qa/uitest/pageFormat/tdf123508.py                            |   65 
 sc/qa/uitest/range_name/tdf119954.py                            |  105 -
 sc/qa/uitest/search_replace/replace.py                          |   59 
 sc/qa/uitest/search_replace/tdf132783.py                        |   28 
 sc/qa/uitest/search_replace/tdf35020.py                         |   55 
 sc/qa/uitest/search_replace/tdf39959.py                         |   61 
 sc/qa/uitest/search_replace/tdf44861.py                         |   62 
 sc/qa/uitest/solver/solver.py                                   |   59 
 sc/qa/uitest/sort/sorting.py                                    |    2 
 sc/qa/uitest/sort/stableSorting.py                              |   80 
 sc/qa/uitest/sort/subtotals.py                                  |  230 +-
 sc/qa/uitest/sort/tdf105301.py                                  |   54 
 sc/qa/uitest/sort/tdf49531.py                                   |   79 
 sc/qa/uitest/sort/tdf53482.py                                   |   58 
 sc/qa/uitest/sort/tdf54018.py                                   |   54 
 sc/qa/uitest/sort/tdf57465.py                                   |   54 
 sc/qa/uitest/sort/tdf91305.py                                   |    2 
 sc/qa/uitest/sort/tdf95192.py                                   |   54 
 sc/qa/uitest/sort/tdf99208.py                                   |   84 
 sc/qa/uitest/sort/tdf99627.py                                   |   54 
 sc/qa/uitest/statistics/regression.py                           |   29 
 sc/qa/uitest/statistics/tdf76731.py                             |   89 
 sc/qa/uitest/textCase/textCase.py                               |   51 
 sc/qa/uitest/validity/tdf137945.py                              |   28 
 sd/qa/uitest/findReplace/findReplace.py                         |  214 +-
 sd/qa/uitest/impress_tests/embedded.py                          |   30 
 sd/qa/uitest/impress_tests/tdf141297.py                         |   20 
 sfx2/qa/uitest/doc/objserv.py                                   |   20 
 sw/qa/uitest/chapterNumbering/tdf123547.py                      |   23 
 sw/qa/uitest/findReplace/findReplace.py                         |  254 +-
 sw/qa/uitest/findReplace/tdf118208.py                           |   96 -
 sw/qa/uitest/findSimilarity/findSimilarity.py                   |  104 -
 sw/qa/uitest/navigator/tdf114724.py                             |   49 
 sw/qa/uitest/navigator/tdf140661.py                             |   20 
 sw/qa/uitest/navigator/tdf40427.py                              |  103 -
 sw/qa/uitest/sidebar/tdf99711.py                                |   30 
 sw/qa/uitest/styleInspector/styleInspector.py                   |  660 +++----
 sw/qa/uitest/table/sheetToTable.py                              |  117 -
 sw/qa/uitest/table/splitTable.py                                |  120 -
 sw/qa/uitest/table/tableProperties.py                           |  407 ++--
 sw/qa/uitest/table/tableToText.py                               |  119 -
 sw/qa/uitest/table/tdf134881_colProportionalAdjust.py           |   64 
 sw/qa/uitest/table/tdf135693.py                                 |   28 
 sw/qa/uitest/table/tdf81292.py                                  |   49 
 sw/qa/uitest/table/tdf99334.py                                  |   45 
 sw/qa/uitest/table/textToTable.py                               |   55 
 sw/qa/uitest/writer_tests/compareDocuments.py                   |   96 -
 sw/qa/uitest/writer_tests/tdf81457.py                           |   46 
 sw/qa/uitest/writer_tests/trackedChanges.py                     |  172 -
 sw/qa/uitest/writer_tests/versionDialog.py                      |   30 
 sw/qa/uitest/writer_tests/wordCount.py                          |  262 +-
 sw/qa/uitest/writer_tests3/goToPage.py                          |   47 
 sw/qa/uitest/writer_tests4/spellDialog.py                       |   48 
 sw/qa/uitest/writer_tests4/tdf113284.py                         |   59 
 sw/qa/uitest/writer_tests4/tdf122449.py                         |   63 
 sw/qa/uitest/writer_tests4/tdf134439.py                         |   52 
 sw/qa/uitest/writer_tests4/tdf135636.py                         |   36 
 sw/qa/uitest/writer_tests4/tdf136578.py                         |   22 
 sw/qa/uitest/writer_tests4/tdf138546.py                         |   46 
 sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py     |  186 -
 sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py |  440 ++--
 sw/qa/uitest/writer_tests5/tdf117039.py                         |   15 
 sw/qa/uitest/writer_tests5/tdf118540.py                         |   23 
 sw/qa/uitest/writer_tests5/titlePageWizard.py                   |  392 ++--
 sw/qa/uitest/writer_tests5/titlePageWizard2.py                  |  242 +-
 sw/qa/uitest/writer_tests6/tdf120731.py                         |   19 
 sw/qa/uitest/writer_tests6/tdf124586.py                         |   35 
 sw/qa/uitest/writer_tests6/tdf124675.py                         |   30 
 sw/qa/uitest/writer_tests6/tdf126017.py                         |   71 
 sw/qa/uitest/writer_tests6/tdf126226.py                         |   21 
 sw/qa/uitest/writer_tests6/tdf126627.py                         |   63 
 sw/qa/uitest/writer_tests7/apply_line_cap.py                    |  120 -
 sw/qa/uitest/writer_tests7/forms.py                             |  246 +-
 sw/qa/uitest/writer_tests7/tdf104795.py                         |   20 
 sw/qa/uitest/writer_tests7/tdf119661.py                         |   20 
 sw/qa/uitest/writer_tests7/tdf122780.py                         |   18 
 sw/qa/uitest/writer_tests7/tdf131936.py                         |   20 
 sw/qa/uitest/writer_tests7/tdf132169.py                         |   46 
 sw/qa/uitest/writer_tests7/tdf134243.py                         |   14 
 sw/qa/uitest/writer_tests7/tdf137802.py                         |   76 
 sw/qa/uitest/writer_tests7/tdf137803.py                         |   55 
 sw/qa/uitest/writer_tests7/tdf139301.py                         |   70 
 sw/qa/uitest/writer_tests7/tdf140117.py                         |   90 
 sw/qa/uitest/writer_tests7/tdf141158.py                         |   53 
 sw/qa/uitest/writer_tests7/tdf141557.py                         |   30 
 sw/qa/uitest/writer_tests7/tdf46561.py                          |  138 -
 sw/qa/uitest/writer_tests7/tdf90401.py                          |  129 -
 uitest/demo_ui/handle_multiple_files.py                         |   44 
 uitest/uitest/test.py                                           |    9 
 uitest/uitest/uihelper/guarded.py                               |    9 
 189 files changed, 9865 insertions(+), 10293 deletions(-)

New commits:
commit be0a41679fea524e0935dc6617b5e65349812dd1
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Mon Jun 21 16:21:30 2021 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Jun 22 14:46:39 2021 +0200

    uitest: guard load_file
    
    Mostly done by a script
    for motivation, see 89aaa17a0a4413f07da2bc5084b0164f15dc01ac
    < UITest: introduce guarded context managers >
    
    Change-Id: Ia924293dc2a12230fd13f69fd734875ced86be8a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117593
    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 060ada717844..1b5bcb1f113f 100644
--- a/sc/qa/uitest/autofilter/autofilter.py
+++ b/sc/qa/uitest/autofilter/autofilter.py
@@ -14,122 +14,116 @@ from uitest.uihelper.calc import enter_text_to_cell
 class AutofilterTest(UITestCase):
 
     def test_tdf106214(self):
-        doc = self.ui_test.load_file(get_url_for_data_file("autofilter.ods"))
+        with self.ui_test.load_file(get_url_for_data_file("autofilter.ods")) as doc:
 
-        xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
 
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
 
-        xTreeList = xCheckListMenu.getChild("check_tree_box")
-        xFirstEntry = xTreeList.getChild("0")
+            xTreeList = xCheckListMenu.getChild("check_tree_box")
+            xFirstEntry = xTreeList.getChild("0")
 
-        xFirstEntry.executeAction("CLICK", tuple())
+            xFirstEntry.executeAction("CLICK", tuple())
 
-        xOkBtn = xFloatWindow.getChild("ok")
-        xOkBtn.executeAction("CLICK", tuple())
+            xOkBtn = xFloatWindow.getChild("ok")
+            xOkBtn.executeAction("CLICK", tuple())
 
-        self.assertFalse(is_row_hidden(doc, 0))
-        self.assertFalse(is_row_hidden(doc, 1))
-        self.assertFalse(is_row_hidden(doc, 2))
-        self.assertTrue(is_row_hidden(doc, 3))
-        self.assertFalse(is_row_hidden(doc, 4))
-
-        self.ui_test.close_doc()
+            self.assertFalse(is_row_hidden(doc, 0))
+            self.assertFalse(is_row_hidden(doc, 1))
+            self.assertFalse(is_row_hidden(doc, 2))
+            self.assertTrue(is_row_hidden(doc, 3))
+            self.assertFalse(is_row_hidden(doc, 4))
 
     def test_filter_multiple_rows(self):
-        doc = self.ui_test.load_file(get_url_for_data_file("autofilter.ods"))
+        with self.ui_test.load_file(get_url_for_data_file("autofilter.ods")) as doc:
 
-        xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
 
-        xTreeList = xCheckListMenu.getChild("check_list_box")
-        xFirstEntry = xTreeList.getChild("1")
+            xTreeList = xCheckListMenu.getChild("check_list_box")
+            xFirstEntry = xTreeList.getChild("1")
 
-        xFirstEntry.executeAction("CLICK", tuple())
+            xFirstEntry.executeAction("CLICK", tuple())
 
-        xOkBtn = xFloatWindow.getChild("ok")
-        xOkBtn.executeAction("CLICK", tuple())
+            xOkBtn = xFloatWindow.getChild("ok")
+            xOkBtn.executeAction("CLICK", tuple())
 
-        self.assertFalse(is_row_hidden(doc, 0))
-        self.assertFalse(is_row_hidden(doc, 1))
-        self.assertTrue(is_row_hidden(doc, 2))
-        self.assertTrue(is_row_hidden(doc, 3))
-        self.assertFalse(is_row_hidden(doc, 4))
+            self.assertFalse(is_row_hidden(doc, 0))
+            self.assertFalse(is_row_hidden(doc, 1))
+            self.assertTrue(is_row_hidden(doc, 2))
+            self.assertTrue(is_row_hidden(doc, 3))
+            self.assertFalse(is_row_hidden(doc, 4))
 
     def test_tdf133160(self):
-        doc = self.ui_test.load_file(get_url_for_data_file("tdf133160.ods"))
-
-        xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "3"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xTreeList = xCheckListMenu.getChild("check_list_box")
-        size1 = int(get_state_as_dict(xTreeList)["Size"].split('x')[0])
-        xOkBtn = xFloatWindow.getChild("cancel")
-        xOkBtn.executeAction("CLICK", tuple())
-
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "3"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xTreeList = xCheckListMenu.getChild("check_list_box")
-        size2 = int(get_state_as_dict(xTreeList)["Size"].split('x')[0])
-        xOkBtn = xFloatWindow.getChild("cancel")
-        xOkBtn.executeAction("CLICK", tuple())
-
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "3", "ROW": "3"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xTreeList = xCheckListMenu.getChild("check_list_box")
-        size3 = int(get_state_as_dict(xTreeList)["Size"].split('x')[0])
-        xOkBtn = xFloatWindow.getChild("cancel")
-        xOkBtn.executeAction("CLICK", tuple())
-
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "4", "ROW": "3"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xTreeList = xCheckListMenu.getChild("check_list_box")
-        size4 = int(get_state_as_dict(xTreeList)["Size"].split('x')[0])
-
-        xOkBtn = xFloatWindow.getChild("cancel")
-        xOkBtn.executeAction("CLICK", tuple())
-
-        self.assertTrue(size1 < size2) # for me they were size1=176 size2=212 size3=459 size4=1012
-        self.assertTrue(size2 < size3) # size1 is the minimum window width,  size2 based on its column width
-        self.assertTrue(size3 < size4) # size3 is a long text width
-        self.assertTrue(size4 < 1500)  # size4 is the maximum window width with a really long text
-
-        self.ui_test.close_doc()
+        with self.ui_test.load_file(get_url_for_data_file("tdf133160.ods")) as doc:
+
+            xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "3"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xTreeList = xCheckListMenu.getChild("check_list_box")
+            size1 = int(get_state_as_dict(xTreeList)["Size"].split('x')[0])
+            xOkBtn = xFloatWindow.getChild("cancel")
+            xOkBtn.executeAction("CLICK", tuple())
+
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "3"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xTreeList = xCheckListMenu.getChild("check_list_box")
+            size2 = int(get_state_as_dict(xTreeList)["Size"].split('x')[0])
+            xOkBtn = xFloatWindow.getChild("cancel")
+            xOkBtn.executeAction("CLICK", tuple())
+
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "3", "ROW": "3"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xTreeList = xCheckListMenu.getChild("check_list_box")
+            size3 = int(get_state_as_dict(xTreeList)["Size"].split('x')[0])
+            xOkBtn = xFloatWindow.getChild("cancel")
+            xOkBtn.executeAction("CLICK", tuple())
+
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "4", "ROW": "3"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xTreeList = xCheckListMenu.getChild("check_list_box")
+            size4 = int(get_state_as_dict(xTreeList)["Size"].split('x')[0])
+
+            xOkBtn = xFloatWindow.getChild("cancel")
+            xOkBtn.executeAction("CLICK", tuple())
+
+            self.assertTrue(size1 < size2) # for me they were size1=176 size2=212 size3=459 size4=1012
+            self.assertTrue(size2 < size3) # size1 is the minimum window width,  size2 based on its column width
+            self.assertTrue(size3 < size4) # size3 is a long text width
+            self.assertTrue(size4 < 1500)  # size4 is the maximum window width with a really long text
 
     def test_tdf134351(self):
-        doc = self.ui_test.load_file(get_url_for_data_file("autofilter.ods"))
+        with self.ui_test.load_file(get_url_for_data_file("autofilter.ods")) as doc:
 
-        xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
 
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
 
-        xTreeList = xCheckListMenu.getChild("check_tree_box")
+            xTreeList = xCheckListMenu.getChild("check_tree_box")
 
-        self.assertEqual(2, len(xTreeList.getChildren()))
-        self.assertTrue(get_state_as_dict(xTreeList.getChild('0'))['IsSelected'])
-        self.assertTrue(get_state_as_dict(xTreeList.getChild('1'))['IsSelected'])
+            self.assertEqual(2, len(xTreeList.getChildren()))
+            self.assertTrue(get_state_as_dict(xTreeList.getChild('0'))['IsSelected'])
+            self.assertTrue(get_state_as_dict(xTreeList.getChild('1'))['IsSelected'])
 
-        xOkBtn = xFloatWindow.getChild("ok")
-        xOkBtn.executeAction("CLICK", tuple())
+            xOkBtn = xFloatWindow.getChild("ok")
+            xOkBtn.executeAction("CLICK", tuple())
 
-        self.assertFalse(is_row_hidden(doc, 0))
-        # Without the fix in place, this test would have failed here
-        self.assertFalse(is_row_hidden(doc, 1))
-        self.assertFalse(is_row_hidden(doc, 2))
-        self.assertFalse(is_row_hidden(doc, 3))
-        self.assertFalse(is_row_hidden(doc, 4))
-
-        self.ui_test.close_doc()
+            self.assertFalse(is_row_hidden(doc, 0))
+            # Without the fix in place, this test would have failed here
+            self.assertFalse(is_row_hidden(doc, 1))
+            self.assertFalse(is_row_hidden(doc, 2))
+            self.assertFalse(is_row_hidden(doc, 3))
+            self.assertFalse(is_row_hidden(doc, 4))
 
     def test_differentSearches(self):
         self.ui_test.create_doc_in_start_center("calc")
@@ -229,165 +223,153 @@ class AutofilterTest(UITestCase):
         self.ui_test.close_doc()
 
     def test_tdf116818(self):
-        doc = self.ui_test.load_file(get_url_for_data_file("tdf116818.xlsx"))
-
-        xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
-
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xTreeList = xCheckListMenu.getChild("check_tree_box")
-        self.assertEqual(3, len(xTreeList.getChildren()))
-        xOkBtn = xFloatWindow.getChild("cancel")
-        xOkBtn.executeAction("CLICK", tuple())
-
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xTreeList = xCheckListMenu.getChild("check_list_box")
-        self.assertEqual(5, len(xTreeList.getChildren()))
-        xOkBtn = xFloatWindow.getChild("cancel")
-        xOkBtn.executeAction("CLICK", tuple())
-
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xTreeList = xCheckListMenu.getChild("check_list_box")
-        self.assertEqual(3, len(xTreeList.getChildren()))
-        xOkBtn = xFloatWindow.getChild("cancel")
-        xOkBtn.executeAction("CLICK", tuple())
-
-        self.ui_test.close_doc()
+        with self.ui_test.load_file(get_url_for_data_file("tdf116818.xlsx")) as doc:
+
+            xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xTreeList = xCheckListMenu.getChild("check_tree_box")
+            self.assertEqual(3, len(xTreeList.getChildren()))
+            xOkBtn = xFloatWindow.getChild("cancel")
+            xOkBtn.executeAction("CLICK", tuple())
+
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xTreeList = xCheckListMenu.getChild("check_list_box")
+            self.assertEqual(5, len(xTreeList.getChildren()))
+            xOkBtn = xFloatWindow.getChild("cancel")
+            xOkBtn.executeAction("CLICK", tuple())
+
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xTreeList = xCheckListMenu.getChild("check_list_box")
+            self.assertEqual(3, len(xTreeList.getChildren()))
+            xOkBtn = xFloatWindow.getChild("cancel")
+            xOkBtn.executeAction("CLICK", tuple())
 
     def test_tdf140469(self):
-        doc = self.ui_test.load_file(get_url_for_data_file("tdf140469.xlsx"))
+        with self.ui_test.load_file(get_url_for_data_file("tdf140469.xlsx")) as doc:
 
-        xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+            xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
 
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xTreeList = xCheckListMenu.getChild("check_list_box")
-        self.assertEqual(9, len(xTreeList.getChildren()))
-        xOkBtn = xFloatWindow.getChild("cancel")
-        xOkBtn.executeAction("CLICK", tuple())
-
-        self.ui_test.close_doc()
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xTreeList = xCheckListMenu.getChild("check_list_box")
+            self.assertEqual(9, len(xTreeList.getChildren()))
+            xOkBtn = xFloatWindow.getChild("cancel")
+            xOkBtn.executeAction("CLICK", tuple())
 
     def test_tdf140462(self):
-        doc = self.ui_test.load_file(get_url_for_data_file("tdf140462.ods"))
-
-        xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
-
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xTreeList = xCheckListMenu.getChild("check_tree_box")
-        self.assertEqual(3, len(xTreeList.getChildren()))
-        xOkBtn = xFloatWindow.getChild("cancel")
-        xOkBtn.executeAction("CLICK", tuple())
-
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xTreeList = xCheckListMenu.getChild("check_list_box")
-        self.assertEqual(3, len(xTreeList.getChildren()))
-        xOkBtn = xFloatWindow.getChild("cancel")
-        xOkBtn.executeAction("CLICK", tuple())
-
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xTreeList = xCheckListMenu.getChild("check_list_box")
-        self.assertEqual(4, len(xTreeList.getChildren()))
-        xOkBtn = xFloatWindow.getChild("cancel")
-        xOkBtn.executeAction("CLICK", tuple())
-
-        self.ui_test.close_doc()
+        with self.ui_test.load_file(get_url_for_data_file("tdf140462.ods")) as doc:
+
+            xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xTreeList = xCheckListMenu.getChild("check_tree_box")
+            self.assertEqual(3, len(xTreeList.getChildren()))
+            xOkBtn = xFloatWindow.getChild("cancel")
+            xOkBtn.executeAction("CLICK", tuple())
+
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xTreeList = xCheckListMenu.getChild("check_list_box")
+            self.assertEqual(3, len(xTreeList.getChildren()))
+            xOkBtn = xFloatWindow.getChild("cancel")
+            xOkBtn.executeAction("CLICK", tuple())
+
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xTreeList = xCheckListMenu.getChild("check_list_box")
+            self.assertEqual(4, len(xTreeList.getChildren()))
+            xOkBtn = xFloatWindow.getChild("cancel")
+            xOkBtn.executeAction("CLICK", tuple())
 
     def test_tdf137626(self):
-        doc = self.ui_test.load_file(get_url_for_data_file("tdf137626.xlsx"))
+        with self.ui_test.load_file(get_url_for_data_file("tdf137626.xlsx")) as doc:
 
-        xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+            xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
 
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xTreeList = xCheckListMenu.getChild("check_list_box")
-        self.assertEqual(3, len(xTreeList.getChildren()))
-        xOkBtn = xFloatWindow.getChild("cancel")
-        xOkBtn.executeAction("CLICK", tuple())
-
-        self.ui_test.close_doc()
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xTreeList = xCheckListMenu.getChild("check_list_box")
+            self.assertEqual(3, len(xTreeList.getChildren()))
+            xOkBtn = xFloatWindow.getChild("cancel")
+            xOkBtn.executeAction("CLICK", tuple())
 
     def test_time_value(self):
-        doc = self.ui_test.load_file(get_url_for_data_file("time_value.xlsx"))
-
-        xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
-
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xTreeList = xCheckListMenu.getChild("check_list_box")
-        self.assertEqual(5, len(xTreeList.getChildren()))
-        self.assertEqual('true', get_state_as_dict(xTreeList.getChild('0'))['IsChecked'])
-        self.assertEqual('false', get_state_as_dict(xTreeList.getChild('1'))['IsChecked'])
-        self.assertEqual('true', get_state_as_dict(xTreeList.getChild('2'))['IsChecked'])
-        self.assertEqual('false', get_state_as_dict(xTreeList.getChild('3'))['IsChecked'])
-        self.assertEqual('true', get_state_as_dict(xTreeList.getChild('4'))['IsChecked'])
-        xOkBtn = xFloatWindow.getChild("cancel")
-        xOkBtn.executeAction("CLICK", tuple())
-
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xTreeList = xCheckListMenu.getChild("check_list_box")
-        self.assertEqual(2, len(xTreeList.getChildren()))
-        xOkBtn = xFloatWindow.getChild("cancel")
-        xOkBtn.executeAction("CLICK", tuple())
-
-        self.ui_test.close_doc()
+        with self.ui_test.load_file(get_url_for_data_file("time_value.xlsx")) as doc:
+
+            xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xTreeList = xCheckListMenu.getChild("check_list_box")
+            self.assertEqual(5, len(xTreeList.getChildren()))
+            self.assertEqual('true', get_state_as_dict(xTreeList.getChild('0'))['IsChecked'])
+            self.assertEqual('false', get_state_as_dict(xTreeList.getChild('1'))['IsChecked'])
+            self.assertEqual('true', get_state_as_dict(xTreeList.getChild('2'))['IsChecked'])
+            self.assertEqual('false', get_state_as_dict(xTreeList.getChild('3'))['IsChecked'])
+            self.assertEqual('true', get_state_as_dict(xTreeList.getChild('4'))['IsChecked'])
+            xOkBtn = xFloatWindow.getChild("cancel")
+            xOkBtn.executeAction("CLICK", tuple())
+
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xTreeList = xCheckListMenu.getChild("check_list_box")
+            self.assertEqual(2, len(xTreeList.getChildren()))
+            xOkBtn = xFloatWindow.getChild("cancel")
+            xOkBtn.executeAction("CLICK", tuple())
 
     def test_tdf140968(self):
-        doc = self.ui_test.load_file(get_url_for_data_file("tdf140968.xlsx"))
-
-        xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
-
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xTreeList = xCheckListMenu.getChild("check_list_box")
-        self.assertEqual(5, len(xTreeList.getChildren()))
-        self.assertEqual("0.000", get_state_as_dict(xTreeList.getChild('0'))['Text'])
-        self.assertEqual("0.046", get_state_as_dict(xTreeList.getChild('1'))['Text'])
-        self.assertEqual("0.365", get_state_as_dict(xTreeList.getChild('2'))['Text'])
-        self.assertEqual("0.500", get_state_as_dict(xTreeList.getChild('3'))['Text'])
-        self.assertEqual("0.516", get_state_as_dict(xTreeList.getChild('4'))['Text'])
-
-        self.assertEqual('false', get_state_as_dict(xTreeList.getChild('0'))['IsChecked'])
-        self.assertEqual('true', get_state_as_dict(xTreeList.getChild('1'))['IsChecked'])
-        self.assertEqual('false', get_state_as_dict(xTreeList.getChild('2'))['IsChecked'])
-        self.assertEqual('true', get_state_as_dict(xTreeList.getChild('3'))['IsChecked'])
-        self.assertEqual('true', get_state_as_dict(xTreeList.getChild('4'))['IsChecked'])
-
-        xFirstEntry = xTreeList.getChild("0")
-        xFirstEntry.executeAction("CLICK", tuple())
-        xFirstEntry = xTreeList.getChild("1")
-        xFirstEntry.executeAction("CLICK", tuple())
-
-        xOkBtn = xFloatWindow.getChild("ok")
-        xOkBtn.executeAction("CLICK", tuple())
-
-        self.assertFalse(is_row_hidden(doc, 0))
-        self.assertTrue(is_row_hidden(doc, 1))
-        self.assertTrue(is_row_hidden(doc, 2))
-        self.assertTrue(is_row_hidden(doc, 3))
-        self.assertTrue(is_row_hidden(doc, 4))
-        self.assertFalse(is_row_hidden(doc, 5))
-        self.assertFalse(is_row_hidden(doc, 6))
-        self.assertFalse(is_row_hidden(doc, 7))
-
-        self.ui_test.close_doc()
+        with self.ui_test.load_file(get_url_for_data_file("tdf140968.xlsx")) as doc:
+
+            xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xTreeList = xCheckListMenu.getChild("check_list_box")
+            self.assertEqual(5, len(xTreeList.getChildren()))
+            self.assertEqual("0.000", get_state_as_dict(xTreeList.getChild('0'))['Text'])
+            self.assertEqual("0.046", get_state_as_dict(xTreeList.getChild('1'))['Text'])
+            self.assertEqual("0.365", get_state_as_dict(xTreeList.getChild('2'))['Text'])
+            self.assertEqual("0.500", get_state_as_dict(xTreeList.getChild('3'))['Text'])
+            self.assertEqual("0.516", get_state_as_dict(xTreeList.getChild('4'))['Text'])
+
+            self.assertEqual('false', get_state_as_dict(xTreeList.getChild('0'))['IsChecked'])
+            self.assertEqual('true', get_state_as_dict(xTreeList.getChild('1'))['IsChecked'])
+            self.assertEqual('false', get_state_as_dict(xTreeList.getChild('2'))['IsChecked'])
+            self.assertEqual('true', get_state_as_dict(xTreeList.getChild('3'))['IsChecked'])
+            self.assertEqual('true', get_state_as_dict(xTreeList.getChild('4'))['IsChecked'])
+
+            xFirstEntry = xTreeList.getChild("0")
+            xFirstEntry.executeAction("CLICK", tuple())
+            xFirstEntry = xTreeList.getChild("1")
+            xFirstEntry.executeAction("CLICK", tuple())
+
+            xOkBtn = xFloatWindow.getChild("ok")
+            xOkBtn.executeAction("CLICK", tuple())
+
+            self.assertFalse(is_row_hidden(doc, 0))
+            self.assertTrue(is_row_hidden(doc, 1))
+            self.assertTrue(is_row_hidden(doc, 2))
+            self.assertTrue(is_row_hidden(doc, 3))
+            self.assertTrue(is_row_hidden(doc, 4))
+            self.assertFalse(is_row_hidden(doc, 5))
+            self.assertFalse(is_row_hidden(doc, 6))
+            self.assertFalse(is_row_hidden(doc, 7))
 
     def test_tdf142350(self):
         self.ui_test.create_doc_in_start_center("calc")
@@ -440,64 +422,61 @@ class AutofilterTest(UITestCase):
         self.ui_test.close_doc()
 
     def test_tdf138438(self):
-        doc = self.ui_test.load_file(get_url_for_data_file("tdf138438.ods"))
+        with self.ui_test.load_file(get_url_for_data_file("tdf138438.ods")) as doc:
+
+            xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+
+            # Top 10 filer
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xMenu = xFloatWindow.getChild("menu")
+            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
+
+            self.assertFalse(is_row_hidden(doc, 0))
+            self.assertTrue(is_row_hidden(doc, 1))
+            self.assertTrue(is_row_hidden(doc, 2))
+            self.assertFalse(is_row_hidden(doc, 3))
+            self.assertFalse(is_row_hidden(doc, 4))
+            self.assertFalse(is_row_hidden(doc, 5))
+            self.assertFalse(is_row_hidden(doc, 6))
+            self.assertTrue(is_row_hidden(doc, 7))
+            self.assertFalse(is_row_hidden(doc, 8))
 
-        xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+    def test_tdf142402(self):
+        with self.ui_test.load_file(get_url_for_data_file("tdf140968.xlsx")) as doc:
 
-        # Top 10 filer
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xMenu = xFloatWindow.getChild("menu")
-        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
-        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
-        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
-
-        self.assertFalse(is_row_hidden(doc, 0))
-        self.assertTrue(is_row_hidden(doc, 1))
-        self.assertTrue(is_row_hidden(doc, 2))
-        self.assertFalse(is_row_hidden(doc, 3))
-        self.assertFalse(is_row_hidden(doc, 4))
-        self.assertFalse(is_row_hidden(doc, 5))
-        self.assertFalse(is_row_hidden(doc, 6))
-        self.assertTrue(is_row_hidden(doc, 7))
-        self.assertFalse(is_row_hidden(doc, 8))
+            xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
 
-        self.ui_test.close_doc()
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            #Choose Standard Filter... button
+            xMenu = xFloatWindow.getChild("menu")
 
-    def test_tdf142402(self):
-        doc = self.ui_test.load_file(get_url_for_data_file("tdf140968.xlsx"))
+            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
 
-        xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+            xDialog = self.xUITest.getTopFocusWindow()
+            xval1 = xDialog.getChild("val1")
 
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        #Choose Standard Filter... button
-        xMenu = xFloatWindow.getChild("menu")
-
-        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
-        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
-        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
-        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
-        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
-        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
-        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
-        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
-
-        xDialog = self.xUITest.getTopFocusWindow()
-        xval1 = xDialog.getChild("val1")
-
-        select_by_text(xval1, "0.365")
-
-        xOKBtn = xDialog.getChild("ok")
-        self.ui_test.close_dialog_through_button(xOKBtn)
-
-        self.assertFalse(is_row_hidden(doc, 0))
-        self.assertFalse(is_row_hidden(doc, 1))
-        self.assertTrue(is_row_hidden(doc, 2))
-        self.assertTrue(is_row_hidden(doc, 3))
-        self.assertTrue(is_row_hidden(doc, 4))
-        self.assertTrue(is_row_hidden(doc, 5))
-        self.assertTrue(is_row_hidden(doc, 6))
+            select_by_text(xval1, "0.365")
+
+            xOKBtn = xDialog.getChild("ok")
+            self.ui_test.close_dialog_through_button(xOKBtn)
+
+            self.assertFalse(is_row_hidden(doc, 0))
+            self.assertFalse(is_row_hidden(doc, 1))
+            self.assertTrue(is_row_hidden(doc, 2))
+            self.assertTrue(is_row_hidden(doc, 3))
+            self.assertTrue(is_row_hidden(doc, 4))
+            self.assertTrue(is_row_hidden(doc, 5))
+            self.assertTrue(is_row_hidden(doc, 6))
 
-        self.ui_test.close_doc()
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/autofilter/autofilterBugs.py b/sc/qa/uitest/autofilter/autofilterBugs.py
index fabde9aabce9..ffb6419690ea 100644
--- a/sc/qa/uitest/autofilter/autofilterBugs.py
+++ b/sc/qa/uitest/autofilter/autofilterBugs.py
@@ -12,20 +12,18 @@ from uitest.uihelper.calc import enter_text_to_cell
 class autofilter(UITestCase):
 
    def test_tdf115046(self):
-        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf115046.ods"))
-        document = self.ui_test.get_component()
-        #autofilter exist
-        self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
-
-        self.ui_test.execute_dialog_through_command(".uno:DataSort")
-        xDialog = self.xUITest.getTopFocusWindow()
+        with self.ui_test.load_file(get_url_for_data_file("tdf115046.ods")) as calc_doc:
+            document = self.ui_test.get_component()
+            #autofilter exist
+            self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
 
-        xcancBtn = xDialog.getChild("cancel")
-        self.ui_test.close_dialog_through_button(xcancBtn)
-        #autofilter still exist
-        self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
+            self.ui_test.execute_dialog_through_command(".uno:DataSort")
+            xDialog = self.xUITest.getTopFocusWindow()
 
-        self.ui_test.close_doc()
+            xcancBtn = xDialog.getChild("cancel")
+            self.ui_test.close_dialog_through_button(xcancBtn)
+            #autofilter still exist
+            self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
 
    def test_tdf94055(self):
         self.ui_test.create_doc_in_start_center("calc")
@@ -59,181 +57,165 @@ class autofilter(UITestCase):
 
         #tdf77479.ods
    def test_tdf77479(self):
-        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf77479.ods"))
-        document = self.ui_test.get_component()
-        calcDoc = self.xUITest.getTopFocusWindow()
-        xGridWindow = calcDoc.getChild("grid_window")
-        #autofilter exist
-        self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
-
-        xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:E6"}))
-
-        self.ui_test.execute_dialog_through_command(".uno:DataSort")
-        xDialog = self.xUITest.getTopFocusWindow()
-        xOKBtn = xDialog.getChild("ok")
-        self.ui_test.close_dialog_through_button(xOKBtn)
-        #autofilter still exist
-        self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
-
-        self.ui_test.close_doc()
+        with self.ui_test.load_file(get_url_for_data_file("tdf77479.ods")) as calc_doc:
+            document = self.ui_test.get_component()
+            calcDoc = self.xUITest.getTopFocusWindow()
+            xGridWindow = calcDoc.getChild("grid_window")
+            #autofilter exist
+            self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
+
+            xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:E6"}))
+
+            self.ui_test.execute_dialog_through_command(".uno:DataSort")
+            xDialog = self.xUITest.getTopFocusWindow()
+            xOKBtn = xDialog.getChild("ok")
+            self.ui_test.close_dialog_through_button(xOKBtn)
+            #autofilter still exist
+            self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
 
         #112656
    def test_tdf112656(self):
-        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf112656.ods"))
-        document = self.ui_test.get_component()
-        calcDoc = self.xUITest.getTopFocusWindow()
-        xGridWindow = calcDoc.getChild("grid_window")
-
-        xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xTreeList = xFloatWindow.getChild("check_list_box")
-        xFirstEntry = xTreeList.getChild("0")
-        xSecondEntry = xTreeList.getChild("1")
-        self.assertEqual(get_state_as_dict(xFirstEntry)["Text"], "Fruit")
-        self.assertEqual(get_state_as_dict(xSecondEntry)["Text"], "Vegetables")
-
-        self.ui_test.close_doc()
+        with self.ui_test.load_file(get_url_for_data_file("tdf112656.ods")) as calc_doc:
+            document = self.ui_test.get_component()
+            calcDoc = self.xUITest.getTopFocusWindow()
+            xGridWindow = calcDoc.getChild("grid_window")
+
+            xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xTreeList = xFloatWindow.getChild("check_list_box")
+            xFirstEntry = xTreeList.getChild("0")
+            xSecondEntry = xTreeList.getChild("1")
+            self.assertEqual(get_state_as_dict(xFirstEntry)["Text"], "Fruit")
+            self.assertEqual(get_state_as_dict(xSecondEntry)["Text"], "Vegetables")
 
         #tdf81124
    def test_tdf81124(self):
-        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf81124.ods"))
-        document = self.ui_test.get_component()
-        calcDoc = self.xUITest.getTopFocusWindow()
-        xGridWindow = calcDoc.getChild("grid_window")
-
-        xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
+        with self.ui_test.load_file(get_url_for_data_file("tdf81124.ods")) as calc_doc:
+            document = self.ui_test.get_component()
+            calcDoc = self.xUITest.getTopFocusWindow()
+            xGridWindow = calcDoc.getChild("grid_window")
 
-        xUnselect = xFloatWindow.getChild("unselect_current")
-        xUnselect.executeAction("CLICK", tuple())
-        xokBtn = xFloatWindow.getChild("ok")
-        self.assertEqual(get_state_as_dict(xokBtn)["Enabled"], "false")
+            xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
 
-        xSelect = xFloatWindow.getChild("select_current")
-        xSelect.executeAction("CLICK", tuple())
-        xokBtn = xFloatWindow.getChild("ok")
-        self.assertEqual(get_state_as_dict(xokBtn)["Enabled"], "true")
+            xUnselect = xFloatWindow.getChild("unselect_current")
+            xUnselect.executeAction("CLICK", tuple())
+            xokBtn = xFloatWindow.getChild("ok")
+            self.assertEqual(get_state_as_dict(xokBtn)["Enabled"], "false")
 
-        xCancel = xFloatWindow.getChild("cancel")
-        xCancel.executeAction("CLICK", tuple())
+            xSelect = xFloatWindow.getChild("select_current")
+            xSelect.executeAction("CLICK", tuple())
+            xokBtn = xFloatWindow.getChild("ok")
+            self.assertEqual(get_state_as_dict(xokBtn)["Enabled"], "true")
 
-        self.ui_test.close_doc()
+            xCancel = xFloatWindow.getChild("cancel")
+            xCancel.executeAction("CLICK", tuple())
 
 #tdf73565
    def test_tdf73565(self):
-        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf73565.ods"))
-        document = self.ui_test.get_component()
-        calcDoc = self.xUITest.getTopFocusWindow()
-        xGridWindow = calcDoc.getChild("grid_window")
+        with self.ui_test.load_file(get_url_for_data_file("tdf73565.ods")) as calc_doc:
+            document = self.ui_test.get_component()
+            calcDoc = self.xUITest.getTopFocusWindow()
+            xGridWindow = calcDoc.getChild("grid_window")
 
-        xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xTreeList = xFloatWindow.getChild("check_tree_box")
-        xFirstEntry = xTreeList.getChild("0")
-        self.assertEqual(get_state_as_dict(xFirstEntry)["Text"], "2014")
+            xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xTreeList = xFloatWindow.getChild("check_tree_box")
+            xFirstEntry = xTreeList.getChild("0")
+            self.assertEqual(get_state_as_dict(xFirstEntry)["Text"], "2014")
 
-        xCancel = xFloatWindow.getChild("cancel")
-        xCancel.executeAction("CLICK", tuple())
-
-        self.ui_test.close_doc()
+            xCancel = xFloatWindow.getChild("cancel")
+            xCancel.executeAction("CLICK", tuple())
 
         #tdf65505
    def test_tdf65505(self):
-        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf81124.ods"))
-        document = self.ui_test.get_component()
-        calcDoc = self.xUITest.getTopFocusWindow()
-        xGridWindow = calcDoc.getChild("grid_window")
+        with self.ui_test.load_file(get_url_for_data_file("tdf81124.ods")) as calc_doc:
+            document = self.ui_test.get_component()
+            calcDoc = self.xUITest.getTopFocusWindow()
+            xGridWindow = calcDoc.getChild("grid_window")
 
-        xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xTreeList = xFloatWindow.getChild("check_list_box")
-        xFirstEntry = xTreeList.getChild("0")
-        self.assertEqual(get_state_as_dict(xFirstEntry)["Text"], "(empty)")
+            xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xTreeList = xFloatWindow.getChild("check_list_box")
+            xFirstEntry = xTreeList.getChild("0")
+            self.assertEqual(get_state_as_dict(xFirstEntry)["Text"], "(empty)")
 
-        xCancel = xFloatWindow.getChild("cancel")
-        xCancel.executeAction("CLICK", tuple())
-
-        self.ui_test.close_doc()
+            xCancel = xFloatWindow.getChild("cancel")
+            xCancel.executeAction("CLICK", tuple())
 
 #tdf74857
    def test_tdf74857(self):
-        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf74857.ods"))
-        document = self.ui_test.get_component()
-        calcDoc = self.xUITest.getTopFocusWindow()
-        xGridWindow = calcDoc.getChild("grid_window")
-
-        xGridWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"SHIFT+CTRL+DOWN"}))
-        # Assert that the correct range has been selected
-        gridWinState = get_state_as_dict(xGridWindow)
-        self.assertEqual(gridWinState["MarkedArea"], "Sheet1.A1:Sheet1.A25")
+        with self.ui_test.load_file(get_url_for_data_file("tdf74857.ods")) as calc_doc:
+            document = self.ui_test.get_component()
+            calcDoc = self.xUITest.getTopFocusWindow()
+            xGridWindow = calcDoc.getChild("grid_window")
 
-        self.ui_test.close_doc()
+            xGridWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"SHIFT+CTRL+DOWN"}))
+            # Assert that the correct range has been selected
+            gridWinState = get_state_as_dict(xGridWindow)
+            self.assertEqual(gridWinState["MarkedArea"], "Sheet1.A1:Sheet1.A25")
 
         #tdf35294
    def test_tdf35294(self):
-        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf35294.ods"))
-        document = self.ui_test.get_component()
-        calcDoc = self.xUITest.getTopFocusWindow()
-        xGridWindow = calcDoc.getChild("grid_window")
-
-        xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xTreeList = xFloatWindow.getChild("check_list_box")
-        x1Entry = xTreeList.getChild("0")
-        x2Entry = xTreeList.getChild("1")
-        x3Entry = xTreeList.getChild("2")
-        x4Entry = xTreeList.getChild("3")
-        x5Entry = xTreeList.getChild("4")
-        x6Entry = xTreeList.getChild("5")
-        x7Entry = xTreeList.getChild("6")
-
-        self.assertEqual(get_state_as_dict(x1Entry)["Text"], "a")
-        self.assertEqual(get_state_as_dict(x2Entry)["Text"], "á")
-        self.assertEqual(get_state_as_dict(x3Entry)["Text"], "b")
-        self.assertEqual(get_state_as_dict(x4Entry)["Text"], "č")
-        self.assertEqual(get_state_as_dict(x5Entry)["Text"], "é")
-        self.assertEqual(get_state_as_dict(x6Entry)["Text"], "ř")
-        self.assertEqual(get_state_as_dict(x7Entry)["Text"], "ž")
-
-        xCancel = xFloatWindow.getChild("cancel")
-        xCancel.executeAction("CLICK", tuple())
-
-        self.ui_test.close_doc()
+        with self.ui_test.load_file(get_url_for_data_file("tdf35294.ods")) as calc_doc:
+            document = self.ui_test.get_component()
+            calcDoc = self.xUITest.getTopFocusWindow()
+            xGridWindow = calcDoc.getChild("grid_window")
+
+            xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xTreeList = xFloatWindow.getChild("check_list_box")
+            x1Entry = xTreeList.getChild("0")
+            x2Entry = xTreeList.getChild("1")
+            x3Entry = xTreeList.getChild("2")
+            x4Entry = xTreeList.getChild("3")
+            x5Entry = xTreeList.getChild("4")
+            x6Entry = xTreeList.getChild("5")
+            x7Entry = xTreeList.getChild("6")
+
+            self.assertEqual(get_state_as_dict(x1Entry)["Text"], "a")
+            self.assertEqual(get_state_as_dict(x2Entry)["Text"], "á")
+            self.assertEqual(get_state_as_dict(x3Entry)["Text"], "b")
+            self.assertEqual(get_state_as_dict(x4Entry)["Text"], "č")
+            self.assertEqual(get_state_as_dict(x5Entry)["Text"], "é")
+            self.assertEqual(get_state_as_dict(x6Entry)["Text"], "ř")
+            self.assertEqual(get_state_as_dict(x7Entry)["Text"], "ž")
+
+            xCancel = xFloatWindow.getChild("cancel")
+            xCancel.executeAction("CLICK", tuple())
 
         #tdf55712
    def test_tdf55712(self):
-        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf55712.ods"))
-        document = self.ui_test.get_component()
-        calcDoc = self.xUITest.getTopFocusWindow()
-        xGridWindow = calcDoc.getChild("grid_window")
-
-        xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xTreeList = xFloatWindow.getChild("check_list_box")
-        x1Entry = xTreeList.getChild("0")
-        x2Entry = xTreeList.getChild("1")
-        x3Entry = xTreeList.getChild("2")
-        x4Entry = xTreeList.getChild("3")
-        x5Entry = xTreeList.getChild("4")
-        x6Entry = xTreeList.getChild("5")
-        x7Entry = xTreeList.getChild("6")
-        x8Entry = xTreeList.getChild("7")
-        x9Entry = xTreeList.getChild("8")
-
-        self.assertEqual(get_state_as_dict(x1Entry)["Text"], "(empty)")
-        self.assertEqual(get_state_as_dict(x2Entry)["Text"], "0")
-        self.assertEqual(get_state_as_dict(x3Entry)["Text"], "0.1")
-        self.assertEqual(get_state_as_dict(x4Entry)["Text"], "0.2")
-        self.assertEqual(get_state_as_dict(x5Entry)["Text"], "0.3")
-        self.assertEqual(get_state_as_dict(x6Entry)["Text"], "0.5")
-        self.assertEqual(get_state_as_dict(x7Entry)["Text"], "0.8")
-        self.assertEqual(get_state_as_dict(x8Entry)["Text"], "0.9")
-        self.assertEqual(get_state_as_dict(x9Entry)["Text"], "1")
-        self.assertEqual(get_state_as_dict(xTreeList)["Children"], "9")
-
-        xCancel = xFloatWindow.getChild("cancel")
-        xCancel.executeAction("CLICK", tuple())
-
-        self.ui_test.close_doc()
+        with self.ui_test.load_file(get_url_for_data_file("tdf55712.ods")) as calc_doc:
+            document = self.ui_test.get_component()
+            calcDoc = self.xUITest.getTopFocusWindow()
+            xGridWindow = calcDoc.getChild("grid_window")
+
+            xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xTreeList = xFloatWindow.getChild("check_list_box")
+            x1Entry = xTreeList.getChild("0")
+            x2Entry = xTreeList.getChild("1")
+            x3Entry = xTreeList.getChild("2")
+            x4Entry = xTreeList.getChild("3")
+            x5Entry = xTreeList.getChild("4")
+            x6Entry = xTreeList.getChild("5")
+            x7Entry = xTreeList.getChild("6")
+            x8Entry = xTreeList.getChild("7")
+            x9Entry = xTreeList.getChild("8")
+
+            self.assertEqual(get_state_as_dict(x1Entry)["Text"], "(empty)")
+            self.assertEqual(get_state_as_dict(x2Entry)["Text"], "0")
+            self.assertEqual(get_state_as_dict(x3Entry)["Text"], "0.1")
+            self.assertEqual(get_state_as_dict(x4Entry)["Text"], "0.2")
+            self.assertEqual(get_state_as_dict(x5Entry)["Text"], "0.3")
+            self.assertEqual(get_state_as_dict(x6Entry)["Text"], "0.5")
+            self.assertEqual(get_state_as_dict(x7Entry)["Text"], "0.8")
+            self.assertEqual(get_state_as_dict(x8Entry)["Text"], "0.9")
+            self.assertEqual(get_state_as_dict(x9Entry)["Text"], "1")
+            self.assertEqual(get_state_as_dict(xTreeList)["Children"], "9")
+
+            xCancel = xFloatWindow.getChild("cancel")
+            xCancel.executeAction("CLICK", tuple())
 
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/autofilter/tdf101165.py b/sc/qa/uitest/autofilter/tdf101165.py
index 1eda0193b69c..e71820e53e0a 100644
--- a/sc/qa/uitest/autofilter/tdf101165.py
+++ b/sc/qa/uitest/autofilter/tdf101165.py
@@ -13,17 +13,16 @@ from uitest.uihelper.common import get_url_for_data_file
 
 class tdf101165(UITestCase):
     def test_tdf101165_autofilter(self):
-        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf101165.ods"))
-        xCalcDoc = self.xUITest.getTopFocusWindow()
-        gridwin = xCalcDoc.getChild("grid_window")
-        document = self.ui_test.get_component()
+        with self.ui_test.load_file(get_url_for_data_file("tdf101165.ods")) as calc_doc:
+            xCalcDoc = self.xUITest.getTopFocusWindow()
+            gridwin = xCalcDoc.getChild("grid_window")
+            document = self.ui_test.get_component()
 
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xAll = xFloatWindow.getChild("toggle_all")
-        xAll.executeAction("CLICK", tuple())
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xAll = xFloatWindow.getChild("toggle_all")
+            xAll.executeAction("CLICK", tuple())
 
-        self.assertEqual(get_cell_by_position(document, 1, 0, 1).getValue(), 6494)
+            self.assertEqual(get_cell_by_position(document, 1, 0, 1).getValue(), 6494)
 
-        self.ui_test.close_doc()
-# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/autofilter/tdf117276.py b/sc/qa/uitest/autofilter/tdf117276.py
index 9f2fa71ee69a..fdd5e91b7f83 100644
--- a/sc/qa/uitest/autofilter/tdf117276.py
+++ b/sc/qa/uitest/autofilter/tdf117276.py
@@ -13,85 +13,84 @@ from uitest.uihelper.common import get_url_for_data_file
 
 class tdf117276(UITestCase):
     def test_tdf117276_autofilter(self):
-        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf117276.ods"))
-        xCalcDoc = self.xUITest.getTopFocusWindow()
-        gridwin = xCalcDoc.getChild("grid_window")
-        document = self.ui_test.get_component()
-        # 1. open attached file
-        # 2. open filter of column B (Fabrikat) and deselect (Citroen, Fiat, Ford, Opel, Peugeot, Renault, Tesla)
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xTreeList = xCheckListMenu.getChild("check_list_box")
-
-        xCitroenEntry = xTreeList.getChild("2")
-        xCitroenEntry.executeAction("CLICK", tuple())   #Citroen
-        xFiatEntry = xTreeList.getChild("3")
-        xFiatEntry.executeAction("CLICK", tuple())   #Fiat
-        xFordEntry = xTreeList.getChild("4")
-        xFordEntry.executeAction("CLICK", tuple())   #Ford
-        xOpelEntry = xTreeList.getChild("6")
-        xOpelEntry.executeAction("CLICK", tuple())   #Opel
-        xPeugeotEntry = xTreeList.getChild("7")
-        xPeugeotEntry.executeAction("CLICK", tuple())   #Peugeot
-        xRenaultEntry = xTreeList.getChild("9")
-        xRenaultEntry.executeAction("CLICK", tuple())   #Renault
-        xTeslaEntry = xTreeList.getChild("10")
-        xTeslaEntry.executeAction("CLICK", tuple())   #Tesla
-
-        xOkBtn = xFloatWindow.getChild("ok")
-        xOkBtn.executeAction("CLICK", tuple())
-
-        self.assertFalse(is_row_hidden(calc_doc, 0))
-        self.assertFalse(is_row_hidden(calc_doc, 1))
-        self.assertTrue(is_row_hidden(calc_doc, 3))
-
-        # 3. open filter of column I (Wert) and deselect 8000 (Values 7000 and 9000 are not shown)
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "8", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xTreeList = xCheckListMenu.getChild("check_list_box")
-
-        xCitroenEntry = xTreeList.getChild("0")
-        xCitroenEntry.executeAction("CLICK", tuple())
-
-        xOkBtn = xFloatWindow.getChild("ok")
-        xOkBtn.executeAction("CLICK", tuple())
-
-        self.assertFalse(is_row_hidden(calc_doc, 0))
-        self.assertFalse(is_row_hidden(calc_doc, 1))
-        self.assertTrue(is_row_hidden(calc_doc, 9))
-
-        # 4. open filter of column B and select Tesla
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xTreeList = xCheckListMenu.getChild("check_list_box")
-        xTeslaEntry = xTreeList.getChild("4")
-        xTeslaEntry.executeAction("CLICK", tuple())   #Tesla
-
-        xOkBtn = xFloatWindow.getChild("ok")
-        xOkBtn.executeAction("CLICK", tuple())
-        self.assertFalse(is_row_hidden(calc_doc, 0))
-        self.assertFalse(is_row_hidden(calc_doc, 1))
-        self.assertFalse(is_row_hidden(calc_doc, 21))
-
-        # 5. open filter of column I and select 7000 --> 8000 because:new strategy of the filter is implemented
-        #(which strings to show and which to hide, when multiple filters are in used).
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "8", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xTreeList = xCheckListMenu.getChild("check_list_box")
-
-        x8000Entry = xTreeList.getChild("1") # check "8000"
-        x8000Entry.executeAction("CLICK", tuple())
-
-        xOkBtn = xFloatWindow.getChild("ok")
-        xOkBtn.executeAction("CLICK", tuple())
-
-        self.assertFalse(is_row_hidden(calc_doc, 0))
-        self.assertFalse(is_row_hidden(calc_doc, 1))
-        self.assertFalse(is_row_hidden(calc_doc, 7))
-
-        self.ui_test.close_doc()
+        with self.ui_test.load_file(get_url_for_data_file("tdf117276.ods")) as calc_doc:
+            xCalcDoc = self.xUITest.getTopFocusWindow()
+            gridwin = xCalcDoc.getChild("grid_window")
+            document = self.ui_test.get_component()
+            # 1. open attached file
+            # 2. open filter of column B (Fabrikat) and deselect (Citroen, Fiat, Ford, Opel, Peugeot, Renault, Tesla)
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xTreeList = xCheckListMenu.getChild("check_list_box")
+
+            xCitroenEntry = xTreeList.getChild("2")
+            xCitroenEntry.executeAction("CLICK", tuple())   #Citroen
+            xFiatEntry = xTreeList.getChild("3")
+            xFiatEntry.executeAction("CLICK", tuple())   #Fiat
+            xFordEntry = xTreeList.getChild("4")
+            xFordEntry.executeAction("CLICK", tuple())   #Ford
+            xOpelEntry = xTreeList.getChild("6")
+            xOpelEntry.executeAction("CLICK", tuple())   #Opel
+            xPeugeotEntry = xTreeList.getChild("7")
+            xPeugeotEntry.executeAction("CLICK", tuple())   #Peugeot
+            xRenaultEntry = xTreeList.getChild("9")
+            xRenaultEntry.executeAction("CLICK", tuple())   #Renault
+            xTeslaEntry = xTreeList.getChild("10")
+            xTeslaEntry.executeAction("CLICK", tuple())   #Tesla
+
+            xOkBtn = xFloatWindow.getChild("ok")
+            xOkBtn.executeAction("CLICK", tuple())
+
+            self.assertFalse(is_row_hidden(calc_doc, 0))
+            self.assertFalse(is_row_hidden(calc_doc, 1))
+            self.assertTrue(is_row_hidden(calc_doc, 3))
+
+            # 3. open filter of column I (Wert) and deselect 8000 (Values 7000 and 9000 are not shown)
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "8", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xTreeList = xCheckListMenu.getChild("check_list_box")
+
+            xCitroenEntry = xTreeList.getChild("0")
+            xCitroenEntry.executeAction("CLICK", tuple())
+
+            xOkBtn = xFloatWindow.getChild("ok")
+            xOkBtn.executeAction("CLICK", tuple())
+
+            self.assertFalse(is_row_hidden(calc_doc, 0))
+            self.assertFalse(is_row_hidden(calc_doc, 1))
+            self.assertTrue(is_row_hidden(calc_doc, 9))
+
+            # 4. open filter of column B and select Tesla
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xTreeList = xCheckListMenu.getChild("check_list_box")
+            xTeslaEntry = xTreeList.getChild("4")
+            xTeslaEntry.executeAction("CLICK", tuple())   #Tesla
+
+            xOkBtn = xFloatWindow.getChild("ok")
+            xOkBtn.executeAction("CLICK", tuple())
+            self.assertFalse(is_row_hidden(calc_doc, 0))
+            self.assertFalse(is_row_hidden(calc_doc, 1))
+            self.assertFalse(is_row_hidden(calc_doc, 21))
+
+            # 5. open filter of column I and select 7000 --> 8000 because:new strategy of the filter is implemented
+            #(which strings to show and which to hide, when multiple filters are in used).
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "8", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xTreeList = xCheckListMenu.getChild("check_list_box")
+
+            x8000Entry = xTreeList.getChild("1") # check "8000"
+            x8000Entry.executeAction("CLICK", tuple())
+
+            xOkBtn = xFloatWindow.getChild("ok")
+            xOkBtn.executeAction("CLICK", tuple())
+
+            self.assertFalse(is_row_hidden(calc_doc, 0))
+            self.assertFalse(is_row_hidden(calc_doc, 1))
+            self.assertFalse(is_row_hidden(calc_doc, 7))
+
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/autofilter/tdf122260.py b/sc/qa/uitest/autofilter/tdf122260.py
index 00c141e3195f..fb2c905e3844 100644
--- a/sc/qa/uitest/autofilter/tdf122260.py
+++ b/sc/qa/uitest/autofilter/tdf122260.py
@@ -59,29 +59,27 @@ class tdf122260(UITestCase):
         return valuesCount
 
     def test_tdf122260_autofilter(self):
-        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf122260.ods"))
-        xCalcDoc = self.xUITest.getTopFocusWindow()
-        gridwin = xCalcDoc.getChild("grid_window")
-        self.assertIsNotNone(gridwin)
-
-        # filter out b1
-        self.check_value_in_AutoFilter(gridwin, "1", "0")
-        # filter out a2 (as a1 is filtered out a2 is the first item)
-        self.check_value_in_AutoFilter(gridwin, "0", "0")
-        # return back a2 (as a1 is filtered out a2 is the first item)
-        self.check_value_in_AutoFilter(gridwin, "0", "0")
-
-        # check rows visibility
-        # row-0 is row with headers
-        self.assertTrue(is_row_hidden(calc_doc, 1))
-        self.assertFalse(is_row_hidden(calc_doc, 2))
-        self.assertFalse(is_row_hidden(calc_doc, 3))
-        self.assertFalse(is_row_hidden(calc_doc, 4))
-
-        # check if "b1" is accessible in filter of the column-b
-        # (so all values of the column B are available)
-        self.assertEqual(4, self.get_values_count_in_AutoFilter(gridwin, "1"))
-
-        self.ui_test.close_doc()
+        with self.ui_test.load_file(get_url_for_data_file("tdf122260.ods")) as calc_doc:
+            xCalcDoc = self.xUITest.getTopFocusWindow()
+            gridwin = xCalcDoc.getChild("grid_window")
+            self.assertIsNotNone(gridwin)
+
+            # filter out b1
+            self.check_value_in_AutoFilter(gridwin, "1", "0")
+            # filter out a2 (as a1 is filtered out a2 is the first item)
+            self.check_value_in_AutoFilter(gridwin, "0", "0")
+            # return back a2 (as a1 is filtered out a2 is the first item)
+            self.check_value_in_AutoFilter(gridwin, "0", "0")
+
+            # check rows visibility
+            # row-0 is row with headers
+            self.assertTrue(is_row_hidden(calc_doc, 1))
+            self.assertFalse(is_row_hidden(calc_doc, 2))
+            self.assertFalse(is_row_hidden(calc_doc, 3))
+            self.assertFalse(is_row_hidden(calc_doc, 4))
+
+            # check if "b1" is accessible in filter of the column-b
+            # (so all values of the column B are available)
+            self.assertEqual(4, self.get_values_count_in_AutoFilter(gridwin, "1"))
 
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/autofilter/tdf130070.py b/sc/qa/uitest/autofilter/tdf130070.py
index 227355626a75..1ea4b8fbaf9c 100644
--- a/sc/qa/uitest/autofilter/tdf130070.py
+++ b/sc/qa/uitest/autofilter/tdf130070.py
@@ -13,43 +13,42 @@ from uitest.uihelper.common import get_url_for_data_file
 
 class tdf130770(UITestCase):
     def test_tdf130770_autofilter(self):
-        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf130770.ods"))
-        xCalcDoc = self.xUITest.getTopFocusWindow()
-        gridwin = xCalcDoc.getChild("grid_window")
-        document = self.ui_test.get_component()
-
-        # 1. open attached file and check initial state
-        self.assertFalse(is_row_hidden(calc_doc, 0))
-        self.assertFalse(is_row_hidden(calc_doc, 1))
-        self.assertTrue(is_row_hidden(calc_doc, 2))
-        self.assertFalse(is_row_hidden(calc_doc, 3))
-        self.assertFalse(is_row_hidden(calc_doc, 4))
-
-        # 2. open filter of column A  and cancel
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-
-        xOkBtn = xFloatWindow.getChild("cancel")
-        xOkBtn.executeAction("CLICK", tuple())
-
-        self.assertFalse(is_row_hidden(calc_doc, 0))
-        self.assertFalse(is_row_hidden(calc_doc, 1))
-        self.assertTrue(is_row_hidden(calc_doc, 2))
-        self.assertFalse(is_row_hidden(calc_doc, 3))
-        self.assertFalse(is_row_hidden(calc_doc, 4))
-
-        # 3. open filter of column A  and just click OK
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-
-        xOkBtn = xFloatWindow.getChild("ok")
-        xOkBtn.executeAction("CLICK", tuple())
-
-        self.assertFalse(is_row_hidden(calc_doc, 0))
-        self.assertFalse(is_row_hidden(calc_doc, 1))
-        self.assertTrue(is_row_hidden(calc_doc, 2))
-        self.assertFalse(is_row_hidden(calc_doc, 3))
-        self.assertTrue(is_row_hidden(calc_doc, 4)) # filtered out
-
-        self.ui_test.close_doc()
+        with self.ui_test.load_file(get_url_for_data_file("tdf130770.ods")) as calc_doc:
+            xCalcDoc = self.xUITest.getTopFocusWindow()
+            gridwin = xCalcDoc.getChild("grid_window")
+            document = self.ui_test.get_component()
+
+            # 1. open attached file and check initial state
+            self.assertFalse(is_row_hidden(calc_doc, 0))
+            self.assertFalse(is_row_hidden(calc_doc, 1))
+            self.assertTrue(is_row_hidden(calc_doc, 2))
+            self.assertFalse(is_row_hidden(calc_doc, 3))
+            self.assertFalse(is_row_hidden(calc_doc, 4))
+
+            # 2. open filter of column A  and cancel
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+
+            xOkBtn = xFloatWindow.getChild("cancel")
+            xOkBtn.executeAction("CLICK", tuple())
+
+            self.assertFalse(is_row_hidden(calc_doc, 0))
+            self.assertFalse(is_row_hidden(calc_doc, 1))
+            self.assertTrue(is_row_hidden(calc_doc, 2))
+            self.assertFalse(is_row_hidden(calc_doc, 3))
+            self.assertFalse(is_row_hidden(calc_doc, 4))
+
+            # 3. open filter of column A  and just click OK
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+
+            xOkBtn = xFloatWindow.getChild("ok")
+            xOkBtn.executeAction("CLICK", tuple())
+
+            self.assertFalse(is_row_hidden(calc_doc, 0))
+            self.assertFalse(is_row_hidden(calc_doc, 1))
+            self.assertTrue(is_row_hidden(calc_doc, 2))
+            self.assertFalse(is_row_hidden(calc_doc, 3))
+            self.assertTrue(is_row_hidden(calc_doc, 4)) # filtered out
+
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/autofilter/tdf140754.py b/sc/qa/uitest/autofilter/tdf140754.py
index 4d413ac0d85f..186637e303b9 100644
--- a/sc/qa/uitest/autofilter/tdf140754.py
+++ b/sc/qa/uitest/autofilter/tdf140754.py
@@ -13,72 +13,70 @@ class tdf140754(UITestCase):
 
     def test_tdf140754(self):
 
-        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf140754.ods"))
-
-        #Make sure 'multi-threaded calculation' is enabled
-        self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog")
-        xDialogOpt = self.xUITest.getTopFocusWindow()
-
-        xPages = xDialogOpt.getChild("pages")
-        xCalcEntry = xPages.getChild('3')
-        xCalcEntry.executeAction("EXPAND", tuple())
-        xCalcCalculateEntry = xCalcEntry.getChild('3')
-        xCalcCalculateEntry.executeAction("SELECT", tuple())
-
-        self.assertEqual('true', get_state_as_dict(xDialogOpt.getChild('threadingenabled'))["Selected"])
-
-        xOKBtn = xDialogOpt.getChild("ok")
-        self.ui_test.close_dialog_through_button(xOKBtn)
-
-        document = self.ui_test.get_component()
-
-        self.assertEqual(0, get_cell_by_position(document, 0, 0, 30).getValue())
-        self.assertEqual(0, get_cell_by_position(document, 0, 0, 82).getValue())
-        self.assertEqual(1, get_cell_by_position(document, 0, 0, 238).getValue())
-        self.assertEqual(28, get_cell_by_position(document, 0, 0, 265).getValue())
-        self.assertEqual(28, get_cell_by_position(document, 0, 0, 1370).getValue())
-
-        xCalcDoc = self.xUITest.getTopFocusWindow()
-        gridwin = xCalcDoc.getChild("grid_window")
-        document = self.ui_test.get_component()
-
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xAll = xFloatWindow.getChild("toggle_all")
-        xAll.executeAction("CLICK", tuple())
-
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xList = xCheckListMenu.getChild("check_list_box")
-        self.assertEqual(25, len(xList.getChildren()))
-
-        # Without the fix in place, this test would have crashed here
-        xOkBtn = xFloatWindow.getChild("ok")
-        xOkBtn.executeAction("CLICK", tuple())
-
-        self.assertEqual(0, get_cell_by_position(document, 0, 0, 30).getValue())
-        self.assertEqual(1, get_cell_by_position(document, 0, 0, 82).getValue())
-        self.assertEqual(39, get_cell_by_position(document, 0, 0, 238).getValue())
-        self.assertEqual(66, get_cell_by_position(document, 0, 0, 265).getValue())
-        self.assertEqual(282, get_cell_by_position(document, 0, 0, 1370).getValue())
-
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "6", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xAll = xFloatWindow.getChild("toggle_all")
-        xAll.executeAction("CLICK", tuple())
-
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xList = xCheckListMenu.getChild("check_list_box")
-        self.assertEqual(10, len(xList.getChildren()))
-
-        xOkBtn = xFloatWindow.getChild("ok")
-        xOkBtn.executeAction("CLICK", tuple())
-
-        self.assertEqual(1, get_cell_by_position(document, 0, 0, 30).getValue())
-        self.assertEqual(11, get_cell_by_position(document, 0, 0, 82).getValue())
-        self.assertEqual(69, get_cell_by_position(document, 0, 0, 238).getValue())
-        self.assertEqual(96, get_cell_by_position(document, 0, 0, 265).getValue())
-        self.assertEqual(411, get_cell_by_position(document, 0, 0, 1370).getValue())
-
-        self.ui_test.close_doc()
+        with self.ui_test.load_file(get_url_for_data_file("tdf140754.ods")) as calc_doc:
+
+            #Make sure 'multi-threaded calculation' is enabled
+            self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog")
+            xDialogOpt = self.xUITest.getTopFocusWindow()
+
+            xPages = xDialogOpt.getChild("pages")
+            xCalcEntry = xPages.getChild('3')
+            xCalcEntry.executeAction("EXPAND", tuple())
+            xCalcCalculateEntry = xCalcEntry.getChild('3')
+            xCalcCalculateEntry.executeAction("SELECT", tuple())
+
+            self.assertEqual('true', get_state_as_dict(xDialogOpt.getChild('threadingenabled'))["Selected"])
+
+            xOKBtn = xDialogOpt.getChild("ok")
+            self.ui_test.close_dialog_through_button(xOKBtn)
+
+            document = self.ui_test.get_component()
+
+            self.assertEqual(0, get_cell_by_position(document, 0, 0, 30).getValue())
+            self.assertEqual(0, get_cell_by_position(document, 0, 0, 82).getValue())
+            self.assertEqual(1, get_cell_by_position(document, 0, 0, 238).getValue())
+            self.assertEqual(28, get_cell_by_position(document, 0, 0, 265).getValue())
+            self.assertEqual(28, get_cell_by_position(document, 0, 0, 1370).getValue())
+
+            xCalcDoc = self.xUITest.getTopFocusWindow()
+            gridwin = xCalcDoc.getChild("grid_window")
+            document = self.ui_test.get_component()
+
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xAll = xFloatWindow.getChild("toggle_all")
+            xAll.executeAction("CLICK", tuple())
+
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xList = xCheckListMenu.getChild("check_list_box")
+            self.assertEqual(25, len(xList.getChildren()))
+
+            # Without the fix in place, this test would have crashed here
+            xOkBtn = xFloatWindow.getChild("ok")
+            xOkBtn.executeAction("CLICK", tuple())
+
+            self.assertEqual(0, get_cell_by_position(document, 0, 0, 30).getValue())
+            self.assertEqual(1, get_cell_by_position(document, 0, 0, 82).getValue())
+            self.assertEqual(39, get_cell_by_position(document, 0, 0, 238).getValue())
+            self.assertEqual(66, get_cell_by_position(document, 0, 0, 265).getValue())
+            self.assertEqual(282, get_cell_by_position(document, 0, 0, 1370).getValue())
+
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "6", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xAll = xFloatWindow.getChild("toggle_all")
+            xAll.executeAction("CLICK", tuple())
+
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xList = xCheckListMenu.getChild("check_list_box")
+            self.assertEqual(10, len(xList.getChildren()))
+
+            xOkBtn = xFloatWindow.getChild("ok")
+            xOkBtn.executeAction("CLICK", tuple())
+
+            self.assertEqual(1, get_cell_by_position(document, 0, 0, 30).getValue())
+            self.assertEqual(11, get_cell_by_position(document, 0, 0, 82).getValue())
+            self.assertEqual(69, get_cell_by_position(document, 0, 0, 238).getValue())
+            self.assertEqual(96, get_cell_by_position(document, 0, 0, 265).getValue())
+            self.assertEqual(411, get_cell_by_position(document, 0, 0, 1370).getValue())
 
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/autofilter/tdf92767.py b/sc/qa/uitest/autofilter/tdf92767.py
index e846e0bcfb40..a016d2337f86 100644
--- a/sc/qa/uitest/autofilter/tdf92767.py
+++ b/sc/qa/uitest/autofilter/tdf92767.py
@@ -12,42 +12,40 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
 class tdf92767(UITestCase):
 
     def test_tdf92767(self):
-        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf92767.ods"))
-        xCalcDoc = self.xUITest.getTopFocusWindow()
-        gridwin = xCalcDoc.getChild("grid_window")
-        document = self.ui_test.get_component()
-
-        for i in range(0,25):
-            self.assertFalse(is_row_hidden(calc_doc, i))
-
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xTreeList = xFloatWindow.getChild("check_tree_box")
-        xFirstEntry = xTreeList.getChild("0")
-        self.assertEqual('2015', get_state_as_dict(xFirstEntry)["Text"])
-        self.assertEqual('7', get_state_as_dict(xFirstEntry)["Children"])
-
-        # Deselect all the options but the last one
-        for i in range(6):
-            xChild = xFirstEntry.getChild(str(i))
-            xChild.executeAction("CLICK", tuple())
-            self.assertEqual('false', get_state_as_dict(xChild)['IsChecked'])
-
-        xLastChild = xFirstEntry.getChild('6')
-        self.assertEqual('true', get_state_as_dict(xLastChild)['IsChecked'])
-        self.assertEqual('July', get_state_as_dict(xLastChild)['Text'])
-
-        xOkBtn = xFloatWindow.getChild("ok")
-        xOkBtn.executeAction("CLICK", tuple())
-
-        for i in range(1,22):
-            self.assertTrue(is_row_hidden(calc_doc, i))
-
-        # Without the fix in place, this test would have failed here
-        self.assertFalse(is_row_hidden(calc_doc, 23))
-        self.assertFalse(is_row_hidden(calc_doc, 24))
-        self.assertFalse(is_row_hidden(calc_doc, 25))
-
-        self.ui_test.close_doc()
+        with self.ui_test.load_file(get_url_for_data_file("tdf92767.ods")) as calc_doc:
+            xCalcDoc = self.xUITest.getTopFocusWindow()
+            gridwin = xCalcDoc.getChild("grid_window")
+            document = self.ui_test.get_component()
+
+            for i in range(0,25):
+                self.assertFalse(is_row_hidden(calc_doc, i))
+
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xTreeList = xFloatWindow.getChild("check_tree_box")
+            xFirstEntry = xTreeList.getChild("0")
+            self.assertEqual('2015', get_state_as_dict(xFirstEntry)["Text"])
+            self.assertEqual('7', get_state_as_dict(xFirstEntry)["Children"])
+
+            # Deselect all the options but the last one
+            for i in range(6):
+                xChild = xFirstEntry.getChild(str(i))
+                xChild.executeAction("CLICK", tuple())
+                self.assertEqual('false', get_state_as_dict(xChild)['IsChecked'])
+
+            xLastChild = xFirstEntry.getChild('6')
+            self.assertEqual('true', get_state_as_dict(xLastChild)['IsChecked'])
+            self.assertEqual('July', get_state_as_dict(xLastChild)['Text'])
+
+            xOkBtn = xFloatWindow.getChild("ok")
+            xOkBtn.executeAction("CLICK", tuple())
+
+            for i in range(1,22):
+                self.assertTrue(is_row_hidden(calc_doc, i))
+
+            # Without the fix in place, this test would have failed here
+            self.assertFalse(is_row_hidden(calc_doc, 23))
+            self.assertFalse(is_row_hidden(calc_doc, 24))
+            self.assertFalse(is_row_hidden(calc_doc, 25))
 
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/autofilter/tdf97340.py b/sc/qa/uitest/autofilter/tdf97340.py
index 7ef59bf6b641..f4b58ce5a7d4 100644
--- a/sc/qa/uitest/autofilter/tdf97340.py
+++ b/sc/qa/uitest/autofilter/tdf97340.py
@@ -12,30 +12,29 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
 
 class tdf97340(UITestCase):
     def test_tdf97340_autofilter(self):
-        calc_doc = self.ui_test.load_file(get_url_for_data_file("autofilter.ods"))
-        xCalcDoc = self.xUITest.getTopFocusWindow()
-        gridwin = xCalcDoc.getChild("grid_window")
-        document = self.ui_test.get_component()
+        with self.ui_test.load_file(get_url_for_data_file("autofilter.ods")) as calc_doc:
+            xCalcDoc = self.xUITest.getTopFocusWindow()
+            gridwin = xCalcDoc.getChild("grid_window")
+            document = self.ui_test.get_component()
 
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
 
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xTreeList = xCheckListMenu.getChild("check_tree_box")
-        self.assertEqual(2, len(xTreeList.getChildren()))
-        self.assertEqual("2016", get_state_as_dict(xTreeList.getChild('0'))['Text'])
-        self.assertEqual("2017", get_state_as_dict(xTreeList.getChild('1'))['Text'])
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xTreeList = xCheckListMenu.getChild("check_tree_box")
+            self.assertEqual(2, len(xTreeList.getChildren()))
+            self.assertEqual("2016", get_state_as_dict(xTreeList.getChild('0'))['Text'])
+            self.assertEqual("2017", get_state_as_dict(xTreeList.getChild('1'))['Text'])
 
-        xsearchEdit = xFloatWindow.getChild("search_edit")
-        xsearchEdit.executeAction("TYPE", mkPropertyValues({"TEXT":" "}))
-        self.assertEqual(0, len(xTreeList.getChildren()))
+            xsearchEdit = xFloatWindow.getChild("search_edit")
+            xsearchEdit.executeAction("TYPE", mkPropertyValues({"TEXT":" "}))
+            self.assertEqual(0, len(xTreeList.getChildren()))
 
-        xsearchEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
+            xsearchEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
 
-        #tdf#133785, without the fix in place, it would have been 0
-        self.assertEqual(2, len(xTreeList.getChildren()))
-        self.assertEqual("2016", get_state_as_dict(xTreeList.getChild('0'))['Text'])
-        self.assertEqual("2017", get_state_as_dict(xTreeList.getChild('1'))['Text'])
+            #tdf#133785, without the fix in place, it would have been 0
+            self.assertEqual(2, len(xTreeList.getChildren()))
+            self.assertEqual("2016", get_state_as_dict(xTreeList.getChild('0'))['Text'])
+            self.assertEqual("2017", get_state_as_dict(xTreeList.getChild('1'))['Text'])
 
-        self.ui_test.close_doc()
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests/autofill.py b/sc/qa/uitest/calc_tests/autofill.py
index 23f8bd9bac26..57691ef5c499 100644
--- a/sc/qa/uitest/calc_tests/autofill.py
+++ b/sc/qa/uitest/calc_tests/autofill.py
@@ -14,115 +14,113 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
 class CalcAutofill(UITestCase):
 
     def test_autofill(self):
-        calc_doc = self.ui_test.load_file(get_url_for_data_file("autofill.ods"))
-        xCalcDoc = self.xUITest.getTopFocusWindow()
-        gridwin = xCalcDoc.getChild("grid_window")
-        document = self.ui_test.get_component()
-        #Select cell A12 and drag the fill handle in the bottom right corner of the cell down to A18
-        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A12:A18"}))
-        self.ui_test.execute_dialog_through_command(".uno:FillSeries")
-        xDialog = self.xUITest.getTopFocusWindow()
-        xOK = xDialog.getChild("ok")
-        self.ui_test.close_dialog_through_button(xOK)
-        #Compare with the content in the right next column
-        self.assertEqual(get_cell_by_position(document, 0, 0, 11).getValue(), 18.34)
-        self.assertEqual(get_cell_by_position(document, 0, 0, 12).getValue(), 19.34)
-        self.assertEqual(get_cell_by_position(document, 0, 0, 13).getValue(), 20.34)
-        self.assertEqual(get_cell_by_position(document, 0, 0, 14).getValue(), 21.34)
-        self.assertEqual(get_cell_by_position(document, 0, 0, 15).getValue(), 22.34)
-        self.assertEqual(get_cell_by_position(document, 0, 0, 16).getValue(), 23.34)
-        self.assertEqual(get_cell_by_position(document, 0, 0, 17).getValue(), 24.34)
-        #Select cell A12 and drag the fill handle in the bottom right corner of the cell up to A6
-        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A6:A12"}))
-        self.ui_test.execute_dialog_through_command(".uno:FillSeries")
-        xDialog = self.xUITest.getTopFocusWindow()
-        xup = xDialog.getChild("up")
-        xincrement = xDialog.getChild("increment")
-        xup.executeAction("CLICK", tuple())
-        xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
-        xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
-        xincrement.executeAction("TYPE", mkPropertyValues({"TEXT":"-1"}))
-        xOK = xDialog.getChild("ok")
-        self.ui_test.close_dialog_through_button(xOK)
-        #Compare with the content in the right next column
-        self.assertEqual(get_cell_by_position(document, 0, 0, 5).getValue(), 12.34)
-        self.assertEqual(get_cell_by_position(document, 0, 0, 6).getValue(), 13.34)
-        self.assertEqual(get_cell_by_position(document, 0, 0, 7).getValue(), 14.34)
-        self.assertEqual(get_cell_by_position(document, 0, 0, 8).getValue(), 15.34)
-        self.assertEqual(get_cell_by_position(document, 0, 0, 9).getValue(), 16.34)
-        self.assertEqual(get_cell_by_position(document, 0, 0, 10).getValue(), 17.34)
-        self.assertEqual(get_cell_by_position(document, 0, 0, 11).getValue(), 18.34)
+        with self.ui_test.load_file(get_url_for_data_file("autofill.ods")) as calc_doc:
+            xCalcDoc = self.xUITest.getTopFocusWindow()
+            gridwin = xCalcDoc.getChild("grid_window")
+            document = self.ui_test.get_component()
+            #Select cell A12 and drag the fill handle in the bottom right corner of the cell down to A18
+            gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A12:A18"}))
+            self.ui_test.execute_dialog_through_command(".uno:FillSeries")
+            xDialog = self.xUITest.getTopFocusWindow()
+            xOK = xDialog.getChild("ok")
+            self.ui_test.close_dialog_through_button(xOK)
+            #Compare with the content in the right next column
+            self.assertEqual(get_cell_by_position(document, 0, 0, 11).getValue(), 18.34)
+            self.assertEqual(get_cell_by_position(document, 0, 0, 12).getValue(), 19.34)
+            self.assertEqual(get_cell_by_position(document, 0, 0, 13).getValue(), 20.34)
+            self.assertEqual(get_cell_by_position(document, 0, 0, 14).getValue(), 21.34)
+            self.assertEqual(get_cell_by_position(document, 0, 0, 15).getValue(), 22.34)
+            self.assertEqual(get_cell_by_position(document, 0, 0, 16).getValue(), 23.34)
+            self.assertEqual(get_cell_by_position(document, 0, 0, 17).getValue(), 24.34)
+            #Select cell A12 and drag the fill handle in the bottom right corner of the cell up to A6
+            gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A6:A12"}))
+            self.ui_test.execute_dialog_through_command(".uno:FillSeries")
+            xDialog = self.xUITest.getTopFocusWindow()
+            xup = xDialog.getChild("up")
+            xincrement = xDialog.getChild("increment")
+            xup.executeAction("CLICK", tuple())
+            xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+            xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+            xincrement.executeAction("TYPE", mkPropertyValues({"TEXT":"-1"}))
+            xOK = xDialog.getChild("ok")
+            self.ui_test.close_dialog_through_button(xOK)
+            #Compare with the content in the right next column
+            self.assertEqual(get_cell_by_position(document, 0, 0, 5).getValue(), 12.34)
+            self.assertEqual(get_cell_by_position(document, 0, 0, 6).getValue(), 13.34)
+            self.assertEqual(get_cell_by_position(document, 0, 0, 7).getValue(), 14.34)
+            self.assertEqual(get_cell_by_position(document, 0, 0, 8).getValue(), 15.34)
+            self.assertEqual(get_cell_by_position(document, 0, 0, 9).getValue(), 16.34)
+            self.assertEqual(get_cell_by_position(document, 0, 0, 10).getValue(), 17.34)
+            self.assertEqual(get_cell_by_position(document, 0, 0, 11).getValue(), 18.34)
 
-        #Continue with the next cells with grey background
-        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "M12:M18"}))
-        self.ui_test.execute_dialog_through_command(".uno:FillSeries")
-        xDialog = self.xUITest.getTopFocusWindow()
-        xOK = xDialog.getChild("ok")
-        self.ui_test.close_dialog_through_button(xOK)
-        #Compare with the content in the right next column
-        self.assertEqual(get_cell_by_position(document, 0, 12, 11).getString(), "12abc40")
-        self.assertEqual(get_cell_by_position(document, 0, 12, 12).getString(), "12abc41")
-        self.assertEqual(get_cell_by_position(document, 0, 12, 13).getString(), "12abc42")
-        self.assertEqual(get_cell_by_position(document, 0, 12, 14).getString(), "12abc43")
-        self.assertEqual(get_cell_by_position(document, 0, 12, 15).getString(), "12abc44")
-        self.assertEqual(get_cell_by_position(document, 0, 12, 16).getString(), "12abc45")
-        self.assertEqual(get_cell_by_position(document, 0, 12, 17).getString(), "12abc46")
+            #Continue with the next cells with grey background
+            gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "M12:M18"}))
+            self.ui_test.execute_dialog_through_command(".uno:FillSeries")
+            xDialog = self.xUITest.getTopFocusWindow()
+            xOK = xDialog.getChild("ok")
+            self.ui_test.close_dialog_through_button(xOK)
+            #Compare with the content in the right next column
+            self.assertEqual(get_cell_by_position(document, 0, 12, 11).getString(), "12abc40")
+            self.assertEqual(get_cell_by_position(document, 0, 12, 12).getString(), "12abc41")
+            self.assertEqual(get_cell_by_position(document, 0, 12, 13).getString(), "12abc42")
+            self.assertEqual(get_cell_by_position(document, 0, 12, 14).getString(), "12abc43")
+            self.assertEqual(get_cell_by_position(document, 0, 12, 15).getString(), "12abc44")
+            self.assertEqual(get_cell_by_position(document, 0, 12, 16).getString(), "12abc45")
+            self.assertEqual(get_cell_by_position(document, 0, 12, 17).getString(), "12abc46")
 
-        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "M6:M12"}))
-        self.ui_test.execute_dialog_through_command(".uno:FillSeries")
-        xDialog = self.xUITest.getTopFocusWindow()
-        xup = xDialog.getChild("up")
-        xincrement = xDialog.getChild("increment")
-        xup.executeAction("CLICK", tuple())
-        xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
-        xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
-        xincrement.executeAction("TYPE", mkPropertyValues({"TEXT":"-1"}))
-        xOK = xDialog.getChild("ok")
-        self.ui_test.close_dialog_through_button(xOK)
-        #Compare with the content in the right next column
-        self.assertEqual(get_cell_by_position(document, 0, 12, 5).getString(), "12abc34")
-        self.assertEqual(get_cell_by_position(document, 0, 12, 6).getString(), "12abc35")
-        self.assertEqual(get_cell_by_position(document, 0, 12, 7).getString(), "12abc36")
-        self.assertEqual(get_cell_by_position(document, 0, 12, 8).getString(), "12abc37")
-        self.assertEqual(get_cell_by_position(document, 0, 12, 9).getString(), "12abc38")
-        self.assertEqual(get_cell_by_position(document, 0, 12, 10).getString(), "12abc39")
-        self.assertEqual(get_cell_by_position(document, 0, 12, 11).getString(), "12abc40")
-
-        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "P12:P18"}))
-        self.ui_test.execute_dialog_through_command(".uno:FillSeries")
-        xDialog = self.xUITest.getTopFocusWindow()
-        xOK = xDialog.getChild("ok")
-        self.ui_test.close_dialog_through_button(xOK)
-        #Compare with the content in the right next column
-        self.assertEqual(get_cell_by_position(document, 0, 15, 11).getString(), "10.64.127.7")
-        self.assertEqual(get_cell_by_position(document, 0, 15, 12).getString(), "10.64.127.8")
-        self.assertEqual(get_cell_by_position(document, 0, 15, 13).getString(), "10.64.127.9")
-        self.assertEqual(get_cell_by_position(document, 0, 15, 14).getString(), "10.64.127.10")
-        self.assertEqual(get_cell_by_position(document, 0, 15, 15).getString(), "10.64.127.11")
-        self.assertEqual(get_cell_by_position(document, 0, 15, 16).getString(), "10.64.127.12")
-        self.assertEqual(get_cell_by_position(document, 0, 15, 17).getString(), "10.64.127.13")
+            gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "M6:M12"}))
+            self.ui_test.execute_dialog_through_command(".uno:FillSeries")
+            xDialog = self.xUITest.getTopFocusWindow()
+            xup = xDialog.getChild("up")
+            xincrement = xDialog.getChild("increment")
+            xup.executeAction("CLICK", tuple())
+            xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+            xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+            xincrement.executeAction("TYPE", mkPropertyValues({"TEXT":"-1"}))
+            xOK = xDialog.getChild("ok")
+            self.ui_test.close_dialog_through_button(xOK)
+            #Compare with the content in the right next column
+            self.assertEqual(get_cell_by_position(document, 0, 12, 5).getString(), "12abc34")
+            self.assertEqual(get_cell_by_position(document, 0, 12, 6).getString(), "12abc35")
+            self.assertEqual(get_cell_by_position(document, 0, 12, 7).getString(), "12abc36")
+            self.assertEqual(get_cell_by_position(document, 0, 12, 8).getString(), "12abc37")
+            self.assertEqual(get_cell_by_position(document, 0, 12, 9).getString(), "12abc38")
+            self.assertEqual(get_cell_by_position(document, 0, 12, 10).getString(), "12abc39")
+            self.assertEqual(get_cell_by_position(document, 0, 12, 11).getString(), "12abc40")
 
-        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "P6:P12"}))
-        self.ui_test.execute_dialog_through_command(".uno:FillSeries")
-        xDialog = self.xUITest.getTopFocusWindow()
-        xup = xDialog.getChild("up")
-        xincrement = xDialog.getChild("increment")
-        xup.executeAction("CLICK", tuple())
-        xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
-        xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
-        xincrement.executeAction("TYPE", mkPropertyValues({"TEXT":"-1"}))
-        xOK = xDialog.getChild("ok")
-        self.ui_test.close_dialog_through_button(xOK)
-        #Compare with the content in the right next column
-        self.assertEqual(get_cell_by_position(document, 0, 15, 5).getString(), "10.64.127.1")
-        self.assertEqual(get_cell_by_position(document, 0, 15, 6).getString(), "10.64.127.2")
-        self.assertEqual(get_cell_by_position(document, 0, 15, 7).getString(), "10.64.127.3")
-        self.assertEqual(get_cell_by_position(document, 0, 15, 8).getString(), "10.64.127.4")
-        self.assertEqual(get_cell_by_position(document, 0, 15, 9).getString(), "10.64.127.5")
-        self.assertEqual(get_cell_by_position(document, 0, 15, 10).getString(), "10.64.127.6")
-        self.assertEqual(get_cell_by_position(document, 0, 15, 11).getString(), "10.64.127.7")
+            gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "P12:P18"}))
+            self.ui_test.execute_dialog_through_command(".uno:FillSeries")
+            xDialog = self.xUITest.getTopFocusWindow()
+            xOK = xDialog.getChild("ok")
+            self.ui_test.close_dialog_through_button(xOK)
+            #Compare with the content in the right next column
+            self.assertEqual(get_cell_by_position(document, 0, 15, 11).getString(), "10.64.127.7")
+            self.assertEqual(get_cell_by_position(document, 0, 15, 12).getString(), "10.64.127.8")
+            self.assertEqual(get_cell_by_position(document, 0, 15, 13).getString(), "10.64.127.9")
+            self.assertEqual(get_cell_by_position(document, 0, 15, 14).getString(), "10.64.127.10")
+            self.assertEqual(get_cell_by_position(document, 0, 15, 15).getString(), "10.64.127.11")
+            self.assertEqual(get_cell_by_position(document, 0, 15, 16).getString(), "10.64.127.12")
+            self.assertEqual(get_cell_by_position(document, 0, 15, 17).getString(), "10.64.127.13")
 
-        self.ui_test.close_doc()
+            gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "P6:P12"}))
+            self.ui_test.execute_dialog_through_command(".uno:FillSeries")
+            xDialog = self.xUITest.getTopFocusWindow()
+            xup = xDialog.getChild("up")
+            xincrement = xDialog.getChild("increment")
+            xup.executeAction("CLICK", tuple())
+            xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+            xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+            xincrement.executeAction("TYPE", mkPropertyValues({"TEXT":"-1"}))
+            xOK = xDialog.getChild("ok")
+            self.ui_test.close_dialog_through_button(xOK)
+            #Compare with the content in the right next column
+            self.assertEqual(get_cell_by_position(document, 0, 15, 5).getString(), "10.64.127.1")
+            self.assertEqual(get_cell_by_position(document, 0, 15, 6).getString(), "10.64.127.2")
+            self.assertEqual(get_cell_by_position(document, 0, 15, 7).getString(), "10.64.127.3")
+            self.assertEqual(get_cell_by_position(document, 0, 15, 8).getString(), "10.64.127.4")
+            self.assertEqual(get_cell_by_position(document, 0, 15, 9).getString(), "10.64.127.5")
+            self.assertEqual(get_cell_by_position(document, 0, 15, 10).getString(), "10.64.127.6")

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list