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/.
9 from uitest
.framework
import UITestCase
10 from uitest
.uihelper
.common
import get_state_as_dict
, get_url_for_data_file
13 # tdf118208/118212 - enabling either CJK or CTL, or both (Tools -> Options -> Languages and Locales -> General: Default Languages for Documents checkboxes)
14 # eliminates all crashes. Setting back to Western only recreates the crashes. - DONE
17 class tdf118208(UITestCase
):
19 def change_default_languages(self
, enabled
):
20 with self
.ui_test
.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog
:
22 xPages
= xDialog
.getChild("pages")
23 xLanguageEntry
= xPages
.getChild('2') # Languages and Locales
24 xLanguageEntry
.executeAction("EXPAND", tuple())
25 xxLanguageEntryGeneralEntry
= xLanguageEntry
.getChild('0')
26 xxLanguageEntryGeneralEntry
.executeAction("SELECT", tuple()) # General
28 asianlanguage
= xDialog
.getChild("asiansupport")
29 complexlanguage
= xDialog
.getChild("ctlsupport")
30 if (get_state_as_dict(asianlanguage
)["Selected"]) != enabled
:
31 asianlanguage
.executeAction("CLICK", tuple())
32 if (get_state_as_dict(complexlanguage
)["Selected"]) != enabled
:
33 complexlanguage
.executeAction("CLICK", tuple())
35 def test_tdf118208_search_dialog_format_crash(self
):
36 with self
.ui_test
.load_file(get_url_for_data_file("tdf118208.odt")) as writer_doc
:
37 # 1. Open the attached file.
38 # 2. Press ctrl-H to show the search and replace dialog.
39 # 3. Press the "Format..." button.
40 # Libreoffice immediately crashed.
43 self
.change_default_languages("false")
45 with self
.ui_test
.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button
="close") as xDialog
:
47 format
= xDialog
.getChild("format")
49 with self
.ui_test
.execute_blocking_action(format
.executeAction
, args
=('CLICK', ())):
53 self
.assertEqual(writer_doc
.Text
.String
[0:14], "Aaaaaaaaaaaaaa")
55 self
.change_default_languages("true")