summaryrefslogtreecommitdiffstats
path: root/uitest/uitest/uihelper/testDialog.py
blob: 0e443643645ff4401235c394f69f804549a25c26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#

from uitest.framework import UITestCase
from uitest.uihelper.common import get_state_as_dict

# opens the dialogs, closes it with the given close button
# and if there is an "OK" button open the dialog again and close it by using the OK button
# the test only checks if LibreOffice crashes by opening the dialog
def testDialog(UITestCase, app, dialog):
    with UITestCase.ui_test.create_doc_in_start_center(app):
        with UITestCase.ui_test.execute_dialog_through_command(dialog['command'], close_button=dialog['closeButton']) as xDialog:
            if 'skipTestOK' in dialog and dialog['skipTestOK'] == True:
                xOKBtn = None
            else:
                try:
                    xOKBtn = xDialog.getChild("ok")
                    if (get_state_as_dict(xOKBtn)["Enabled"] != "true"):
                        xOKBtn = None
                except:
                    xOKBtn = None

        if (xOKBtn != None):
            print("check also OK button")
            with UITestCase.ui_test.execute_dialog_through_command(dialog['command']):
                pass

# vim: set shiftwidth=4 softtabstop=4 expandtab: