[Libreoffice-commits] core.git: cui/qa sc/qa sd/qa svx/qa sw/qa uitest/demo_ui uitest/impress_tests uitest/math_tests uitest/uitest

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


 cui/qa/uitest/dialogs/chardlg.py                        |  139 -
 cui/qa/uitest/dialogs/pastedlg.py                       |   57 
 cui/qa/uitest/dialogs/shortcuts.py                      |   34 
 sc/qa/uitest/autofilter/autofilter.py                   |  216 +-
 sc/qa/uitest/autofilter/autofilterBugs.py               |   54 
 sc/qa/uitest/autofilter/tdf117276_autofilter_reset.py   |  247 +--
 sc/qa/uitest/autofilter/tdf126306.py                    |  229 +--
 sc/qa/uitest/autofilter/tdf141559.py                    |  146 -
 sc/qa/uitest/autofilter/tdf141946.py                    |   94 -
 sc/qa/uitest/autofilter/tdf36383.py                     |   76 -
 sc/qa/uitest/autofilter/tdf46062.py                     |   62 
 sc/qa/uitest/autofilter/tdf48025.py                     |   88 -
 sc/qa/uitest/autofilter/tdf68113.py                     |  104 -
 sc/qa/uitest/calc_tests/CalcPasteOnly.py                |   49 
 sc/qa/uitest/calc_tests/CellDropDownItems.py            |  136 -
 sc/qa/uitest/calc_tests/Comments.py                     |   66 
 sc/qa/uitest/calc_tests/autofill.py                     |   33 
 sc/qa/uitest/calc_tests/calcSheetDelete.py              |  207 +-
 sc/qa/uitest/calc_tests/cellBackgroundColorSelector.py  |  368 ++---
 sc/qa/uitest/calc_tests/columns.py                      |  478 +++---
 sc/qa/uitest/calc_tests/fillRandomNumber.py             |   79 -
 sc/qa/uitest/calc_tests/formatCells.py                  |  832 +++++------
 sc/qa/uitest/calc_tests/mergedRowsColumns.py            |   25 
 sc/qa/uitest/calc_tests/printRange.py                   |  183 +-
 sc/qa/uitest/calc_tests/rows.py                         |  398 ++---
 sc/qa/uitest/calc_tests/sheetRename.py                  |   81 -
 sc/qa/uitest/calc_tests/zoom.py                         |   92 -
 sc/qa/uitest/calc_tests2/dataform.py                    |   17 
 sc/qa/uitest/calc_tests2/standardFilter.py              | 1053 +++++++-------
 sc/qa/uitest/calc_tests2/tdf104117.py                   |   59 
 sc/qa/uitest/calc_tests2/tdf117367.py                   |   70 
 sc/qa/uitest/calc_tests2/tdf120174.py                   |   29 
 sc/qa/uitest/calc_tests2/tdf126577.py                   |   44 
 sc/qa/uitest/calc_tests2/tdf46138.py                    |   37 
 sc/qa/uitest/calc_tests2/tdf51700.py                    |   68 
 sc/qa/uitest/calc_tests3/clearCells.py                  |  548 +++----
 sc/qa/uitest/calc_tests3/insertQrCodeGen.py             |  125 -
 sc/qa/uitest/calc_tests3/tdf69450.py                    |   85 -
 sc/qa/uitest/calc_tests3/tdf73006.py                    |   44 
 sc/qa/uitest/calc_tests3/tdf79983.py                    |   94 -
 sc/qa/uitest/calc_tests3/tdf80693.py                    |   65 
 sc/qa/uitest/calc_tests3/tdf82398.py                    |   82 -
 sc/qa/uitest/calc_tests4/tdf88999.py                    |   58 
 sc/qa/uitest/calc_tests4/tdf89907.py                    |   86 -
 sc/qa/uitest/calc_tests4/tdf92423.py                    |  104 -
 sc/qa/uitest/calc_tests4/tdf94208.py                    |   56 
 sc/qa/uitest/calc_tests4/trackedChanges.py              |  472 +++---
 sc/qa/uitest/calc_tests6/autoFormat.py                  |  106 -
 sc/qa/uitest/calc_tests6/autocorrectOptions.py          |  168 +-
 sc/qa/uitest/calc_tests6/hideShowSheet.py               |   78 -
 sc/qa/uitest/calc_tests6/moveCopySheet.py               |  112 -
 sc/qa/uitest/calc_tests6/multipleOperations.py          |  197 +-
 sc/qa/uitest/calc_tests6/scenarios.py                   |   67 
 sc/qa/uitest/calc_tests6/shareSpreadsheet.py            |   27 
 sc/qa/uitest/calc_tests6/tdf104378.py                   |   30 
 sc/qa/uitest/calc_tests6/tdf116996.py                   |   77 -
 sc/qa/uitest/calc_tests6/tdf121263.py                   |   59 
 sc/qa/uitest/calc_tests6/tdf91726.py                    |   58 
 sc/qa/uitest/calc_tests7/tdf106667.py                   |   27 
 sc/qa/uitest/calc_tests7/tdf117987.py                   |   21 
 sc/qa/uitest/calc_tests7/tdf123122.py                   |   89 -
 sc/qa/uitest/calc_tests7/tdf125030.py                   |   31 
 sc/qa/uitest/calc_tests7/tdf45020.py                    |   41 
 sc/qa/uitest/calc_tests8/navigator.py                   |   50 
 sc/qa/uitest/calc_tests8/tdf114710.py                   |    2 
 sc/qa/uitest/calc_tests8/tdf118308.py                   |   65 
 sc/qa/uitest/calc_tests8/tdf125051.py                   |   52 
 sc/qa/uitest/calc_tests8/tdf126248.py                   |    2 
 sc/qa/uitest/calc_tests8/tdf137726.py                   |   22 
 sc/qa/uitest/calc_tests9/tdf113571.py                   |    2 
 sc/qa/uitest/calc_tests9/tdf117879.py                   |   38 
 sc/qa/uitest/calc_tests9/tdf121949.py                   |   26 
 sc/qa/uitest/calc_tests9/tdf125440.py                   |    2 
 sc/qa/uitest/calc_tests9/tdf133629.py                   |   98 -
 sc/qa/uitest/calc_tests9/tdf141244.py                   |   34 
 sc/qa/uitest/chart/copyPaste.py                         |    2 
 sc/qa/uitest/chart/create_chart.py                      |  115 -
 sc/qa/uitest/chart/edit_chart.py                        |   44 
 sc/qa/uitest/chart/tdf107097.py                         |    2 
 sc/qa/uitest/chart/tdf120348.py                         |    2 
 sc/qa/uitest/chart/tdf124295.py                         |   26 
 sc/qa/uitest/chart/tdf131715.py                         |   21 
 sc/qa/uitest/chart/tdf136011.py                         |    2 
 sc/qa/uitest/chart/tdf46885.py                          |   61 
 sc/qa/uitest/chart/tdf62057.py                          |    2 
 sc/qa/uitest/chart/tdf98690.py                          |    2 
 sc/qa/uitest/conditional_format/tdf105351.py            |   80 -
 sc/qa/uitest/conditional_format/tdf105411.py            |   24 
 sc/qa/uitest/conditional_format/tdf105466.py            |   22 
 sc/qa/uitest/conditional_format/tdf117899.py            |   29 
 sc/qa/uitest/function_wizard/function_wizard.py         |   16 
 sc/qa/uitest/function_wizard/tdf132173.py               |   24 
 sc/qa/uitest/hide_cols/tdf95306.py                      |   34 
 sc/qa/uitest/inputLine/tdf54197.py                      |   30 
 sc/qa/uitest/inputLine/tdf67346.py                      |   44 
 sc/qa/uitest/key_f4/f4.py                               |  201 +-
 sc/qa/uitest/manual_tests/calc.py                       |  266 +--
 sc/qa/uitest/manual_tests/more_calc.py                  |   53 
 sc/qa/uitest/options/tdf122977.py                       |   82 -
 sc/qa/uitest/protect/protectSheet.py                    |   82 -
 sc/qa/uitest/protect/protectSpreadsheet.py              |   42 
 sc/qa/uitest/range_name/create_range_name.py            |  224 +--
 sc/qa/uitest/range_name/tdf137617.py                    |  126 -
 sc/qa/uitest/range_name/tdf138822.py                    |   62 
 sc/qa/uitest/range_name/tdf86214.py                     |   58 
 sc/qa/uitest/search_replace/tdf132097.py                |   36 
 sc/qa/uitest/search_replace/tdf39917.py                 |  153 +-
 sc/qa/uitest/search_replace/tdf44398.py                 |  121 -
 sc/qa/uitest/search_replace/tdf57523.py                 |   56 
 sc/qa/uitest/signatureLine/insertSignatureLine.py       |  155 +-
 sc/qa/uitest/sort/naturalSort.py                        |  163 +-
 sc/qa/uitest/sort/sorting.py                            |  533 +++----
 sc/qa/uitest/sort/subtotals.py                          |   58 
 sc/qa/uitest/sort/tdf100517.py                          |   66 
 sc/qa/uitest/sort/tdf126678.py                          |   62 
 sc/qa/uitest/sort/tdf53482.py                           |   70 
 sc/qa/uitest/sort/tdf91305.py                           |  206 +-
 sc/qa/uitest/sort/tdf99773.py                           |   59 
 sc/qa/uitest/statistics/anova.py                        |  231 +--
 sc/qa/uitest/statistics/chiSquare.py                    |  134 -
 sc/qa/uitest/statistics/correlation.py                  |  359 ++--
 sc/qa/uitest/statistics/covariance.py                   |  355 ++--
 sc/qa/uitest/statistics/descriptiveStatistics.py        |  287 +--
 sc/qa/uitest/statistics/exponentialSmoothing.py         |  311 ++--
 sc/qa/uitest/statistics/fTest.py                        |  184 +-
 sc/qa/uitest/statistics/movingAverage.py                |  316 ++--
 sc/qa/uitest/statistics/regression.py                   |   12 
 sc/qa/uitest/statistics/sampling.py                     |  167 +-
 sc/qa/uitest/statistics/tTest.py                        |  190 +-
 sc/qa/uitest/statistics/zTest.py                        |  168 +-
 sc/qa/uitest/textCase/textCase.py                       |  221 +--
 sc/qa/uitest/validity/tdf138134.py                      |   80 -
 sc/qa/uitest/validity/tdf53920.py                       |  106 -
 sc/qa/uitest/validity/tdf65686.py                       |   72 
 sc/qa/uitest/validity/tdf96698.py                       |  222 +--
 sc/qa/uitest/validity/validity.py                       |  220 +--
 sd/qa/uitest/impress_tests/autocorrectOptions.py        |  170 +-
 sd/qa/uitest/impress_tests/customSlideShow.py           |  102 -
 sd/qa/uitest/impress_tests/insertSlide.py               |   62 
 sd/qa/uitest/impress_tests/masterElements.py            |   66 
 sd/qa/uitest/impress_tests/masterSlides.py              |   42 
 sd/qa/uitest/impress_tests/renameSlide.py               |   55 
 sd/qa/uitest/impress_tests/slideShowSettings.py         |   92 -
 sd/qa/uitest/impress_tests/tdf106612.py                 |   39 
 sd/qa/uitest/impress_tests/tdf125449.py                 |   88 -
 sd/qa/uitest/impress_tests/tdf126605.py                 |   22 
 sd/qa/uitest/impress_tests/tdf130440.py                 |   65 
 sd/qa/uitest/impress_tests/tdf134734.py                 |  174 +-
 sd/qa/uitest/impress_tests/tdf137729.py                 |   56 
 sd/qa/uitest/impress_tests/tdf139511.py                 |   54 
 sd/qa/uitest/impress_tests/tdf141297.py                 |  108 -
 sd/qa/uitest/impress_tests/tdf141708.py                 |   23 
 sd/qa/uitest/impress_tests/tdf82616.py                  |   70 
 sd/qa/uitest/impress_tests/tdf91762.py                  |   64 
 sd/qa/uitest/impress_tests/textColumnsDialog.py         |    5 
 svx/qa/uitest/table/tablecontroller.py                  |  110 -
 sw/qa/uitest/chapterNumbering/chapterNumbering.py       |  127 -
 sw/qa/uitest/chapterNumbering/tdf140528.py              |   50 
 sw/qa/uitest/chart/tdf138556.py                         |   71 
 sw/qa/uitest/classification/classification.py           |  251 +--
 sw/qa/uitest/findBar/findbar.py                         |   80 -
 sw/qa/uitest/findBar/tdf136941.py                       |   66 
 sw/qa/uitest/findBar/tdf138232.py                       |   46 
 sw/qa/uitest/findBar/tdf88608.py                        |   52 
 sw/qa/uitest/findReplace/findReplace.py                 |   80 -
 sw/qa/uitest/findReplace/tdf106099.py                   |   47 
 sw/qa/uitest/findReplace/tdf119462.py                   |   45 
 sw/qa/uitest/librelogo/run.py                           |  118 -
 sw/qa/uitest/macro_tests/tdf124413.py                   |   56 
 sw/qa/uitest/macro_tests/tdf64690.py                    |   78 -
 sw/qa/uitest/navigator/tdf137274.py                     |   62 
 sw/qa/uitest/navigator/tdf140257.py                     |  116 -
 sw/qa/uitest/options/optionsDialog.py                   |   64 
 sw/qa/uitest/options/tdf131581.py                       |   34 
 sw/qa/uitest/options/tdf78133.py                        |   61 
 sw/qa/uitest/sidebar/stylesSidebar.py                   |   86 -
 sw/qa/uitest/sidebar/tdf133189.py                       |  124 -
 sw/qa/uitest/sidebar/tdf135590.py                       |   90 -
 sw/qa/uitest/styleInspector/tdf137105.py                |   48 
 sw/qa/uitest/styleInspector/tdf137513.py                |   66 
 sw/qa/uitest/table/insertTableDialog.py                 |   84 -
 sw/qa/uitest/table/sheetToTable.py                      |   22 
 sw/qa/uitest/table/tdf115026.py                         |   29 
 sw/qa/uitest/table/tdf116737.py                         |   71 
 sw/qa/uitest/table/tdf128593.py                         |   44 
 sw/qa/uitest/table/textToTable.py                       |   46 
 sw/qa/uitest/ui/fmtui/fmtui.py                          |   35 
 sw/qa/uitest/ui/index/index.py                          |   71 
 sw/qa/uitest/writer_tests/comments.py                   |  240 +--
 sw/qa/uitest/writer_tests/insertCaption.py              |   84 -
 sw/qa/uitest/writer_tests/tdf134734.py                  |  134 -
 sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py |   24 
 sw/qa/uitest/writer_tests/tdf53460.py                   |  111 -
 sw/qa/uitest/writer_tests/tdf78068.py                   |   29 
 sw/qa/uitest/writer_tests/tdf93068.py                   |   65 
 sw/qa/uitest/writer_tests/trackedChanges.py             |  196 +-
 sw/qa/uitest/writer_tests/watermark.py                  |   95 -
 sw/qa/uitest/writer_tests/wordCount.py                  |  307 ++--
 sw/qa/uitest/writer_tests2/asianPhoneticGuide.py        |   41 
 sw/qa/uitest/writer_tests2/bookmark.py                  |  180 +-
 sw/qa/uitest/writer_tests2/deleteAllComments.py         |   45 
 sw/qa/uitest/writer_tests2/documentProperties.py        |  192 +-
 sw/qa/uitest/writer_tests2/exchangeDatabase.py          |   54 
 sw/qa/uitest/writer_tests2/fontworks.py                 |   36 
 sw/qa/uitest/writer_tests2/formatBulletsNumbering.py    |  591 +++-----
 sw/qa/uitest/writer_tests2/formatCharacter.py           |  486 +++---
 sw/qa/uitest/writer_tests2/formatParagraph.py           | 1171 +++++++---------
 sw/qa/uitest/writer_tests2/horizontalLine.py            |   39 
 sw/qa/uitest/writer_tests2/insertFootnote.py            |   35 
 sw/qa/uitest/writer_tests2/pasteSpecial.py              |   36 
 sw/qa/uitest/writer_tests2/tdf116474.py                 |   65 
 sw/qa/uitest/writer_tests3/autoredactDialog.py          |  209 +-
 sw/qa/uitest/writer_tests3/customizeDialog.py           |  169 +-
 sw/qa/uitest/writer_tests3/hyperlinkdialog.py           |  109 -
 sw/qa/uitest/writer_tests3/insertEndnote.py             |   35 
 sw/qa/uitest/writer_tests3/insertEnvelope.py            |   47 
 sw/qa/uitest/writer_tests3/insertFootEndnote.py         |  105 -
 sw/qa/uitest/writer_tests3/insertPageFooter.py          |   33 
 sw/qa/uitest/writer_tests3/insertQrCodeGen.py           |  113 -
 sw/qa/uitest/writer_tests3/insertSignatureLine.py       |  155 +-
 sw/qa/uitest/writer_tests3/lineNumbering.py             |  146 -
 sw/qa/uitest/writer_tests3/pageDialog.py                |  112 -
 sw/qa/uitest/writer_tests3/sort.py                      |   89 -
 sw/qa/uitest/writer_tests3/specialCharacter.py          |  105 -
 sw/qa/uitest/writer_tests3/tdf79236.py                  |  148 --
 sw/qa/uitest/writer_tests4/insertBreakDialog.py         |   58 
 sw/qa/uitest/writer_tests4/insertPageHeader.py          |   34 
 sw/qa/uitest/writer_tests4/spellDialog.py               |   74 -
 sw/qa/uitest/writer_tests4/start.py                     |   32 
 sw/qa/uitest/writer_tests4/tdf113252.py                 |   47 
 sw/qa/uitest/writer_tests4/tdf115572.py                 |  109 -
 sw/qa/uitest/writer_tests4/tdf115573.py                 |  211 +-
 sw/qa/uitest/writer_tests4/tdf51352.py                  |   71 
 sw/qa/uitest/writer_tests4/tdf92611.py                  |    8 
 sw/qa/uitest/writer_tests5/about_test.py                |   12 
 sw/qa/uitest/writer_tests5/autocorrectOptions.py        |  166 +-
 sw/qa/uitest/writer_tests5/columns.py                   |   66 
 sw/qa/uitest/writer_tests5/tdf107494.py                 |  123 -
 sw/qa/uitest/writer_tests5/tdf122045.py                 |   36 
 sw/qa/uitest/writer_tests5/tdf122722.py                 |   97 -
 sw/qa/uitest/writer_tests5/tdf123378.py                 |   17 
 sw/qa/uitest/writer_tests5/tdf123446.py                 |   53 
 sw/qa/uitest/writer_tests5/titlePage.py                 |   44 
 sw/qa/uitest/writer_tests5/xwindow.py                   |  189 +-
 sw/qa/uitest/writer_tests5/zoom.py                      |  164 +-
 sw/qa/uitest/writer_tests6/infobar.py                   |   59 
 sw/qa/uitest/writer_tests6/tdf107847.py                 |   39 
 sw/qa/uitest/writer_tests6/tdf118883.py                 |   35 
 sw/qa/uitest/writer_tests6/tdf125104.py                 |   70 
 sw/qa/uitest/writer_tests6/tdf126168.py                 |   61 
 sw/qa/uitest/writer_tests6/tdf128431.py                 |   52 
 sw/qa/uitest/writer_tests6/tdf131041.py                 |   50 
 sw/qa/uitest/writer_tests6/tdf44837.py                  |   55 
 sw/qa/uitest/writer_tests7/tdf109083.py                 |   95 -
 sw/qa/uitest/writer_tests7/tdf115853.py                 |   34 
 sw/qa/uitest/writer_tests7/tdf119661.py                 |  102 -
 sw/qa/uitest/writer_tests7/tdf133348.py                 |   94 -
 sw/qa/uitest/writer_tests7/tdf140731.py                 |   81 -
 sw/qa/uitest/writer_tests7/tdf140863.py                 |   76 -
 sw/qa/uitest/writer_tests7/tdf90401.py                  |    2 
 uitest/demo_ui/char_dialog.py                           |   16 
 uitest/demo_ui/checkbox.py                              |   16 
 uitest/demo_ui/combobox.py                              |   16 
 uitest/demo_ui/command_with_parameters.py               |   12 
 uitest/demo_ui/edit.py                                  |   42 
 uitest/demo_ui/gridwin.py                               |   40 
 uitest/demo_ui/hierarchy.py                             |   22 
 uitest/demo_ui/listbox.py                               |   24 
 uitest/demo_ui/radiobutton.py                           |   16 
 uitest/demo_ui/spinfield.py                             |   68 
 uitest/demo_ui/tabcontrol.py                            |   24 
 uitest/demo_ui/tabdialog.py                             |   24 
 uitest/demo_ui/treelist.py                              |   32 
 uitest/impress_tests/backgrounds.py                     |   54 
 uitest/impress_tests/drawinglayer.py                    |  198 +-
 uitest/impress_tests/layouts.py                         |   42 
 uitest/impress_tests/start.py                           |   42 
 uitest/math_tests/start.py                              |   78 -
 uitest/uitest/test.py                                   |    6 
 uitest/uitest/uihelper/guarded.py                       |   10 
 uitest/uitest/uihelper/testDialog.py                    |   39 
 281 files changed, 14366 insertions(+), 15090 deletions(-)

New commits:
commit 374baf308979306aa35575118c40ccd7caae1e29
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Tue Jun 22 11:17:29 2021 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Jun 22 21:47:11 2021 +0200

    uitest: guard create_doc_in_start_center
    
    Mostly done by a script
    for motivation, see 89aaa17a0a4413f07da2bc5084b0164f15dc01ac
    < UITest: introduce guarded context managers >
    
    Change-Id: I75ef7712af3676363a9a464acf83f6f68ffc4f85
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117617
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/cui/qa/uitest/dialogs/chardlg.py b/cui/qa/uitest/dialogs/chardlg.py
index fb1c1286cbae..01c372ce9780 100644
--- a/cui/qa/uitest/dialogs/chardlg.py
+++ b/cui/qa/uitest/dialogs/chardlg.py
@@ -14,90 +14,87 @@ class Test(UITestCase):
 
     def testSvxCharEffectsPage(self):
         # Start Impress.
-        self.ui_test.create_doc_in_start_center("impress")
-        template = self.xUITest.getTopFocusWindow()
-        self.ui_test.close_dialog_through_button(template.getChild("close"))
-        doc = self.xUITest.getTopFocusWindow()
-        editWin = doc.getChild("impress_win")
-        # Select the title shape.
-        editWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
-        editWin.executeAction("TYPE", mkPropertyValues({"TEXT": "t"}))
-        self.xUITest.executeCommand(".uno:SelectAll")
+        with self.ui_test.create_doc_in_start_center("impress"):
+            template = self.xUITest.getTopFocusWindow()
+            self.ui_test.close_dialog_through_button(template.getChild("close"))
+            doc = self.xUITest.getTopFocusWindow()
+            editWin = doc.getChild("impress_win")
+            # Select the title shape.
+            editWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
+            editWin.executeAction("TYPE", mkPropertyValues({"TEXT": "t"}))
+            self.xUITest.executeCommand(".uno:SelectAll")
 
-        # Now use Format -> Character.
-        self.ui_test.execute_dialog_through_command(".uno:FontDialog")
-        xDialog = self.xUITest.getTopFocusWindow()
-        xTabs = xDialog.getChild("tabcontrol")
-        # Select RID_SVXPAGE_CHAR_EFFECTS.
-        select_pos(xTabs, "1")
-        xFontTransparency = xDialog.getChild("fonttransparencymtr")
-        for _ in range(5):
-            xFontTransparency.executeAction("UP", tuple())
-        self.ui_test.close_dialog_through_button(xDialog.getChild("ok"))
+            # Now use Format -> Character.
+            self.ui_test.execute_dialog_through_command(".uno:FontDialog")
+            xDialog = self.xUITest.getTopFocusWindow()
+            xTabs = xDialog.getChild("tabcontrol")
+            # Select RID_SVXPAGE_CHAR_EFFECTS.
+            select_pos(xTabs, "1")
+            xFontTransparency = xDialog.getChild("fonttransparencymtr")
+            for _ in range(5):
+                xFontTransparency.executeAction("UP", tuple())
+            self.ui_test.close_dialog_through_button(xDialog.getChild("ok"))
 
-        # Verify the result.
-        component = self.ui_test.get_component()
-        drawPage = component.getDrawPages().getByIndex(0)
-        shape = drawPage.getByIndex(0)
+            # Verify the result.
+            component = self.ui_test.get_component()
+            drawPage = component.getDrawPages().getByIndex(0)
+            shape = drawPage.getByIndex(0)
 
-        # Without the accompanying fix in place, this test would have failed with:
-        # AssertionError: 100 != 5
-        # i.e. the dialog did not set transparency to 5%, instead it left the character color at
-        # COL_AUTO.
-        self.assertEqual(shape.CharTransparence, 5)
-        self.ui_test.close_doc()
+            # Without the accompanying fix in place, this test would have failed with:
+            # AssertionError: 100 != 5
+            # i.e. the dialog did not set transparency to 5%, instead it left the character color at
+            # COL_AUTO.
+            self.assertEqual(shape.CharTransparence, 5)
 
     def testSvxCharEffectsPageWriter(self):
         # Start Writer.
-        self.ui_test.create_doc_in_start_center("writer")
-        doc = self.xUITest.getTopFocusWindow()
-        editWin = doc.getChild("writer_edit")
-        # Type a character and select it.
-        editWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
-        editWin.executeAction("TYPE", mkPropertyValues({"TEXT": "t"}))
-        self.xUITest.executeCommand(".uno:SelectAll")
+        with self.ui_test.create_doc_in_start_center("writer"):
+            doc = self.xUITest.getTopFocusWindow()
+            editWin = doc.getChild("writer_edit")
+            # Type a character and select it.
+            editWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
+            editWin.executeAction("TYPE", mkPropertyValues({"TEXT": "t"}))
+            self.xUITest.executeCommand(".uno:SelectAll")
 
-        # Now use Format -> Character.
-        self.ui_test.execute_dialog_through_command(".uno:FontDialog")
-        xDialog = self.xUITest.getTopFocusWindow()
-        xTabs = xDialog.getChild("tabcontrol")
-        # Select RID_SVXPAGE_CHAR_EFFECTS.
-        select_pos(xTabs, "1")
-        xFontTransparency = xDialog.getChild("fonttransparencymtr")
-        # Without the accompanying fix in place, this test would have failed with:
-        # AssertionError: 'false' != 'true'
-        # i.e. the transparency widget was hidden.
-        self.assertEqual(get_state_as_dict(xFontTransparency)["Visible"], "true")
-        for _ in range(5):
-            xFontTransparency.executeAction("UP", tuple())
-        self.ui_test.close_dialog_through_button(xDialog.getChild("ok"))
+            # Now use Format -> Character.
+            self.ui_test.execute_dialog_through_command(".uno:FontDialog")
+            xDialog = self.xUITest.getTopFocusWindow()
+            xTabs = xDialog.getChild("tabcontrol")
+            # Select RID_SVXPAGE_CHAR_EFFECTS.
+            select_pos(xTabs, "1")
+            xFontTransparency = xDialog.getChild("fonttransparencymtr")
+            # Without the accompanying fix in place, this test would have failed with:
+            # AssertionError: 'false' != 'true'
+            # i.e. the transparency widget was hidden.
+            self.assertEqual(get_state_as_dict(xFontTransparency)["Visible"], "true")
+            for _ in range(5):
+                xFontTransparency.executeAction("UP", tuple())
+            self.ui_test.close_dialog_through_button(xDialog.getChild("ok"))
 
-        # Verify the result.
-        component = self.ui_test.get_component()
-        paragraph = component.Text.createEnumeration().nextElement()
+            # Verify the result.
+            component = self.ui_test.get_component()
+            paragraph = component.Text.createEnumeration().nextElement()
 
-        self.assertEqual(paragraph.CharTransparence, 5)
-        self.ui_test.close_doc()
+            self.assertEqual(paragraph.CharTransparence, 5)
 
     def testSvxCharEffectsPageWriterAutomatic(self):
         # Start Writer.
-        self.ui_test.create_doc_in_start_center("writer")
-        doc = self.xUITest.getTopFocusWindow()
-        editWin = doc.getChild("writer_edit")
+        with self.ui_test.create_doc_in_start_center("writer"):
+            doc = self.xUITest.getTopFocusWindow()
+            editWin = doc.getChild("writer_edit")
 
-        # Use Format -> Character.
-        self.ui_test.execute_dialog_through_command(".uno:FontDialog")
-        xDialog = self.xUITest.getTopFocusWindow()
-        xTabs = xDialog.getChild("tabcontrol")
-        # Select RID_SVXPAGE_CHAR_EFFECTS.
-        select_pos(xTabs, "1")
-        xFontColorLB = xDialog.getChild("fontcolorlb")
-        # Without the accompanying fix in place, this test would have failed with:
-        # AssertionError: 'White' != 'Automatic'
-        # i.e. the auto color lost its alpha component and appeared as white.
-        self.assertEqual(get_state_as_dict(xFontColorLB)["Text"], "Automatic")
+            # Use Format -> Character.
+            self.ui_test.execute_dialog_through_command(".uno:FontDialog")
+            xDialog = self.xUITest.getTopFocusWindow()
+            xTabs = xDialog.getChild("tabcontrol")
+            # Select RID_SVXPAGE_CHAR_EFFECTS.
+            select_pos(xTabs, "1")
+            xFontColorLB = xDialog.getChild("fontcolorlb")
+            # Without the accompanying fix in place, this test would have failed with:
+            # AssertionError: 'White' != 'Automatic'
+            # i.e. the auto color lost its alpha component and appeared as white.
+            self.assertEqual(get_state_as_dict(xFontColorLB)["Text"], "Automatic")
 
-        self.ui_test.close_dialog_through_button(xDialog.getChild("ok"))
-        self.ui_test.close_doc()
+            self.ui_test.close_dialog_through_button(xDialog.getChild("ok"))
 
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/cui/qa/uitest/dialogs/pastedlg.py b/cui/qa/uitest/dialogs/pastedlg.py
index 9ac40c55d2b6..f186a28c3e7a 100644
--- a/cui/qa/uitest/dialogs/pastedlg.py
+++ b/cui/qa/uitest/dialogs/pastedlg.py
@@ -14,34 +14,33 @@ class Test(UITestCase):
 
     def testGetFormat(self):
         # Copy a string in Impress.
-        self.ui_test.create_doc_in_start_center("impress")
-        template = self.xUITest.getTopFocusWindow()
-        self.ui_test.close_dialog_through_button(template.getChild("close"))
-        doc = self.xUITest.getTopFocusWindow()
-        editWin = doc.getChild("impress_win")
-        # Select the title shape.
-        editWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
-        editWin.executeAction("TYPE", mkPropertyValues({"TEXT": "t"}))
-        self.xUITest.executeCommand(".uno:SelectAll")
-        self.xUITest.executeCommand(".uno:Copy")
-
-        # Now use paste special to see what formats are offered.
-        self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
-        pasteSpecial = self.xUITest.getTopFocusWindow()
-        formats = pasteSpecial.getChild("list")
-        entryCount = int(get_state_as_dict(formats)["Children"])
-        items = []
-        for index in range(entryCount):
-            entry = formats.getChild(str(index))
-            entry.executeAction("SELECT", tuple())
-            items.append(get_state_as_dict(formats)["SelectEntryText"])
-
-        # Make sure there is no RTF vs Richtext duplication.
-        self.assertTrue("Rich text formatting (RTF)" in items)
-        self.assertFalse("Rich text formatting (Richtext)" in items)
-
-        # Close the dialog and the document.
-        self.ui_test.close_dialog_through_button(pasteSpecial.getChild("cancel"))
-        self.ui_test.close_doc()
+        with self.ui_test.create_doc_in_start_center("impress"):
+            template = self.xUITest.getTopFocusWindow()
+            self.ui_test.close_dialog_through_button(template.getChild("close"))
+            doc = self.xUITest.getTopFocusWindow()
+            editWin = doc.getChild("impress_win")
+            # Select the title shape.
+            editWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
+            editWin.executeAction("TYPE", mkPropertyValues({"TEXT": "t"}))
+            self.xUITest.executeCommand(".uno:SelectAll")
+            self.xUITest.executeCommand(".uno:Copy")
+
+            # Now use paste special to see what formats are offered.
+            self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
+            pasteSpecial = self.xUITest.getTopFocusWindow()
+            formats = pasteSpecial.getChild("list")
+            entryCount = int(get_state_as_dict(formats)["Children"])
+            items = []
+            for index in range(entryCount):
+                entry = formats.getChild(str(index))
+                entry.executeAction("SELECT", tuple())
+                items.append(get_state_as_dict(formats)["SelectEntryText"])
+
+            # Make sure there is no RTF vs Richtext duplication.
+            self.assertTrue("Rich text formatting (RTF)" in items)
+            self.assertFalse("Rich text formatting (Richtext)" in items)
+
+            # Close the dialog and the document.
+            self.ui_test.close_dialog_through_button(pasteSpecial.getChild("cancel"))
 
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/cui/qa/uitest/dialogs/shortcuts.py b/cui/qa/uitest/dialogs/shortcuts.py
index 8a52ee42315a..3b5810757566 100644
--- a/cui/qa/uitest/dialogs/shortcuts.py
+++ b/cui/qa/uitest/dialogs/shortcuts.py
@@ -13,31 +13,29 @@ from uitest.uihelper.common import get_state_as_dict
 class Test(UITestCase):
 
     def test_tab_navigation(self):
-        self.ui_test.create_doc_in_start_center("writer")
-        xWriterDoc = self.xUITest.getTopFocusWindow()
-        xWriterEdit = xWriterDoc.getChild("writer_edit")
+        with self.ui_test.create_doc_in_start_center("writer"):
+            xWriterDoc = self.xUITest.getTopFocusWindow()
+            xWriterEdit = xWriterDoc.getChild("writer_edit")
 
-        self.ui_test.execute_dialog_through_command(".uno:EditStyle")  #open style dialog
-        xDialog = self.xUITest.getTopFocusWindow()
+            self.ui_test.execute_dialog_through_command(".uno:EditStyle")  #open style dialog
+            xDialog = self.xUITest.getTopFocusWindow()
 
-        xTabs = xDialog.getChild("tabcontrol")
-        select_pos(xTabs, "0")
+            xTabs = xDialog.getChild("tabcontrol")
+            select_pos(xTabs, "0")
 
-        for i in range(16):
-            self.assertEqual(get_state_as_dict(xTabs)["CurrPagePos"], str(i))
+            for i in range(16):
+                self.assertEqual(get_state_as_dict(xTabs)["CurrPagePos"], str(i))
 
-            xTabs.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+PAGEDOWN"}))
+                xTabs.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+PAGEDOWN"}))
 
-        self.assertEqual(get_state_as_dict(xTabs)["CurrPagePos"], "0")
+            self.assertEqual(get_state_as_dict(xTabs)["CurrPagePos"], "0")
 
-        for i in reversed(range(16)):
-            xTabs.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+PAGEUP"}))
+            for i in reversed(range(16)):
+                xTabs.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+PAGEUP"}))
 
-            self.assertEqual(get_state_as_dict(xTabs)["CurrPagePos"], str(i))
+                self.assertEqual(get_state_as_dict(xTabs)["CurrPagePos"], str(i))
 
-        xOkBtn = xDialog.getChild("ok")
-        xOkBtn.executeAction("CLICK", tuple())
-
-        self.ui_test.close_doc()
+            xOkBtn = xDialog.getChild("ok")
+            xOkBtn.executeAction("CLICK", tuple())
 
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py
index 1b5bcb1f113f..2a06199b4c8c 100644
--- a/sc/qa/uitest/autofilter/autofilter.py
+++ b/sc/qa/uitest/autofilter/autofilter.py
@@ -126,101 +126,97 @@ class AutofilterTest(UITestCase):
             self.assertFalse(is_row_hidden(doc, 4))
 
     def test_differentSearches(self):
-        self.ui_test.create_doc_in_start_center("calc")
-        document = self.ui_test.get_component()
-        calcDoc = self.xUITest.getTopFocusWindow()
+        with self.ui_test.create_doc_in_start_center("calc"):
+            document = self.ui_test.get_component()
+            calcDoc = self.xUITest.getTopFocusWindow()
 
-        xGridWindow = calcDoc.getChild("grid_window")
-        enter_text_to_cell(xGridWindow, "A1", "X")
-        enter_text_to_cell(xGridWindow, "A2", "11")
-        enter_text_to_cell(xGridWindow, "A3", "22")
-        xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A3"}))
+            xGridWindow = calcDoc.getChild("grid_window")
+            enter_text_to_cell(xGridWindow, "A1", "X")
+            enter_text_to_cell(xGridWindow, "A2", "11")
+            enter_text_to_cell(xGridWindow, "A3", "22")
+            xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A3"}))
 
-        self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
+            self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
 
-        xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
 
-        xFloatWindow = self.xUITest.getFloatWindow()
-
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xFloatWindow = self.xUITest.getFloatWindow()
 
-        xList = xCheckListMenu.getChild("check_list_box")
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
 
-        self.assertEqual(2, len(xList.getChildren()))
-        self.assertEqual("11", get_state_as_dict(xList.getChild('0'))['Text'])
-        self.assertEqual("22", get_state_as_dict(xList.getChild('1'))['Text'])
+            xList = xCheckListMenu.getChild("check_list_box")
 
-        xSearchEdit = xFloatWindow.getChild("search_edit")
-        xSearchEdit.executeAction("TYPE", mkPropertyValues({"TEXT" : "11"}))
+            self.assertEqual(2, len(xList.getChildren()))
+            self.assertEqual("11", get_state_as_dict(xList.getChild('0'))['Text'])
+            self.assertEqual("22", get_state_as_dict(xList.getChild('1'))['Text'])
 
-        self.assertEqual(1, len(xList.getChildren()))
-        self.assertEqual("11", get_state_as_dict(xList.getChild('0'))['Text'])
+            xSearchEdit = xFloatWindow.getChild("search_edit")
+            xSearchEdit.executeAction("TYPE", mkPropertyValues({"TEXT" : "11"}))
 
-        xOkBtn = xFloatWindow.getChild("ok")
-        xOkBtn.executeAction("CLICK", tuple())
+            self.assertEqual(1, len(xList.getChildren()))
+            self.assertEqual("11", get_state_as_dict(xList.getChild('0'))['Text'])
 
-        self.assertFalse(is_row_hidden(document, 0))
-        self.assertFalse(is_row_hidden(document, 1))
-        self.assertTrue(is_row_hidden(document, 2))
+            xOkBtn = xFloatWindow.getChild("ok")
+            xOkBtn.executeAction("CLICK", tuple())
 
-        xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            self.assertFalse(is_row_hidden(document, 0))
+            self.assertFalse(is_row_hidden(document, 1))
+            self.assertTrue(is_row_hidden(document, 2))
 
-        xFloatWindow = self.xUITest.getFloatWindow()
+            xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
 
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xFloatWindow = self.xUITest.getFloatWindow()
 
-        xList = xCheckListMenu.getChild("check_list_box")
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
 
-        self.assertEqual(2, len(xList.getChildren()))
-        self.assertEqual("11", get_state_as_dict(xList.getChild('0'))['Text'])
-        self.assertEqual("22", get_state_as_dict(xList.getChild('1'))['Text'])
+            xList = xCheckListMenu.getChild("check_list_box")
 
-        xSearchEdit = xFloatWindow.getChild("search_edit")
-        xSearchEdit.executeAction("TYPE", mkPropertyValues({"TEXT" : "22"}))
+            self.assertEqual(2, len(xList.getChildren()))
+            self.assertEqual("11", get_state_as_dict(xList.getChild('0'))['Text'])
+            self.assertEqual("22", get_state_as_dict(xList.getChild('1'))['Text'])
 
-        self.assertEqual(1, len(xList.getChildren()))
-        self.assertEqual("22", get_state_as_dict(xList.getChild('0'))['Text'])
+            xSearchEdit = xFloatWindow.getChild("search_edit")
+            xSearchEdit.executeAction("TYPE", mkPropertyValues({"TEXT" : "22"}))
 
-        xOkBtn = xFloatWindow.getChild("ok")
-        xOkBtn.executeAction("CLICK", tuple())
+            self.assertEqual(1, len(xList.getChildren()))
+            self.assertEqual("22", get_state_as_dict(xList.getChild('0'))['Text'])
 
+            xOkBtn = xFloatWindow.getChild("ok")
+            xOkBtn.executeAction("CLICK", tuple())
 
-        self.assertFalse(is_row_hidden(document, 0))
-        self.assertTrue(is_row_hidden(document, 1))
-        self.assertFalse(is_row_hidden(document, 2))
 
-        self.ui_test.close_doc()
+            self.assertFalse(is_row_hidden(document, 0))
+            self.assertTrue(is_row_hidden(document, 1))
+            self.assertFalse(is_row_hidden(document, 2))
 
     def test_tdf89244(self):
-        calc_doc = self.ui_test.create_doc_in_start_center("calc")
-        xCalcDoc = self.xUITest.getTopFocusWindow()
-        gridwin = xCalcDoc.getChild("grid_window")
-        document = self.ui_test.get_component()
+        with self.ui_test.create_doc_in_start_center("calc"):
+            xCalcDoc = self.xUITest.getTopFocusWindow()
+            gridwin = xCalcDoc.getChild("grid_window")
+            document = self.ui_test.get_component()
 
-        enter_text_to_cell(gridwin, "A1", "AAA")
-        enter_text_to_cell(gridwin, "A3", "BBB")
-        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"}))
+            enter_text_to_cell(gridwin, "A1", "AAA")
+            enter_text_to_cell(gridwin, "A3", "BBB")
+            gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"}))
 
-        self.xUITest.executeCommand(".uno:MergeCells")
+            self.xUITest.executeCommand(".uno:MergeCells")
 
-        self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
+            self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
 
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
 
-        xFloatWindow = self.xUITest.getFloatWindow()
-
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xFloatWindow = self.xUITest.getFloatWindow()
 
-        xList = xCheckListMenu.getChild("check_list_box")
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
 
-        self.assertEqual(2, len(xList.getChildren()))
-        self.assertEqual("(empty)", get_state_as_dict(xList.getChild('0'))['Text'])
-        self.assertEqual("BBB", get_state_as_dict(xList.getChild('1'))['Text'])
+            xList = xCheckListMenu.getChild("check_list_box")
 
-        xOkBtn = xFloatWindow.getChild("ok")
-        xOkBtn.executeAction("CLICK", tuple())
+            self.assertEqual(2, len(xList.getChildren()))
+            self.assertEqual("(empty)", get_state_as_dict(xList.getChild('0'))['Text'])
+            self.assertEqual("BBB", get_state_as_dict(xList.getChild('1'))['Text'])
 
-        self.ui_test.close_doc()
+            xOkBtn = xFloatWindow.getChild("ok")
+            xOkBtn.executeAction("CLICK", tuple())
 
     def test_tdf116818(self):
         with self.ui_test.load_file(get_url_for_data_file("tdf116818.xlsx")) as doc:
@@ -372,54 +368,52 @@ class AutofilterTest(UITestCase):
             self.assertFalse(is_row_hidden(doc, 7))
 
     def test_tdf142350(self):
-        self.ui_test.create_doc_in_start_center("calc")
-        document = self.ui_test.get_component()
-        calcDoc = self.xUITest.getTopFocusWindow()
-        gridwin = calcDoc.getChild("grid_window")
-        document = self.ui_test.get_component()
-
-        enter_text_to_cell(gridwin, "A1", "A")
-        enter_text_to_cell(gridwin, "A2", "0")
-        enter_text_to_cell(gridwin, "A3", "")
-        enter_text_to_cell(gridwin, "A4", "1")
-
-        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"}))
-
-        self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
-
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xList = xCheckListMenu.getChild("check_list_box")
-
-        # tdf140745 show (empty) entry on top of the checkbox list
-        self.assertEqual(3, len(xList.getChildren()))
-        self.assertEqual("(empty)", get_state_as_dict(xList.getChild('0'))['Text'])
-        self.assertEqual("0", get_state_as_dict(xList.getChild('1'))['Text'])
-        self.assertEqual("1", get_state_as_dict(xList.getChild('2'))['Text'])
-
-        xEntry = xList.getChild("0")
-        xEntry.executeAction("CLICK", tuple())
-
-        xOkButton = xFloatWindow.getChild("ok")
-        xOkButton.executeAction("CLICK", tuple())
-
-        self.assertFalse(is_row_hidden(document, 1))
-        self.assertTrue(is_row_hidden(document, 2))
-        self.assertFalse(is_row_hidden(document, 3))
-
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xList = xCheckListMenu.getChild("check_list_box")
-        self.assertEqual(3, len(xList.getChildren()))
-        self.assertEqual('false', get_state_as_dict(xList.getChild('0'))['IsChecked'])
-        self.assertEqual('true', get_state_as_dict(xList.getChild('1'))['IsChecked'])
-        self.assertEqual('true', get_state_as_dict(xList.getChild('2'))['IsChecked'])
-        xCloseButton = xFloatWindow.getChild("cancel")
-        xCloseButton.executeAction("CLICK", tuple())
-
-        self.ui_test.close_doc()
+        with self.ui_test.create_doc_in_start_center("calc"):
+            document = self.ui_test.get_component()
+            calcDoc = self.xUITest.getTopFocusWindow()
+            gridwin = calcDoc.getChild("grid_window")
+            document = self.ui_test.get_component()
+
+            enter_text_to_cell(gridwin, "A1", "A")
+            enter_text_to_cell(gridwin, "A2", "0")
+            enter_text_to_cell(gridwin, "A3", "")
+            enter_text_to_cell(gridwin, "A4", "1")
+
+            gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"}))
+
+            self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
+
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xList = xCheckListMenu.getChild("check_list_box")
+
+            # tdf140745 show (empty) entry on top of the checkbox list
+            self.assertEqual(3, len(xList.getChildren()))
+            self.assertEqual("(empty)", get_state_as_dict(xList.getChild('0'))['Text'])
+            self.assertEqual("0", get_state_as_dict(xList.getChild('1'))['Text'])
+            self.assertEqual("1", get_state_as_dict(xList.getChild('2'))['Text'])
+
+            xEntry = xList.getChild("0")
+            xEntry.executeAction("CLICK", tuple())
+
+            xOkButton = xFloatWindow.getChild("ok")
+            xOkButton.executeAction("CLICK", tuple())
+
+            self.assertFalse(is_row_hidden(document, 1))
+            self.assertTrue(is_row_hidden(document, 2))
+            self.assertFalse(is_row_hidden(document, 3))
+
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xList = xCheckListMenu.getChild("check_list_box")
+            self.assertEqual(3, len(xList.getChildren()))
+            self.assertEqual('false', get_state_as_dict(xList.getChild('0'))['IsChecked'])
+            self.assertEqual('true', get_state_as_dict(xList.getChild('1'))['IsChecked'])
+            self.assertEqual('true', get_state_as_dict(xList.getChild('2'))['IsChecked'])
+            xCloseButton = xFloatWindow.getChild("cancel")
+            xCloseButton.executeAction("CLICK", tuple())
 
     def test_tdf138438(self):
         with self.ui_test.load_file(get_url_for_data_file("tdf138438.ods")) as doc:
diff --git a/sc/qa/uitest/autofilter/autofilterBugs.py b/sc/qa/uitest/autofilter/autofilterBugs.py
index ffb6419690ea..189c524c5f1a 100644
--- a/sc/qa/uitest/autofilter/autofilterBugs.py
+++ b/sc/qa/uitest/autofilter/autofilterBugs.py
@@ -26,34 +26,32 @@ class autofilter(UITestCase):
             self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
 
    def test_tdf94055(self):
-        self.ui_test.create_doc_in_start_center("calc")
-        document = self.ui_test.get_component()
-        calcDoc = self.xUITest.getTopFocusWindow()
-        xGridWindow = calcDoc.getChild("grid_window")
-        enter_text_to_cell(xGridWindow, "A1", "X")
-        enter_text_to_cell(xGridWindow, "B1", "Y")
-        enter_text_to_cell(xGridWindow, "A2", "a")
-        enter_text_to_cell(xGridWindow, "B2", "b")
-        enter_text_to_cell(xGridWindow, "A3", "c")
-        enter_text_to_cell(xGridWindow, "B3", "d")
-        xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B1"}))
-
-        self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter")
-        xDialog = self.xUITest.getTopFocusWindow()
-        xYesBtn = xDialog.getChild("yes")
-        self.ui_test.close_dialog_through_button(xYesBtn)
-
-        xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A3"}))
-        self.xUITest.executeCommand(".uno:SelectRow") #select two rows
-
-        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.create_doc_in_start_center("calc"):
+            document = self.ui_test.get_component()
+            calcDoc = self.xUITest.getTopFocusWindow()
+            xGridWindow = calcDoc.getChild("grid_window")
+            enter_text_to_cell(xGridWindow, "A1", "X")
+            enter_text_to_cell(xGridWindow, "B1", "Y")
+            enter_text_to_cell(xGridWindow, "A2", "a")
+            enter_text_to_cell(xGridWindow, "B2", "b")
+            enter_text_to_cell(xGridWindow, "A3", "c")
+            enter_text_to_cell(xGridWindow, "B3", "d")
+            xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B1"}))
+
+            self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter")
+            xDialog = self.xUITest.getTopFocusWindow()
+            xYesBtn = xDialog.getChild("yes")
+            self.ui_test.close_dialog_through_button(xYesBtn)
+
+            xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A3"}))
+            self.xUITest.executeCommand(".uno:SelectRow") #select two rows
+
+            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)
 
         #tdf77479.ods
    def test_tdf77479(self):
diff --git a/sc/qa/uitest/autofilter/tdf117276_autofilter_reset.py b/sc/qa/uitest/autofilter/tdf117276_autofilter_reset.py
index 89be1bb51099..51f3e1cf1efb 100644
--- a/sc/qa/uitest/autofilter/tdf117276_autofilter_reset.py
+++ b/sc/qa/uitest/autofilter/tdf117276_autofilter_reset.py
@@ -49,130 +49,129 @@ class tdf117276_autofilter_reset(UITestCase):
         self.assertEqual(2, self.get_values_count_in_AutoFilter(xGridWindow, "1"))
 
     def test_run(self):
-        self.ui_test.create_doc_in_start_center("calc")
-        document = self.ui_test.get_component()
-        calcDoc = self.xUITest.getTopFocusWindow()
-        xGridWindow = calcDoc.getChild("grid_window")
-
-#        self.ui_test.execute_dialog_through_command(".uno:Insert")  # insert sheet
-#        xDialog = self.xUITest.getTopFocusWindow()
-#        xOKButton = xDialog.getChild("ok")
-#        xOKButton.executeAction("CLICK", tuple())
-
-        # 1. prepare document
-        #    |    A       | B                      |
-        #  -----------------------------------------
-        #  1 | HEADER-A   | HEADER-B               |
-        #  -----------------------------------------
-        #  2 | Unique a2  | common value for B2:B4 |
-        #  3 | Unique a3  | common value for B2:B4 |
-        #  4 | Unique a4  | common value for B2:B4 |
-        #  5 | Unique a5  | Unique b5              |
-        #  6 | Unique a6  | Unique b6              |
-        #
-        # row-1
-        enter_text_to_cell(xGridWindow, "A1", "HEADER-A")
-        enter_text_to_cell(xGridWindow, "B1", "HEADER-B")
-
-        # row-1
-        enter_text_to_cell(xGridWindow, "A2", "Unique a2")
-        enter_text_to_cell(xGridWindow, "B2", "common value for B2:B4")
-
-        # row-2
-        enter_text_to_cell(xGridWindow, "A3", "Unique a3")
-        enter_text_to_cell(xGridWindow, "B3", "common value for B2:B4")
-
-        # row-3
-        enter_text_to_cell(xGridWindow, "A4", "Unique a4")
-        enter_text_to_cell(xGridWindow, "B4", "common value for B2:B4")
-
-        # row-4
-        enter_text_to_cell(xGridWindow, "A5", "Unique a5")
-        enter_text_to_cell(xGridWindow, "B5", "Unique b5")
-
-        # row-5
-        enter_text_to_cell(xGridWindow, "A6", "Unique a6")
-        enter_text_to_cell(xGridWindow, "B6", "Unique b6")
-
-        xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B6"}))
-
-        # 2. switch on auto-filter
-        self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter")
-        xDialog = self.xUITest.getTopFocusWindow()
-        xYesBtn = xDialog.getChild("yes")
-        self.ui_test.close_dialog_through_button(xYesBtn)
-
-        # autofilter still exist
-        self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
-
-        # 3. open filter of column A and deselect first 3 entries (Unique a2, Unique a3, Unique a4)
-        xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xTreeList = xCheckListMenu.getChild("check_list_box")
-
-        xEntry1 = xTreeList.getChild("0")
-        xEntry1.executeAction("CLICK", tuple())   # Unique a2
-        xEntry2 = xTreeList.getChild("1")
-        xEntry2.executeAction("CLICK", tuple())   # Unique a3
-        xEntry3 = xTreeList.getChild("2")
-        xEntry3.executeAction("CLICK", tuple())   # Unique a4
-
-        xOkButton = xFloatWindow.getChild("ok")
-        xOkButton.executeAction("CLICK", tuple())
-
-        # check filtering
-        #    |    A       | B                      |
-        #  -----------------------------------------
-        #  1 | HEADER-A   | HEADER-B               |
-        #  -----------------------------------------
-        #  5 | Unique a5  | Unique b5              |
-        #  6 | Unique a6  | Unique b6              |
-        self.assertFalse(is_row_hidden(document, 0))  # column headers
-        self.assertTrue(is_row_hidden(document, 1))
-        self.assertTrue(is_row_hidden(document, 2))
-        self.assertTrue(is_row_hidden(document, 3))
-        self.assertFalse(is_row_hidden(document, 4))
-        self.assertFalse(is_row_hidden(document, 5))
-
-        self.assertEqual(5, self.get_values_count_in_AutoFilter(xGridWindow, "0"))
-        self.assertEqual(2, self.get_values_count_in_AutoFilter(xGridWindow, "1"))
-
-        # 4. open filter of column B and deselect "Unique b5"
-        xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xTreeList = xCheckListMenu.getChild("check_list_box")
-
-        xEntry = xTreeList.getChild("0")
-        xEntry.executeAction("CLICK", tuple())   # Unique b5
-
-        xOkButton = xFloatWindow.getChild("ok")
-        xOkButton.executeAction("CLICK", tuple())
-
-        # check filtering
-        #    |    A       | B                      |
-        #  -----------------------------------------
-        #  1 | HEADER-A   | HEADER-B               |
-        #  -----------------------------------------
-        #  6 | Unique a6  | Unique b6              |
-        self.check_state(document, xGridWindow)
-
-        # 4. open filters of column A, B and close it using different buttons
-        self.openAutoFilterAndCloseIt(xGridWindow, "1", "ok")
-        self.check_state(document, xGridWindow)
-
-        self.openAutoFilterAndCloseIt(xGridWindow, "1", "cancel")
-        self.check_state(document, xGridWindow)
-
-        self.openAutoFilterAndCloseIt(xGridWindow, "0", "cancel")
-        self.check_state(document, xGridWindow)
-
-        self.openAutoFilterAndCloseIt(xGridWindow, "0", "ok")
-        self.check_state(document, xGridWindow)
-
-        # finish
-        self.ui_test.close_doc()
+        with self.ui_test.create_doc_in_start_center("calc"):
+            document = self.ui_test.get_component()
+            calcDoc = self.xUITest.getTopFocusWindow()
+            xGridWindow = calcDoc.getChild("grid_window")
+
+    #        self.ui_test.execute_dialog_through_command(".uno:Insert")  # insert sheet
+    #        xDialog = self.xUITest.getTopFocusWindow()
+    #        xOKButton = xDialog.getChild("ok")
+    #        xOKButton.executeAction("CLICK", tuple())
+
+            # 1. prepare document
+            #    |    A       | B                      |
+            #  -----------------------------------------
+            #  1 | HEADER-A   | HEADER-B               |
+            #  -----------------------------------------
+            #  2 | Unique a2  | common value for B2:B4 |
+            #  3 | Unique a3  | common value for B2:B4 |
+            #  4 | Unique a4  | common value for B2:B4 |
+            #  5 | Unique a5  | Unique b5              |
+            #  6 | Unique a6  | Unique b6              |
+            #
+            # row-1
+            enter_text_to_cell(xGridWindow, "A1", "HEADER-A")
+            enter_text_to_cell(xGridWindow, "B1", "HEADER-B")
+
+            # row-1
+            enter_text_to_cell(xGridWindow, "A2", "Unique a2")
+            enter_text_to_cell(xGridWindow, "B2", "common value for B2:B4")
+
+            # row-2
+            enter_text_to_cell(xGridWindow, "A3", "Unique a3")
+            enter_text_to_cell(xGridWindow, "B3", "common value for B2:B4")
+
+            # row-3
+            enter_text_to_cell(xGridWindow, "A4", "Unique a4")
+            enter_text_to_cell(xGridWindow, "B4", "common value for B2:B4")
+
+            # row-4
+            enter_text_to_cell(xGridWindow, "A5", "Unique a5")
+            enter_text_to_cell(xGridWindow, "B5", "Unique b5")
+
+            # row-5
+            enter_text_to_cell(xGridWindow, "A6", "Unique a6")
+            enter_text_to_cell(xGridWindow, "B6", "Unique b6")
+
+            xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B6"}))
+
+            # 2. switch on auto-filter
+            self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter")
+            xDialog = self.xUITest.getTopFocusWindow()
+            xYesBtn = xDialog.getChild("yes")
+            self.ui_test.close_dialog_through_button(xYesBtn)
+
+            # autofilter still exist
+            self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
+
+            # 3. open filter of column A and deselect first 3 entries (Unique a2, Unique a3, Unique a4)
+            xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xTreeList = xCheckListMenu.getChild("check_list_box")
+
+            xEntry1 = xTreeList.getChild("0")
+            xEntry1.executeAction("CLICK", tuple())   # Unique a2
+            xEntry2 = xTreeList.getChild("1")
+            xEntry2.executeAction("CLICK", tuple())   # Unique a3
+            xEntry3 = xTreeList.getChild("2")
+            xEntry3.executeAction("CLICK", tuple())   # Unique a4
+
+            xOkButton = xFloatWindow.getChild("ok")
+            xOkButton.executeAction("CLICK", tuple())
+
+            # check filtering
+            #    |    A       | B                      |
+            #  -----------------------------------------
+            #  1 | HEADER-A   | HEADER-B               |
+            #  -----------------------------------------
+            #  5 | Unique a5  | Unique b5              |
+            #  6 | Unique a6  | Unique b6              |
+            self.assertFalse(is_row_hidden(document, 0))  # column headers
+            self.assertTrue(is_row_hidden(document, 1))
+            self.assertTrue(is_row_hidden(document, 2))
+            self.assertTrue(is_row_hidden(document, 3))
+            self.assertFalse(is_row_hidden(document, 4))
+            self.assertFalse(is_row_hidden(document, 5))
+
+            self.assertEqual(5, self.get_values_count_in_AutoFilter(xGridWindow, "0"))
+            self.assertEqual(2, self.get_values_count_in_AutoFilter(xGridWindow, "1"))
+
+            # 4. open filter of column B and deselect "Unique b5"
+            xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xTreeList = xCheckListMenu.getChild("check_list_box")
+
+            xEntry = xTreeList.getChild("0")
+            xEntry.executeAction("CLICK", tuple())   # Unique b5
+
+            xOkButton = xFloatWindow.getChild("ok")
+            xOkButton.executeAction("CLICK", tuple())
+
+            # check filtering
+            #    |    A       | B                      |
+            #  -----------------------------------------
+            #  1 | HEADER-A   | HEADER-B               |
+            #  -----------------------------------------
+            #  6 | Unique a6  | Unique b6              |
+            self.check_state(document, xGridWindow)
+
+            # 4. open filters of column A, B and close it using different buttons
+            self.openAutoFilterAndCloseIt(xGridWindow, "1", "ok")
+            self.check_state(document, xGridWindow)
+
+            self.openAutoFilterAndCloseIt(xGridWindow, "1", "cancel")
+            self.check_state(document, xGridWindow)
+
+            self.openAutoFilterAndCloseIt(xGridWindow, "0", "cancel")
+            self.check_state(document, xGridWindow)
+
+            self.openAutoFilterAndCloseIt(xGridWindow, "0", "ok")
+            self.check_state(document, xGridWindow)
+
+            # finish
 
 
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/autofilter/tdf126306.py b/sc/qa/uitest/autofilter/tdf126306.py
index 73f8d83f8b85..71102365fd5e 100644
--- a/sc/qa/uitest/autofilter/tdf126306.py
+++ b/sc/qa/uitest/autofilter/tdf126306.py
@@ -21,120 +21,119 @@ class tdf126306(UITestCase):
             self.assertEqual(bVisible, value)
 
     def test_run(self):
-        self.ui_test.create_doc_in_start_center("calc")
-        document = self.ui_test.get_component()
-        calcDoc = self.xUITest.getTopFocusWindow()
-        xGridWin = calcDoc.getChild("grid_window")
-
-        default_values = [25, 1023, 17, 9, 19, 0, 107, 89, 8, 453, 33, 3, 25, 204]
-        document = self.ui_test.get_component()
-
-        for i, value in enumerate(default_values, start=2):
-            enter_text_to_cell(xGridWin, "A" + str(i), str(value))
-
-        xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A15"}))
-
-        self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter")
-        xDialog = self.xUITest.getTopFocusWindow()
-        xYesBtn = xDialog.getChild("yes")
-        self.ui_test.close_dialog_through_button(xYesBtn)
-
-        self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
-
-        self.check_values(document, default_values)
-        self.check_row_hidden(document)
-
-        # Sort ascending button
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xMenu = xFloatWindow.getChild("menu")
-        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"SPACE"}))
-        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
-
-        sort_asc_values = [0, 3, 8, 9, 17, 19, 25, 25, 33, 89, 107, 204, 453, 1023]
-        self.check_values(document, sort_asc_values)
-        self.check_row_hidden(document)
-
-        #Undo
-        self.xUITest.executeCommand(".uno:Undo")
-        self.check_values(document, default_values)
-        self.check_row_hidden(document)
-
-        # Sort descending button
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xMenu = xFloatWindow.getChild("menu")
-        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
-        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
-
-        sort_des_values = [1023, 453, 204, 107, 89, 33, 25, 25, 19, 17, 9, 8, 3, 0]
-        self.check_values(document, sort_des_values)
-        self.check_row_hidden(document)
-
-        #Undo
-        self.xUITest.executeCommand(".uno:Undo")
-        self.check_values(document, default_values)
-        self.check_row_hidden(document)
-
-        # Top 10 button
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "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"}))
-
-        top10_hidden_values = [True, True, True, False, True, False, True,
-                True, False, True, True, False, True, True]
-
-        #Values are the same
-        self.check_values(document, default_values)
-        self.check_row_hidden(document, top10_hidden_values)
-
-        #Undo
-        self.xUITest.executeCommand(".uno:Undo")
-        self.check_values(document, default_values)
-        self.check_row_hidden(document)
-
-        # Empty button
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "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":"DOWN"}))
-        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
-
-        empty_values = [False] * 14
-        #Values are the same
-        self.check_values(document, default_values)
-        self.check_row_hidden(document, empty_values)
-
-        #Undo
-        self.xUITest.executeCommand(".uno:Undo")
-        self.check_values(document, default_values)
-        self.check_row_hidden(document)
-
-        # Not Empty button
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "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":"DOWN"}))
-        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
-        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
-
-        #Nothing should change
-        self.check_values(document, default_values)
-        self.check_row_hidden(document)
-
-        #Undo
-        self.xUITest.executeCommand(".uno:Undo")
-        self.check_values(document, default_values)
-        self.check_row_hidden(document)
-
-        # finish
-        self.ui_test.close_doc()
+        with self.ui_test.create_doc_in_start_center("calc"):
+            document = self.ui_test.get_component()
+            calcDoc = self.xUITest.getTopFocusWindow()
+            xGridWin = calcDoc.getChild("grid_window")
+
+            default_values = [25, 1023, 17, 9, 19, 0, 107, 89, 8, 453, 33, 3, 25, 204]
+            document = self.ui_test.get_component()
+
+            for i, value in enumerate(default_values, start=2):
+                enter_text_to_cell(xGridWin, "A" + str(i), str(value))
+
+            xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A15"}))
+
+            self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter")
+            xDialog = self.xUITest.getTopFocusWindow()
+            xYesBtn = xDialog.getChild("yes")
+            self.ui_test.close_dialog_through_button(xYesBtn)
+
+            self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
+
+            self.check_values(document, default_values)
+            self.check_row_hidden(document)
+
+            # Sort ascending button
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xMenu = xFloatWindow.getChild("menu")
+            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"SPACE"}))
+            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
+
+            sort_asc_values = [0, 3, 8, 9, 17, 19, 25, 25, 33, 89, 107, 204, 453, 1023]
+            self.check_values(document, sort_asc_values)
+            self.check_row_hidden(document)
+
+            #Undo
+            self.xUITest.executeCommand(".uno:Undo")
+            self.check_values(document, default_values)
+            self.check_row_hidden(document)
+
+            # Sort descending button
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xMenu = xFloatWindow.getChild("menu")
+            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
+
+            sort_des_values = [1023, 453, 204, 107, 89, 33, 25, 25, 19, 17, 9, 8, 3, 0]
+            self.check_values(document, sort_des_values)
+            self.check_row_hidden(document)
+
+            #Undo
+            self.xUITest.executeCommand(".uno:Undo")
+            self.check_values(document, default_values)
+            self.check_row_hidden(document)
+
+            # Top 10 button
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "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"}))
+
+            top10_hidden_values = [True, True, True, False, True, False, True,
+                    True, False, True, True, False, True, True]
+
+            #Values are the same
+            self.check_values(document, default_values)
+            self.check_row_hidden(document, top10_hidden_values)
+
+            #Undo
+            self.xUITest.executeCommand(".uno:Undo")
+            self.check_values(document, default_values)
+            self.check_row_hidden(document)
+
+            # Empty button
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "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":"DOWN"}))
+            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
+
+            empty_values = [False] * 14
+            #Values are the same
+            self.check_values(document, default_values)
+            self.check_row_hidden(document, empty_values)
+
+            #Undo
+            self.xUITest.executeCommand(".uno:Undo")
+            self.check_values(document, default_values)
+            self.check_row_hidden(document)
+
+            # Not Empty button
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "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":"DOWN"}))
+            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
+
+            #Nothing should change
+            self.check_values(document, default_values)
+            self.check_row_hidden(document)
+
+            #Undo
+            self.xUITest.executeCommand(".uno:Undo")
+            self.check_values(document, default_values)
+            self.check_row_hidden(document)
+
+            # finish
 
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/autofilter/tdf141559.py b/sc/qa/uitest/autofilter/tdf141559.py
index 6bce18852ff3..dc09609f5655 100644
--- a/sc/qa/uitest/autofilter/tdf141559.py
+++ b/sc/qa/uitest/autofilter/tdf141559.py
@@ -15,79 +15,77 @@ from uitest.uihelper.common import get_state_as_dict
 
 class tdf141559(UITestCase):
     def test_tdf141559_clear_filter(self):
-        self.ui_test.create_doc_in_start_center("calc")
-        document = self.ui_test.get_component()
-        calcDoc = self.xUITest.getTopFocusWindow()
-        gridwin = calcDoc.getChild("grid_window")
-        document = self.ui_test.get_component()
-
-        enter_text_to_cell(gridwin, "A1", "A")
-        enter_text_to_cell(gridwin, "A2", "1")
-        enter_text_to_cell(gridwin, "A3", "2")
-        enter_text_to_cell(gridwin, "A4", "3")
-
-        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"}))
-
-        self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
-
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        #Choose Standard Filter... button
-        xMenu = xFloatWindow.getChild("menu")
-
-        # check last item: 'Standard Filter...' (new menu item 'Clear Filter' is optional)
-        nLastIdx = int(get_state_as_dict(xMenu)['Children']) - 1
-        self.assertEqual(10, nLastIdx)
-        self.assertEqual('Standard Filter...', get_state_as_dict(xMenu.getChild(str(nLastIdx)))['Text'])
-
-        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"}))
-        self.assertEqual("Standard Filter...", get_state_as_dict(xMenu)['SelectEntryText'])
-        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
-
-        xDialog = self.xUITest.getTopFocusWindow()
-        xfield1 = xDialog.getChild("field1")
-        xcond1 = xDialog.getChild("cond1")
-        xval1 = xDialog.getChild("val1")
-
-        select_by_text(xfield1, "A")
-        select_by_text(xcond1, ">")
-        xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
-        xOKBtn = xDialog.getChild("ok")
-        self.ui_test.close_dialog_through_button(xOKBtn)
-
-        row = get_row(document, 1)
-        self.assertFalse(row.getPropertyValue("IsVisible"))
-
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        #Choose Clear Filter button
-        xMenu = xFloatWindow.getChild("menu")
-
-        # check last item: 'Clear Filter'
-        nLastIdx = int(get_state_as_dict(xMenu)['Children']) - 1
-        self.assertEqual(11, nLastIdx)
-        self.assertEqual('Clear Filter', get_state_as_dict(xMenu.getChild(str(nLastIdx)))['Text'])
-
-        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":"DOWN"}))
-        # Use new menu item "Clear Filter" to remove the standard filter condition
-        self.assertEqual("Clear Filter", get_state_as_dict(xMenu)['SelectEntryText'])
-        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
-
-        self.assertTrue(row.getPropertyValue("IsVisible"))
-
-        self.ui_test.close_doc()
+        with self.ui_test.create_doc_in_start_center("calc"):
+            document = self.ui_test.get_component()
+            calcDoc = self.xUITest.getTopFocusWindow()
+            gridwin = calcDoc.getChild("grid_window")
+            document = self.ui_test.get_component()
+
+            enter_text_to_cell(gridwin, "A1", "A")
+            enter_text_to_cell(gridwin, "A2", "1")
+            enter_text_to_cell(gridwin, "A3", "2")
+            enter_text_to_cell(gridwin, "A4", "3")
+
+            gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"}))
+
+            self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
+
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            #Choose Standard Filter... button
+            xMenu = xFloatWindow.getChild("menu")
+
+            # check last item: 'Standard Filter...' (new menu item 'Clear Filter' is optional)
+            nLastIdx = int(get_state_as_dict(xMenu)['Children']) - 1
+            self.assertEqual(10, nLastIdx)
+            self.assertEqual('Standard Filter...', get_state_as_dict(xMenu.getChild(str(nLastIdx)))['Text'])
+
+            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"}))
+            self.assertEqual("Standard Filter...", get_state_as_dict(xMenu)['SelectEntryText'])
+            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
+
+            xDialog = self.xUITest.getTopFocusWindow()
+            xfield1 = xDialog.getChild("field1")
+            xcond1 = xDialog.getChild("cond1")
+            xval1 = xDialog.getChild("val1")
+
+            select_by_text(xfield1, "A")
+            select_by_text(xcond1, ">")
+            xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
+            xOKBtn = xDialog.getChild("ok")
+            self.ui_test.close_dialog_through_button(xOKBtn)
+
+            row = get_row(document, 1)
+            self.assertFalse(row.getPropertyValue("IsVisible"))
+
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            #Choose Clear Filter button
+            xMenu = xFloatWindow.getChild("menu")
+
+            # check last item: 'Clear Filter'
+            nLastIdx = int(get_state_as_dict(xMenu)['Children']) - 1
+            self.assertEqual(11, nLastIdx)
+            self.assertEqual('Clear Filter', get_state_as_dict(xMenu.getChild(str(nLastIdx)))['Text'])
+
+            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":"DOWN"}))
+            # Use new menu item "Clear Filter" to remove the standard filter condition
+            self.assertEqual("Clear Filter", get_state_as_dict(xMenu)['SelectEntryText'])
+            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
+
+            self.assertTrue(row.getPropertyValue("IsVisible"))
 
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/autofilter/tdf141946.py b/sc/qa/uitest/autofilter/tdf141946.py
index 4e45ecfb7d5a..464728e8ef9c 100644
--- a/sc/qa/uitest/autofilter/tdf141946.py
+++ b/sc/qa/uitest/autofilter/tdf141946.py
@@ -12,64 +12,62 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
 
 class tdf141946(UITestCase):
     def test_tdf141946_inserted_column(self):
-        self.ui_test.create_doc_in_start_center("calc")
-        document = self.ui_test.get_component()
-        calcDoc = self.xUITest.getTopFocusWindow()
-        gridwin = calcDoc.getChild("grid_window")
-        document = self.ui_test.get_component()
+        with self.ui_test.create_doc_in_start_center("calc"):
+            document = self.ui_test.get_component()
+            calcDoc = self.xUITest.getTopFocusWindow()
+            gridwin = calcDoc.getChild("grid_window")
+            document = self.ui_test.get_component()
 
-        enter_text_to_cell(gridwin, "A1", "A")
-        enter_text_to_cell(gridwin, "A2", "1")
-        enter_text_to_cell(gridwin, "A3", "2")
-        enter_text_to_cell(gridwin, "A4", "3")
+            enter_text_to_cell(gridwin, "A1", "A")
+            enter_text_to_cell(gridwin, "A2", "1")
+            enter_text_to_cell(gridwin, "A3", "2")
+            enter_text_to_cell(gridwin, "A4", "3")
 
-        enter_text_to_cell(gridwin, "B1", "B")
-        enter_text_to_cell(gridwin, "B2", "4")
-        enter_text_to_cell(gridwin, "B3", "5")
-        enter_text_to_cell(gridwin, "B4", "6")
+            enter_text_to_cell(gridwin, "B1", "B")
+            enter_text_to_cell(gridwin, "B2", "4")
+            enter_text_to_cell(gridwin, "B3", "5")
+            enter_text_to_cell(gridwin, "B4", "6")
 
-        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B4"}))
+            gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B4"}))
 
-        self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
+            self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
 
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xList = xCheckListMenu.getChild("check_list_box")
-        xEntry = xList.getChild("1")
-        xEntry.executeAction("CLICK", tuple())
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xList = xCheckListMenu.getChild("check_list_box")
+            xEntry = xList.getChild("1")
+            xEntry.executeAction("CLICK", tuple())
 
-        xOkButton = xFloatWindow.getChild("ok")
-        xOkButton.executeAction("CLICK", tuple())
+            xOkButton = xFloatWindow.getChild("ok")
+            xOkButton.executeAction("CLICK", tuple())
 
-        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"}))
+            gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"}))
 
-        self.xUITest.executeCommand(".uno:InsertColumnsBefore")
+            self.xUITest.executeCommand(".uno:InsertColumnsBefore")
 
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xList = xCheckListMenu.getChild("check_list_box")
-        self.assertEqual(2, len(xList.getChildren()))
-        xCloseBtn = xFloatWindow.getChild("cancel")
-        xCloseBtn.executeAction("CLICK", tuple())
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xList = xCheckListMenu.getChild("check_list_box")
+            self.assertEqual(2, len(xList.getChildren()))
+            xCloseBtn = xFloatWindow.getChild("cancel")
+            xCloseBtn.executeAction("CLICK", tuple())
 
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xList = xCheckListMenu.getChild("check_list_box")
-        self.assertEqual(1, len(xList.getChildren()))
-        xCloseBtn = xFloatWindow.getChild("cancel")
-        xCloseBtn.executeAction("CLICK", tuple())
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xList = xCheckListMenu.getChild("check_list_box")
+            self.assertEqual(1, len(xList.getChildren()))
+            xCloseBtn = xFloatWindow.getChild("cancel")
+            xCloseBtn.executeAction("CLICK", tuple())
 
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xList = xCheckListMenu.getChild("check_list_box")
-        self.assertEqual(3, len(xList.getChildren()))
-        xCloseBtn = xFloatWindow.getChild("cancel")
-        xCloseBtn.executeAction("CLICK", tuple())
-
-        self.ui_test.close_doc()
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xList = xCheckListMenu.getChild("check_list_box")
+            self.assertEqual(3, len(xList.getChildren()))
+            xCloseBtn = xFloatWindow.getChild("cancel")
+            xCloseBtn.executeAction("CLICK", tuple())
 
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/autofilter/tdf36383.py b/sc/qa/uitest/autofilter/tdf36383.py
index d55db21837b3..9c341845b617 100644
--- a/sc/qa/uitest/autofilter/tdf36383.py
+++ b/sc/qa/uitest/autofilter/tdf36383.py
@@ -13,56 +13,54 @@ from libreoffice.calc.document import get_row
 
 class tdf36383(UITestCase):
     def test_tdf36383_row_height(self):
-        self.ui_test.create_doc_in_start_center("calc")
-        document = self.ui_test.get_component()
-        calcDoc = self.xUITest.getTopFocusWindow()
-        gridwin = calcDoc.getChild("grid_window")
-        document = self.ui_test.get_component()
+        with self.ui_test.create_doc_in_start_center("calc"):
+            document = self.ui_test.get_component()
+            calcDoc = self.xUITest.getTopFocusWindow()
+            gridwin = calcDoc.getChild("grid_window")
+            document = self.ui_test.get_component()
 
-        enter_text_to_cell(gridwin, "A1", "A")
-        enter_text_to_cell(gridwin, "A2", "1")
-        enter_text_to_cell(gridwin, "A3", "2")
-        enter_text_to_cell(gridwin, "A4", "3")
+            enter_text_to_cell(gridwin, "A1", "A")
+            enter_text_to_cell(gridwin, "A2", "1")
+            enter_text_to_cell(gridwin, "A3", "2")
+            enter_text_to_cell(gridwin, "A4", "3")
 
-        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"}))
+            gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"}))
 
-        self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
+            self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
 
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xList = xCheckListMenu.getChild("check_list_box")
-        xEntry = xList.getChild("1")
-        xEntry.executeAction("CLICK", tuple())
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xList = xCheckListMenu.getChild("check_list_box")
+            xEntry = xList.getChild("1")
+            xEntry.executeAction("CLICK", tuple())
 
-        xOkButton = xFloatWindow.getChild("ok")
-        xOkButton.executeAction("CLICK", tuple())
+            xOkButton = xFloatWindow.getChild("ok")
+            xOkButton.executeAction("CLICK", tuple())
 
-        row = get_row(document, 2)
-        self.assertFalse(row.getPropertyValue("IsVisible"))
+            row = get_row(document, 2)
+            self.assertFalse(row.getPropertyValue("IsVisible"))
 
-        #row height
-        self.ui_test.execute_dialog_through_command(".uno:RowHeight")
-        xDialog = self.xUITest.getTopFocusWindow()
-        xvalue = xDialog.getChild("value")
-        xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
-        xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
-        xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"}))
+            #row height
+            self.ui_test.execute_dialog_through_command(".uno:RowHeight")
+            xDialog = self.xUITest.getTopFocusWindow()
+            xvalue = xDialog.getChild("value")
+            xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+            xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+            xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"}))
 
-        xOk = xDialog.getChild("ok")
-        self.ui_test.close_dialog_through_button(xOk)
+            xOk = xDialog.getChild("ok")
+            self.ui_test.close_dialog_through_button(xOk)
 
-        self.assertFalse(row.getPropertyValue("IsVisible"))
+            self.assertFalse(row.getPropertyValue("IsVisible"))
 
-        #optimal row height
-        self.ui_test.execute_dialog_through_command(".uno:SetOptimalRowHeight")
-        xDialog = self.xUITest.getTopFocusWindow()
+            #optimal row height
+            self.ui_test.execute_dialog_through_command(".uno:SetOptimalRowHeight")
+            xDialog = self.xUITest.getTopFocusWindow()
 
-        xOk = xDialog.getChild("ok")
-        self.ui_test.close_dialog_through_button(xOk)
+            xOk = xDialog.getChild("ok")
+            self.ui_test.close_dialog_through_button(xOk)
 
-        self.assertFalse(row.getPropertyValue("IsVisible"))
-
-        self.ui_test.close_doc()
+            self.assertFalse(row.getPropertyValue("IsVisible"))
 
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/autofilter/tdf46062.py b/sc/qa/uitest/autofilter/tdf46062.py
index 41b42eb0e475..769d20fd31b1 100644
--- a/sc/qa/uitest/autofilter/tdf46062.py
+++ b/sc/qa/uitest/autofilter/tdf46062.py
@@ -13,37 +13,35 @@ class tdf46062(UITestCase):
 
     def test_tdf46062(self):
 
-        self.ui_test.create_doc_in_start_center("calc")
-        calcDoc = self.xUITest.getTopFocusWindow()
-        gridwin = calcDoc.getChild("grid_window")
-
-        enter_text_to_cell(gridwin, "A1", "spaces")
-        enter_text_to_cell(gridwin, "A2", " ")
-        enter_text_to_cell(gridwin, "A3", "  ")
-        enter_text_to_cell(gridwin, "A4", "   ")
-
-        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"}))
-
-        self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter")
-        xDialog = self.xUITest.getTopFocusWindow()
-        xYesBtn = xDialog.getChild("yes")
-        self.ui_test.close_dialog_through_button(xYesBtn)
-
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xList = xCheckListMenu.getChild("check_list_box")
-        self.assertEqual(3, len(xList.getChildren()))
-
-        # Without the fix in place, this test would have failed with
-        # AssertionError: '" "' != ' '
-        self.assertEqual('" "', get_state_as_dict(xList.getChild("0"))['Text'])
-        self.assertEqual('"  "', get_state_as_dict(xList.getChild("1"))['Text'])
-        self.assertEqual('"   "', get_state_as_dict(xList.getChild("2"))['Text'])
-
-        xOkButton = xFloatWindow.getChild("ok")
-        xOkButton.executeAction("CLICK", tuple())
-
-        self.ui_test.close_doc()
+        with self.ui_test.create_doc_in_start_center("calc"):
+            calcDoc = self.xUITest.getTopFocusWindow()
+            gridwin = calcDoc.getChild("grid_window")
+
+            enter_text_to_cell(gridwin, "A1", "spaces")
+            enter_text_to_cell(gridwin, "A2", " ")
+            enter_text_to_cell(gridwin, "A3", "  ")
+            enter_text_to_cell(gridwin, "A4", "   ")
+
+            gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"}))
+
+            self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter")
+            xDialog = self.xUITest.getTopFocusWindow()
+            xYesBtn = xDialog.getChild("yes")
+            self.ui_test.close_dialog_through_button(xYesBtn)
+
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xList = xCheckListMenu.getChild("check_list_box")
+            self.assertEqual(3, len(xList.getChildren()))
+
+            # Without the fix in place, this test would have failed with
+            # AssertionError: '" "' != ' '
+            self.assertEqual('" "', get_state_as_dict(xList.getChild("0"))['Text'])
+            self.assertEqual('"  "', get_state_as_dict(xList.getChild("1"))['Text'])
+            self.assertEqual('"   "', get_state_as_dict(xList.getChild("2"))['Text'])
+
+            xOkButton = xFloatWindow.getChild("ok")
+            xOkButton.executeAction("CLICK", tuple())
 
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/autofilter/tdf48025.py b/sc/qa/uitest/autofilter/tdf48025.py
index c5d5c711da5f..dbbdefe5ff42 100644
--- a/sc/qa/uitest/autofilter/tdf48025.py
+++ b/sc/qa/uitest/autofilter/tdf48025.py
@@ -12,61 +12,59 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
 
 class tdf48025(UITestCase):
     def test_tdf48025_deleted_columns(self):
-        self.ui_test.create_doc_in_start_center("calc")
-        document = self.ui_test.get_component()
-        calcDoc = self.xUITest.getTopFocusWindow()
-        gridwin = calcDoc.getChild("grid_window")
-        document = self.ui_test.get_component()
+        with self.ui_test.create_doc_in_start_center("calc"):
+            document = self.ui_test.get_component()
+            calcDoc = self.xUITest.getTopFocusWindow()
+            gridwin = calcDoc.getChild("grid_window")
+            document = self.ui_test.get_component()
 
-        enter_text_to_cell(gridwin, "A1", "A")
-        enter_text_to_cell(gridwin, "A2", "1")
-        enter_text_to_cell(gridwin, "A3", "2")
-        enter_text_to_cell(gridwin, "A4", "3")
+            enter_text_to_cell(gridwin, "A1", "A")
+            enter_text_to_cell(gridwin, "A2", "1")
+            enter_text_to_cell(gridwin, "A3", "2")
+            enter_text_to_cell(gridwin, "A4", "3")
 
-        enter_text_to_cell(gridwin, "B1", "B")
-        enter_text_to_cell(gridwin, "B2", "4")
-        enter_text_to_cell(gridwin, "B3", "5")
-        enter_text_to_cell(gridwin, "B4", "6")
+            enter_text_to_cell(gridwin, "B1", "B")
+            enter_text_to_cell(gridwin, "B2", "4")
+            enter_text_to_cell(gridwin, "B3", "5")
+            enter_text_to_cell(gridwin, "B4", "6")
 
-        enter_text_to_cell(gridwin, "C1", "C")
-        enter_text_to_cell(gridwin, "C2", "7")
-        enter_text_to_cell(gridwin, "C3", "8")
-        enter_text_to_cell(gridwin, "C4", "9")
+            enter_text_to_cell(gridwin, "C1", "C")
+            enter_text_to_cell(gridwin, "C2", "7")
+            enter_text_to_cell(gridwin, "C3", "8")
+            enter_text_to_cell(gridwin, "C4", "9")
 
-        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C4"}))
+            gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C4"}))
 
-        self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
+            self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
 
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xList = xCheckListMenu.getChild("check_list_box")
-        xEntry = xList.getChild("1")
-        xEntry.executeAction("CLICK", tuple())
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xList = xCheckListMenu.getChild("check_list_box")
+            xEntry = xList.getChild("1")
+            xEntry.executeAction("CLICK", tuple())
 
-        xOkButton = xFloatWindow.getChild("ok")
-        xOkButton.executeAction("CLICK", tuple())
+            xOkButton = xFloatWindow.getChild("ok")
+            xOkButton.executeAction("CLICK", tuple())
 
-        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+            gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
 
-        self.xUITest.executeCommand(".uno:DeleteColumns")
+            self.xUITest.executeCommand(".uno:DeleteColumns")
 
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xList = xCheckListMenu.getChild("check_list_box")
-        self.assertEqual(3, len(xList.getChildren()))
-        xCloseBtn = xFloatWindow.getChild("cancel")
-        xCloseBtn.executeAction("CLICK", tuple())
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xList = xCheckListMenu.getChild("check_list_box")
+            self.assertEqual(3, len(xList.getChildren()))
+            xCloseBtn = xFloatWindow.getChild("cancel")
+            xCloseBtn.executeAction("CLICK", tuple())
 
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
-        xFloatWindow = self.xUITest.getFloatWindow()
-        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-        xList = xCheckListMenu.getChild("check_list_box")
-        self.assertEqual(2, len(xList.getChildren()))
-        xCloseBtn = xFloatWindow.getChild("cancel")
-        xCloseBtn.executeAction("CLICK", tuple())
-
-        self.ui_test.close_doc()
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+            xList = xCheckListMenu.getChild("check_list_box")
+            self.assertEqual(2, len(xList.getChildren()))
+            xCloseBtn = xFloatWindow.getChild("cancel")
+            xCloseBtn.executeAction("CLICK", tuple())
 
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/autofilter/tdf68113.py b/sc/qa/uitest/autofilter/tdf68113.py
index f62ac9ce95c0..5a65398866ef 100644
--- a/sc/qa/uitest/autofilter/tdf68113.py
+++ b/sc/qa/uitest/autofilter/tdf68113.py
@@ -13,65 +13,63 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
 
 class tdf68113(UITestCase):
     def test_tdf68113_empty_notempty_button(self):
-        self.ui_test.create_doc_in_start_center("calc")
-        document = self.ui_test.get_component()
-        calcDoc = self.xUITest.getTopFocusWindow()
-        xGridWin = calcDoc.getChild("grid_window")
-        document = self.ui_test.get_component()
+        with self.ui_test.create_doc_in_start_center("calc"):
+            document = self.ui_test.get_component()
+            calcDoc = self.xUITest.getTopFocusWindow()
+            xGridWin = calcDoc.getChild("grid_window")
+            document = self.ui_test.get_component()
 
-        enter_text_to_cell(xGridWin, "A1", "A")
-        enter_text_to_cell(xGridWin, "A2", "1")
-        enter_text_to_cell(xGridWin, "A3", "2")
-        enter_text_to_cell(xGridWin, "A5", "4")
-        enter_text_to_cell(xGridWin, "A7", "6")
+            enter_text_to_cell(xGridWin, "A1", "A")
+            enter_text_to_cell(xGridWin, "A2", "1")
+            enter_text_to_cell(xGridWin, "A3", "2")
+            enter_text_to_cell(xGridWin, "A5", "4")
+            enter_text_to_cell(xGridWin, "A7", "6")
 
-        xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A7"}))
+            xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A7"}))
 
-        self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
+            self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
 
-        # Empty button
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "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":"DOWN"}))
-        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
+            # Empty button
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "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":"DOWN"}))
+            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
 
-        # Checkbox elements
-        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('2'))['IsChecked'])
-        self.assertEqual('false', get_state_as_dict(xTreeList.getChild('4'))['IsChecked'])
-        xCancelBtn = xFloatWindow.getChild("cancel")
-        xCancelBtn.executeAction("CLICK", tuple())
+            # Checkbox elements
+            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('2'))['IsChecked'])
+            self.assertEqual('false', get_state_as_dict(xTreeList.getChild('4'))['IsChecked'])
+            xCancelBtn = xFloatWindow.getChild("cancel")
+            xCancelBtn.executeAction("CLICK", tuple())
 
-        # Not Empty button
-        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "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":"DOWN"}))
-        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
-        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
+            # Not Empty button
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "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":"DOWN"}))
+            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
 
-        # Checkbox elements
-        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('false', get_state_as_dict(xTreeList.getChild('0'))['IsChecked'])
-        self.assertEqual('true', get_state_as_dict(xTreeList.getChild('2'))['IsChecked'])
-        self.assertEqual('true', get_state_as_dict(xTreeList.getChild('4'))['IsChecked'])
-        xCancelBtn = xFloatWindow.getChild("cancel")
-        xCancelBtn.executeAction("CLICK", tuple())
-
-        self.ui_test.close_doc()
+            # Checkbox elements
+            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('false', get_state_as_dict(xTreeList.getChild('0'))['IsChecked'])
+            self.assertEqual('true', get_state_as_dict(xTreeList.getChild('2'))['IsChecked'])
+            self.assertEqual('true', get_state_as_dict(xTreeList.getChild('4'))['IsChecked'])
+            xCancelBtn = xFloatWindow.getChild("cancel")
+            xCancelBtn.executeAction("CLICK", tuple())
 
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests/CalcPasteOnly.py b/sc/qa/uitest/calc_tests/CalcPasteOnly.py
index 414f58230a51..1c567549af66 100644
--- a/sc/qa/uitest/calc_tests/CalcPasteOnly.py
+++ b/sc/qa/uitest/calc_tests/CalcPasteOnly.py
@@ -13,29 +13,28 @@ from uitest.uihelper.calc import enter_text_to_cell
 class CalcPasteOnly(UITestCase):
 
     def test_paste_only(self):
-        calc_doc = self.ui_test.create_doc_in_start_center("calc")
-        xTopWindow = self.xUITest.getTopFocusWindow()
-        document = self.ui_test.get_component()
-        gridwin = xTopWindow.getChild("grid_window")
-
-        enter_text_to_cell(gridwin, "A1", "=SUM(A2:A3)")
-        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
-        self.xUITest.executeCommand(".uno:Copy")
-
-        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"}))
-        self.xUITest.executeCommand(".uno:PasteOnlyText")
-        self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "")
-
-        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"}))
-        self.xUITest.executeCommand(".uno:PasteOnlyValue")
-        self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "0")
-        self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 0)
-
-        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E1"}))
-        self.xUITest.executeCommand(".uno:PasteOnlyFormula")
-        self.assertEqual(get_cell_by_position(document, 0, 4, 0).getString(), "0")
-        self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 0)
-        self.assertEqual(get_cell_by_position(document, 0, 4, 0).getFormula(), "=SUM(E2:E3)")
-
-        self.ui_test.close_doc()
+        with self.ui_test.create_doc_in_start_center("calc"):
+            xTopWindow = self.xUITest.getTopFocusWindow()
+            document = self.ui_test.get_component()
+            gridwin = xTopWindow.getChild("grid_window")
+
+            enter_text_to_cell(gridwin, "A1", "=SUM(A2:A3)")
+            gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+            self.xUITest.executeCommand(".uno:Copy")
+
+            gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"}))
+            self.xUITest.executeCommand(".uno:PasteOnlyText")
+            self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "")
+
+            gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"}))
+            self.xUITest.executeCommand(".uno:PasteOnlyValue")
+            self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "0")
+            self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 0)
+
+            gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E1"}))
+            self.xUITest.executeCommand(".uno:PasteOnlyFormula")
+            self.assertEqual(get_cell_by_position(document, 0, 4, 0).getString(), "0")
+            self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 0)
+            self.assertEqual(get_cell_by_position(document, 0, 4, 0).getFormula(), "=SUM(E2:E3)")
+
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests/CellDropDownItems.py b/sc/qa/uitest/calc_tests/CellDropDownItems.py
index 7b089751cff5..ffef1e8c6644 100644
--- a/sc/qa/uitest/calc_tests/CellDropDownItems.py
+++ b/sc/qa/uitest/calc_tests/CellDropDownItems.py
@@ -13,74 +13,72 @@ class CellDropDownItems(UITestCase):
     def test_dropdownitems(self):
 
         #This is to test Dropdown items in grid window
-        calc_doc = self.ui_test.create_doc_in_start_center("calc")
-        xCalcDoc = self.xUITest.getTopFocusWindow()
-        gridwin = xCalcDoc.getChild("grid_window")
-        document = self.ui_test.get_component()
-
-        #select cell C10
-        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C10"}))
-
-        #Open Validation Dialog
-        self.ui_test.execute_dialog_through_command(".uno:Validation")
-        xDialog = self.xUITest.getTopFocusWindow()
-
-        #Select List option
-        xallow = xDialog.getChild("allow")
-        xallow.executeAction("SELECT", mkPropertyValues({"POS": "6"}))
-
-        #Add items to the List
-        xminlist = xDialog.getChild("minlist")
-        xminlist.executeAction("TYPE", mkPropertyValues({"TEXT": "Item1"}))
-        xminlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
-        xminlist.executeAction("TYPE", mkPropertyValues({"TEXT": "Item2"}))
-        xminlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
-        xminlist.executeAction("TYPE", mkPropertyValues({"TEXT": "Item3"}))
-        xminlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
-        xminlist.executeAction("TYPE", mkPropertyValues({"TEXT": "Item4"}))
-        xminlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
-        xminlist.executeAction("TYPE", mkPropertyValues({"TEXT": "Item5"}))
-
-        #Close the dialog
-        xOk = xDialog.getChild("ok")
-        self.ui_test.close_dialog_through_button(xOk)
-
-        #Launch the Select Menu to view the list ans select first item in the list
-        gridwin = xCalcDoc.getChild("grid_window")
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"SELECTMENU": "", "COL": "2", "ROW": "9"}))
-
-        #Select the TreeList UI Object
-        xWin = self.xUITest.getTopFocusWindow()
-        xlist = xWin.getChild("list")
-
-        xListItem = xlist.getChild('0')
-        xListItem.executeAction("DOUBLECLICK" , mkPropertyValues({}) )
-        self.assertEqual(get_cell_by_position(document, 0, 2, 9).getString(), "Item1")
-
-        #Launch the Select Menu to view the list ans select Third item in the list
-        gridwin = xCalcDoc.getChild("grid_window")
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"SELECTMENU": "", "COL": "2", "ROW": "9"}))
-
-        #Select the TreeList UI Object
-        xWin = self.xUITest.getTopFocusWindow()
-        xlist = xWin.getChild("list")
-
-        xListItem = xlist.getChild('2')
-        xListItem.executeAction("DOUBLECLICK" , mkPropertyValues({}) )
-        self.assertEqual(get_cell_by_position(document, 0, 2, 9).getString(), "Item3")
-
-        #Launch the Select Menu to view the list ans select Fifth item in the list
-        gridwin = xCalcDoc.getChild("grid_window")
-        gridwin.executeAction("LAUNCH", mkPropertyValues({"SELECTMENU": "", "COL": "2", "ROW": "9"}))
-
-        #Select the TreeList UI Object
-        xWin = self.xUITest.getTopFocusWindow()
-        xlist = xWin.getChild("list")
-
-        xListItem = xlist.getChild('4')
-        xListItem.executeAction("DOUBLECLICK" , mkPropertyValues({}) )
-        self.assertEqual(get_cell_by_position(document, 0, 2, 9).getString(), "Item5")
-
-        self.ui_test.close_doc()
+        with self.ui_test.create_doc_in_start_center("calc"):
+            xCalcDoc = self.xUITest.getTopFocusWindow()
+            gridwin = xCalcDoc.getChild("grid_window")
+            document = self.ui_test.get_component()
+
+            #select cell C10
+            gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C10"}))
+
+            #Open Validation Dialog
+            self.ui_test.execute_dialog_through_command(".uno:Validation")
+            xDialog = self.xUITest.getTopFocusWindow()
+
+            #Select List option
+            xallow = xDialog.getChild("allow")
+            xallow.executeAction("SELECT", mkPropertyValues({"POS": "6"}))
+
+            #Add items to the List
+            xminlist = xDialog.getChild("minlist")
+            xminlist.executeAction("TYPE", mkPropertyValues({"TEXT": "Item1"}))
+            xminlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+            xminlist.executeAction("TYPE", mkPropertyValues({"TEXT": "Item2"}))
+            xminlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+            xminlist.executeAction("TYPE", mkPropertyValues({"TEXT": "Item3"}))
+            xminlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+            xminlist.executeAction("TYPE", mkPropertyValues({"TEXT": "Item4"}))
+            xminlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+            xminlist.executeAction("TYPE", mkPropertyValues({"TEXT": "Item5"}))
+
+            #Close the dialog
+            xOk = xDialog.getChild("ok")
+            self.ui_test.close_dialog_through_button(xOk)
+
+            #Launch the Select Menu to view the list ans select first item in the list
+            gridwin = xCalcDoc.getChild("grid_window")
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"SELECTMENU": "", "COL": "2", "ROW": "9"}))
+
+            #Select the TreeList UI Object
+            xWin = self.xUITest.getTopFocusWindow()
+            xlist = xWin.getChild("list")
+
+            xListItem = xlist.getChild('0')
+            xListItem.executeAction("DOUBLECLICK" , mkPropertyValues({}) )
+            self.assertEqual(get_cell_by_position(document, 0, 2, 9).getString(), "Item1")
+
+            #Launch the Select Menu to view the list ans select Third item in the list
+            gridwin = xCalcDoc.getChild("grid_window")
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"SELECTMENU": "", "COL": "2", "ROW": "9"}))
+
+            #Select the TreeList UI Object
+            xWin = self.xUITest.getTopFocusWindow()
+            xlist = xWin.getChild("list")
+
+            xListItem = xlist.getChild('2')
+            xListItem.executeAction("DOUBLECLICK" , mkPropertyValues({}) )
+            self.assertEqual(get_cell_by_position(document, 0, 2, 9).getString(), "Item3")
+
+            #Launch the Select Menu to view the list ans select Fifth item in the list

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list