1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 from uitest
.framework
import UITestCase
10 from uitest
.uihelper
.common
import get_state_as_dict
, type_text
11 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
12 from uitest
.debug
import sleep
14 class exchangeDB(UITestCase
):
16 def test_exchange_database(self
):
18 self
.ui_test
.create_doc_in_start_center("writer")
20 self
.ui_test
.execute_dialog_through_command(".uno:ChangeDatabaseField")
21 xExDBDlg
= self
.xUITest
.getTopFocusWindow()
22 xCloseBtn
= xExDBDlg
.getChild("close")
23 self
.ui_test
.close_dialog_through_button(xCloseBtn
)
25 self
.ui_test
.close_doc()
27 def test_exchange_database2(self
):
29 self
.ui_test
.create_doc_in_start_center("writer")
31 self
.ui_test
.execute_dialog_through_command(".uno:ChangeDatabaseField")
32 xExDBDlg
= self
.xUITest
.getTopFocusWindow()
33 xTreelist
= xExDBDlg
.getChild("availablelb")
35 xLabeldb
= xExDBDlg
.getChild("dbnameft")
36 self
.assertEqual(get_state_as_dict(xLabeldb
)["Text"], "[None]")
38 xTreeEntry
= xTreelist
.getChild('0') #Available Databases
39 xTreeEntry
.executeAction("EXPAND", tuple()) #Click on the Bibliography
40 xTreeEntry
.executeAction("COLLAPSE", tuple())
41 xTreeEntry
.executeAction("EXPAND", tuple())
42 xTreeEntry2
= xTreeEntry
.getChild('0') #Available Databases
43 xTreeEntry2
.executeAction("SELECT", tuple()) #Click on the biblio
45 xDefineBtn
= xExDBDlg
.getChild("define")
46 xDefineBtn
.executeAction("CLICK", tuple())
48 self
.ui_test
.execute_dialog_through_command(".uno:ChangeDatabaseField")
49 xExDBDlg
= self
.xUITest
.getTopFocusWindow()
50 xLabeldb
= xExDBDlg
.getChild("dbnameft")
51 self
.assertEqual(get_state_as_dict(xLabeldb
)["Text"], "Bibliography.biblio")
53 xCloseBtn
= xExDBDlg
.getChild("close")
54 self
.ui_test
.close_dialog_through_button(xCloseBtn
)
56 self
.ui_test
.close_doc()
58 # vim: set shiftwidth=4 softtabstop=4 expandtab: