sw/qa/uitest/writer_tests/horizontalLine.py | 42 +++++++++++ sw/qa/uitest/writer_tests/specialCharacter.py | 93 ++++++++++++++++++++++++++ 2 files changed, 135 insertions(+)
New commits: commit 1632166329e6c14d885229c358a6c60dd2528244 Author: Zdeněk Crhonek <zcrho...@gmail.com> Date: Sun Dec 31 08:49:04 2017 +0100 uitest - writer Insert Horizontal Line Change-Id: Ia44e18650b72ffe8d8d263f62dc6d5a31d1b0dc3 Reviewed-on: https://gerrit.libreoffice.org/47215 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com> diff --git a/sw/qa/uitest/writer_tests/horizontalLine.py b/sw/qa/uitest/writer_tests/horizontalLine.py new file mode 100644 index 000000000000..7a25d36ee19e --- /dev/null +++ b/sw/qa/uitest/writer_tests/horizontalLine.py @@ -0,0 +1,42 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep + +class WriterInsertHorizontalLine(UITestCase): + + def test_insert_horizontal_line(self): + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + type_text(xWriterEdit, "Test horizontal line") #write the text + + self.xUITest.executeCommand(".uno:StyleApply?Style:string=Horizontal%20Line&FamilyName:string=ParagraphStyles") #insert horizontal line + + self.ui_test.execute_dialog_through_command(".uno:EditStyle") #open style dialog + xDialog = self.xUITest.getTopFocusWindow() + xStyleNametxt = xDialog.getChild("namerw") + self.assertEqual(get_state_as_dict(xStyleNametxt)["Text"], "Horizontal Line") #check style name + xCancBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancBtn) + + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Redo") + + self.ui_test.execute_dialog_through_command(".uno:EditStyle") #open style dialog + xDialog = self.xUITest.getTopFocusWindow() + xStyleNametxt = xDialog.getChild("namerw") + self.assertEqual(get_state_as_dict(xStyleNametxt)["Text"], "Horizontal Line") #check style name + xCancBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancBtn) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: commit 7e171db74d134dfd81bf2882592e1740185c6ccd Author: Zdeněk Crhonek <zcrho...@gmail.com> Date: Sun Dec 24 09:05:23 2017 +0100 uitest - writer/ Special character dialog Change-Id: I6de8570e5a2c1404cbf9c0a11f68373857a8836d Reviewed-on: https://gerrit.libreoffice.org/47035 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com> diff --git a/sw/qa/uitest/writer_tests/specialCharacter.py b/sw/qa/uitest/writer_tests/specialCharacter.py new file mode 100644 index 000000000000..31226f7368e1 --- /dev/null +++ b/sw/qa/uitest/writer_tests/specialCharacter.py @@ -0,0 +1,93 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +import time +from uitest.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +from uitest.uihelper.common import select_pos + +#specialcharacters.ui +class specialCharacter(UITestCase): + + def test_special_character(self): + + self.ui_test.create_doc_in_start_center("writer") + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + document = self.ui_test.get_component() + + self.ui_test.execute_dialog_through_command(".uno:InsertSymbol") #specialCharacter dialog + xDialog = self.xUITest.getTopFocusWindow() + xCharSet = xDialog.getChild("showcharset") #default charset + + xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "1", "ROW": "4"})) #digit 4 selected + + xHexText = xDialog.getChild("hexvalue") + xDecText = xDialog.getChild("decimalvalue") + + self.assertEqual(get_state_as_dict(xHexText)["Text"], "34") # check the values Hex and decimal + self.assertEqual(get_state_as_dict(xDecText)["Text"], "52") + + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.execute_dialog_through_command(".uno:InsertSymbol") + xDialog = self.xUITest.getTopFocusWindow() + + xComboFont = xDialog.getChild("fontlb") + select_pos(xComboFont, "0") #select font + xComboFont2 = xDialog.getChild("subsetlb") + select_pos(xComboFont2, "0") #select font subset + + xSearchText = xDialog.getChild("search") #test search textBox + xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT":"d"})) + xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT":"i"})) + xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT":"g"})) + xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT":"i"})) + xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT":"t"})) + xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT":" "})) + xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT":"f"})) + xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT":"o"})) + xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT":"u"})) + xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT":"r"})) + +# works locally and linux_gcc_release_64, but fails at linux_clang_dbgutil_64. +#Markus: Actually after a round of debugging I think the problem is actually that the test depends on the used font. +#Therefore, if the font is not available or not selected by default the test fails. +# xCharSet = xDialog.getChild("searchcharset") #another charset -> search charset +# xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "0", "ROW": "0"})) #digit 4 selected, we have only one result; +# sleep(1) #try sleep here +# xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "0", "ROW": "0"})) #try it twice, because it works at local,but fail on gerrit +##gerrit:self.assertEqual(get_state_as_dict(xHexText)["Text"], "34") # check the values for digit 4; AssertionError: '1' != '34' + +# xHexText = xDialog.getChild("hexvalue") +# xDecText = xDialog.getChild("decimalvalue") +# self.assertEqual(get_state_as_dict(xHexText)["Text"], "34") # check the values for digit 4 +# self.assertEqual(get_state_as_dict(xDecText)["Text"], "52") + +# xAddFavBtn = xDialog.getChild("favbtn") +# xAddFavBtn.executeAction("CLICK", tuple()) # Add to favorites button + +# xInsrBtn = xDialog.getChild("insert") +# xInsrBtn.executeAction("CLICK", tuple()) # Insert to document + +# self.assertEqual(document.Text.String[0:1], "4") # check inserted character + +# self.xUITest.executeCommand(".uno:Undo") +# self.xUITest.executeCommand(".uno:Redo") #undo, redo + +# self.assertEqual(document.Text.String[0:1], "4") # check inserted character after undo, redo + + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits