Update git submodules
[LibreOffice.git] / sc / qa / uitest / calc_tests8 / tdf126248.py
blob9e65f9c3d5b38f234b59b51b60ab3bf847bd60e4
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 uitest.uihelper.common import get_state_as_dict
12 from libreoffice.uno.propertyvalue import mkPropertyValues
13 from uitest.uihelper.calc import enter_text_to_cell
14 from uitest.uihelper.common import select_pos
15 from uitest.uihelper.common import select_by_text
17 class tdf126248(UITestCase):
19 def assertFontName(self, gridwin, fontName):
21 #Open the sidebar
22 self.xUITest.executeCommand(".uno:Sidebar")
23 gridwin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "TextPropertyPanel"}))
25 xCalcDoc = self.xUITest.getTopFocusWindow()
27 xFontName = xCalcDoc.getChild("fontnamecombobox")
28 self.ui_test.wait_until_property_is_updated(xFontName, "Text", fontName)
29 self.assertEqual(fontName, get_state_as_dict(xFontName)['Text'])
31 #Close the sidebar
32 self.xUITest.executeCommand(".uno:Sidebar")
34 def changeLocalSetting(self, language):
35 with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog:
36 xPages = xDialog.getChild("pages")
37 xLanguageEntry = xPages.getChild('2')
38 xLanguageEntry.executeAction("EXPAND", tuple())
39 xxLanguageEntryGeneralEntry = xLanguageEntry.getChild('0')
40 xxLanguageEntryGeneralEntry.executeAction("SELECT", tuple())
42 # Check asian support is enabled
43 asianlanguage = xDialog.getChild("asiansupport")
44 self.assertEqual("true", get_state_as_dict(asianlanguage)['Selected'])
46 localeSetting = xDialog.getChild("localesetting")
47 select_by_text(localeSetting, language)
48 self.ui_test.wait_until_property_is_updated(localeSetting, 'SelectEntryText', language)
49 self.assertEqual(language, get_state_as_dict(localeSetting)['SelectEntryText'])
51 def test_tdf126248(self):
53 with self.ui_test.create_doc_in_start_center("calc"):
55 try:
56 self.changeLocalSetting("Chinese (traditional)")
58 with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog:
59 xTabs = xDialog.getChild("tabcontrol")
60 select_pos(xTabs, "1")
62 # Get current font names from the Format Cell dialog
63 westFontName = get_state_as_dict(xDialog.getChild("edWestFontName"))['Text']
64 eastFontName = get_state_as_dict(xDialog.getChild("edCJKFontName"))['Text']
66 xCalcDoc = self.xUITest.getTopFocusWindow()
67 gridwin = xCalcDoc.getChild("grid_window")
69 enter_text_to_cell(gridwin, "A1", "Test")
71 # Without the fix in place, this test would have failed here
72 self.assertFontName(gridwin, westFontName)
74 enter_text_to_cell(gridwin, "B1", "測試")
76 self.assertFontName(gridwin, eastFontName)
78 finally:
79 self.changeLocalSetting("English (USA)")
81 enter_text_to_cell(gridwin, "C1", "Test")
83 self.assertFontName(gridwin, westFontName)
85 enter_text_to_cell(gridwin, "D1", "測試")
87 self.assertFontName(gridwin, eastFontName)
89 # vim: set shiftwidth=4 softtabstop=4 expandtab: