1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 from uitest
.framework
import UITestCase
11 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
12 from uitest
.uihelper
.common
import get_state_as_dict
, select_pos
, type_text
14 class tdf150331(UITestCase
):
16 def test_tdf150331(self
):
17 with self
.ui_test
.create_doc_in_start_center("writer") as document
:
19 with self
.ui_test
.execute_dialog_through_command(".uno:AutoCorrectDlg") as xDialog
:
20 xTabs
= xDialog
.getChild("tabcontrol")
21 select_pos(xTabs
, "4")
23 xEnableWordComplete
= xDialog
.getChild("enablewordcomplete")
24 xAppendSpace
= xDialog
.getChild("appendspace")
25 xShowAsTip
= xDialog
.getChild("showastip")
26 xMinWordLen
= xDialog
.getChild("minwordlen")
27 xMaxEntries
= xDialog
.getChild("maxentries")
29 xEnableWordComplete
.executeAction("CLICK", tuple())
31 self
.assertEqual("true", get_state_as_dict(xEnableWordComplete
)['Selected'])
32 self
.assertEqual("false", get_state_as_dict(xAppendSpace
)['Selected'])
33 self
.assertEqual("true", get_state_as_dict(xShowAsTip
)['Selected'])
34 self
.assertEqual("8", get_state_as_dict(xMinWordLen
)['Value'])
35 self
.assertEqual("1000", get_state_as_dict(xMaxEntries
)['Value'])
37 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
38 xWriterEdit
= xWriterDoc
.getChild("writer_edit")
40 type_text(xWriterEdit
, "sun")
41 xWriterEdit
.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
43 self
.assertEqual("sunday", document
.Text
.String
)
45 with self
.ui_test
.execute_dialog_through_command(".uno:AutoCorrectDlg") as xDialog
:
46 xTabs
= xDialog
.getChild("tabcontrol")
47 select_pos(xTabs
, "4")
49 xShowAsTip
= xDialog
.getChild("showastip")
51 xShowAsTip
.executeAction("CLICK", tuple())
52 self
.assertEqual("false", get_state_as_dict(xShowAsTip
)['Selected'])
54 type_text(xWriterEdit
, " sunny")
56 # Without the fix in place, this test would have failed with
57 # AssertionError: 'sunday sunny' != 'Sunday sundayny'
58 self
.assertEqual("Sunday sunny", document
.Text
.String
)
60 # vim: set shiftwidth=4 softtabstop=4 expandtab: