Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sw / qa / uitest / writer_tests / specialCharacter.py
blob31226f7368e10ac2fc68136b30eae45f146eb226
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
9 from libreoffice.uno.propertyvalue import mkPropertyValues
10 import time
11 from uitest.uihelper.common import get_state_as_dict, type_text
12 from uitest.debug import sleep
13 from uitest.uihelper.common import select_pos
15 #specialcharacters.ui
16 class specialCharacter(UITestCase):
18 def test_special_character(self):
20 self.ui_test.create_doc_in_start_center("writer")
22 xWriterDoc = self.xUITest.getTopFocusWindow()
23 xWriterEdit = xWriterDoc.getChild("writer_edit")
25 document = self.ui_test.get_component()
27 self.ui_test.execute_dialog_through_command(".uno:InsertSymbol") #specialCharacter dialog
28 xDialog = self.xUITest.getTopFocusWindow()
29 xCharSet = xDialog.getChild("showcharset") #default charset
31 xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "1", "ROW": "4"})) #digit 4 selected
33 xHexText = xDialog.getChild("hexvalue")
34 xDecText = xDialog.getChild("decimalvalue")
36 self.assertEqual(get_state_as_dict(xHexText)["Text"], "34") # check the values Hex and decimal
37 self.assertEqual(get_state_as_dict(xDecText)["Text"], "52")
39 xCancelBtn = xDialog.getChild("cancel")
40 self.ui_test.close_dialog_through_button(xCancelBtn)
42 self.ui_test.execute_dialog_through_command(".uno:InsertSymbol")
43 xDialog = self.xUITest.getTopFocusWindow()
45 xComboFont = xDialog.getChild("fontlb")
46 select_pos(xComboFont, "0") #select font
47 xComboFont2 = xDialog.getChild("subsetlb")
48 select_pos(xComboFont2, "0") #select font subset
50 xSearchText = xDialog.getChild("search") #test search textBox
51 xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT":"d"}))
52 xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT":"i"}))
53 xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT":"g"}))
54 xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT":"i"}))
55 xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT":"t"}))
56 xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT":" "}))
57 xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT":"f"}))
58 xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT":"o"}))
59 xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT":"u"}))
60 xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT":"r"}))
62 # works locally and linux_gcc_release_64, but fails at linux_clang_dbgutil_64.
63 #Markus: Actually after a round of debugging I think the problem is actually that the test depends on the used font.
64 #Therefore, if the font is not available or not selected by default the test fails.
65 # xCharSet = xDialog.getChild("searchcharset") #another charset -> search charset
66 # xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "0", "ROW": "0"})) #digit 4 selected, we have only one result;
67 # sleep(1) #try sleep here
68 # xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "0", "ROW": "0"})) #try it twice, because it works at local,but fail on gerrit
69 ##gerrit:self.assertEqual(get_state_as_dict(xHexText)["Text"], "34") # check the values for digit 4; AssertionError: '1' != '34'
71 # xHexText = xDialog.getChild("hexvalue")
72 # xDecText = xDialog.getChild("decimalvalue")
73 # self.assertEqual(get_state_as_dict(xHexText)["Text"], "34") # check the values for digit 4
74 # self.assertEqual(get_state_as_dict(xDecText)["Text"], "52")
76 # xAddFavBtn = xDialog.getChild("favbtn")
77 # xAddFavBtn.executeAction("CLICK", tuple()) # Add to favorites button
79 # xInsrBtn = xDialog.getChild("insert")
80 # xInsrBtn.executeAction("CLICK", tuple()) # Insert to document
82 # self.assertEqual(document.Text.String[0:1], "4") # check inserted character
84 # self.xUITest.executeCommand(".uno:Undo")
85 # self.xUITest.executeCommand(".uno:Redo") #undo, redo
87 # self.assertEqual(document.Text.String[0:1], "4") # check inserted character after undo, redo
89 xCancelBtn = xDialog.getChild("cancel")
90 self.ui_test.close_dialog_through_button(xCancelBtn)
92 self.ui_test.close_doc()
93 # vim: set shiftwidth=4 softtabstop=4 expandtab: