use special method to close dialog through button click

Change-Id: Id884cc75503cb433742f9316d9647cff801565f7
Reviewed-on: https://gerrit.libreoffice.org/34230
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
diff --git a/uitest/calc_tests/about_test.py b/uitest/calc_tests/about_test.py
index 016c486..a5082ee 100644
--- a/uitest/calc_tests/about_test.py
+++ b/uitest/calc_tests/about_test.py
@@ -18,7 +18,7 @@ class AboutDlgTest(UITestCase):
        xAboutDlg = self.xUITest.getTopFocusWindow()

        xCloseBtn = xAboutDlg.getChild("close")
        xCloseBtn.executeAction("CLICK", tuple())
        self.ui_test.close_dialog_through_button(xCloseBtn)

        self.ui_test.close_doc()

diff --git a/uitest/calc_tests/create_chart.py b/uitest/calc_tests/create_chart.py
index d98eeff..427b4ce 100644
--- a/uitest/calc_tests/create_chart.py
+++ b/uitest/calc_tests/create_chart.py
@@ -39,7 +39,7 @@ class CalcChartUIDemo(UITestCase):
        xChartDlg = self.xUITest.getTopFocusWindow()

        xCancelBtn = xChartDlg.getChild("cancel")
        xCancelBtn.executeAction("CLICK", tuple())
        self.ui_test.close_dialog_through_button(xCancelBtn)

        self.ui_test.close_doc()

@@ -54,7 +54,7 @@ class CalcChartUIDemo(UITestCase):
        xChartDlg = self.xUITest.getTopFocusWindow()

        xOkBtn = xChartDlg.getChild("finish")
        xOkBtn.executeAction("CLICK", tuple())
        self.ui_test.close_dialog_through_button(xOkBtn)

        self.ui_test.close_doc()

@@ -78,7 +78,7 @@ class CalcChartUIDemo(UITestCase):
        xDataInCols.executeAction("CLICK", tuple())

        xCancelBtn = xChartDlg.getChild("finish")
        xCancelBtn.executeAction("CLICK", tuple())
        self.ui_test.close_dialog_through_button(xCancelBtn)

        self.ui_test.close_doc()

@@ -95,7 +95,7 @@ class CalcChartUIDemo(UITestCase):
        xChartDlg = self.xUITest.getTopFocusWindow()

        xNextBtn = xChartDlg.getChild("finish")
        xNextBtn.executeAction("CLICK", tuple())
        self.ui_test.close_dialog_through_button(xNextBtn)

        xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""}))

@@ -118,7 +118,7 @@ class CalcChartUIDemo(UITestCase):
        xChartDlg = self.xUITest.getTopFocusWindow()

        xNextBtn = xChartDlg.getChild("finish")
        xNextBtn.executeAction("CLICK", tuple())
        self.ui_test.close_dialog_through_button(xNextBtn)

        xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""}))

@@ -144,7 +144,7 @@ class CalcChartUIDemo(UITestCase):
        xChartDlg = self.xUITest.getTopFocusWindow()

        xNextBtn = xChartDlg.getChild("finish")
        xNextBtn.executeAction("CLICK", tuple())
        self.ui_test.close_dialog_through_button(xNextBtn)

        xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""}))

diff --git a/uitest/calc_tests/create_range_name.py b/uitest/calc_tests/create_range_name.py
index 1ab7805..1babca7 100644
--- a/uitest/calc_tests/create_range_name.py
+++ b/uitest/calc_tests/create_range_name.py
@@ -24,7 +24,7 @@ class CreateRangeNameTest(UITestCase):
        type_text(xEdit, "simpleRangeName")

        xAddBtn = xAddNameDlg.getChild("add")
        xAddBtn.executeAction("CLICK", tuple())
        self.ui_test.close_dialog_through_button(xAddBtn)

        self.ui_test.close_doc()

@@ -43,7 +43,7 @@ class CreateRangeNameTest(UITestCase):
        select_pos(xScope, "1")

        xAddBtn = xAddNameDlg.getChild("add")
        xAddBtn.executeAction("CLICK", tuple())
        self.ui_test.close_dialog_through_button(xAddBtn)

        self.ui_test.close_doc()

diff --git a/uitest/calc_tests/edit_chart.py b/uitest/calc_tests/edit_chart.py
index a8aa36e..4d44d52 100644
--- a/uitest/calc_tests/edit_chart.py
+++ b/uitest/calc_tests/edit_chart.py
@@ -42,7 +42,7 @@ class CalcChartEditUIDemo(UITestCase):
        xChartDlg = self.xUITest.getTopFocusWindow()

        xNextBtn = xChartDlg.getChild("finish")
        xNextBtn.executeAction("CLICK", tuple())
        self.ui_test.close_dialog_through_button(xNextBtn)

        xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""}))

diff --git a/uitest/calc_tests/function_wizard.py b/uitest/calc_tests/function_wizard.py
index 7387071..13b8335 100644
--- a/uitest/calc_tests/function_wizard.py
+++ b/uitest/calc_tests/function_wizard.py
@@ -22,7 +22,7 @@ class FunctionWizardTest(UITestCase):
        xArrayChkBox.executeAction("CLICK", tuple())

        xCancelBtn = xFunctionDlg.getChild("cancel")
        xCancelBtn.executeAction("CLICK", tuple())
        self.ui_test.close_dialog_through_button(xCancelBtn)

        self.ui_test.close_doc()

diff --git a/uitest/calc_tests/tdf105411.py b/uitest/calc_tests/tdf105411.py
index c9910bc..8f08c2f 100644
--- a/uitest/calc_tests/tdf105411.py
+++ b/uitest/calc_tests/tdf105411.py
@@ -28,7 +28,7 @@ class tdf105411(UITestCase):
        xCondFormatDlg = self.xUITest.getTopFocusWindow()

        xOkBtn = xCondFormatDlg.getChild("ok")
        xOkBtn.executeAction("CLICK", tuple())
        self.ui_test.close_dialog_through_button(xOkBtn)

        self.ui_test.close_doc()

diff --git a/uitest/calc_tests/tdf105466.py b/uitest/calc_tests/tdf105466.py
index 6e3593b..e1cfd2d 100644
--- a/uitest/calc_tests/tdf105466.py
+++ b/uitest/calc_tests/tdf105466.py
@@ -23,7 +23,7 @@ class tdf105466(UITestCase):

        xCondFormatDlg = self.xUITest.getTopFocusWindow()
        xOkBtn = xCondFormatDlg.getChild("ok")
        xOkBtn.executeAction("CLICK", tuple())
        self.ui_test.close_dialog_through_button(xOkBtn)

        self.ui_test.close_doc()

diff --git a/uitest/calc_tests/tdf96453.py b/uitest/calc_tests/tdf96453.py
index 94f047d..696fff8 100644
--- a/uitest/calc_tests/tdf96453.py
+++ b/uitest/calc_tests/tdf96453.py
@@ -82,7 +82,7 @@ class ConditionalFormatDlgTest(UITestCase):

        # close the conditional format manager
        xCancelBtn = xCondFormatMgr.getChild("cancel")
        xCancelBtn.executeAction("CLICK", tuple())
        self.ui_test.close_dialog_through_button(xCancelBtn)

        self.ui_test.close_doc()

diff --git a/uitest/demo_ui/radiobutton.py b/uitest/demo_ui/radiobutton.py
index 34c6dee..bb2f5bd 100644
--- a/uitest/demo_ui/radiobutton.py
+++ b/uitest/demo_ui/radiobutton.py
@@ -33,7 +33,7 @@ class RadioButtonTest(UITestCase):
        xNegativeNumRedCB.executeAction("CLICK",tuple())

        okBtn = xCellsDlg.getChild("ok")
        okBtn.executeAction("CLICK", tuple())
        self.ui_test.close_dialog_through_button(okBtn)

        self.ui_test.close_doc()

diff --git a/uitest/demo_ui/tabdialog.py b/uitest/demo_ui/tabdialog.py
index f925117..ed46379 100644
--- a/uitest/demo_ui/tabdialog.py
+++ b/uitest/demo_ui/tabdialog.py
@@ -22,7 +22,7 @@ class TabDialogTest(UITestCase):
        select_pos(xCellsDlg, "1")

        xOkBtn = xCellsDlg.getChild("ok")
        xOkBtn.executeAction("CLICK", tuple())
        self.ui_test.close_dialog_through_button(xOkBtn)

        self.ui_test.close_doc()

@@ -38,7 +38,7 @@ class TabDialogTest(UITestCase):
        xCellsDlg.executeAction("SELECT", propsUNO)

        xOkBtn = xCellsDlg.getChild("ok")
        xOkBtn.executeAction("CLICK", tuple())
        self.ui_test.close_dialog_through_button(xOkBtn)

        self.ui_test.close_doc()

diff --git a/uitest/uitest/test.py b/uitest/uitest/test.py
index 0f8cee1..3122329 100644
--- a/uitest/uitest/test.py
+++ b/uitest/uitest/test.py
@@ -144,7 +144,7 @@ class UITest(object):
                if event.hasExecuted("DialogExecute"):
                    xCloseDlg = self._xUITest.getTopFocusWindow()
                    xNoBtn = xCloseDlg.getChild("discard")
                    xNoBtn.executeAction("CLICK", tuple())
                    self.close_dialog_through_button(xNoBtn);
                    return
                elif event.hasExecuted("OnViewClosed"):
                    return