diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
commit | 940b4d1848e8c70ab7642901a68594e8016caffc (patch) | |
tree | eb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /sw/qa/uitest | |
parent | Initial commit. (diff) | |
download | libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.zip |
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sw/qa/uitest')
135 files changed, 8442 insertions, 0 deletions
diff --git a/sw/qa/uitest/chapterNumbering/chapterNumbering.py b/sw/qa/uitest/chapterNumbering/chapterNumbering.py new file mode 100644 index 000000000..02e4c3953 --- /dev/null +++ b/sw/qa/uitest/chapterNumbering/chapterNumbering.py @@ -0,0 +1,113 @@ +# -*- 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 uitest.debug import sleep +from uitest.path import get_srcdir_url +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +from uitest.uihelper.common import select_pos + +#Outline Numbering is now Chapter Numbering + +class WriterChapterNumbering(UITestCase): + + def test_chapter_numbering_dialog(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialog = self.xUITest.getTopFocusWindow() + xPages = xDialog.getChild("pages") + xWriterEntry = xPages.getChild('3') # Writer + xWriterEntry.executeAction("EXPAND", tuple()) + xWriterGeneralEntry = xWriterEntry.getChild('0') + xWriterGeneralEntry.executeAction("SELECT", tuple()) #General - set millimeters + xMetric = xDialog.getChild("metric") + props = {"TEXT": "Millimeter"} + actionProps = mkPropertyValues(props) + xMetric.executeAction("SELECT", actionProps) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xstyle = xDialog.getChild("style") + xnumbering = xDialog.getChild("numbering") + xcharstyle = xDialog.getChild("charstyle") + xprefix = xDialog.getChild("prefix") + xsuffix = xDialog.getChild("suffix") + xstartat = xDialog.getChild("startat") + xtab = xDialog.getChild("tabcontrol") + #second tab + xalignedatmf = xDialog.getChild("alignedatmf") + xnum2alignlb = xDialog.getChild("num2alignlb") + xnumfollowedbylb = xDialog.getChild("numfollowedbylb") + xatmf = xDialog.getChild("atmf") + xindentatmf = xDialog.getChild("indentatmf") + select_pos(xtab, "0") #first tab + props = {"TEXT": "Heading"} + actionProps = mkPropertyValues(props) + xstyle.executeAction("SELECT", actionProps) + props2 = {"TEXT": "1, 2, 3, ..."} + actionProps2 = mkPropertyValues(props2) + xnumbering.executeAction("SELECT", actionProps2) + props3 = {"TEXT": "Bullets"} + actionProps3 = mkPropertyValues(props3) + xcharstyle.executeAction("SELECT", actionProps3) + xprefix.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) + xsuffix.executeAction("TYPE", mkPropertyValues({"TEXT":"B"})) + xstartat.executeAction("UP", tuple()) + + select_pos(xtab, "1") #second tab Position + xalignedatmf.executeAction("UP", tuple()) + props4 = {"TEXT": "Centered"} + actionProps4 = mkPropertyValues(props4) + xnum2alignlb.executeAction("SELECT", actionProps4) + props5 = {"TEXT": "Tab stop"} + actionProps5 = mkPropertyValues(props5) + xnumfollowedbylb.executeAction("SELECT", actionProps5) + xatmf.executeAction("UP", tuple()) + xindentatmf.executeAction("UP", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + + xstyle = xDialog.getChild("style") + xnumbering = xDialog.getChild("numbering") + xcharstyle = xDialog.getChild("charstyle") + xprefix = xDialog.getChild("prefix") + xsuffix = xDialog.getChild("suffix") + xstartat = xDialog.getChild("startat") + xtab = xDialog.getChild("tabcontrol") + #second tab + xalignedatmf = xDialog.getChild("alignedatmf") + xnum2alignlb = xDialog.getChild("num2alignlb") + xnumfollowedbylb = xDialog.getChild("numfollowedbylb") + xatmf = xDialog.getChild("atmf") + xindentatmf = xDialog.getChild("indentatmf") + select_pos(xtab, "0") + self.assertEqual(get_state_as_dict(xstyle)["SelectEntryText"], "Heading") + self.assertEqual(get_state_as_dict(xnumbering)["SelectEntryText"], "1, 2, 3, ...") + self.assertEqual(get_state_as_dict(xcharstyle)["SelectEntryText"], "Bullets") + self.assertEqual(get_state_as_dict(xprefix)["Text"], "A") + self.assertEqual(get_state_as_dict(xsuffix)["Text"], "B") + self.assertEqual(get_state_as_dict(xstartat)["Text"], "2") + select_pos(xtab, "1") #second tab Position + self.assertEqual(get_state_as_dict(xalignedatmf)["Text"], "0.1 mm") + self.assertEqual(get_state_as_dict(xnum2alignlb)["SelectEntryText"], "Centered") + self.assertEqual(get_state_as_dict(xnumfollowedbylb)["SelectEntryText"], "Tab stop") + self.assertEqual(get_state_as_dict(xatmf)["Text"], "0.1 mm") + self.assertEqual(get_state_as_dict(xindentatmf)["Text"], "0.1 mm") + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/chapterNumbering/tdf123547.py b/sw/qa/uitest/chapterNumbering/tdf123547.py new file mode 100644 index 000000000..116ac3dfe --- /dev/null +++ b/sw/qa/uitest/chapterNumbering/tdf123547.py @@ -0,0 +1,38 @@ +# -*- 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 +import time +from uitest.debug import sleep +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import select_pos +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Bug 123547 - Systematic crash after opening Tools > Chapter Numbering + +class tdf123547(UITestCase): + def test_tdf123547_numbering_dialog_crash(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf123547.docx")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + xokbtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xokbtn) + #verify we didn't crash + self.assertEqual(document.CurrentController.PageCount, 1) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/classification/classification.py b/sw/qa/uitest/classification/classification.py new file mode 100644 index 000000000..e7fde9d70 --- /dev/null +++ b/sw/qa/uitest/classification/classification.py @@ -0,0 +1,190 @@ +# -*- 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 uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#TSCP: add advanced classification dialog https://cgit.freedesktop.org/libreoffice/core/commit/?id=71ee09947d5a71105d64fd225bb3672dfa7ce834 +# This adds an advanced classification dialog, which enables the user +# to manually construct a header/footer message from classification +# properties in cases where the user needs more control. All the +# text is inserted as fields into the end document and can be changed +# by changing the document properties. The simple classification +# still functions as it did before, which is what most users will +# want to use in this case. + +#[Bug 122491] Classification: dialog (Paragraph) Classification doesn't show previously chosen classification +#https://wiki.documentfoundation.org/TSCP-classification + + #new file; open Doc classification dialog + #add classification Confidential, save + #reopen and verify + #verify watermark Bug 122586 - Classification: by using the dialog, Watermark text from policy is not placed in the document + #open dialog and add intellectualProperty text, save + #verify in doc properties text of IP (in API, cannot verify in UI) + #reopen and verify classification and Content + #do the same for Paragraph classification + # verify the text on characters 0-6 : "(Conf)" + #+ new file and do it only for Paragraph classification (no watermark!) + #+ bug with bold text Bug 122565 - Classification dialog - Button "bold" works only in dialog + + #variants of content written manually, IP strings, classification (Conf, NB, GB, IO) + #[Bug 122491] with testdoc + +class classification(UITestCase): + def test_document_classification_dialog(self): + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:ClassificationDialog") + xDialog = self.xUITest.getTopFocusWindow() + classificationEditWindow = xDialog.getChild("classificationEditWindow") + recentlyUsedCB = xDialog.getChild("recentlyUsedCB") + classificationCB = xDialog.getChild("classificationCB") + internationalClassificationCB = xDialog.getChild("internationalClassificationCB") + intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry") + intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton") + + props = {"TEXT": "Confidential"} + actionProps = mkPropertyValues(props) + classificationCB.executeAction("SELECT", actionProps) + #verify International is set too + self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Confidential") + #verify textBox Content + # self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + header = document.StyleFamilies.PageStyles.Standard.HeaderText.createEnumeration().nextElement() + self.assertEqual(header.String, "Confidential") + + controller = self.ui_test.get_component().getCurrentController() + self.assertTrue(controller.hasInfobar("classification")) + + #verify watermark + #Bug 122586 - Classification: by using the dialog, Watermark text from policy is not placed in the document + self.ui_test.execute_dialog_through_command(".uno:Watermark") + xDialog = self.xUITest.getTopFocusWindow() + xTextInput = xDialog.getChild("TextInput") + xAngle = xDialog.getChild("Angle") + xTransparency = xDialog.getChild("Transparency") + self.assertEqual(get_state_as_dict(xTextInput)["Text"], "Confidential") + self.assertEqual(get_state_as_dict(xAngle)["Text"], "45°") + self.assertEqual((get_state_as_dict(xTransparency)["Text"])[0:2], "50") + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + #TODO + #open dialog and add intellectualProperty text, save + #verify + #reopen and verify classification and Content + + #do the same for Paragraph classification + self.ui_test.execute_dialog_through_command(".uno:ParagraphClassificationDialog") + xDialog = self.xUITest.getTopFocusWindow() + classificationEditWindow = xDialog.getChild("classificationEditWindow") + recentlyUsedCB = xDialog.getChild("recentlyUsedCB") + classificationCB = xDialog.getChild("classificationCB") + internationalClassificationCB = xDialog.getChild("internationalClassificationCB") + intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry") + intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton") + + props = {"TEXT": "Confidential"} + actionProps = mkPropertyValues(props) + classificationCB.executeAction("SELECT", actionProps) + #verify International is set too + self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Confidential") + #verify textBox Content TODO textbox not supported + #self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf") + # print(get_state_as_dict(classificationEditWindow)) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.assertEqual(document.Text.String[0:6], "(Conf)") + self.assertEqual(header.String, "Confidential") + self.assertTrue(controller.hasInfobar("classification")) + + self.ui_test.close_doc() + + def test_paragraph_classification_dialog(self): + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #+ new file and do it only for Paragraph classification (no watermark!) + self.ui_test.execute_dialog_through_command(".uno:ParagraphClassificationDialog") + xDialog = self.xUITest.getTopFocusWindow() + classificationEditWindow = xDialog.getChild("classificationEditWindow") + recentlyUsedCB = xDialog.getChild("recentlyUsedCB") + classificationCB = xDialog.getChild("classificationCB") + internationalClassificationCB = xDialog.getChild("internationalClassificationCB") + intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry") + intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton") + + props = {"TEXT": "Confidential"} + actionProps = mkPropertyValues(props) + classificationCB.executeAction("SELECT", actionProps) + #verify International is set too + self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Confidential") + #verify textBox Content TODO - texbox not supported yet + # self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf") + # print(get_state_as_dict(classificationEditWindow)) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + controller = self.ui_test.get_component().getCurrentController() + self.assertEqual(document.Text.String[0:6], "(Conf)") + self.assertFalse(controller.hasInfobar("classification")) + self.assertFalse(document.StyleFamilies.PageStyles.Standard.HeaderIsOn) + + self.ui_test.close_doc() + + def test_paragraph_classification_dialog_text(self): + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #+ new file and do it only for Paragraph classification (no watermark!) + self.ui_test.execute_dialog_through_command(".uno:ParagraphClassificationDialog") + xDialog = self.xUITest.getTopFocusWindow() + classificationEditWindow = xDialog.getChild("classificationEditWindow") + recentlyUsedCB = xDialog.getChild("recentlyUsedCB") + classificationCB = xDialog.getChild("classificationCB") + internationalClassificationCB = xDialog.getChild("internationalClassificationCB") + intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry") + intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton") + #type text AA + intellectualPropertyPartEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"AA"})) + intellectualPropertyPartAddButton.executeAction("CLICK", tuple()) + props = {"TEXT": "Internal Only"} + actionProps = mkPropertyValues(props) + classificationCB.executeAction("SELECT", actionProps) + #verify International is set too + self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Internal Only") + #verify textBox Content TODO - texbox not supported yet + # self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + controller = self.ui_test.get_component().getCurrentController() + self.assertEqual(document.Text.String[0:6], "(AAIO)") + self.assertFalse(controller.hasInfobar("classification")) + self.assertFalse(document.StyleFamilies.PageStyles.Standard.HeaderIsOn) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/findReplace/findReplace.py b/sw/qa/uitest/findReplace/findReplace.py new file mode 100644 index 000000000..83821ae86 --- /dev/null +++ b/sw/qa/uitest/findReplace/findReplace.py @@ -0,0 +1,197 @@ +# -*- 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 uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib +from uitest.path import get_srcdir_url +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#tdf116242 ţ ț - DONE +#Bug 98417 - FIND & REPLACE: Add 'Find Previous' button - DONE +#Bug 39022 - find-replace->$1, not pattern - DONE + +class findReplace(UITestCase): + def test_find_writer(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("findReplace.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"second"})) #2nd page + xsearch = xDialog.getChild("search") + xsearch.executeAction("CLICK", tuple()) + #verify + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") + + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"third"})) + xsearch.executeAction("CLICK", tuple()) + #verify + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3") #3rd page + + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + + #now open dialog and verify find="third" (remember last value); replace value with "First" ( click match case) with word "Replace" - click twice Replace button, check "Replace first first" + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + searchterm = xDialog.getChild("searchterm") + self.assertEqual(get_state_as_dict(searchterm)["Text"], "third") + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"First"})) + matchcase = xDialog.getChild("matchcase") + matchcase.executeAction("CLICK", tuple()) #click match case + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Replace"})) #replace textbox + replace = xDialog.getChild("replace") + replace.executeAction("CLICK", tuple()) + replace.executeAction("CLICK", tuple()) #click twice Replace button + #verify + self.assertEqual(document.Text.String[0:19], "Replace first first") + + #now replace first (uncheck match case) with word "aaa" - click once Replace All button, check "Replace aaa aaa" + replaceterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + replaceterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"aaa"})) + matchcase.executeAction("CLICK", tuple()) #uncheck match case + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) + #verify + self.assertEqual(document.Text.String[0:15], "Replace aaa aaa") + + #now delete strings in textbox Find and textbox Replace, click button Format, select Size=16 pt, Close OK, Find Next; verify Page=2; + #click No format button; close dialog + replaceterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + replaceterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + + format = xDialog.getChild("format") + def handle_format_dlg(dialog): + #print(dialog.getChildren()) + xTabs = dialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xSizeFont = dialog.getChild("westsizelb-cjk") + xSizeFont.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSizeFont.executeAction("BACKSPACE", tuple()) + xSizeFont.executeAction("TYPE", mkPropertyValues({"TEXT":"16"})) #set font size 16 + xOkBtn = dialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ()), + dialog_handler=handle_format_dlg) + + # Verify these didn't get set again through SvxSearchController::StateChanged, timer- + # triggered from SfxBindings::NextJob while executing the Format dialog above: + self.assertEqual(get_state_as_dict(searchterm)["Text"], "") + self.assertEqual(get_state_as_dict(replaceterm)["Text"], "") + + xsearch = xDialog.getChild("search") + xsearch.executeAction("CLICK", tuple()) + #verify + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") + noformat = xDialog.getChild("noformat") + noformat.executeAction("CLICK", tuple()) #click No format button + + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + + self.ui_test.close_doc() + + #Bug 39022 - find-replace->$1, not pattern + def test_tdf39022_replace_regexp(self): + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + type_text(xWriterEdit, "test number1 testnot") + + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"T(est|other)\\>"})) #find + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"replaced$1"})) #replace + regexp = xDialog.getChild("regexp") + regexp.executeAction("CLICK", tuple()) #regular expressions + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) + #verify + self.assertEqual(document.Text.String[0:27], "replacedest number1 testnot") + regexp.executeAction("CLICK", tuple()) + + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + + self.ui_test.close_doc() + + #tdf116242 ţ ț + def test_tdf116242_replace_t_with_cedilla(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf116242.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"ţ"})) #find + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"ț"})) #replace + includediacritics = xDialog.getChild("includediacritics") + if (get_state_as_dict(includediacritics)["Selected"]) == "false": + includediacritics.executeAction("CLICK", tuple()) + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) + #verify + self.assertEqual(document.Text.String[0:13], "țoootdf116242") + + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + + self.ui_test.close_doc() + + #Bug 98417 - FIND & REPLACE: Add 'Find Previous' button + def test_tdf98417_find_previous_writer(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("findReplace.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"third"})) + xsearch = xDialog.getChild("search") + xsearch.executeAction("CLICK", tuple()) + #verify + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3") + xsearch.executeAction("CLICK", tuple()) + #verify + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "4") #page 4 + backsearch = xDialog.getChild("backsearch") + backsearch.executeAction("CLICK", tuple()) + #verify + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3") + + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/findReplace/tdf106099.py b/sw/qa/uitest/findReplace/tdf106099.py new file mode 100644 index 000000000..085bba6e6 --- /dev/null +++ b/sw/qa/uitest/findReplace/tdf106099.py @@ -0,0 +1,52 @@ +# -*- 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 uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep + +#Bug 106099 - Find and replace by format, font color added by force + +class tdf106099(UITestCase): + def test_tdf106099_find_format_underline(self): + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #Find and replace + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + #2. Choose Format + format = xDialog.getChild("format") + def handle_format_dlg(dialog): + #Font effects - Underline Single. OK. + xTabs = dialog.getChild("tabcontrol") + select_pos(xTabs, "1") #tab font effects + underlinelb = dialog.getChild("underlinelb") + props = {"TEXT": "Single"} + actionProps = mkPropertyValues(props) + underlinelb.executeAction("SELECT", actionProps) + xOkBtn = dialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ()), + dialog_handler=handle_format_dlg) + #verify label searchdesc + searchdesc = xDialog.getChild("searchdesc") + print(get_state_as_dict(searchdesc)) + self.assertEqual(get_state_as_dict(searchdesc)["Text"], "Single underline") + noformat = xDialog.getChild("noformat") + noformat.executeAction("CLICK", tuple()) #click No format button + self.assertEqual(get_state_as_dict(searchdesc)["Text"], "") + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/findReplace/tdf118208.py b/sw/qa/uitest/findReplace/tdf118208.py new file mode 100644 index 000000000..2d98a7a44 --- /dev/null +++ b/sw/qa/uitest/findReplace/tdf118208.py @@ -0,0 +1,91 @@ +# -*- 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 uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Find and replace +#tdf118208/118212 - enabling either CJK or CTL, or both (Tools -> Options -> Language Settings -> Languages: Default Languages for Documents checkboxes) +#eliminates all crashes. Setting back to Western only recreates the crashes. - DONE + +class tdf118208(UITestCase): + + def test_tdf118208_search_dialog_format_crash(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf118208.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + # 1. Open the attached file. + # 2. Press ctrl-H to show the search and replace dialog. + # 3. Press the "Format..." button. + #Libreoffice immediately crashed. + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialog = self.xUITest.getTopFocusWindow() + + xPages = xDialog.getChild("pages") + xLanguageEntry = xPages.getChild('2') # Language Settings + xLanguageEntry.executeAction("EXPAND", tuple()) + xxLanguageEntryGeneralEntry = xLanguageEntry.getChild('0') + xxLanguageEntryGeneralEntry.executeAction("SELECT", tuple()) #Language + + asianlanguage = xDialog.getChild("asiansupport") + complexlanguage = xDialog.getChild("ctlsupport") + if (get_state_as_dict(asianlanguage)["Selected"]) == "true": + asianlanguage.executeAction("CLICK", tuple()) + if (get_state_as_dict(complexlanguage)["Selected"]) == "true": + complexlanguage.executeAction("CLICK", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + + format = xDialog.getChild("format") + def handle_format_dlg(dialog): + xOkBtn = dialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ()), + dialog_handler=handle_format_dlg) + + #verify + self.assertEqual(document.Text.String[0:14], "Aaaaaaaaaaaaaa") + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + sleep(1) + #enable lang support again + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialog = self.xUITest.getTopFocusWindow() + + xPages = xDialog.getChild("pages") + xLanguageEntry = xPages.getChild('2') # Language Settings + xLanguageEntry.executeAction("EXPAND", tuple()) + xxLanguageEntryGeneralEntry = xLanguageEntry.getChild('0') + xxLanguageEntryGeneralEntry.executeAction("SELECT", tuple()) #Language + + asianlanguage = xDialog.getChild("asiansupport") + complexlanguage = xDialog.getChild("ctlsupport") + if (get_state_as_dict(asianlanguage)["Selected"]) == "false": + asianlanguage.executeAction("CLICK", tuple()) + if (get_state_as_dict(complexlanguage)["Selected"]) == "false": + complexlanguage.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/findReplace/tdf119462.py b/sw/qa/uitest/findReplace/tdf119462.py new file mode 100644 index 000000000..e87cd8e7b --- /dev/null +++ b/sw/qa/uitest/findReplace/tdf119462.py @@ -0,0 +1,50 @@ +# -*- 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 uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep + +#Bug 119462 - Find with formatting adds 0pt text size + +class tdf119462(UITestCase): + def test_tdf119462_find_format(self): + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #1. Choose Edit > Find and Replace + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + #2. Choose Format + format = xDialog.getChild("format") + def handle_format_dlg(dialog): + + #3. Choose Bold + xTabs = dialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xweststylelbcjk = dialog.getChild("weststylelb-cjk") + xweststylelbcjk.executeAction("TYPE", mkPropertyValues({"TEXT":"Bold"})) + xOkBtn = dialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ()), + dialog_handler=handle_format_dlg) + #verify label searchdesc + searchdesc = xDialog.getChild("searchdesc") + self.assertEqual(get_state_as_dict(searchdesc)["Text"], "bold") + noformat = xDialog.getChild("noformat") + noformat.executeAction("CLICK", tuple()) #click No format button + self.assertEqual(get_state_as_dict(searchdesc)["Text"], "") + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/findSimilarity/findSimilarity.py b/sw/qa/uitest/findSimilarity/findSimilarity.py new file mode 100644 index 000000000..ac5b62fac --- /dev/null +++ b/sw/qa/uitest/findSimilarity/findSimilarity.py @@ -0,0 +1,91 @@ +# -*- 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 uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Find similarities + +class findSimilarities(UITestCase): + def test_find_similarities(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("findReplace.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + #verify: we are on page 1 + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1") + # search and replace dialog + #find = seco + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"seco"})) #seco + # check similarities, button similarities, set values = 1; close dialog with OK + similarity = xDialog.getChild("similarity") + similaritybtn = xDialog.getChild("similaritybtn") + similarity.executeAction("CLICK", tuple()) + def handle_similarity_dlg(dialog): + otherfld = dialog.getChild("otherfld") + longerfld = dialog.getChild("longerfld") + shorterfld = dialog.getChild("shorterfld") + otherfld.executeAction("DOWN", tuple()) + longerfld.executeAction("DOWN", tuple()) + shorterfld.executeAction("DOWN", tuple()) + xOKBtn = dialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.execute_blocking_action(similaritybtn.executeAction, args=('CLICK', ()), + dialog_handler=handle_similarity_dlg) + #open dialog again, verify values = 1; close dialog with cancel + def handle_similarity_dlg2(dialog): + otherfld = dialog.getChild("otherfld") + longerfld = dialog.getChild("longerfld") + shorterfld = dialog.getChild("shorterfld") + self.assertEqual(get_state_as_dict(otherfld)["Text"], "1") + self.assertEqual(get_state_as_dict(longerfld)["Text"], "1") + self.assertEqual(get_state_as_dict(shorterfld)["Text"], "1") + + xCancelBtn = dialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.execute_blocking_action(similaritybtn.executeAction, args=('CLICK', ()), + dialog_handler=handle_similarity_dlg2) + + xsearch = xDialog.getChild("search") + xsearch.executeAction("CLICK", tuple()) + # Find next - not found + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1") + #find = secon + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"secon"})) + # Find next - verify: we are on page 2 + xsearch = xDialog.getChild("search") + xsearch.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) #word "second" is selected + #find = irst + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"irst"})) + # Find next - verify: we are on page 1 + xsearch.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/librelogo/compile.py b/sw/qa/uitest/librelogo/compile.py new file mode 100644 index 000000000..89e538b8c --- /dev/null +++ b/sw/qa/uitest/librelogo/compile.py @@ -0,0 +1,132 @@ +# -*- 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 + +import time, re +from uitest.debug import sleep +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import select_pos + +class LibreLogoCompileTest(UITestCase): + LIBRELOGO_PATH = "vnd.sun.star.script:LibreLogo|LibreLogo.py$%s?language=Python&location=share" + LS = "#_@L_i_N_e@_#" # LibreLogo line separator for debug feature "jump to the bad LibreLogo program line" + + def createMasterScriptProviderFactory(self): + xServiceManager = self.xContext.ServiceManager + return xServiceManager.createInstanceWithContext( + "com.sun.star.script.provider.MasterScriptProviderFactory", + self.xContext) + + def getScript(self, command): + xMasterScriptProviderFactory = self.createMasterScriptProviderFactory() + document = self.ui_test.get_component() + xScriptProvider = xMasterScriptProviderFactory.createScriptProvider(document) + xScript = xScriptProvider.getScript(self.LIBRELOGO_PATH %command) + self.assertIsNotNone(xScript, "xScript was not loaded") + return xScript + + def test_compile_librelogo(self): + # XScript interface to LibreLogo Python compiler + xCompile = self.getScript("__compil__") + + for test in ( + # BASE COMMANDS + ("FORWARD 1 forward 1 fd 1", "forward(1)\nforward(1)\nforward(1)"), + ("BACK 1 back 1 bk 1", "backward(1)\nbackward(1)\nbackward(1)"), + ("RIGHT 1 right 1 rt 1", "turnright(1)\nturnright(1)\nturnright(1)"), + ("LEFT 1 left 1 lt 1", "turnleft(1)\nturnleft(1)\nturnleft(1)"), + # COMMENTS + ("fd 1; comment\n; full-line comment", "forward(1)\n" + self.LS), + # MULTI-LINE COMMAND + ("LABEL ~\n10 + 10", "label(10 + 10)\n" + self.LS), + # UNIT SPECIFIERS + # check specifier "pt" (point) + ("fd 1pt", "forward(1)"), + # check specifier "pt" (point) + ("fd 0.5pt", "forward(0.5)"), + # check "in" (inch) + ("fd 1in", "forward(72.0)"), + # check "cm" (centimeter) + ("fd 1cm", "forward(%s)" % (1/(2.54/72))), + # check "mm" (millimeter) + ("fd 10mm", "forward(%s)" % (1/(2.54/72))), + # angle + ("rt 90°", "turnright(90)"), + # clock-position + ("rt 3h", "turnright(90.0)"), + # CONDITION + ("if a = 1 [ ]", "if a == 1 :\n __checkhalt__()"), + # with else + ("if a == 1 [ ] [ ]", "if a == 1 :\n __checkhalt__()\nelse:\n __checkhalt__()"), + # LOOPS + ("repeat 10 [ ]", "for REPCOUNT in range(1, 1+int(10 )):\n __checkhalt__()"), + # endless loop + ("repeat [ ]", "REPCOUNT0 = 1\nwhile True:\n __checkhalt__()\n REPCOUNT = REPCOUNT0\n REPCOUNT0 += 1"), + # loop in loop + ("repeat 10 [ repeat REPCOUNT [ a=1 ] ]", "for REPCOUNT in range(1, 1+int(10 )):\n __checkhalt__()\n for REPCOUNT in range(1, 1+int(REPCOUNT )):\n __checkhalt__()\n a=1"), + # while + ("WHILE REPCOUNT < 10 [ ]", "REPCOUNT2 = 1\nwhile REPCOUNT2 < 10 :\n __checkhalt__()\n REPCOUNT = REPCOUNT2\n REPCOUNT2 += 1"), + # for + ("FOR i in [1, 2, 3] [ ]", "REPCOUNT4 = 1\nfor i in [1, 2, 3] :\n __checkhalt__()\n REPCOUNT = REPCOUNT4\n REPCOUNT4 += 1"), + ("FOR i IN RANGE COUNT 'letters' [ ]", "REPCOUNT6 = 1\nfor i in range(len(u'letters'),) :\n __checkhalt__()\n REPCOUNT = REPCOUNT6\n REPCOUNT6 += 1"), + # PROCEDURE + ("TO x\nLABEL 2\nEND", "global x\ndef x():\n __checkhalt__()\n %s\n label(2)\n %s" % (((self.LS),)*2)), + # FUNCTION + ("TO x\nOUTPUT 3\nEND", "global x\ndef x():\n __checkhalt__()\n %s\n return 3\n %s" % (((self.LS),)*2)), + # PROCEDURE WITH ARGUMENTS + ("TO x y\nLABEL y\nEND\nx 25", "global x\ndef x(y):\n __checkhalt__()\n %s\n label(y)\n %s\n%s\nx(25)" % (((self.LS),)*3)), + ("TO x :y :z\nLABEL :y + :z\nEND\nx 25 26", "global x\ndef x(_y, _z):\n __checkhalt__()\n %s\n label(_y + _z)\n %s\n%s\nx(25, 26)" % (((self.LS),)*3)), + ("TO x :y :z\nLABEL :y + :z\nEND\nx 25 :w", "global x\ndef x(_y, _z):\n __checkhalt__()\n %s\n label(_y + _z)\n %s\n%s\nx(25, _w)" % (((self.LS),)*3)), + # UNICODE VARIABLE NAMES + ("Erdős=1", "Erd__u__0151s=1"), + # STRING CONSTANTS + ("LABEL \"label", "label(u'label')"), + ("LABEL “label”", "label(u'label')"), + ("LABEL 'label'", "label(u'label')"), + ("LABEL ‘label’", "label(u'label')"), + # check apostrophe and quote usage within strings + ("LABEL “label\’s”", "label(u'label’s')"), + ("LABEL ““It\’s quote\’s...\””", "label(u'“It’s quote’s...”')"), + ("LABEL ““It\\'s quote\\'s...\””", "label(u'“It\\'s quote\\'s...”')"), + # CONVERSION OF LOGO EXPRESSIONS + ("a=SIN 100 + COS 100", "a=sin(100 + cos(100))"), + ("a=SIN(101) + COS(101)", "a=sin(101) + cos(101)"), + ("a=(SIN 102) + (COS 102)", "a=(sin(102)) + (cos(102))"), + ("a=SIN 103 + COS 103 - SQRT 103", "a=sin(103 + cos(103 - sqrt(103)))"), + ("a=(SIN 104 + COS 104) - SQRT 104", "a=(sin(104 + cos(104))) - sqrt(104)"), + # SIN(x) is Python-like, SIN (x) is Logo-like syntax + ("a=SIN(105) + COS (105) - SQRT 105", "a=sin(105) + cos((105) - sqrt(105))"), + ("a=COUNT [1, 2, 3]", "a=len([1, 2, 3])"), + ("PRINT COUNT [1, 2, 3]", "Print(len([1, 2, 3]))"), + ("PRINT 'TEXT: ' + 'CHAR'[0] + ' TEXT2: ' + variable[-1]", "Print(u'TEXT: ' + u'CHAR'[0] + u' TEXT2: ' + variable[-1])"), + ("PRINT 'TEXT: ' + 'CHAR'[0][n] + ' TEXT2: ' + varia[len k][i+1]", "Print(u'TEXT: ' + u'CHAR'[0][n] + u' TEXT2: ' + varia[len(k)][i+1])"), + ("a=SQRT COUNT [1, 2, 3]", "a=sqrt(len([1, 2, 3]))"), + ("a=RANGE 1", "a=range(1,)"), + ("a=RANGE 1 10", "a=range(1, 10,)"), + ("a=RANGE 1 10 5", "a=range(1, 10, 5)"), + ("a=RANDOM 40 + 120", "a=Random(40 + 120)"), + ("a=RANDOM(40) + 120", "a=Random(40) + 120"), + ("a=RANDOM [1, 2, 3]", "a=Random([1, 2, 3])"), + ("a=[sin 90 + cos 15, cos 100 * x, sqrt 25 * 25]", "a=[sin(90 + cos(15)), cos(100 * x), sqrt(25 * 25)]"), + ("a=[sin 90 + cos 15, cos 100 * x, sqrt 25 * 25]", "a=[sin(90 + cos(15)), cos(100 * x), sqrt(25 * 25)]"), + ("a=[sin(90) + cos 15, cos(100) * x, sqrt(25) * 25]", "a=[sin(90) + cos(15), cos(100) * x, sqrt(25) * 25]"), + ("TO x y z\nOUTPUT 3\nEND", "global x\ndef x(y, z):\n __checkhalt__()\n %s\n return 3\n %s" % (((self.LS),)*2)), + ("TO x\nOUTPUT 3\nEND", "global x\ndef x():\n __checkhalt__()\n %s\n return 3\n %s" % (((self.LS),)*2)), + ("TO f x y z\nOUTPUT x+y+z\nEND\na = [-sin -len f [-cos 45, 6] -len [1, 2, 3] -sin -90", "global f\ndef f(x, y, z):\n __checkhalt__()\n %s\n return x+y+z\n %s\n%s\na = [-sin(-len(f([-cos(45), 6], -len([1, 2, 3]), -sin(-90))))" % (((self.LS),)*3)), + ("TO f x y z\nOUTPUT x+y+z\nEND\na = [sin len f [cos 45, 6] [1, 2, 3] sin 90", "global f\ndef f(x, y, z):\n __checkhalt__()\n %s\n return x+y+z\n %s\n%s\na = [sin(len(f([cos(45), 6], [1, 2, 3], sin(90))))" % (((self.LS),)*3)), + ("TO f x y z\nLABEL x+y+z\nEND\nf len [1, cos 2, [65]] sqrt len [1, 2, 3, 4] sin 90 * cos 270", "global f\ndef f(x, y, z):\n __checkhalt__()\n %s\n label(x+y+z)\n %s\n%s\nf(len([1, cos(2), [65]]), sqrt(len([1, 2, 3, 4])), sin(90 * cos(270)))" % (((self.LS),)*3)), + ("TO f x y z\nLABEL x+y+z\nEND\nf len([1, cos 2, [65]]) sqrt(len [1, 2, 3, 4]) sin(90) * cos 270", "global f\ndef f(x, y, z):\n __checkhalt__()\n %s\n label(x+y+z)\n %s\n%s\nf(len([1, cos(2), [65]]), sqrt(len([1, 2, 3, 4])), sin(90) * cos(270))" % (((self.LS),)*3)), + ("TO f x y z\nLABEL x+y+z\nEND\nf (len [1, cos 2, [65]]) (sqrt len [1, 2, 3, 4]) (sin 90) * (cos 270)", "global f\ndef f(x, y, z):\n __checkhalt__()\n %s\n label(x+y+z)\n %s\n%s\nf((len([1, cos(2), [65]])), (sqrt(len([1, 2, 3, 4]))), (sin(90)) * (cos(270)))" % (((self.LS),)*3)), + # arbitrary order of function definitions and calls + ("f 1 1 f 2 2\nTO f x y\nPRINT x + y\nEND", "global f\nf(1, 1)\nf(2, 2)\n%s\ndef f(x, y):\n __checkhalt__()\n %s\n Print(x + y)\n %s" % (((self.LS),)*3)), + ): + compiled = xCompile.invoke((test[0],), (), ())[0] + self.assertEqual(test[1], re.sub(r'(\n| +\n)+', '\n', re.sub(r'\( ', '(', compiled)).strip()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/librelogo/run.py b/sw/qa/uitest/librelogo/run.py new file mode 100644 index 000000000..7b243f00b --- /dev/null +++ b/sw/qa/uitest/librelogo/run.py @@ -0,0 +1,103 @@ +# -*- 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 + +import time +from uitest.debug import sleep +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import select_pos + +class LibreLogoTest(UITestCase): + LIBRELOGO_PATH = "vnd.sun.star.script:LibreLogo|LibreLogo.py$%s?language=Python&location=share" + + def createMasterScriptProviderFactory(self): + xServiceManager = self.xContext.ServiceManager + return xServiceManager.createInstanceWithContext( + "com.sun.star.script.provider.MasterScriptProviderFactory", + self.xContext) + + def getScript(self, command): + xMasterScriptProviderFactory = self.createMasterScriptProviderFactory() + document = self.ui_test.get_component() + xScriptProvider = xMasterScriptProviderFactory.createScriptProvider(document) + xScript = xScriptProvider.getScript(self.LIBRELOGO_PATH %command) + self.assertIsNotNone(xScript, "xScript was not loaded") + return xScript + + def logo(self, command): + self.xUITest.executeCommand(self.LIBRELOGO_PATH %command) + + def test_librelogo(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + # to check the state of LibreLogo program execution + xIsAlive = self.getScript("__is_alive__") + + # run a program with basic drawing commands FORWARD and RIGHT + # using their abbreviated names FD and RT + type_text(xWriterEdit, "fd 100 rt 45 fd 100") + self.logo("run") + # wait for LibreLogo program termination + while xIsAlive.invoke((), (), ())[0]: + pass + # check shape count for + # a) program running: + # - turtle shape: result of program start + # - line shape: result of turtle drawing + # b) continuous line drawing (the regression + # related to the fix of tdf#106792 resulted shorter line + # segments than the turtle path and non-continuous line + # drawing, ie. in this example, three line shapes + # instead of a single one. See its fix in + # commit 502e8785085f9e8b54ee383080442c2dcaf95b15) + self.assertEqual(document.DrawPage.getCount(), 2) + + # check formatting by "magic wand" + self.logo("__translate__") + # a) check expansion of abbreviated commands : fd -> FORWARD, rt -> RIGHT, + # b) check line breaking (fix for tdf#100941: new line instead of the text "\" and "n") + self.assertEqual(document.Text.String.replace('\r\n', '\n'), "\nFORWARD 100 RIGHT 45 FORWARD 100") + # c) check usage of real paragraphs instead of line break (tdf#120422) + # first paragraph is empty (for working page break) + self.assertEqual(document.Text.createEnumeration().nextElement().String, "") + + # function definitions and calls can be in arbitrary order + document.Text.String = """ +; dragon curve +TO x n +IF n = 0 [ STOP ] +x n-1 +RIGHT 90 +y n-1 ; it worked only as "y(n-1)" +FORWARD 10 +END + +TO y n +IF n = 0 [ STOP ] +FORWARD 10 +x n-1 +LEFT 90 +y n-1 +END + +PICTURE ; start new line draw +x 3 ; draw only a few levels +""" + self.logo("run") + # wait for LibreLogo program termination + while xIsAlive.invoke((), (), ())[0]: + pass + # new shape + previous two ones = 3 + self.assertEqual(document.DrawPage.getCount(), 3) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/macro_tests/tdf124413.py b/sw/qa/uitest/macro_tests/tdf124413.py new file mode 100644 index 000000000..a8ab676b7 --- /dev/null +++ b/sw/qa/uitest/macro_tests/tdf124413.py @@ -0,0 +1,43 @@ +# -*- 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 uitest.uihelper.common import get_state_as_dict + +class tdf124413(UITestCase): + + def test_copy_paste_overwriting_undo_redo_in_macro_editor_tdf124413(self): + + self.ui_test.create_doc_in_start_center("writer") + #Start LibreOffice. Go to Tools > Macros > Organize Macros > Basic + self.ui_test.execute_dialog_through_command(".uno:MacroDialog") + xDialog = self.xUITest.getTopFocusWindow() + #Open Editor + xEditBtn = xDialog.getChild("edit") + xEditBtn.executeAction("CLICK", tuple()) + + resultText = "REM ***** BASIC *****\n\nSub Main\n\nEnd Sub\n" + + xMacroWin = self.xUITest.getTopFocusWindow() + xEditWin = xMacroWin.getChild('EditorWindow') + + self.assertEqual(get_state_as_dict(xEditWin)['Text'], resultText) + + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:Copy") + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:Paste") + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Redo") + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Redo") + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Redo") + + self.assertEqual(get_state_as_dict(xEditWin)['Text'], resultText) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/options/tdf78133.py b/sw/qa/uitest/options/tdf78133.py new file mode 100644 index 000000000..de1f21242 --- /dev/null +++ b/sw/qa/uitest/options/tdf78133.py @@ -0,0 +1,53 @@ +# -*- 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.debug import sleep +from uitest.uihelper.common import get_state_as_dict + +#Bug 78133 - LibO crashes when in options dialog +#when i was going through the options dialog, if i click on the 'Colors' entry, LibO will crash. +class tdf78133(UITestCase): + + def test_tdf78133_options_app_colors(self): + + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + #New text document + #open option, go to App colors + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialog = self.xUITest.getTopFocusWindow() + + xPages = xDialog.getChild("pages") + xLOEntry = xPages.getChild('0') # Lo Dev + xLOEntry.executeAction("EXPAND", tuple()) + xLoAppColorsEntry = xLOEntry.getChild('8') + xLoAppColorsEntry.executeAction("SELECT", tuple()) #Applications Colors + #change text boundaries checkbox, save + docboundaries = xDialog.getChild("docboundaries") + docboundaries.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify - reopen dialog and check if "text boundaries" is still unchecked + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialog = self.xUITest.getTopFocusWindow() + + xPages = xDialog.getChild("pages") + xLOEntry = xPages.getChild('0') # Lo Dev + xLOEntry.executeAction("EXPAND", tuple()) + xLoAppColorsEntry = xLOEntry.getChild('8') + xLoAppColorsEntry.executeAction("SELECT", tuple()) #Applications Colors + #change text boundaries checkbox, save + docboundaries = xDialog.getChild("docboundaries") + self.assertEqual(get_state_as_dict(docboundaries)["Selected"], "false") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/splitTable.py b/sw/qa/uitest/table/splitTable.py new file mode 100644 index 000000000..589673b2b --- /dev/null +++ b/sw/qa/uitest/table/splitTable.py @@ -0,0 +1,94 @@ +# -*- 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 uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Writer Split Table + +class splitTable(UITestCase): + def test_split_table(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #go to row 2 + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoDown") + #dialog Split table, check Copy heading, OK -> verify 2 tables, 1st has 2 rows, second has 5 rows + self.ui_test.execute_dialog_through_command(".uno:SplitTable") + xDialog = self.xUITest.getTopFocusWindow() + + copyheading = xDialog.getChild("copyheading") + copyheading.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + self.assertEqual(document.TextTables.getCount(), 2) + tables = document.getTextTables() + self.assertEqual(len(tables[0].getRows()), 2) + self.assertEqual(len(tables[1].getRows()), 5) + #undo -> verify 1 tables + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextTables.getCount(), 1) + + self.ui_test.close_doc() + + #dialog Split table, check Custom heading, OK -> verify 2 tables, 1st has 2 rows, second has 4 rows + writer_doc = self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #go to row 2 + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoDown") + self.ui_test.execute_dialog_through_command(".uno:SplitTable") + xDialog = self.xUITest.getTopFocusWindow() + + customheading = xDialog.getChild("customheading") + customheading.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + self.assertEqual(document.TextTables.getCount(), 2) + tables = document.getTextTables() + self.assertEqual(len(tables[0].getRows()), 2) + self.assertEqual(len(tables[1].getRows()), 4) + #undo -> verify 1 tables + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextTables.getCount(), 1) + + self.ui_test.close_doc() + #dialog Split table, check No heading, OK -> verify 2 tables, 1st has 2 rows, second has 4 rows + writer_doc = self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #go to row 2 + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoDown") + self.ui_test.execute_dialog_through_command(".uno:SplitTable") + xDialog = self.xUITest.getTopFocusWindow() + + noheading = xDialog.getChild("noheading") + noheading.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + self.assertEqual(document.TextTables.getCount(), 2) + tables = document.getTextTables() + self.assertEqual(len(tables[0].getRows()), 2) + self.assertEqual(len(tables[1].getRows()), 4) + #undo -> verify 1 tables + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextTables.getCount(), 1) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tableProperties.py b/sw/qa/uitest/table/tableProperties.py new file mode 100644 index 000000000..c0c1cd9de --- /dev/null +++ b/sw/qa/uitest/table/tableProperties.py @@ -0,0 +1,247 @@ +# -*- 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 uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Writer Table Properties + +class tableProperties(UITestCase): + def test_table_properties(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #set cm + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialog = self.xUITest.getTopFocusWindow() + + xPages = xDialog.getChild("pages") + xWriterEntry = xPages.getChild('3') # Writer + xWriterEntry.executeAction("EXPAND", tuple()) + xWriterGeneralEntry = xWriterEntry.getChild('0') + xWriterGeneralEntry.executeAction("SELECT", tuple()) #General + xMetric = xDialog.getChild("metric") + props = {"TEXT": "Centimeter"} + actionProps = mkPropertyValues(props) + xMetric.executeAction("SELECT", actionProps) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #dialog Table Properties - Table + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + name = xDialog.getChild("name") + free = xDialog.getChild("free") + widthmf = xDialog.getChild("widthmf") + leftmf = xDialog.getChild("leftmf") + rightmf = xDialog.getChild("rightmf") + abovemf = xDialog.getChild("abovemf") + belowmf = xDialog.getChild("belowmf") + textdirection = xDialog.getChild("textdirection") + + name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + name.executeAction("TYPE", mkPropertyValues({"TEXT":"NewName"})) + free.executeAction("CLICK", tuple()) + widthmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + widthmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + widthmf.executeAction("TYPE", mkPropertyValues({"TEXT":"15"})) + leftmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + leftmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + leftmf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + rightmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + rightmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + rightmf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + abovemf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + abovemf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + abovemf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + belowmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + belowmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + belowmf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + props = {"TEXT": "Left-to-right (LTR)"} + actionProps = mkPropertyValues(props) + textdirection.executeAction("SELECT", actionProps) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + name = xDialog.getChild("name") + free = xDialog.getChild("free") + widthmf = xDialog.getChild("widthmf") + leftmf = xDialog.getChild("leftmf") + rightmf = xDialog.getChild("rightmf") + abovemf = xDialog.getChild("abovemf") + belowmf = xDialog.getChild("belowmf") + textdirection = xDialog.getChild("textdirection") + + self.assertEqual(get_state_as_dict(name)["Text"], "NewName") + self.assertEqual(get_state_as_dict(free)["Checked"], "true") + self.assertEqual(get_state_as_dict(widthmf)["Text"], "15.00 cm") + self.assertEqual(get_state_as_dict(leftmf)["Text"], "1.00 cm") + self.assertEqual(get_state_as_dict(rightmf)["Text"], "1.00 cm") + self.assertEqual(get_state_as_dict(abovemf)["Text"], "1.00 cm") + self.assertEqual(get_state_as_dict(belowmf)["Text"], "1.00 cm") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #dialog Table Properties - Text flow + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + xbreak = xDialog.getChild("break") + xbreak.executeAction("CLICK", tuple()) + column = xDialog.getChild("column") + column.executeAction("CLICK", tuple()) + after = xDialog.getChild("after") + after.executeAction("CLICK", tuple()) + keep = xDialog.getChild("keep") + keep.executeAction("CLICK", tuple()) + headline = xDialog.getChild("headline") + headline.executeAction("CLICK", tuple()) + textdirection = xDialog.getChild("textorientation") + props = {"TEXT": "Vertical (bottom to top)"} + actionProps = mkPropertyValues(props) + textdirection.executeAction("SELECT", actionProps) + vertorient = xDialog.getChild("vertorient") + props2 = {"TEXT": "Bottom"} + actionProps2 = mkPropertyValues(props2) + vertorient.executeAction("SELECT", actionProps2) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + xbreak = xDialog.getChild("break") + self.assertEqual(get_state_as_dict(xbreak)["Selected"], "true") + column = xDialog.getChild("column") + self.assertEqual(get_state_as_dict(column)["Checked"], "true") + after = xDialog.getChild("column") + self.assertEqual(get_state_as_dict(after)["Checked"], "true") + keep = xDialog.getChild("keep") + self.assertEqual(get_state_as_dict(keep)["Selected"], "true") + headline = xDialog.getChild("headline") + self.assertEqual(get_state_as_dict(headline)["Selected"], "true") + textdirection = xDialog.getChild("textorientation") + self.assertEqual(get_state_as_dict(textdirection)["SelectEntryText"], "Vertical (bottom to top)") + vertorient = xDialog.getChild("vertorient") + self.assertEqual(get_state_as_dict(vertorient)["SelectEntryText"], "Bottom") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #dialog Table Properties - Columns + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "2") + + adaptwidth = xDialog.getChild("adaptwidth") + adaptwidth.executeAction("CLICK", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + #doesn't work / probably Bug 100537 - Width and relative checkboxes disabled in Table + #dialog by default with automatic alignment +# self.ui_test.execute_dialog_through_command(".uno:TableDialog") +# xDialog = self.xUITest.getTopFocusWindow() +# tabcontrol = xDialog.getChild("tabcontrol") +# select_pos(tabcontrol, "2") +# adaptwidth = xDialog.getChild("adaptwidth") +# self.assertEqual(get_state_as_dict(adaptwidth)["Selected"], "true") +# xOKBtn = xDialog.getChild("ok") +# self.ui_test.close_dialog_through_button(xOKBtn) + + #dialog Table Properties - Borders + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "3") + + sync = xDialog.getChild("sync") + mergeadjacent = xDialog.getChild("mergeadjacent") + sync.executeAction("CLICK", tuple()) + mergeadjacent.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #verify + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "3") + sync = xDialog.getChild("sync") + mergeadjacent = xDialog.getChild("mergeadjacent") +# self.assertEqual(get_state_as_dict(sync)["Selected"], "false") #need change spacing, but ui names are not unique + self.assertEqual(get_state_as_dict(mergeadjacent)["Selected"], "false") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #dialog Table Properties - Background + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "4") + + btncolor = xDialog.getChild("btncolor") + btncolor.executeAction("CLICK", tuple()) + R_custom = xDialog.getChild("R_custom") + G_custom = xDialog.getChild("G_custom") + B_custom = xDialog.getChild("B_custom") + R_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + R_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + R_custom.executeAction("TYPE", mkPropertyValues({"TEXT":"100"})) + G_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + G_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + G_custom.executeAction("TYPE", mkPropertyValues({"TEXT":"100"})) + B_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + B_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + B_custom.executeAction("TYPE", mkPropertyValues({"TEXT":"100"})) + B_custom.executeAction("UP", tuple()) + B_custom.executeAction("DOWN", tuple()) #need to refresh HEX value... + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #verify + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "4") + btncolor = xDialog.getChild("btncolor") + btncolor.executeAction("CLICK", tuple()) + R_custom = xDialog.getChild("R_custom") + G_custom = xDialog.getChild("G_custom") + B_custom = xDialog.getChild("B_custom") + + self.assertEqual(get_state_as_dict(R_custom)["Text"], "100") + self.assertEqual(get_state_as_dict(B_custom)["Text"], "100") + self.assertEqual(get_state_as_dict(G_custom)["Text"], "100") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tableToText.py b/sw/qa/uitest/table/tableToText.py new file mode 100644 index 000000000..f47eeeef2 --- /dev/null +++ b/sw/qa/uitest/table/tableToText.py @@ -0,0 +1,88 @@ +# -*- 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 uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Writer Table to text + +class tableToText(UITestCase): + def test_table_to_text(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #dialog Table to text - Tabs; verify + self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText") + xDialog = self.xUITest.getTopFocusWindow() + tabs = xDialog.getChild("tabs") + tabs.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.assertEqual(document.Text.String[0:3], "a\ta") + self.assertEqual(document.TextTables.getCount(), 0) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextTables.getCount(), 1) + + #dialog Table to text - Paragraph; verify + self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText") + xDialog = self.xUITest.getTopFocusWindow() + paragraph = xDialog.getChild("paragraph") + paragraph.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.assertEqual(document.Text.String.replace('\r\n', '\n')[0:4], "a\na\n") + self.assertEqual(document.TextTables.getCount(), 0) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextTables.getCount(), 1) + + #dialog Table to text - Semicolons; verify + self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText") + xDialog = self.xUITest.getTopFocusWindow() + semicolons = xDialog.getChild("semicolons") + semicolons.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.assertEqual(document.Text.String.replace('\r\n', '\n')[0:6], "a;a\n;\n") + self.assertEqual(document.TextTables.getCount(), 0) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextTables.getCount(), 1) + + #dialog Table to text - other; verify + self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText") + xDialog = self.xUITest.getTopFocusWindow() + other = xDialog.getChild("other") + other.executeAction("CLICK", tuple()) + othered = xDialog.getChild("othered") + othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + othered.executeAction("TYPE", mkPropertyValues({"TEXT":":"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.assertEqual(document.Text.String.replace('\r\n', '\n')[0:6], "a:a\n:\n") + self.assertEqual(document.TextTables.getCount(), 0) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextTables.getCount(), 1) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tdf115026.py b/sw/qa/uitest/table/tdf115026.py new file mode 100644 index 000000000..610804948 --- /dev/null +++ b/sw/qa/uitest/table/tdf115026.py @@ -0,0 +1,38 @@ +# -*- 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 uitest.path import get_srcdir_url +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict + +class tdf115026(UITestCase): + + def test_pageBreak_and_tableAutoFormat(self): + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:InsertPagebreak") + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") + + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + xDialog = self.xUITest.getTopFocusWindow() + + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.ui_test.execute_dialog_through_command(".uno:AutoFormat") + xDialog = self.xUITest.getTopFocusWindow() + + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tdf116737.py b/sw/qa/uitest/table/tdf116737.py new file mode 100644 index 000000000..7b27020e4 --- /dev/null +++ b/sw/qa/uitest/table/tdf116737.py @@ -0,0 +1,54 @@ +# -*- 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 +from uitest.debug import sleep +from uitest.uihelper.common import select_pos + +#Bug 116737 - INSERT TABLE: Can't select table style (gen/gtk) +class tdf116737(UITestCase): + def test_tdf116737_select_table_style(self): + + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + + #Insert => Insert Table / It's not possible to select a table style + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + xDialog = self.xUITest.getTopFocusWindow() + + formatlbinstable = xDialog.getChild("formatlbinstable") + entry = formatlbinstable.getChild("11") #Simple List Shaded + entry.executeAction("SELECT", tuple()) + + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + #verify .uno:TableDialog + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") #tab Background + + btncolor = xDialog.getChild("btncolor") + btncolor.executeAction("CLICK", tuple()) + + R_custom = xDialog.getChild("R_custom") + G_custom = xDialog.getChild("G_custom") + B_custom = xDialog.getChild("B_custom") + #"Simple List Shaded" -> header should be black + self.assertEqual(get_state_as_dict(R_custom)["Text"], "0") + self.assertEqual(get_state_as_dict(G_custom)["Text"], "0") + self.assertEqual(get_state_as_dict(B_custom)["Text"], "0") + + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tdf128593.py b/sw/qa/uitest/table/tdf128593.py new file mode 100755 index 000000000..26f9d903b --- /dev/null +++ b/sw/qa/uitest/table/tdf128593.py @@ -0,0 +1,39 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +import importlib +from uitest.uihelper.common import get_state_as_dict + +#https://bugs.documentfoundation.org/show_bug.cgi?id=128593 +#Bug 128593 - Writer table cell's background color is always black + +class tdf128593(UITestCase): + def test_tdf128593_table_background_color(self): + MainDoc = self.ui_test.create_doc_in_start_center("writer") + MainWindow = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + InsertTableDialog = self.xUITest.getTopFocusWindow() + xok = InsertTableDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xok) + + self.xUITest.executeCommandWithParameters(".uno:TableCellBackgroundColor", mkPropertyValues({"TableCellBackgroundColor" : 16776960 }) ) + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + writer_edit = MainWindow.getChild("writer_edit") + writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "0", "START_POS": "0"})) + TablePropertiesDialog = self.xUITest.getTopFocusWindow() + tabcontrol = TablePropertiesDialog.getChild("tabcontrol") + tabcontrol.executeAction("SELECT", mkPropertyValues({"POS": "4"})) + Rcustom = TablePropertiesDialog.getChild("R_custom") #255 + self.assertEqual(get_state_as_dict(Rcustom)["Text"], "255") + Gcustom = TablePropertiesDialog.getChild("G_custom") #255 + self.assertEqual(get_state_as_dict(Gcustom)["Text"], "255") + Bcustom = TablePropertiesDialog.getChild("B_custom") #0 + self.assertEqual(get_state_as_dict(Bcustom)["Text"], "0") + xok = TablePropertiesDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xok) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tdf81292.py b/sw/qa/uitest/table/tdf81292.py new file mode 100644 index 000000000..019219f41 --- /dev/null +++ b/sw/qa/uitest/table/tdf81292.py @@ -0,0 +1,49 @@ +# -*- 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 +import time +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib + +#Bug 81292 - TABLE: Crashes on sorting table + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf81292(UITestCase): + + def test_tdf81292_table_sort(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf81292.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #select whole table + self.xUITest.executeCommand(".uno:SelectTable") + #Tools - Sort + self.ui_test.execute_dialog_through_command(".uno:SortDialog") + xDialog = self.xUITest.getTopFocusWindow() + xDown = xDialog.getChild("down1") + xDown.executeAction("CLICK", tuple()) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #verify + tables = document.getTextTables() + table = tables[0] + tableText = table.getCellByName("B3") + b3 = tableText.getString() + tableTextc1 = table.getCellByName("C1").getString() + self.assertEqual(b3, "https://www.hightail.com/") + self.assertEqual(tableTextc1, "inlognaam") + #undo + self.xUITest.executeCommand(".uno:Undo") + b3 = tableText.getString() + self.assertEqual(b3, "www.comicstripshop.com") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tdf99334.py b/sw/qa/uitest/table/tdf99334.py new file mode 100644 index 000000000..de013a1e8 --- /dev/null +++ b/sw/qa/uitest/table/tdf99334.py @@ -0,0 +1,47 @@ +# -*- 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 +import time +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib + +#Bug 99334 - Crashes when sorting table by columns with umlauts + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf99334(UITestCase): + + def test_tdf99334_table_sort_umlauts(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf99334.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #select whole table + self.xUITest.executeCommand(".uno:SelectTable") + #Tools - Sort + self.ui_test.execute_dialog_through_command(".uno:SortDialog") + xDialog = self.xUITest.getTopFocusWindow() + # xDown = xDialog.getChild("down1") + # xDown.executeAction("CLICK", tuple()) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #verify + tables = document.getTextTables() + table = tables[0] + tableText = table.getCellByName("B1") + b1 = tableText.getString() + self.assertEqual(b1, "two") + #undo + self.xUITest.executeCommand(".uno:Undo") + b1 = tableText.getString() + self.assertEqual(b1, "one") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/textToTable.py b/sw/qa/uitest/table/textToTable.py new file mode 100644 index 000000000..7d89a42d9 --- /dev/null +++ b/sw/qa/uitest/table/textToTable.py @@ -0,0 +1,79 @@ +# -*- 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 uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Writer Text to table + +class textToTable(UITestCase): + def test_text_to_table(self): + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + #Enter A;B ; select the text ; dialog Text to table - Semicolon; verify + type_text(xWriterEdit, "A;B;C") + xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "0", "END_POS": "5"})) + self.ui_test.execute_dialog_through_command(".uno:ConvertTextToTable") + xDialog = self.xUITest.getTopFocusWindow() + semicolons = xDialog.getChild("semicolons") + semicolons.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.assertEqual(document.TextTables.getCount(), 1) + tables = document.getTextTables() + self.assertEqual(len(tables[0].getRows()), 1) + self.assertEqual(len(tables[0].getColumns()), 3) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextTables.getCount(), 0) + self.assertEqual(document.Text.String[0:5], "A;B;C") + + self.ui_test.close_doc() + + def test_text_to_table_header(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("textToTable.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + #open file; select all text ; dialog Text to table - other ":"; verify + self.xUITest.executeCommand(".uno:SelectAll") + self.ui_test.execute_dialog_through_command(".uno:ConvertTextToTable") + xDialog = self.xUITest.getTopFocusWindow() + other = xDialog.getChild("other") + other.executeAction("CLICK", tuple()) + othered = xDialog.getChild("othered") + othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + othered.executeAction("TYPE", mkPropertyValues({"TEXT":":"})) + headingcb = xDialog.getChild("headingcb") + headingcb.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.assertEqual(document.TextTables.getCount(), 1) + tables = document.getTextTables() + self.assertEqual(len(tables[0].getRows()), 4) + self.assertEqual(len(tables[0].getColumns()), 3) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextTables.getCount(), 0) + self.assertEqual(document.Text.String[0:5], "A:B:C") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/ui/fmtui/fmtui.py b/sw/qa/uitest/ui/fmtui/fmtui.py new file mode 100644 index 000000000..d14702263 --- /dev/null +++ b/sw/qa/uitest/ui/fmtui/fmtui.py @@ -0,0 +1,39 @@ +# -*- 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/. +# + +"""Covers sw/source/ui/fmtui/ fixes.""" + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.debug import sleep +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos + +class TestTmpdlg(UITestCase): + + def test_para_style_semi_transparent_text(self): + + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + self.ui_test.execute_dialog_through_command(".uno:EditStyle") + xDialog = self.xUITest.getTopFocusWindow() + + xTabs = xDialog.getChild("tabcontrol") + # Select RID_SVXPAGE_CHAR_EFFECTS. + select_pos(xTabs, "1") + xFontTransparency = xDialog.getChild("fonttransparencymtr") + # Without the accompanying fix in place, this test would have failed with: + # AssertionError: 'false' != 'true' + # i.e. the control was hidden in the paragraph style dialog. + self.assertEqual(get_state_as_dict(xFontTransparency)["Visible"], "true") + + xCancBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancBtn) + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_dialogs/openDialogs.py b/sw/qa/uitest/writer_dialogs/openDialogs.py new file mode 100644 index 000000000..60e126780 --- /dev/null +++ b/sw/qa/uitest/writer_dialogs/openDialogs.py @@ -0,0 +1,138 @@ +# -*- 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 +import unittest +from uitest.uihelper.testDialog import testDialog + +dialogs = [ + {"command": ".uno:OpenRemote", "closeButton": "cancel"}, + {"command": ".uno:NewDoc", "closeButton": "cancel"}, + {"command": ".uno:SaveAsTemplate", "closeButton": "cancel"}, + {"command": ".uno:ExportToPDF", "closeButton": "cancel", "skipTestOK": True}, + # export needs filesystem + {"command": ".uno:ExportToEPUB", "closeButton": "cancel", "skipTestOK": True}, + # export needs filesystem + {"command": ".uno:Print", "closeButton": "cancel", "skipTestOK": True}, + # no printer in CI + # tested in sw/qa/uitest/writer_tests5/tdf123378.py + {"command": ".uno:PrinterSetup", "closeButton": "cancel"}, + # {"command": ".uno:SetDocumentProperties", "closeButton": "cancel"}, + # tested in sw/qa/uitest/writer_tests2/documentProperties.py + # {"command": ".uno:PasteSpecial", "closeButton": "cancel"}, + # would need to copy first something into the clipboard + # {"command": ".uno:SearchDialog", "closeButton": "close"}, + # tested in sw/qa/uitest/findReplace/findReplace.py + # {"command": ".uno:GotoPage", "closeButton": "cancel"}, + # tested in uitest/writer_tests/goToPage.py + # {"command": ".uno:AcceptTrackedChanges", "closeButton": "close"}, + # tested in sw/qa/uitest/writer_tests/trackedChanges.py + {"command": ".uno:ProtectTraceChangeMode", "closeButton": "cancel"}, + # {"command": ".uno:ChangeDatabaseField", "closeButton": "close"}, + # tested in sw/qa/uitest/writer_tests2/exchangeDatabase.py + # {"command": ".uno:InsertBreak", "closeButton": "cancel"}, + # tested in uitest/writer_tests/insertBreakDialog.py + {"command": ".uno:InsertObject", "closeButton": "cancel"}, + {"command": ".uno:InsertSection", "closeButton": "cancel"}, + {"command": ".uno:InsertFrame", "closeButton": "cancel"}, + {"command": ".uno:InsertObjectFloatingFrame", "closeButton": "cancel"}, + {"command": ".uno:FontworkGalleryFloater", "closeButton": "cancel"}, + # {"command": ".uno:HyperlinkDialog", "closeButton": "close"}, + # dialog opens but is not recognised by execute_dialog_through_command + # {"command": ".uno:InsertBookmark", "closeButton": "close"}, + # tested in sw/qa/uitest/writer_tests2/bookmark.py + # {"command": ".uno:InsertReferenceField", "closeButton": "close"}, + # dialog not closed + # {"command": ".uno:InsertSymbol", "closeButton": "cancel"}, + # tested in sw/qa/uitest/writer_tests3/specialCharacter.py + # {"command": ".uno:InsertFootnoteDialog", "closeButton": "cancel"}, + # tested in sw/qa/uitest/writer_tests3/insertFootEndnote.py + {"command": ".uno:InsertIndexesEntry", "closeButton": "close"}, + {"command": ".uno:InsertAuthoritiesEntry", "closeButton": "close"}, + {"command": ".uno:InsertMultiIndex", "closeButton": "cancel"}, + # button is labeled "Close" but is called "cancel" + {"command": ".uno:InsertFieldCtrl", "closeButton": "cancel", "skipTestOK": True}, + # when running the test through the make command the OK button (insert) is enabled for some reason + # {"command": ".uno:InsertEnvelope", "closeButton": "cancel"}, + # tested in sw/qa/uitest/writer_tests3/insertEnvelope.py + # {"command": ".uno:InsertSignatureLine", "closeButton": "cancel"}, + # tested in sw/qa/uitest/writer_tests3/insertSignatureLine.py + # {"command": ".uno:FontDialog", "closeButton": "cancel"}, + # tested in sw/qa/uitest/writer_tests2/formatCharacter.py + # {"command": ".uno:ParagraphDialog", "closeButton": "cancel"}, + # tested in sw/qa/uitest/writer_tests2/formatParagraph.py + # {"command": ".uno:BulletsAndNumberingDialog", "closeButton": "cancel"}, + # tested in sw/qa/uitest/writer_tests2/formatBulletsNumbering.py + # {"command": ".uno:PageDialog", "closeButton": "cancel"}, + # tested in uitest/writer_tests/pageDialog.py + # {"command": ".uno:TitlePageDialog", "closeButton": "cancel"}, + # tested in sw/qa/uitest/writer_tests5/titlePage.py + # {"command": ".uno:RubyDialog", "closeButton": "close"}, + # dialog opens but is not recognised by execute_dialog_through_command + # {"command": ".uno:FormatColumns", "closeButton": "cancel"}, + # tested in sw/qa/uitest/writer_tests5/columns.py + # {"command": ".uno:Watermark", "closeButton": "cancel"}, + # tested in sw/qa/uitest/writer_tests/watermark.py + # {"command": ".uno:EditStyle", "closeButton": "cancel"}, + # tested in sw/qa/uitest/writer_tests2/horizontalLine.py + {"command": ".uno:LoadStyles", "closeButton": "cancel"}, + # {"command": ".uno:InsertTable", "closeButton": "cancel"}, + # tested in uitest/writer_tests/insertTableDialog.py + # {"command": ".uno:SpellDialog", "closeButton": "close"}, + # an extra dialog appears + # {"command": ".uno:ThesaurusDialog", "closeButton": "cancel"}, + # fails in CI, but works fine locally + {"command": ".uno:Hyphenate", "closeButton": "ok", "skipTestOK": True}, + # do not test the OK button twice + {"command": ".uno:ChineseConversion", "closeButton": "cancel"}, + # {"command": ".uno:WordCountDialog", "closeButton": "close"}, + # tested in sw/qa/uitest/writer_tests/wordCount.py + # {"command": ".uno:AutoCorrectDlg", "closeButton": "cancel"}, + # tested in sw/qa/uitest/writer_tests5/autocorrectOptions.py + {"command": ".uno:EditGlossary", "closeButton": "close"}, + # {"command": ".uno:ChapterNumberingDialog", "closeButton": "cancel"}, + # tested in sw/qa/uitest/chapterNumbering/chapterNumbering.py + # {"command": ".uno:LineNumberingDialog", "closeButton": "cancel"}, + # tested in sw/qa/uitest/writer_tests3/lineNumbering.py + {"command": ".uno:FootnoteDialog", "closeButton": "cancel"}, + # {"command": ".uno:MailMergeWizard", "closeButton": "cancel"}, + # may hang forever in e_book_client_connect_direct_sync + {"command": ".uno:AddressBookSource", "closeButton": "cancel"}, + {"command": ".uno:RunMacro", "closeButton": "cancel"}, + {"command": ".uno:ScriptOrganizer", "closeButton": "close"}, + {"command": ".uno:OpenXMLFilterSettings", "closeButton": "close"}, + {"command": "service:com.sun.star.deployment.ui.PackageManagerDialog", "closeButton": "close"}, + # {"command": ".uno:ConfigureDialog", "closeButton": "cancel"}, + # tested in uitest/writer_tests/customizeDialog.py + {"command": ".uno:OptionsTreeDialog", "closeButton": "cancel"}, + {"command": ".uno:ShowLicense", "closeButton": "close"}, + # {"command": ".uno:About", "closeButton": "close"}, + # tested in sw/qa/uitest/writer_tests5/about_test.py +] + +def load_tests(loader, tests, pattern): + return unittest.TestSuite(openDialogs(dialog) + for dialog in dialogs) + +# Test to open all listed dialogs one by one, close it with the given close button +# and if there is an "OK" button open the dialog again and close it by using the OK button +# the test only checks if writer crashes by opening the dialog +class openDialogs(UITestCase): + def check(self, dialog): + testDialog(self, "writer", dialog) + +dialogCount = 0 +for dialog in dialogs: + dialogCount = dialogCount + 1 + + + def ch(dialog): + return lambda self: self.check(dialog) + + + setattr(openDialogs, "test_%02d_%s" % (dialogCount, dialog["command"]), ch(dialog)) +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests/compareDocuments.py b/sw/qa/uitest/writer_tests/compareDocuments.py new file mode 100644 index 000000000..310d9cd73 --- /dev/null +++ b/sw/qa/uitest/writer_tests/compareDocuments.py @@ -0,0 +1,57 @@ +#! /usr/bin/env python +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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 uitest.path import get_srcdir_url +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +import datetime + +def get_url_for_data_file(file_name): + return get_srcdir_url() + "/sw/qa/uitest/writer_tests/data/" + file_name + + +class compareDocuments(UITestCase): + + def test_tdf130960(self): + + writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf130960.odt")) + + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:CompareDocuments") + + xOpenDialog = self.xUITest.getTopFocusWindow() + xFileName = xOpenDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf130960_2.odt")})) + + xOpenBtn = xOpenDialog.getChild("open") + xOpenBtn.executeAction("CLICK", tuple()) + + # Close the dialog and open it again so the list of changes is updated + xTrackDlg = self.xUITest.getTopFocusWindow() + xcloseBtn = xTrackDlg.getChild("close") + xcloseBtn.executeAction("CLICK", tuple()) + + self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges") + xTrackDlg = self.xUITest.getTopFocusWindow() + changesList = xTrackDlg.getChild("writerchanges") + + text = "Unknown Author\t" + datetime.datetime.now().strftime("%m/%d/%Y") + self.assertEqual(2, len(changesList.getChildren())) + self.assertTrue(get_state_as_dict(changesList.getChild('0'))["Text"].startswith(text)) + self.assertTrue(get_state_as_dict(changesList.getChild('1'))["Text"].startswith(text)) + + xcloseBtn = xTrackDlg.getChild("close") + xcloseBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests/data/LibreOffice.jpg b/sw/qa/uitest/writer_tests/data/LibreOffice.jpg Binary files differnew file mode 100644 index 000000000..23812dcfd --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/LibreOffice.jpg diff --git a/sw/qa/uitest/writer_tests/data/LibreOffice_external_logo_100px.png b/sw/qa/uitest/writer_tests/data/LibreOffice_external_logo_100px.png Binary files differnew file mode 100644 index 000000000..d55048283 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/LibreOffice_external_logo_100px.png diff --git a/sw/qa/uitest/writer_tests/data/date_form_field.odt b/sw/qa/uitest/writer_tests/data/date_form_field.odt Binary files differnew file mode 100644 index 000000000..8335a1cc1 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/date_form_field.odt diff --git a/sw/qa/uitest/writer_tests/data/date_form_field_custom_format.odt b/sw/qa/uitest/writer_tests/data/date_form_field_custom_format.odt Binary files differnew file mode 100644 index 000000000..fadd890ed --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/date_form_field_custom_format.odt diff --git a/sw/qa/uitest/writer_tests/data/date_form_field_with_placeholder.odt b/sw/qa/uitest/writer_tests/data/date_form_field_with_placeholder.odt Binary files differnew file mode 100644 index 000000000..6f8a63784 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/date_form_field_with_placeholder.odt diff --git a/sw/qa/uitest/writer_tests/data/date_form_field_without_current_date.odt b/sw/qa/uitest/writer_tests/data/date_form_field_without_current_date.odt Binary files differnew file mode 100644 index 000000000..802dff32d --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/date_form_field_without_current_date.odt diff --git a/sw/qa/uitest/writer_tests/data/drop_down_form_field.doc b/sw/qa/uitest/writer_tests/data/drop_down_form_field.doc Binary files differnew file mode 100644 index 000000000..cf94a1fda --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/drop_down_form_field.doc diff --git a/sw/qa/uitest/writer_tests/data/drop_down_form_field.docx b/sw/qa/uitest/writer_tests/data/drop_down_form_field.docx Binary files differnew file mode 100644 index 000000000..d039cd2b6 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/drop_down_form_field.docx diff --git a/sw/qa/uitest/writer_tests/data/drop_down_form_field.odt b/sw/qa/uitest/writer_tests/data/drop_down_form_field.odt Binary files differnew file mode 100644 index 000000000..f27b11574 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/drop_down_form_field.odt diff --git a/sw/qa/uitest/writer_tests/data/empty_drop_down_form_field.odt b/sw/qa/uitest/writer_tests/data/empty_drop_down_form_field.odt Binary files differnew file mode 100644 index 000000000..bd85dc2a9 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/empty_drop_down_form_field.odt diff --git a/sw/qa/uitest/writer_tests/data/findReplace.odt b/sw/qa/uitest/writer_tests/data/findReplace.odt Binary files differnew file mode 100644 index 000000000..97f92b778 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/findReplace.odt diff --git a/sw/qa/uitest/writer_tests/data/shape.odt b/sw/qa/uitest/writer_tests/data/shape.odt Binary files differnew file mode 100644 index 000000000..7b3ebf027 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/shape.odt diff --git a/sw/qa/uitest/writer_tests/data/splitTable.odt b/sw/qa/uitest/writer_tests/data/splitTable.odt Binary files differnew file mode 100644 index 000000000..269f1f654 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/splitTable.odt diff --git a/sw/qa/uitest/writer_tests/data/tableToText.odt b/sw/qa/uitest/writer_tests/data/tableToText.odt Binary files differnew file mode 100644 index 000000000..5f8f9b01d --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/tableToText.odt diff --git a/sw/qa/uitest/writer_tests/data/tdf108124.odt b/sw/qa/uitest/writer_tests/data/tdf108124.odt Binary files differnew file mode 100644 index 000000000..af0260928 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/tdf108124.odt diff --git a/sw/qa/uitest/writer_tests/data/tdf113284.odt b/sw/qa/uitest/writer_tests/data/tdf113284.odt Binary files differnew file mode 100644 index 000000000..b062fc2e8 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/tdf113284.odt diff --git a/sw/qa/uitest/writer_tests/data/tdf116242.odt b/sw/qa/uitest/writer_tests/data/tdf116242.odt Binary files differnew file mode 100644 index 000000000..6f995b065 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/tdf116242.odt diff --git a/sw/qa/uitest/writer_tests/data/tdf117039.odt b/sw/qa/uitest/writer_tests/data/tdf117039.odt Binary files differnew file mode 100644 index 000000000..6f8f61d83 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/tdf117039.odt diff --git a/sw/qa/uitest/writer_tests/data/tdf118208.odt b/sw/qa/uitest/writer_tests/data/tdf118208.odt Binary files differnew file mode 100644 index 000000000..8390f28e8 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/tdf118208.odt diff --git a/sw/qa/uitest/writer_tests/data/tdf118540.docx b/sw/qa/uitest/writer_tests/data/tdf118540.docx Binary files differnew file mode 100644 index 000000000..64022073e --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/tdf118540.docx diff --git a/sw/qa/uitest/writer_tests/data/tdf120731.odt b/sw/qa/uitest/writer_tests/data/tdf120731.odt Binary files differnew file mode 100644 index 000000000..30638ec2c --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/tdf120731.odt diff --git a/sw/qa/uitest/writer_tests/data/tdf122449.odt b/sw/qa/uitest/writer_tests/data/tdf122449.odt Binary files differnew file mode 100644 index 000000000..fb809c1ba --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/tdf122449.odt diff --git a/sw/qa/uitest/writer_tests/data/tdf123547.docx b/sw/qa/uitest/writer_tests/data/tdf123547.docx Binary files differnew file mode 100644 index 000000000..2b6ed9bd5 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/tdf123547.docx diff --git a/sw/qa/uitest/writer_tests/data/tdf124586.odt b/sw/qa/uitest/writer_tests/data/tdf124586.odt Binary files differnew file mode 100644 index 000000000..4d3852ae5 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/tdf124586.odt diff --git a/sw/qa/uitest/writer_tests/data/tdf124675.docx b/sw/qa/uitest/writer_tests/data/tdf124675.docx Binary files differnew file mode 100644 index 000000000..13ee05c5e --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/tdf124675.docx diff --git a/sw/qa/uitest/writer_tests/data/tdf126017.odt b/sw/qa/uitest/writer_tests/data/tdf126017.odt Binary files differnew file mode 100644 index 000000000..96d6a67a8 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/tdf126017.odt diff --git a/sw/qa/uitest/writer_tests/data/tdf126627.odt b/sw/qa/uitest/writer_tests/data/tdf126627.odt Binary files differnew file mode 100644 index 000000000..79b481015 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/tdf126627.odt diff --git a/sw/qa/uitest/writer_tests/data/tdf130960.odt b/sw/qa/uitest/writer_tests/data/tdf130960.odt Binary files differnew file mode 100644 index 000000000..788db8e96 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/tdf130960.odt diff --git a/sw/qa/uitest/writer_tests/data/tdf130960_2.odt b/sw/qa/uitest/writer_tests/data/tdf130960_2.odt Binary files differnew file mode 100644 index 000000000..2123a85c4 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/tdf130960_2.odt diff --git a/sw/qa/uitest/writer_tests/data/tdf131931.odt b/sw/qa/uitest/writer_tests/data/tdf131931.odt Binary files differnew file mode 100644 index 000000000..7a2eae064 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/tdf131931.odt diff --git a/sw/qa/uitest/writer_tests/data/tdf49683.rtf b/sw/qa/uitest/writer_tests/data/tdf49683.rtf new file mode 100644 index 000000000..6dd4739e7 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/tdf49683.rtf @@ -0,0 +1,81 @@ +{\rtf1\ansi\deff4\adeflang1025 +{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\froman\fprq2\fcharset2 Symbol;}{\f2\fswiss\fprq2\fcharset0 Arial;}{\f3\froman\fprq2\fcharset128 Times New Roman;}{\f4\fswiss\fprq0\fcharset0 Arial;}{\f5\fswiss\fprq2\fcharset128 Arial Narrow;}{\f6\froman\fprq2\fcharset0 Garamond;}{\f7\fnil\fprq2\fcharset128 WenQuanYi Zen Hei;}{\f8\fswiss\fprq2\fcharset0 Lucida Sans Unicode;}{\f9\fnil\fprq2\fcharset0 MS Mincho;}{\f10\fnil\fprq2\fcharset128 Lohit Hindi;}{\f11\fnil\fprq0\fcharset128 Lohit Hindi;}} +{\colortbl;\red0\green0\blue0;\red128\green128\blue128;} +{\stylesheet{\s0\snext0\aspalpha\nowidctlpar{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\hich\af8\langfe255\dbch\af6\afs24\cf0\kerning1\lang1081\loch\f6\fs24\lang1043 Standaard;} +{\s15\sbasedon0\snext16\aspalpha\sb240\sa120\keepn\hich\af7\langfe255\dbch\af10\afs28\loch\f5\fs28\lang1043 Kop;} +{\s16\sbasedon0\snext16\aspalpha\sb0\sa120\hich\af8\langfe255\dbch\af6\afs24\loch\f6\fs24\lang1043 Tekstblok;} +{\s17\sbasedon16\snext17\aspalpha\sb0\sa120\hich\af8\langfe255\dbch\af4\afs24\loch\f4\fs24\lang1043 Lijst;} +{\s18\sbasedon0\snext18\aspalpha\sb120\sa120\noline\i\hich\af8\langfe255\dbch\af11\afs24\ai\loch\f6\fs24\lang1043 Bijschrift;} +{\s19\sbasedon0\snext19\aspalpha\hich\af8\langfe255\dbch\af4\afs24\loch\f4\fs24\lang1043 Index;} +{\s20\sbasedon0\snext16\aspalpha\sb240\sa120\keepn\hich\af9\langfe255\dbch\af2\afs28\loch\f2\fs28\lang1043 Heading;} +{\s21\sbasedon0\snext21\aspalpha\sb120\sa120\i\hich\af8\langfe255\dbch\af4\afs24\ai\loch\f4\fs24\lang1043 caption;} +{\s22\sbasedon0\snext16\aspalpha\sb240\sa120\keepn\hich\af9\langfe255\dbch\af2\afs28\loch\f2\fs28\lang1043 WW-Heading;} +{\s23\sbasedon0\snext23\aspalpha\sb120\sa120\i\hich\af8\langfe255\dbch\af4\afs24\ai\loch\f4\fs24\lang1043 WW-caption;} +{\s24\sbasedon0\snext24\tqc\tx4818\tqr\tx9637\aspalpha\hich\af8\langfe255\dbch\af6\afs24\loch\f6\fs24\lang1043 header;} +{\s25\sbasedon0\snext25\qr\aspalpha\hich\af8\langfe255\dbch\af6\afs22\loch\f6\fs22\lang1043 _GegegRiagg;} +{\s26\sbasedon0\snext26\tqc\tx4320\tqr\tx8640\aspalpha\hich\af8\langfe255\dbch\af6\afs24\loch\f6\fs24\lang1043 WW-header;} +{\s27\sbasedon0\snext27\aspalpha\hich\af8\langfe255\dbch\af6\afs18\loch\f6\fs18\lang1043 _GegegDoc;} +{\s28\sbasedon0\snext28\aspalpha\hich\af8\langfe255\dbch\af6\afs24\loch\f6\fs24\lang1043 Table Contents;} +{\s29\sbasedon0\snext29\aspalpha\hich\af8\langfe255\dbch\af6\afs24\loch\f6\fs24\lang1043 WW-Table Contents;} +{\s30\sbasedon27\snext30\aspalpha\hich\af8\langfe255\dbch\af6\afs22\loch\f6\fs22\lang1043 _GegegVast11;} +{\s31\sbasedon30\snext31\aspalpha\b\hich\af8\langfe255\dbch\af6\afs22\ab\loch\f6\fs22\lang1043 _GegegVast11Vet;} +{\s32\sbasedon29\snext32\qc\aspalpha\b\hich\af8\langfe255\dbch\af6\afs24\ab\loch\f6\fs24\lang1043 Table Heading;} +{\s33\sbasedon0\snext33\tqc\tx4320\tqr\tx8640\aspalpha\noline\hich\af8\langfe255\dbch\af6\afs24\loch\f6\fs24\lang1043 Koptekst;} +{\s34\sbasedon0\snext34\aspalpha\noline\hich\af8\langfe255\dbch\af6\afs24\loch\f6\fs24\lang1043 Inhoud tabel;} +{\s35\sbasedon34\snext35\qc\aspalpha\noline\b\hich\af8\langfe255\dbch\af6\afs24\ab\loch\f6\fs24\lang1043 Tabelkop;} +}{\info{\keywords bhavb}{\author Cor Nouws}{\creatim\yr2009\mo10\dy20\hr14\min33}{\revtim\yr2009\mo10\dy20\hr14\min47}{\printim\yr0\mo0\dy0\hr0\min0}{\comment LibreOffice 3.4.5}{\vern3400}}\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709 + +{\*\pgdsctbl +{\pgdsc0\pgdscuse195\pgwsxn11906\pghsxn16838\marglsxn1417\margrsxn1417\margtsxn1247\headery709\margbsxn1134{\header\trowd\trql\trleft-1102\ltrrow\trpaddft3\trpaddt0\trpaddfl3\trpaddl0\trpaddfb3\trpaddb0\trpaddfr3\trpaddr0\cellx-270\cellx-89\cellx7970\pard\plain \s27\aspalpha\hich\af8\langfe255\dbch\af6\afs18\loch\f6\fs18\lang1043\intbl{\i0\b0\rtlch \ltrch\loch +Kenmerk:}\cell\pard\plain \s27\aspalpha\hich\af8\langfe255\dbch\af6\afs18\loch\f6\fs18\lang1043\intbl{\rtlch \ltrch\loch +}\cell\pard\plain \s28\aspalpha\hich\af8\langfe255\dbch\af6\afs24\loch\f6\fs24\lang1043\intbl{\rtlch \ltrch\loch +*BriefReferentie*}\cell\row\pard\pard\plain \s0\aspalpha\nowidctlpar{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\hich\af8\langfe255\dbch\af6\afs24\cf0\kerning1\lang1081\loch\f6\fs24\lang1043{\afs4\rtlch \ltrch\loch\fs4 +} +\par }\pgdscnxt0 Standard;} +{\pgdsc1\pgdscuse195\pgndec\pgwsxn11906\pghsxn16838\marglsxn1417\margrsxn1417\margtsxn1247\margbsxn1134\pgdscnxt0 First Page;} +{\pgdsc2\pgdscuse195\pgndec\pgwsxn11906\pghsxn16838\marglsxn1417\margrsxn1417\margtsxn1247\margbsxn1134\pgdscnxt0 First Page;} +{\pgdsc3\pgdscuse195\pgndec\pgwsxn11906\pghsxn16838\marglsxn1417\margrsxn1417\margtsxn1247\margbsxn1134\pgdscnxt0 Eerste pagina;}} +\formshade{\*\pgdscno3}\paperh16838\paperw11906\margl1417\margr1417\margt1247\margb1134\sectd\sbknone\sectunlocked1\pgndec\pgwsxn11906\pghsxn16838\marglsxn1417\margrsxn1417\margtsxn1247\headery709\margbsxn1134{\header\trowd\trql\trleft-1102\ltrrow\trpaddft3\trpaddt0\trpaddfl3\trpaddl0\trpaddfb3\trpaddb0\trpaddfr3\trpaddr0\cellx-270\cellx-89\cellx7970\pard\plain \s27\aspalpha\hich\af8\langfe255\dbch\af6\afs18\loch\f6\fs18\lang1043\intbl{\i0\b0\rtlch \ltrch\loch +Kenmerk:}\cell\pard\plain \s27\aspalpha\hich\af8\langfe255\dbch\af6\afs18\loch\f6\fs18\lang1043\intbl{\rtlch \ltrch\loch +}\cell\pard\plain \s28\aspalpha\hich\af8\langfe255\dbch\af6\afs24\loch\f6\fs24\lang1043\intbl{\rtlch \ltrch\loch +*BriefReferentie*}\cell\row\pard\pard\plain \s0\aspalpha\nowidctlpar{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\hich\af8\langfe255\dbch\af6\afs24\cf0\kerning1\lang1081\loch\f6\fs24\lang1043{\afs4\rtlch \ltrch\loch\fs4 +} +\par }\titlepg\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc +\trowd\trql\trleft0\ltrrow\trrh2098\trpaddft3\trpaddt0\trpaddfl3\trpaddl0\trpaddfb3\trpaddb0\trpaddfr3\trpaddr0\cellx4748\cellx9072\pgndec\pard\plain \s28\aspalpha\hich\af8\langfe255\dbch\af6\afs24\loch\f6\fs24\lang1043\intbl\ltrpar{\rtlch \ltrch\loch +}\cell\pard\plain \s25\qr\aspalpha\hich\af8\langfe255\dbch\af6\afs22\loch\f6\fs22\lang1043\intbl\ltrpar{\rtlch \ltrch\loch +}\cell\row\pard\trowd\trql\trleft0\ltrrow\trrh1191\trpaddft3\trpaddt0\trpaddfl3\trpaddl0\trpaddfb3\trpaddb0\trpaddfr3\trpaddr0\cellx4748\cellx9072\pard\plain \s28\aspalpha\hich\af8\langfe255\dbch\af6\afs24\loch\f6\fs24\lang1043\intbl\ltrpar{\rtlch \ltrch\loch +*HuisartsNaam*} +\par \pard\plain \s28\aspalpha\hich\af8\langfe255\dbch\af6\afs24\loch\f6\fs24\lang1043\intbl\ltrpar{\rtlch \ltrch\loch +*HuisartsAdres*} +\par \pard\plain \s28\aspalpha\hich\af8\langfe255\dbch\af6\afs24\loch\f6\fs24\lang1043\intbl\ltrpar{\rtlch \ltrch\loch +*HuisartsPostcode* *HuisartsPlaats*}\cell\pard\plain \s28\aspalpha\hich\af8\langfe255\dbch\af6\afs24\loch\f6\fs24\lang1043\intbl\ltrpar{\rtlch \ltrch\loch +}\cell\row\pard\trowd\trql\trleft0\ltrrow\trrh624\trpaddft3\trpaddt0\trpaddfl3\trpaddl0\trpaddfb3\trpaddb0\trpaddfr3\trpaddr0\cellx4748\cellx9072\pard\plain \s28\aspalpha\hich\af8\langfe255\dbch\af6\afs24\loch\f6\fs24\lang1043\intbl\ltrpar{\rtlch \ltrch\loch +*ClientPostcode* *ClientPlaats*}\cell\pard\plain \s25\qr\aspalpha\hich\af8\langfe255\dbch\af6\afs22\loch\f6\fs22\lang1043\intbl\ltrpar{\rtlch \ltrch\loch +*ClientAfdelingPlaatsLower*, *BriefDatum*}\cell\row\pard\pard\plain \s0\aspalpha\nowidctlpar{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\hich\af8\langfe255\dbch\af6\afs24\cf0\kerning1\lang1081\loch\f6\fs24\lang1043\ltrpar{\rtlch \ltrch\loch +} +\par \trowd\trql\trleft-1102\ltrrow\trpaddft3\trpaddt0\trpaddfl3\trpaddl0\trpaddfb3\trpaddb0\trpaddfr3\trpaddr0\cellx-270\cellx-89\cellx7970\pard\plain \s27\aspalpha\hich\af8\langfe255\dbch\af6\afs18\loch\f6\fs18\lang1043\intbl\ltrpar{\rtlch \ltrch\loch +Betreft:}\cell\pard\plain \s27\aspalpha\hich\af8\langfe255\dbch\af6\afs18\loch\f6\fs18\lang1043\intbl\ltrpar{\rtlch \ltrch\loch +}\cell\pard\plain \s28\aspalpha\hich\af8\langfe255\dbch\af6\afs24\loch\f6\fs24\lang1043\intbl\ltrpar{\b\ab\rtlch \ltrch\loch +}\cell\row\pard\pard\plain \s0\aspalpha\nowidctlpar{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\hich\af8\langfe255\dbch\af6\afs24\cf0\kerning1\lang1081\loch\f6\fs24\lang1043\ltrpar{\rtlch \ltrch\loch +} +\par \trowd\trql\ltrrow\trpaddft3\trpaddt0\trpaddfl3\trpaddl0\trpaddfb3\trpaddb0\trpaddfr3\trpaddr0\cellx1245\cellx1365\cellx9072\pard\plain \s30\aspalpha\hich\af8\langfe255\dbch\af6\afs22\loch\f6\fs22\lang1043\intbl\ltrpar{\rtlch \ltrch\loch +}\cell\pard\plain \s30\aspalpha\hich\af8\langfe255\dbch\af6\afs22\loch\f6\fs22\lang1043\intbl\ltrpar{\rtlch \ltrch\loch +}\cell\pard\plain \s31\aspalpha\b\hich\af8\langfe255\dbch\af6\afs22\ab\loch\f6\fs22\lang1043\intbl\ltrpar{\rtlch \ltrch\loch +}\cell\row\pard\trowd\trql\ltrrow\trpaddft3\trpaddt0\trpaddfl3\trpaddl0\trpaddfb3\trpaddb0\trpaddfr3\trpaddr0\cellx1245\cellx1365\cellx9072\pard\plain \s30\aspalpha\hich\af8\langfe255\dbch\af6\afs22\loch\f6\fs22\lang1043\intbl\ltrpar{\rtlch \ltrch\loch +}\cell\pard\plain \s30\aspalpha\hich\af8\langfe255\dbch\af6\afs22\loch\f6\fs22\lang1043\intbl\ltrpar{\rtlch \ltrch\loch +}\cell\pard\plain \s31\aspalpha\b\hich\af8\langfe255\dbch\af6\afs22\ab\loch\f6\fs22\lang1043\intbl\ltrpar{\rtlch \ltrch\loch +}\cell\row\pard\trowd\trql\ltrrow\trpaddft3\trpaddt0\trpaddfl3\trpaddl0\trpaddfb3\trpaddb0\trpaddfr3\trpaddr0\cellx1245\cellx1365\cellx9072\pard\plain \s30\aspalpha\hich\af8\langfe255\dbch\af6\afs22\loch\f6\fs22\lang1043\intbl\ltrpar{\rtlch \ltrch\loch +}\cell\pard\plain \s30\aspalpha\hich\af8\langfe255\dbch\af6\afs22\loch\f6\fs22\lang1043\intbl\ltrpar{\rtlch \ltrch\loch +}\cell\pard\plain \s31\aspalpha\b\hich\af8\langfe255\dbch\af6\afs22\ab\loch\f6\fs22\lang1043\intbl\ltrpar{\rtlch \ltrch\loch +}\cell\row\pard\pard\plain \s0\aspalpha\nowidctlpar{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\hich\af8\langfe255\dbch\af6\afs24\cf0\kerning1\lang1081\loch\f6\fs24\lang1043\ltrpar{\rtlch \ltrch\loch +} +\par \trowd\trql\trleft-1102\ltrrow\trpaddft3\trpaddt0\trpaddfl3\trpaddl0\trpaddfb3\trpaddb0\trpaddfr3\trpaddr0\cellx-270\cellx-89\cellx7970\pard\plain \s27\aspalpha\hich\af8\langfe255\dbch\af6\afs18\loch\f6\fs18\lang1043\intbl\ltrpar{\rtlch \ltrch\loch +Kenmerk:}\cell\pard\plain \s27\aspalpha\hich\af8\langfe255\dbch\af6\afs18\loch\f6\fs18\lang1043\intbl\ltrpar{\rtlch \ltrch\loch +}\cell\pard\plain \s28\aspalpha\hich\af8\langfe255\dbch\af6\afs24\loch\f6\fs24\lang1043\intbl\ltrpar{\rtlch \ltrch\loch +*BriefReferentie*}\cell\row\pard\pard\plain \s0\aspalpha\nowidctlpar{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\hich\af8\langfe255\dbch\af6\afs24\cf0\kerning1\lang1081\loch\f6\fs24\lang1043\ltrpar{\rtlch \ltrch\loch +} +\par \pard\plain \s0\aspalpha\nowidctlpar{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\hich\af8\langfe255\dbch\af6\afs24\cf0\kerning1\lang1081\loch\f6\fs24\lang1043\ltrpar{\rtlch \ltrch\loch +} +\par \pard\plain \s0\aspalpha\nowidctlpar{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\hich\af8\langfe255\dbch\af6\afs24\cf0\kerning1\lang1081\loch\f6\fs24\lang1043\ltrpar{\rtlch \ltrch\loch +} +\par }
\ No newline at end of file diff --git a/sw/qa/uitest/writer_tests/data/tdf51816.odt b/sw/qa/uitest/writer_tests/data/tdf51816.odt Binary files differnew file mode 100644 index 000000000..a7816a74f --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/tdf51816.odt diff --git a/sw/qa/uitest/writer_tests/data/tdf58050.html b/sw/qa/uitest/writer_tests/data/tdf58050.html new file mode 100644 index 000000000..9d61cf1c4 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/tdf58050.html @@ -0,0 +1,19 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"/> + <title></title> + <meta name="generator" content="LibreOffice 5.1.6.2 (Linux)"/> + <meta name="author" content="-- "/> + <meta name="created" content="2018-02-24T09:48:50.194598073"/> + <meta name="changedby" content="-- "/> + <meta name="changed" content="2018-02-24T09:50:10.334408638"/> + <style type="text/css"> + @page { margin: 56.7pt } + p { margin-bottom: 7pt; line-height: 120% } + </style> +</head> +<body lang="en-US" dir="ltr"> +<p style="margin-bottom: 0pt; line-height: 100%">Bug 58050 test</p> +</body> +</html>
\ No newline at end of file diff --git a/sw/qa/uitest/writer_tests/data/tdf68347.odt b/sw/qa/uitest/writer_tests/data/tdf68347.odt Binary files differnew file mode 100644 index 000000000..2e72fb541 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/tdf68347.odt diff --git a/sw/qa/uitest/writer_tests/data/tdf81292.odt b/sw/qa/uitest/writer_tests/data/tdf81292.odt Binary files differnew file mode 100644 index 000000000..47e4ee9ab --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/tdf81292.odt diff --git a/sw/qa/uitest/writer_tests/data/tdf81457.odt b/sw/qa/uitest/writer_tests/data/tdf81457.odt Binary files differnew file mode 100644 index 000000000..04c18dd3a --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/tdf81457.odt diff --git a/sw/qa/uitest/writer_tests/data/tdf99334.odt b/sw/qa/uitest/writer_tests/data/tdf99334.odt Binary files differnew file mode 100644 index 000000000..9cbdcbc41 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/tdf99334.odt diff --git a/sw/qa/uitest/writer_tests/data/textToTable.odt b/sw/qa/uitest/writer_tests/data/textToTable.odt Binary files differnew file mode 100644 index 000000000..088b6b4c1 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/textToTable.odt diff --git a/sw/qa/uitest/writer_tests/data/trackedChanges.odt b/sw/qa/uitest/writer_tests/data/trackedChanges.odt Binary files differnew file mode 100644 index 000000000..61f546695 --- /dev/null +++ b/sw/qa/uitest/writer_tests/data/trackedChanges.odt diff --git a/sw/qa/uitest/writer_tests/insertCaption.py b/sw/qa/uitest/writer_tests/insertCaption.py new file mode 100644 index 000000000..de73b3b76 --- /dev/null +++ b/sw/qa/uitest/writer_tests/insertCaption.py @@ -0,0 +1,76 @@ +# -*- 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 +import time +from uitest.debug import sleep +from uitest.uihelper.common import select_pos + +class insertCaption(UITestCase): + + def test_insert_caption(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + self.ui_test.execute_dialog_through_command(".uno:InsertFrame") # insert frame + xDialogFr = self.xUITest.getTopFocusWindow() + + xWidth = xDialogFr.getChild("width") + xWidth.executeAction("UP", tuple()) + xWidth.executeAction("UP", tuple()) + + xHeight = xDialogFr.getChild("height") + xHeight.executeAction("UP", tuple()) + xHeight.executeAction("UP", tuple()) + + xOkBtn=xDialogFr.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.assertEqual(document.TextFrames.getCount(), 1) + + self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") # caption + xDialogCaption = self.xUITest.getTopFocusWindow() + + xCapt = xDialogCaption.getChild("caption_edit") + xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption"})) + + xOkBtn=xDialogCaption.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + xFrame = document.TextFrames[0] + + self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), "\nText 1: Caption") + + self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") # 2nd caption + xDialogCaption = self.xUITest.getTopFocusWindow() + xCapt = xDialogCaption.getChild("caption_edit") + xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption2"})) + xSep = xDialogCaption.getChild("separator_edit") + xSep.executeAction("TYPE", mkPropertyValues({"TEXT":"-"})) + + xOkBtn=xDialogCaption.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), "\nText 1: Caption\nText 2-: Caption2") + + self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") # 3. caption + xDialogCaption = self.xUITest.getTopFocusWindow() + xCapt = xDialogCaption.getChild("caption_edit") + xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption3"})) + xSep = xDialogCaption.getChild("separator_edit") + xSep.executeAction("TYPE", mkPropertyValues({"TEXT":"-"})) + xPos = xDialogCaption.getChild("position") + select_pos(xPos, "1") + + xOkBtn=xDialogCaption.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), "\nText 1: Caption\nText 2-: Caption2\nText 3--: Caption3") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests/tdf53460.py b/sw/qa/uitest/writer_tests/tdf53460.py new file mode 100644 index 000000000..f8fc0ad47 --- /dev/null +++ b/sw/qa/uitest/writer_tests/tdf53460.py @@ -0,0 +1,78 @@ +# -*- 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.debug import sleep + +class tdf53460(UITestCase): + + def test_resize_table_with_keyboard_tdf53460(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() + #-insert a table (by default 2x2) + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + xDialog = self.xUITest.getTopFocusWindow() + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + #-put the cursor inside first cell top left for example + #-insert an inner table (by default 2x2) inside this cell + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + xDialog = self.xUITest.getTopFocusWindow() + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + #-still in top left cell, go to the line after the inner table + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + #- <ALT>+up key => crash + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+UP"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+LEFT"})) + + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+UP"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+LEFT"})) + + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+UP"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+LEFT"})) + + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+UP"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+LEFT"})) + + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+UP"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+LEFT"})) + + self.assertEqual(document.TextTables.getCount(), 2) + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests/tdf78068.py b/sw/qa/uitest/writer_tests/tdf78068.py new file mode 100644 index 000000000..145b0bd99 --- /dev/null +++ b/sw/qa/uitest/writer_tests/tdf78068.py @@ -0,0 +1,36 @@ +# -*- 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 + +import time +from uitest.debug import sleep +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import select_pos + +class tdf78068(UITestCase): + + def test_tdf78068_format_paragraph_crash(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + #- add some text + type_text(xWriterEdit, "Test") + #- go to Format > Paragraph + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) #close dialog + + self.assertEqual(document.Text.String[0:4], "Test") + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file diff --git a/sw/qa/uitest/writer_tests/tdf81457.py b/sw/qa/uitest/writer_tests/tdf81457.py new file mode 100644 index 000000000..3b7108866 --- /dev/null +++ b/sw/qa/uitest/writer_tests/tdf81457.py @@ -0,0 +1,35 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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.path import get_srcdir_url +from uitest.uihelper.common import get_state_as_dict +import time +from uitest.debug import sleep +from uitest.uihelper.common import select_pos + +def get_url_for_data_file(file_name): + return get_srcdir_url() + "/sw/qa/uitest/writer_tests/data/" + file_name + +class tdf81457(UITestCase): + +#tdf 81457 + def test_open_documentProperties_tdf81457(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf81457.odt")) + self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") #tab Custom properties + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file diff --git a/sw/qa/uitest/writer_tests/tdf93068.py b/sw/qa/uitest/writer_tests/tdf93068.py new file mode 100644 index 000000000..fb883d58a --- /dev/null +++ b/sw/qa/uitest/writer_tests/tdf93068.py @@ -0,0 +1,36 @@ +# +# 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 +import time +from uitest.uihelper.common import get_state_as_dict, type_text + +class tdf93068(UITestCase): + + def test_tdf93068(self): + + self.ui_test.create_doc_in_start_center("writer") + + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xFontDlg = self.xUITest.getTopFocusWindow() + xOKBtn = xFontDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xFontDlg = self.xUITest.getTopFocusWindow() + xCancBtn = xFontDlg.getChild("cancel") + xCancBtn.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xFontDlg = self.xUITest.getTopFocusWindow() + xDiscardBtn = xFontDlg.getChild("reset") + xDiscardBtn.executeAction("CLICK", tuple()) + xOKBtn = xFontDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() diff --git a/sw/qa/uitest/writer_tests/trackedChanges.py b/sw/qa/uitest/writer_tests/trackedChanges.py new file mode 100644 index 000000000..1fb999e63 --- /dev/null +++ b/sw/qa/uitest/writer_tests/trackedChanges.py @@ -0,0 +1,229 @@ +# -*- 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/. +# tests for tracked changes ; tdf912270 + +from uitest.framework import UITestCase +from uitest.debug import sleep +from uitest.path import get_srcdir_url +import time +from uitest.uihelper.common import get_state_as_dict, type_text + + +def get_url_for_data_file(file_name): + return get_srcdir_url() + "/sw/qa/uitest/writer_tests/data/" + file_name + +class trackedchanges(UITestCase): + + def test_tdf91270(self): + + self.ui_test.create_doc_in_start_center("writer") + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + type_text(xWriterEdit, "Test") + + self.xUITest.executeCommand(".uno:TrackChanges") + + selection = self.xUITest.executeCommand(".uno:SelectAll") #select whole text + self.xUITest.executeCommand(".uno:Cut") #cut text + + self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges") + xTrackDlg = self.xUITest.getTopFocusWindow() + xCancBtn = xTrackDlg.getChild("close") + xCancBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() + + def test_tracked_changes_accept(self): + + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:TrackChanges") + type_text(xWriterEdit, "Test LibreOffice") + self.xUITest.executeCommand(".uno:ShowTrackedChanges") + + self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges") + xTrackDlg = self.xUITest.getTopFocusWindow() + xAccBtn = xTrackDlg.getChild("accept") + xAccBtn.executeAction("CLICK", tuple()) + xCancBtn = xTrackDlg.getChild("close") + xCancBtn.executeAction("CLICK", tuple()) + + self.assertEqual(document.Text.String[0:16], "Test LibreOffice") + self.ui_test.close_doc() + + def test_tracked_changes_acceptall(self): + + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:TrackChanges") + type_text(xWriterEdit, "Test LibreOffice") + self.xUITest.executeCommand(".uno:ShowTrackedChanges") + + self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges") + xTrackDlg = self.xUITest.getTopFocusWindow() + + xAccBtn = xTrackDlg.getChild("acceptall") + xAccBtn.executeAction("CLICK", tuple()) + xCancBtn = xTrackDlg.getChild("close") + xCancBtn.executeAction("CLICK", tuple()) + + + self.assertEqual(document.Text.String[0:16], "Test LibreOffice") + self.ui_test.close_doc() + + def test_tracked_changes_reject(self): + + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:TrackChanges") + type_text(xWriterEdit, "Test LibreOffice") + self.xUITest.executeCommand(".uno:ShowTrackedChanges") + + self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges") + xTrackDlg = self.xUITest.getTopFocusWindow() + + xRejBtn = xTrackDlg.getChild("reject") + xRejBtn.executeAction("CLICK", tuple()) + xCancBtn = xTrackDlg.getChild("close") + xCancBtn.executeAction("CLICK", tuple()) + + self.assertEqual(document.Text.String[0:1], "") + self.ui_test.close_doc() + + def test_tracked_changes_rejectall(self): + + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:TrackChanges") + type_text(xWriterEdit, "Test LibreOffice") + self.xUITest.executeCommand(".uno:ShowTrackedChanges") + + self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges") + xTrackDlg = self.xUITest.getTopFocusWindow() + + xAccBtn = xTrackDlg.getChild("rejectall") + xAccBtn.executeAction("CLICK", tuple()) + xCancBtn = xTrackDlg.getChild("close") + xCancBtn.executeAction("CLICK", tuple()) + + self.assertEqual(document.Text.String[0:1], "") + self.ui_test.close_doc() + + def test_tracked_changes_zprev_next(self): + + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:TrackChanges") + type_text(xWriterEdit, "Test LibreOffice") + self.xUITest.executeCommand(".uno:TrackChanges") + type_text(xWriterEdit, " Test2") + self.xUITest.executeCommand(".uno:TrackChanges") + type_text(xWriterEdit, " Test3") + self.xUITest.executeCommand(".uno:TrackChanges") + type_text(xWriterEdit, " Test4") + self.xUITest.executeCommand(".uno:TrackChanges") + type_text(xWriterEdit, " Test5") + self.xUITest.executeCommand(".uno:PreviousTrackedChange") + self.xUITest.executeCommand(".uno:RejectTrackedChange") + self.assertEqual(document.Text.String[0:37], "Test LibreOffice Test2 Test3 Test4") + + self.xUITest.executeCommand(".uno:PreviousTrackedChange") + self.xUITest.executeCommand(".uno:PreviousTrackedChange") + self.xUITest.executeCommand(".uno:AcceptTrackedChange") + self.assertEqual(document.Text.String[0:37], "Test LibreOffice Test2 Test3 Test4") + + self.xUITest.executeCommand(".uno:NextTrackedChange") + self.xUITest.executeCommand(".uno:RejectTrackedChange") + self.assertEqual(document.Text.String[0:30], "Test LibreOffice Test2 Test4") + + self.ui_test.close_doc() + + def test_list_of_changes(self): + self.ui_test.load_file(get_url_for_data_file("trackedChanges.odt")) + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + document = self.ui_test.get_component() + + listText = [ + "Unknown Author\t01/24/2020 16:19:32\t", + "Unknown Author\t01/24/2020 16:19:35\t", + "Unknown Author\t01/24/2020 16:19:39\t", + "Unknown Author\t01/24/2020 16:19:39\t", + "Xisco Fauli\t01/27/2020 17:42:55\t"] + + self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges") + xTrackDlg = self.xUITest.getTopFocusWindow() + changesList = xTrackDlg.getChild("writerchanges") + + resultsAccept = [ + "The tennis ball is a small ball. The baskedtball is much bigger.", + "The tennis ball is a small ball. The baskedtball is much bigger.", + "The tennis ball is a small ball. The baskedtball is much bigger.", + "The tennis ball is a small ball. The basketball is much bigger.", + "The tennis ball is a small ball. The basketball is much bigger.", + "The tennis ball is a small ball. The basketball is much bigger."] + + for i in range(len(listText)): + self.assertEqual(document.Text.String.strip(), resultsAccept[i]) + self.assertEqual(get_state_as_dict(changesList.getChild('0'))["Text"], listText[i] ) + xAccBtn = xTrackDlg.getChild("accept") + xAccBtn.executeAction("CLICK", tuple()) + + self.assertEqual(document.Text.String.strip(), resultsAccept[5]) + #List is empty + self.assertFalse('0' in changesList.getChildren()) + + for i in reversed(range(len(listText))): + xUndoBtn = xTrackDlg.getChild("undo") + xUndoBtn.executeAction("CLICK", tuple()) + self.assertEqual(document.Text.String.strip(), resultsAccept[i]) + self.assertEqual(get_state_as_dict(changesList.getChild('0'))["Text"], listText[i] ) + + resultsReject = [ + "The tennis ball is a small ball. The baskedtball is much bigger.", + "The tenis ball is a small ball. The baskedtball is much bigger.", + "The tenis ball is a small bal. The baskedtball is much bigger.", + "The tenis ball is a small bal. The baskedtball is much bigger.", + "The tenis ball is a small bal. The baskedball is much bigger.", + "The tenis ball is a small bal. The baskedball is much biger."] + + for i in range(len(listText)): + self.assertEqual(document.Text.String.strip(), resultsReject[i]) + self.assertEqual(get_state_as_dict(changesList.getChild('0'))["Text"], listText[i] ) + xAccBtn = xTrackDlg.getChild("reject") + xAccBtn.executeAction("CLICK", tuple()) + + self.assertEqual(document.Text.String.strip(), resultsReject[5]) + #List is empty + self.assertFalse('0' in changesList.getChildren()) + + for i in reversed(range(len(listText))): + xUndoBtn = xTrackDlg.getChild("undo") + xUndoBtn.executeAction("CLICK", tuple()) + self.assertEqual(document.Text.String.strip(), resultsReject[i]) + self.assertEqual(get_state_as_dict(changesList.getChild('0'))["Text"], listText[i] ) + + xcloseBtn = xTrackDlg.getChild("close") + xcloseBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests/versionDialog.py b/sw/qa/uitest/writer_tests/versionDialog.py new file mode 100644 index 000000000..6a97bfd20 --- /dev/null +++ b/sw/qa/uitest/writer_tests/versionDialog.py @@ -0,0 +1,47 @@ +#! /usr/bin/env python +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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 uitest.path import get_srcdir_url +from uitest.uihelper.common import get_state_as_dict + +def get_url_for_data_file(file_name): + return get_srcdir_url() + "/sw/qa/uitest/writer_tests/data/" + file_name + + +class versionDialog(UITestCase): + + def test_tdf131931(self): + + writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf131931.odt")) + + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:VersionDialog") + + xVersionDialog = self.xUITest.getTopFocusWindow() + + versiondList = xVersionDialog.getChild("versions") + + text = "04/06/2020 15:18\t\tHELLO" + self.assertEqual(1, len(versiondList.getChildren())) + self.assertEqual(get_state_as_dict(versiondList.getChild('0'))["Text"].strip(), text) + + xDeleteBtn = xVersionDialog.getChild("delete") + xDeleteBtn.executeAction("CLICK", tuple()) + + self.assertEqual(0, len(versiondList.getChildren())) + + xCloseBtn = xVersionDialog.getChild("close") + xCloseBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests/watermark.py b/sw/qa/uitest/writer_tests/watermark.py new file mode 100644 index 000000000..9fb587aa7 --- /dev/null +++ b/sw/qa/uitest/writer_tests/watermark.py @@ -0,0 +1,66 @@ +# -*- 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 +import time +from uitest.debug import sleep +from uitest.uihelper.common import select_pos + + +class watermark(UITestCase): + + def test_insert_watermark(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:Watermark") + xDialog = self.xUITest.getTopFocusWindow() + xTextInput = xDialog.getChild("TextInput") + xAngle = xDialog.getChild("Angle") + xTransparency = xDialog.getChild("Transparency") + + xTextInput.executeAction("TYPE", mkPropertyValues({"TEXT":"Watermark"})) + xAngle.executeAction("UP", tuple()) + xTransparency.executeAction("UP", tuple()) + + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.ui_test.execute_dialog_through_command(".uno:Watermark") + xDialog = self.xUITest.getTopFocusWindow() + xTextInput = xDialog.getChild("TextInput") + xAngle = xDialog.getChild("Angle") + xTransparency = xDialog.getChild("Transparency") + + self.assertEqual(get_state_as_dict(xTextInput)["Text"], "Watermark") + self.assertEqual(get_state_as_dict(xAngle)["Text"], "46°") + self.assertEqual(get_state_as_dict(xTransparency)["Text"], "51%") + + xCancBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancBtn) + + self.ui_test.execute_dialog_through_command(".uno:Watermark") + xDialog = self.xUITest.getTopFocusWindow() + xTextInput = xDialog.getChild("TextInput") + xTextInput.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xTextInput.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.ui_test.execute_dialog_through_command(".uno:Watermark") + xDialog = self.xUITest.getTopFocusWindow() + xTextInput = xDialog.getChild("TextInput") + + self.assertEqual(get_state_as_dict(xTextInput)["Text"], "") + + xCancBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancBtn) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests/wordCount.py b/sw/qa/uitest/writer_tests/wordCount.py new file mode 100644 index 000000000..07a4c6934 --- /dev/null +++ b/sw/qa/uitest/writer_tests/wordCount.py @@ -0,0 +1,298 @@ +# -*- 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.debug import sleep +from uitest.uihelper.common import get_state_as_dict, type_text +from uitest.path import get_srcdir_url + +def get_url_for_data_file(file_name): + return get_srcdir_url() + "/sw/qa/uitest/writer_tests/data/" + file_name + +class writerWordCount(UITestCase): + + def test_word_count_dialog(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() + + type_text(xWriterEdit, "Test for word count dialog") #type text + xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "0", "END_POS": "8"})) #select two words + + self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog") + xDialog = self.xUITest.getTopFocusWindow() + + xselectwords = xDialog.getChild("selectwords") + xdocwords = xDialog.getChild("docwords") + xselectchars = xDialog.getChild("selectchars") + xdocchars = xDialog.getChild("docchars") + xselectcharsnospaces = xDialog.getChild("selectcharsnospaces") + xdoccharsnospaces = xDialog.getChild("doccharsnospaces") + xselectcjkchars = xDialog.getChild("selectcjkchars") + xdoccjkchars = xDialog.getChild("doccjkchars") + + self.assertEqual(get_state_as_dict(xselectwords)["Text"], "2") + self.assertEqual(get_state_as_dict(xdocwords)["Text"], "5") + self.assertEqual(get_state_as_dict(xselectchars)["Text"], "8") + self.assertEqual(get_state_as_dict(xdocchars)["Text"], "26") + self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "7") + self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "22") + self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0") + self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0") + xCloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() + + def test_tdf68347(self): + #Bug 68347 - Incorrect word count in a document with recorded changes + writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf68347.odt")) + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + document = self.ui_test.get_component() + + xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "24", "END_POS": "39"})) #select two words + + self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog") + xDialog = self.xUITest.getTopFocusWindow() + xselectwords = xDialog.getChild("selectwords") + xdocwords = xDialog.getChild("docwords") + xselectchars = xDialog.getChild("selectchars") + xdocchars = xDialog.getChild("docchars") + xselectcharsnospaces = xDialog.getChild("selectcharsnospaces") + xdoccharsnospaces = xDialog.getChild("doccharsnospaces") + xselectcjkchars = xDialog.getChild("selectcjkchars") + xdoccjkchars = xDialog.getChild("doccjkchars") + + self.assertEqual(get_state_as_dict(xselectwords)["Text"], "4") + self.assertEqual(get_state_as_dict(xdocwords)["Text"], "12") + self.assertEqual(get_state_as_dict(xselectchars)["Text"], "15") + self.assertEqual(get_state_as_dict(xdocchars)["Text"], "54") + self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "12") + #bug Bug 117703 Word Count: Wrong result for "Characters excluding spaces" + #self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "44") + self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0") + self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0") + xCloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() + + def test_tdf91100(self): + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + + self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() + + def test_tdf58050(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf58050.html")) + + self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog") + xDialog = self.xUITest.getTopFocusWindow() + + xselectwords = xDialog.getChild("selectwords") + xdocwords = xDialog.getChild("docwords") + xselectchars = xDialog.getChild("selectchars") + xdocchars = xDialog.getChild("docchars") + xselectcharsnospaces = xDialog.getChild("selectcharsnospaces") + xdoccharsnospaces = xDialog.getChild("doccharsnospaces") + xselectcjkchars = xDialog.getChild("selectcjkchars") + xdoccjkchars = xDialog.getChild("doccjkchars") + + self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0") + self.assertEqual(get_state_as_dict(xdocwords)["Text"], "3") + self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0") + self.assertEqual(get_state_as_dict(xdocchars)["Text"], "14") + self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0") + self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "12") + self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0") + self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0") + xCloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() + + def test_word_count_interpunction_counted_tdf56975_a(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() + #Open writer, enter "Testing one two! Test?" + type_text(xWriterEdit, "Testing one two! Test?") + #-> LO says: 4 words. SUCCESS! :) + self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog") + xDialog = self.xUITest.getTopFocusWindow() + + xselectwords = xDialog.getChild("selectwords") + xdocwords = xDialog.getChild("docwords") + xselectchars = xDialog.getChild("selectchars") + xdocchars = xDialog.getChild("docchars") + xselectcharsnospaces = xDialog.getChild("selectcharsnospaces") + xdoccharsnospaces = xDialog.getChild("doccharsnospaces") + xselectcjkchars = xDialog.getChild("selectcjkchars") + xdoccjkchars = xDialog.getChild("doccjkchars") + + self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0") + self.assertEqual(get_state_as_dict(xdocwords)["Text"], "4") + self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0") + self.assertEqual(get_state_as_dict(xdocchars)["Text"], "22") + self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0") + self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "19") + self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0") + self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0") + xCloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() + + def test_word_count_interpunction_counted_tdf56975_b(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() + #1. Create a new text document. + #2. Type-in the words: + # This is a test sentence. + type_text(xWriterEdit, "This is a test sentence.") + #3. Open the word count dialogue. + # Word count in both, dialogue and status line, shows 5 words. + self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog") + xDialog = self.xUITest.getTopFocusWindow() + + xselectwords = xDialog.getChild("selectwords") + xdocwords = xDialog.getChild("docwords") + xselectchars = xDialog.getChild("selectchars") + xdocchars = xDialog.getChild("docchars") + xselectcharsnospaces = xDialog.getChild("selectcharsnospaces") + xdoccharsnospaces = xDialog.getChild("doccharsnospaces") + xselectcjkchars = xDialog.getChild("selectcjkchars") + xdoccjkchars = xDialog.getChild("doccjkchars") + + self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0") + self.assertEqual(get_state_as_dict(xdocwords)["Text"], "5") + self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0") + self.assertEqual(get_state_as_dict(xdocchars)["Text"], "24") + self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0") + self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "20") + self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0") + self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0") + xCloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) + #4. Select the space between 'a' and 'test'. + xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "9", "END_POS": "10"})) + #5. Replace selection by a non-breaking space by pressing Shift+Ctrl+Space. Don't move the cursor. + self.xUITest.executeCommand(".uno:InsertNonBreakingSpace") + # Word count in dialogue shows 4 words, whereas in the status line it shows 5 words. + self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog") + xDialog = self.xUITest.getTopFocusWindow() + + xselectwords = xDialog.getChild("selectwords") + xdocwords = xDialog.getChild("docwords") + xselectchars = xDialog.getChild("selectchars") + xdocchars = xDialog.getChild("docchars") + xselectcharsnospaces = xDialog.getChild("selectcharsnospaces") + xdoccharsnospaces = xDialog.getChild("doccharsnospaces") + xselectcjkchars = xDialog.getChild("selectcjkchars") + xdoccjkchars = xDialog.getChild("doccjkchars") + + self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0") + self.assertEqual(get_state_as_dict(xdocwords)["Text"], "5") + self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0") + self.assertEqual(get_state_as_dict(xdocchars)["Text"], "24") + self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0") + self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "20") + self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0") + self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0") + xCloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) + #6. Move the cursor by pressing Left. + self.xUITest.executeCommand(".uno:GoLeft") + # Word count in both, dialogue and status line, shows 5 words. + self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog") + xDialog = self.xUITest.getTopFocusWindow() + + xselectwords = xDialog.getChild("selectwords") + xdocwords = xDialog.getChild("docwords") + xselectchars = xDialog.getChild("selectchars") + xdocchars = xDialog.getChild("docchars") + xselectcharsnospaces = xDialog.getChild("selectcharsnospaces") + xdoccharsnospaces = xDialog.getChild("doccharsnospaces") + xselectcjkchars = xDialog.getChild("selectcjkchars") + xdoccjkchars = xDialog.getChild("doccjkchars") + + self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0") + self.assertEqual(get_state_as_dict(xdocwords)["Text"], "5") + self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0") + self.assertEqual(get_state_as_dict(xdocchars)["Text"], "24") + self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0") + self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "20") + self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0") + self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0") + xCloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) + self.ui_test.close_doc() + + def test_tdf51816(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf51816.odt")) + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + document = self.ui_test.get_component() + #1. Open attached document + #2. Tools> Word count + self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog") + xDialog = self.xUITest.getTopFocusWindow() + xselectwords = xDialog.getChild("selectwords") + xdocwords = xDialog.getChild("docwords") + xselectchars = xDialog.getChild("selectchars") + xdocchars = xDialog.getChild("docchars") + xselectcharsnospaces = xDialog.getChild("selectcharsnospaces") + xdoccharsnospaces = xDialog.getChild("doccharsnospaces") + xselectcjkchars = xDialog.getChild("selectcjkchars") + xdoccjkchars = xDialog.getChild("doccjkchars") + + #3. Click after "At nunc" then <Ctrl><Shift><Left> + self.xUITest.executeCommand(".uno:GoRight") + self.xUITest.executeCommand(".uno:GoRight") + self.xUITest.executeCommand(".uno:GoRight") + self.xUITest.executeCommand(".uno:GoRight") + self.xUITest.executeCommand(".uno:GoRight") + self.xUITest.executeCommand(".uno:GoRight") + self.xUITest.executeCommand(".uno:GoRight") + self.xUITest.executeCommand(".uno:WordLeftSel") + + #needs to wait, because Word count dialog is already open and it takes time to refresh the counter + #Expected result : Words 1 & Characters 4 #Actual result : Words 0 & Characters 0 + self.ui_test.wait_until_property_is_updated(xselectwords, "Text", "1") + self.assertEqual(get_state_as_dict(xselectwords)["Text"], "1") + self.assertEqual(get_state_as_dict(xselectchars)["Text"], "4") + + #4. Click after "At nunc" then <Shift><Home> + self.xUITest.executeCommand(".uno:StartOfParaSel") + + #needs to wait, because Word count dialog is already open and it takes time to refresh the counter + #Expected result : Words 2 & Characters 7 & excluding space 6 #Actual result : Words 0 & Characters 0 + self.ui_test.wait_until_property_is_updated(xselectwords, "Text", "2") + self.assertEqual(get_state_as_dict(xselectwords)["Text"], "2") + self.assertEqual(get_state_as_dict(xselectchars)["Text"], "7") + + self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "6") + + xCloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests2/asianPhoneticGuide.py b/sw/qa/uitest/writer_tests2/asianPhoneticGuide.py new file mode 100644 index 000000000..4722541e6 --- /dev/null +++ b/sw/qa/uitest/writer_tests2/asianPhoneticGuide.py @@ -0,0 +1,50 @@ +# -*- 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 +import time +from uitest.debug import sleep +from uitest.uihelper.common import select_pos + +class asianPhoneticGuide(UITestCase): + + def test_asian_phonetic_guide(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_modeless_dialog_through_command(".uno:RubyDialog") + xDialog = self.xUITest.getTopFocusWindow() + + xLeft1ED = xDialog.getChild("Left1ED") + xRight1ED = xDialog.getChild("Right1ED") + xadjustlb = xDialog.getChild("adjustlb") + xpositionlb = xDialog.getChild("positionlb") + xstylelb = xDialog.getChild("stylelb") + + xLeft1ED.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) + xRight1ED.executeAction("TYPE", mkPropertyValues({"TEXT":"w"})) + props = {"TEXT": "Right"} + actionProps = mkPropertyValues(props) + xadjustlb.executeAction("SELECT", actionProps) + props2 = {"TEXT": "Right"} + actionProps2 = mkPropertyValues(props2) + xpositionlb.executeAction("SELECT", actionProps2) + props3 = {"TEXT": "Quotation"} + actionProps3 = mkPropertyValues(props3) + xstylelb.executeAction("SELECT", actionProps3) + + xApplyBtn = xDialog.getChild("ok") + xApplyBtn.executeAction("CLICK", tuple()) + + xCloseBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.assertEqual(document.Text.String[0:1], "a") + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests2/bookmark.py b/sw/qa/uitest/writer_tests2/bookmark.py new file mode 100644 index 000000000..9cbf82c29 --- /dev/null +++ b/sw/qa/uitest/writer_tests2/bookmark.py @@ -0,0 +1,139 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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 +import time +from uitest.uihelper.common import get_state_as_dict, type_text +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.debug import sleep +#test bookmark dialog +class bookmarkDialog(UITestCase): + + def test_bookmark_dialog(self): + + self.ui_test.create_doc_in_start_center("writer") + + self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") + xBookDlg = self.xUITest.getTopFocusWindow() + xInsertBtn = xBookDlg.getChild("insert") + xInsertBtn.executeAction("CLICK", tuple()) # first bookmark + + self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") + xBookDlg = self.xUITest.getTopFocusWindow() + xInsertBtn = xBookDlg.getChild("insert") + xBmk = xBookDlg.getChild("bookmarks") + self.assertEqual(get_state_as_dict(xBmk)["VisibleCount"], "1") #check for 1st bookmark exist + xInsertBtn.executeAction("CLICK", tuple()) # add 2nd bookmark + + self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") + xBookDlg = self.xUITest.getTopFocusWindow() + xCloseBtn = xBookDlg.getChild("close") + xCloseBtn.executeAction("CLICK", tuple()) # close + + self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") + xBookDlg = self.xUITest.getTopFocusWindow() + xBmk = xBookDlg.getChild("bookmarks") + self.assertEqual(get_state_as_dict(xBmk)["VisibleCount"], "2") #check for 2 bookmarks + xCloseBtn = xBookDlg.getChild("close") + xCloseBtn.executeAction("CLICK", tuple()) # close dialog + +#now delete one bookmark + self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") + xBookDlg = self.xUITest.getTopFocusWindow() + xBmk = xBookDlg.getChild("bookmarks") + xSecondListEntry = xBmk.getChild("1") # select second bookmark + xSecondListEntry.executeAction("SELECT", tuple()) + xDelBtn = xBookDlg.getChild("delete") + xDelBtn.executeAction("CLICK", tuple()) # delete one bookmark + xCloseBtn = xBookDlg.getChild("close") + xCloseBtn.executeAction("CLICK", tuple()) # close dialog + + self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") + xBookDlg = self.xUITest.getTopFocusWindow() + xCloseBtn = xBookDlg.getChild("close") + xBmk2 = xBookDlg.getChild("bookmarks") + self.assertEqual(get_state_as_dict(xBmk2)["VisibleCount"], "1") #check for 1 bookmark + xCloseBtn.executeAction("CLICK", tuple()) # now we have only 1 bookmark + + self.ui_test.close_doc() + + + + def test_bookmark_dialog_rename(self): + self.ui_test.create_doc_in_start_center("writer") + + self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") + xBookDlg = self.xUITest.getTopFocusWindow() + xInsertBtn = xBookDlg.getChild("insert") + xInsertBtn.executeAction("CLICK", tuple()) # first bookmark + + self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") + xBookDlg = self.xUITest.getTopFocusWindow() + xBmk = xBookDlg.getChild("bookmarks") + xFirstListEntry = xBmk.getChild("0") # select first bookmark + xFirstListEntry.executeAction("SELECT", tuple()) + xRenameBtn = xBookDlg.getChild("rename") + + def handle_rename_dlg(dialog): #handle rename dialog - need special handling + + xNewNameTxt=dialog.getChild("entry") + xNewNameTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"newname"})) + xOKBtn = dialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.execute_blocking_action(xRenameBtn.executeAction, args=('CLICK', ()), + dialog_handler=handle_rename_dlg) #close rename dialog with OK button + + xBookDlg = self.xUITest.getTopFocusWindow() + x1stListEntry = xBmk.getChild("O") # select first bookmark - name "newname" + x1stListEntry.executeAction("SELECT", tuple()) + + self.assertEqual(get_state_as_dict(x1stListEntry)["Text"], "1\tnewname\t\tNo\t") #check the new name "newname" + + xCloseBtn = xBookDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() + + def test_bookmark_dialog_goto(self): + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") + xBookDlg = self.xUITest.getTopFocusWindow() + xInsertBtn = xBookDlg.getChild("insert") + xInsertBtn.executeAction("CLICK", tuple()) # first bookmark + + + type_text(xWriterEdit, "Test for bookmark") + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + type_text(xWriterEdit, "Test2 for bookmark") + + + self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") + xBookDlg = self.xUITest.getTopFocusWindow() + xInsertBtn = xBookDlg.getChild("insert") + xInsertBtn.executeAction("CLICK", tuple()) # second bookmark + + self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") + xBookDlg = self.xUITest.getTopFocusWindow() + xBmk = xBookDlg.getChild("bookmarks") + xFirstListEntry = xBmk.getChild("0") # select first bookmark + xFirstListEntry.executeAction("SELECT", tuple()) + xGoToBtn = xBookDlg.getChild("goto") + xGoToBtn.executeAction("CLICK", tuple()) # goto 1st bookmark + xCloseBtn = xBookDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) + + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests2/deleteAllComments.py b/sw/qa/uitest/writer_tests2/deleteAllComments.py new file mode 100644 index 000000000..ad9e0c823 --- /dev/null +++ b/sw/qa/uitest/writer_tests2/deleteAllComments.py @@ -0,0 +1,54 @@ +# +# 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 +import time +from uitest.uihelper.common import get_state_as_dict, type_text + +class DeleteAllComments(UITestCase): + + def test_comments_delete(self): + + self.ui_test.create_doc_in_start_center("writer") + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + + type_text(xWriterEdit, "Test LibreOffice") + + document = self.ui_test.get_component() + + selection = self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:InsertAnnotation") + cursor = document.getCurrentController().getViewCursor() + xWriterDoc.executeAction("LEFT", tuple()) + type_text(xWriterEdit, "EEEEE") + self.xUITest.executeCommand(".uno:InsertAnnotation") + self.xUITest.executeCommand(".uno:DeleteAllNotes") + self.assertEqual(document.Text.String[0:4], "Test") + + self.ui_test.close_doc() + + def test_comment_trackchanges(self): +#tdf111524 + self.ui_test.create_doc_in_start_center("writer") + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + type_text(xWriterEdit, "foo") + + document = self.ui_test.get_component() + + selection = self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:InsertAnnotation") + self.xUITest.executeCommand(".uno:TrackChanges") + self.xUITest.executeCommand(".uno:DeleteAllNotes") + + + + self.ui_test.close_doc() diff --git a/sw/qa/uitest/writer_tests2/documentProperties.py b/sw/qa/uitest/writer_tests2/documentProperties.py new file mode 100644 index 000000000..40366d230 --- /dev/null +++ b/sw/qa/uitest/writer_tests2/documentProperties.py @@ -0,0 +1,118 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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 +import time +from uitest.debug import sleep +from uitest.uihelper.common import select_pos + + +class documentProperties(UITestCase): + + def test_open_documentProperties_writer(self): + self.ui_test.create_doc_in_start_center("writer") + self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") + xDialog = self.xUITest.getTopFocusWindow() + xResetBtn = xDialog.getChild("reset") + xResetBtn.executeAction("CLICK", tuple()) + + xUserDataCheckbox = xDialog.getChild("userdatacb") # apply user data + xUserDataCheckbox.executeAction("CLICK", tuple()) + xThumbSaveCheckbox = xDialog.getChild("thumbnailsavecb") # save preview image with document + xThumbSaveCheckbox.executeAction("CLICK", tuple()) + +#digital signature + xDigSignBtn = xDialog.getChild("signature") + + def handle_sign_dlg(dialog): + xNoBtn = dialog.getChild("no") + self.ui_test.close_dialog_through_button(xNoBtn) + + self.ui_test.execute_blocking_action(xDigSignBtn.executeAction, args=('CLICK', ()), + dialog_handler=handle_sign_dlg) + + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") #tab Description + + xTitleText = xDialog.getChild("title") + xTitleText.executeAction("TYPE", mkPropertyValues({"TEXT":"Title text"})) + xSubjectText = xDialog.getChild("subject") + xSubjectText.executeAction("TYPE", mkPropertyValues({"TEXT":"Subject text"})) + xKeywordsText = xDialog.getChild("keywords") + xKeywordsText.executeAction("TYPE", mkPropertyValues({"TEXT":"Keywords text"})) + xCommentsText = xDialog.getChild("comments") + xCommentsText.executeAction("TYPE", mkPropertyValues({"TEXT":"Comments text"})) + + +#Font tab + select_pos(xTabs, "4") #tab Fonts + xFontEmbedCheckbox = xDialog.getChild("embedFonts") + xFontEmbedCheckbox.executeAction("CLICK", tuple()) + +#Security tab + select_pos(xTabs, "3") #tab Security + xReadOnlyCheckbox = xDialog.getChild("readonly") + xReadOnlyCheckbox.executeAction("CLICK", tuple()) + xRecordChangesCheckbox = xDialog.getChild("recordchanges") + xRecordChangesCheckbox.executeAction("CLICK", tuple()) + xProtectBtn = xDialog.getChild("protect") + def handle_protect_dlg(dialog): + xOkBtn = dialog.getChild("ok") + xPasswordText = dialog.getChild("pass1ed") + xPasswordText.executeAction("TYPE", mkPropertyValues({"TEXT":"password"})) + xConfirmText = dialog.getChild("confirm1ed") + xConfirmText.executeAction("TYPE", mkPropertyValues({"TEXT":"password"})) + self.ui_test.close_dialog_through_button(xOkBtn) + + self.ui_test.execute_blocking_action(xProtectBtn.executeAction, args=('CLICK', ()), + dialog_handler=handle_protect_dlg) + + select_pos(xTabs, "2") #tab Custom properties +#add custom properties ------>>>>>>>>>>> not supported + xAddBtn = xDialog.getChild("add") + xAddBtn.executeAction("CLICK", tuple()) + + select_pos(xTabs, "5") #tab Statistics + xUpdateBtn = xDialog.getChild("update") + xUpdateBtn.executeAction("CLICK", tuple()) + + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) +#now open the dialog again and read the properties + self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") + xDialog = self.xUITest.getTopFocusWindow() + xTitleText = xDialog.getChild("title") + xSubjectText = xDialog.getChild("subject") + xKeywordsText = xDialog.getChild("keywords") + xCommentsText = xDialog.getChild("comments") + xReadOnlyCheckbox = xDialog.getChild("readonly") + xRecordChangesCheckbox = xDialog.getChild("recordchanges") + xFontEmbedCheckbox = xDialog.getChild("embedFonts") + xUserDataCheckbox = xDialog.getChild("userdatacb") + xThumbSaveCheckbox = xDialog.getChild("thumbnailsavecb") + self.assertEqual(get_state_as_dict(xTitleText)["Text"], "Title text") + self.assertEqual(get_state_as_dict(xSubjectText)["Text"], "Subject text") + self.assertEqual(get_state_as_dict(xKeywordsText)["Text"], "Keywords text") + self.assertEqual(get_state_as_dict(xReadOnlyCheckbox)["Selected"], "true") + self.assertEqual(get_state_as_dict(xRecordChangesCheckbox)["Selected"], "true") + self.assertEqual(get_state_as_dict(xReadOnlyCheckbox)["Selected"], "true") + self.assertEqual(get_state_as_dict(xFontEmbedCheckbox)["Selected"], "true") + self.assertEqual(get_state_as_dict(xUserDataCheckbox)["Selected"], "false") + self.assertEqual(get_state_as_dict(xThumbSaveCheckbox)["Selected"], "false") + self.assertEqual(get_state_as_dict(xCommentsText)["Text"], "Comments text") + xResetBtn = xDialog.getChild("reset") + xResetBtn.executeAction("CLICK", tuple()) + xCancBtn = xDialog.getChild("cancel") + xCancBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests2/exchangeDatabase.py b/sw/qa/uitest/writer_tests2/exchangeDatabase.py new file mode 100644 index 000000000..d255bd152 --- /dev/null +++ b/sw/qa/uitest/writer_tests2/exchangeDatabase.py @@ -0,0 +1,58 @@ +# -*- 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 +import time +from uitest.uihelper.common import get_state_as_dict, type_text +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.debug import sleep + +class exchangeDB(UITestCase): + + def test_exchange_database(self): + + self.ui_test.create_doc_in_start_center("writer") + + self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField") + xExDBDlg = self.xUITest.getTopFocusWindow() + xCloseBtn = xExDBDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() + + def test_exchange_database2(self): + + self.ui_test.create_doc_in_start_center("writer") + + self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField") + xExDBDlg = self.xUITest.getTopFocusWindow() + xTreelist = xExDBDlg.getChild("availablelb") + + xLabeldb = xExDBDlg.getChild("dbnameft") + self.assertEqual(get_state_as_dict(xLabeldb)["Text"], "[None]") + + xTreeEntry = xTreelist.getChild('0') #Available Databases + xTreeEntry.executeAction("EXPAND", tuple()) #Click on the Bibliography + xTreeEntry.executeAction("COLLAPSE", tuple()) + xTreeEntry.executeAction("EXPAND", tuple()) + xTreeEntry2 = xTreeEntry.getChild('0') #Available Databases + xTreeEntry2.executeAction("SELECT", tuple()) #Click on the biblio + + xDefineBtn = xExDBDlg.getChild("ok") + xDefineBtn.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField") + xExDBDlg = self.xUITest.getTopFocusWindow() + xLabeldb = xExDBDlg.getChild("dbnameft") + self.assertEqual(get_state_as_dict(xLabeldb)["Text"], "Bibliography.biblio") + + xCloseBtn = xExDBDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py new file mode 100644 index 000000000..0d245b858 --- /dev/null +++ b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py @@ -0,0 +1,293 @@ +# -*- 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 + +import time +from uitest.debug import sleep +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import select_pos + +class formatBulletsNumbering(UITestCase): + + def test_bullets_and_numbering_dialog_tab_position(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialog = self.xUITest.getTopFocusWindow() + xPages = xDialog.getChild("pages") + xWriterEntry = xPages.getChild('3') # Writer + xWriterEntry.executeAction("EXPAND", tuple()) + xWriterGeneralEntry = xWriterEntry.getChild('0') + xWriterGeneralEntry.executeAction("SELECT", tuple()) #General - set millimeters + xMetric = xDialog.getChild("metric") + props = {"TEXT": "Millimeter"} + actionProps = mkPropertyValues(props) + xMetric.executeAction("SELECT", actionProps) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xalignedatmf = xDialog.getChild("alignedatmf") + xnum2alignlb = xDialog.getChild("num2alignlb") + xatmf = xDialog.getChild("atmf") + xindentatmf = xDialog.getChild("indentatmf") + xokbtn = xDialog.getChild("ok") + + xalignedatmf.executeAction("UP", tuple()) + props = {"TEXT": "Centered"} + actionProps = mkPropertyValues(props) + xnum2alignlb.executeAction("SELECT", actionProps) + xatmf.executeAction("UP", tuple()) + xindentatmf.executeAction("UP", tuple()) + + self.ui_test.close_dialog_through_button(xokbtn) + + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xalignedatmf = xDialog.getChild("alignedatmf") + xnum2alignlb = xDialog.getChild("num2alignlb") + xatmf = xDialog.getChild("atmf") + xindentatmf = xDialog.getChild("indentatmf") + + self.assertEqual(get_state_as_dict(xalignedatmf)["Text"], "6.5 mm") + self.assertEqual(get_state_as_dict(xnum2alignlb)["SelectEntryText"], "Centered") + self.assertEqual(get_state_as_dict(xatmf)["Text"], "12.8 mm") + self.assertEqual(get_state_as_dict(xindentatmf)["Text"], "12.8 mm") + + xcancbtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancbtn) + + self.ui_test.close_doc() + + def test_bullets_and_numbering_dialog_tab_position2(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xnumfollowedbylb = xDialog.getChild("numfollowedbylb") + props = {"TEXT": "Space"} + actionProps = mkPropertyValues(props) + xnumfollowedbylb.executeAction("SELECT", actionProps) + + xokbtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xokbtn) + + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xnumfollowedbylb = xDialog.getChild("numfollowedbylb") + self.assertEqual(get_state_as_dict(xnumfollowedbylb)["SelectEntryText"], "Space") + + xcancbtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancbtn) + + self.ui_test.close_doc() + + def test_bullets_and_numbering_dialog_tab_customize(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + xnumfmtlb = xDialog.getChild("numfmtlb") + xstartat = xDialog.getChild("startat") + xcharstyle = xDialog.getChild("charstyle") + xprefix = xDialog.getChild("prefix") + xsuffix = xDialog.getChild("suffix") + xallsame = xDialog.getChild("allsame") + + props = {"TEXT": "A, B, C, ..."} + actionProps = mkPropertyValues(props) + xnumfmtlb.executeAction("SELECT", actionProps) + xstartat.executeAction("UP", tuple()) + props2 = {"TEXT": "Bullets"} + actionProps2 = mkPropertyValues(props2) + xcharstyle.executeAction("SELECT", actionProps2) + xprefix.executeAction("TYPE", mkPropertyValues({"TEXT":"o"})) + xsuffix.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xsuffix.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) + xallsame.executeAction("CLICK", tuple()) + + xokbtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xokbtn) + + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + xnumfmtlb = xDialog.getChild("numfmtlb") + xstartat = xDialog.getChild("startat") + xcharstyle = xDialog.getChild("charstyle") + xprefix = xDialog.getChild("prefix") + xsuffix = xDialog.getChild("suffix") + xallsame = xDialog.getChild("allsame") + + self.assertEqual(get_state_as_dict(xnumfmtlb)["SelectEntryText"], "A, B, C, ...") + self.assertEqual(get_state_as_dict(xstartat)["Text"], "2") + self.assertEqual(get_state_as_dict(xcharstyle)["SelectEntryText"], "Bullets") + self.assertEqual(get_state_as_dict(xprefix)["Text"], "o") + self.assertEqual(get_state_as_dict(xsuffix)["Text"], "a") + self.assertEqual(get_state_as_dict(xallsame)["Selected"], "true") + + xcancbtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancbtn) + + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + + xremovebtn = xDialog.getChild("user") + self.ui_test.close_dialog_through_button(xremovebtn) #remove new settings, back to default + + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + xnumfmtlb = xDialog.getChild("numfmtlb") + xstartat = xDialog.getChild("startat") + xcharstyle = xDialog.getChild("charstyle") + xprefix = xDialog.getChild("prefix") + xsuffix = xDialog.getChild("suffix") + xallsame = xDialog.getChild("allsame") + + self.assertEqual(get_state_as_dict(xnumfmtlb)["SelectEntryText"], "1, 2, 3, ...") + self.assertEqual(get_state_as_dict(xstartat)["Text"], "1") + self.assertEqual(get_state_as_dict(xcharstyle)["SelectEntryText"], "None") + self.assertEqual(get_state_as_dict(xprefix)["Text"], "") + self.assertEqual(get_state_as_dict(xsuffix)["Text"], ".") + self.assertEqual(get_state_as_dict(xallsame)["Selected"], "false") + + xcancbtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancbtn) + + self.ui_test.close_doc() + + def test_bullets_and_numbering_tab_move(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialog = self.xUITest.getTopFocusWindow() + xPages = xDialog.getChild("pages") + xWriterEntry = xPages.getChild('3') # Writer + xWriterEntry.executeAction("EXPAND", tuple()) + xWriterGeneralEntry = xWriterEntry.getChild('0') + xWriterGeneralEntry.executeAction("SELECT", tuple()) #General - set millimeters + xMetric = xDialog.getChild("metric") + props = {"TEXT": "Millimeter"} + actionProps = mkPropertyValues(props) + xMetric.executeAction("SELECT", actionProps) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xindentatmf = xDialog.getChild("indentatmf") + indentValue = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] + + xokbtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xokbtn) #create bullets + + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) #TAB to move indent right + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xindentatmf = xDialog.getChild("indentatmf") + indentValue2 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] + self.assertEqual(indentValue < indentValue2 , True) + xcancbtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancbtn) + + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xindentatmf = xDialog.getChild("indentatmf") + indentValue3 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] + self.assertEqual(indentValue == indentValue3 , True) + xcancbtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancbtn) + + self.ui_test.close_doc() + + def test_bullets_and_numbering_button_move(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialog = self.xUITest.getTopFocusWindow() + xPages = xDialog.getChild("pages") + xWriterEntry = xPages.getChild('3') # Writer + xWriterEntry.executeAction("EXPAND", tuple()) + xWriterGeneralEntry = xWriterEntry.getChild('0') + xWriterGeneralEntry.executeAction("SELECT", tuple()) #General - set millimeters + xMetric = xDialog.getChild("metric") + props = {"TEXT": "Millimeter"} + actionProps = mkPropertyValues(props) + xMetric.executeAction("SELECT", actionProps) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xindentatmf = xDialog.getChild("indentatmf") + indentValue = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] + + xokbtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xokbtn) #create bullets + + self.xUITest.executeCommand(".uno:DecrementSubLevels") + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xindentatmf = xDialog.getChild("indentatmf") + indentValue2 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] + self.assertEqual(indentValue < indentValue2 , True) + xcancbtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancbtn) + + self.xUITest.executeCommand(".uno:IncrementLevel") + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xindentatmf = xDialog.getChild("indentatmf") + indentValue3 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] + self.assertEqual(indentValue == indentValue3 , True) + xcancbtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancbtn) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests2/formatCharacter.py b/sw/qa/uitest/writer_tests2/formatCharacter.py new file mode 100644 index 000000000..e1da1d2cb --- /dev/null +++ b/sw/qa/uitest/writer_tests2/formatCharacter.py @@ -0,0 +1,287 @@ +# -*- 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 + +import time +from uitest.debug import sleep +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import select_pos + +class formatCharacter(UITestCase): + + def test_format_character_tab_font(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + + xSizeFont = xDialog.getChild("westsizelb-cjk") + xSizeFontEast = xDialog.getChild("eastsizelb") + xSizeFontCTL = xDialog.getChild("ctlsizelb") + xLangFont = xDialog.getChild("westlanglb-cjk") + xLangFontEast = xDialog.getChild("eastlanglb") + xLangFontCTL = xDialog.getChild("ctllanglb") + + xSizeFont.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSizeFont.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18 + xSizeFontEast.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSizeFontEast.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18 + xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18 + select_pos(xLangFont, "0") + select_pos(xLangFontEast, "0") + select_pos(xLangFontCTL, "0") + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xSizeFont = xDialog.getChild("westsizelb-cjk") + xSizeFontEast = xDialog.getChild("eastsizelb") + xSizeFontCTL = xDialog.getChild("ctlsizelb") + xLangFont = xDialog.getChild("westlanglb-cjk") + xLangFontEast = xDialog.getChild("eastlanglb") + xLangFontCTL = xDialog.getChild("ctllanglb") + + self.assertEqual(get_state_as_dict(xSizeFont)["Text"], "18 pt") + self.assertEqual(get_state_as_dict(xSizeFontEast)["Text"], "18 pt") + self.assertEqual(get_state_as_dict(xSizeFontCTL)["Text"], "18 pt") #check font size + self.assertEqual(get_state_as_dict(xLangFont)["Text"], "[None]") + self.assertEqual(get_state_as_dict(xLangFontEast)["SelectEntryText"], "[None]") + self.assertEqual(get_state_as_dict(xLangFontCTL)["SelectEntryText"], "[None]") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.close_doc() + + def test_format_character_tab_font_effects(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + + xEffects = xDialog.getChild("effectslb") + xRelief = xDialog.getChild("relieflb") + xHidden = xDialog.getChild("hiddencb") + xOverline = xDialog.getChild("overlinelb") + xStrikeout = xDialog.getChild("strikeoutlb") + xUnderline = xDialog.getChild("underlinelb") + xEmphasis = xDialog.getChild("emphasislb") + xPosition = xDialog.getChild("positionlb") + + select_pos(xEffects, "1") + select_pos(xRelief, "1") + xHidden.executeAction("CLICK", tuple()) + select_pos(xOverline, "1") + select_pos(xStrikeout, "1") + select_pos(xUnderline, "1") + select_pos(xEmphasis, "1") + select_pos(xPosition, "1") + + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + + xEffects = xDialog.getChild("effectslb") + xRelief = xDialog.getChild("relieflb") + xHidden = xDialog.getChild("hiddencb") + xOverline = xDialog.getChild("overlinelb") + xStrikeout = xDialog.getChild("strikeoutlb") + xUnderline = xDialog.getChild("underlinelb") + xEmphasis = xDialog.getChild("emphasislb") + xPosition = xDialog.getChild("positionlb") + + self.assertEqual(get_state_as_dict(xEffects)["SelectEntryText"], "UPPERCASE") + self.assertEqual(get_state_as_dict(xRelief)["SelectEntryText"], "Embossed") + self.assertEqual(get_state_as_dict(xHidden)["Selected"], "true") + self.assertEqual(get_state_as_dict(xOverline)["SelectEntryText"], "Single") + self.assertEqual(get_state_as_dict(xStrikeout)["SelectEntryText"], "Single") + self.assertEqual(get_state_as_dict(xUnderline)["SelectEntryText"], "Single") + self.assertEqual(get_state_as_dict(xEmphasis)["SelectEntryText"], "Dot") + self.assertEqual(get_state_as_dict(xPosition)["SelectEntryText"], "Below text") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.close_doc() + + def test_format_character_tab_hyperlink(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + + xURL = xDialog.getChild("urled") + xURL.executeAction("TYPE", mkPropertyValues({"TEXT":"libreoffice.org"})) + xTexted = xDialog.getChild("texted") + xTexted.executeAction("TYPE", mkPropertyValues({"TEXT":"LibreOffice"})) + xName = xDialog.getChild("nameed") + xName.executeAction("TYPE", mkPropertyValues({"TEXT":"hyperlink"})) + + xVisited = xDialog.getChild("visitedlb") + props = {"TEXT": "Bullets"} + actionProps = mkPropertyValues(props) + xVisited.executeAction("SELECT", actionProps) + xUnVisited = xDialog.getChild("unvisitedlb") + props = {"TEXT": "Bullets"} + actionProps = mkPropertyValues(props) + xUnVisited.executeAction("SELECT", actionProps) + + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + self.xUITest.executeCommand(".uno:GoLeft") + self.assertEqual(document.Text.String[0:11], "LibreOffice") + + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xURL = xDialog.getChild("urled") + xTexted = xDialog.getChild("texted") + xName = xDialog.getChild("nameed") + xVisited = xDialog.getChild("visitedlb") + xUnVisited = xDialog.getChild("unvisitedlb") + + self.assertEqual(get_state_as_dict(xURL)["Text"], "http://libreoffice.org/") + self.assertEqual(get_state_as_dict(xTexted)["Text"], "LibreOffice") + self.assertEqual(get_state_as_dict(xName)["Text"], "hyperlink") + self.assertEqual(get_state_as_dict(xVisited)["SelectEntryText"], "Bullets") + self.assertEqual(get_state_as_dict(xUnVisited)["SelectEntryText"], "Bullets") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + self.ui_test.close_doc() + + def test_format_character_tab_asian_layout(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "3") + + xTwolines = xDialog.getChild("twolines") + xTwolines.executeAction("CLICK", tuple()) + + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "3") + xTwolines = xDialog.getChild("twolines") + + self.assertEqual(get_state_as_dict(xTwolines)["Selected"], "true") + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + self.ui_test.close_doc() + + def test_format_character_tab_position(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + + xSuperscript = xDialog.getChild("superscript") + xRelFontSize = xDialog.getChild("fontsizesb") + x90deg = xDialog.getChild("90deg") + xScalewidth = xDialog.getChild("scalewidthsb") + xKerning = xDialog.getChild("kerningsb") + xPairKerning = xDialog.getChild("pairkerning") + xFitToLine = xDialog.getChild("fittoline") + + xSuperscript.executeAction("CLICK", tuple()) + xRelFontSize.executeAction("UP", tuple()) + x90deg.executeAction("CLICK", tuple()) + xScalewidth.executeAction("UP", tuple()) + xKerning.executeAction("UP", tuple()) + xPairKerning.executeAction("CLICK", tuple()) + xFitToLine.executeAction("CLICK", tuple()) + + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + xSuperscript = xDialog.getChild("superscript") + xRelFontSize = xDialog.getChild("fontsizesb") + x90deg = xDialog.getChild("90deg") + xScalewidth = xDialog.getChild("scalewidthsb") + xKerning = xDialog.getChild("kerningsb") + xPairKerning = xDialog.getChild("pairkerning") + xFitToLine = xDialog.getChild("fittoline") + + self.assertEqual(get_state_as_dict(xSuperscript)["Checked"], "true") + self.assertEqual(get_state_as_dict(x90deg)["Checked"], "true") + self.assertEqual(get_state_as_dict(xScalewidth)["Text"], "100%") + self.assertEqual(get_state_as_dict(xKerning)["Text"], "0.1 pt") + self.assertEqual(get_state_as_dict(xPairKerning)["Selected"], "false") + self.assertEqual(get_state_as_dict(xFitToLine)["Selected"], "true") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.close_doc() + + def test_format_character_tab_position_scalewidthsb(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + + xScalewidth = xDialog.getChild("scalewidthsb") + xScalewidth.executeAction("UP", tuple()) + + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + xScalewidth = xDialog.getChild("scalewidthsb") + self.assertEqual(get_state_as_dict(xScalewidth)["Text"], "101%") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests2/formatParagraph.py b/sw/qa/uitest/writer_tests2/formatParagraph.py new file mode 100644 index 000000000..cd07db9a1 --- /dev/null +++ b/sw/qa/uitest/writer_tests2/formatParagraph.py @@ -0,0 +1,685 @@ +# -*- 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 + +import time +from uitest.debug import sleep +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import select_pos + +class formatParagraph(UITestCase): + + def test_format_paragraph_tab_indents_spacing(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + + xBeforeText = xDialog.getChild("spinED_LEFTINDENT") + xAfterText = xDialog.getChild("spinED_RIGHTINDENT") + xFirstLine = xDialog.getChild("spinED_FLINEINDENT") + xAutomaticChk = xDialog.getChild("checkCB_AUTO") + xAbovePar = xDialog.getChild("spinED_TOPDIST") + xBelowPar = xDialog.getChild("spinED_BOTTOMDIST") + xChkspace = xDialog.getChild("checkCB_CONTEXTUALSPACING") + xLineSpacing = xDialog.getChild("comboLB_LINEDIST") + xActivate = xDialog.getChild("checkCB_REGISTER") + + xBeforeText.executeAction("UP", tuple()) + xAfterText.executeAction("UP", tuple()) + xFirstLine.executeAction("UP", tuple()) + xAutomaticChk.executeAction("CLICK", tuple()) + xAbovePar.executeAction("UP", tuple()) + xBelowPar.executeAction("UP", tuple()) + xChkspace.executeAction("CLICK", tuple()) + props = {"TEXT": "Double"} + actionProps = mkPropertyValues(props) + xLineSpacing.executeAction("SELECT", actionProps) + xActivate.executeAction("CLICK", tuple()) + + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xBeforeText = xDialog.getChild("spinED_LEFTINDENT") + xAfterText = xDialog.getChild("spinED_RIGHTINDENT") + xFirstLine = xDialog.getChild("spinED_FLINEINDENT") + xAutomaticChk = xDialog.getChild("checkCB_AUTO") + xAbovePar = xDialog.getChild("spinED_TOPDIST") + xBelowPar = xDialog.getChild("spinED_BOTTOMDIST") + xChkspace = xDialog.getChild("checkCB_CONTEXTUALSPACING") + xLineSpacing = xDialog.getChild("comboLB_LINEDIST") + xActivate = xDialog.getChild("checkCB_REGISTER") + + self.assertEqual(get_state_as_dict(xBeforeText)["Text"], "0.50 ch") + self.assertEqual(get_state_as_dict(xAfterText)["Text"], "0.50 ch") + self.assertEqual(get_state_as_dict(xFirstLine)["Text"], "0.50 ch") + self.assertEqual(get_state_as_dict(xAutomaticChk)["Selected"], "true") + self.assertEqual(get_state_as_dict(xAbovePar)["Text"], "0.50 line") + self.assertEqual(get_state_as_dict(xBelowPar)["Text"], "0.50 line") + self.assertEqual(get_state_as_dict(xChkspace)["Selected"], "true") + self.assertEqual(get_state_as_dict(xLineSpacing)["SelectEntryText"], "Double") + self.assertEqual(get_state_as_dict(xActivate)["Selected"], "true") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.close_doc() + + def test_format_paragraph_tab_alignment(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + + xTextDirection = xDialog.getChild("comboLB_TEXTDIRECTION") + xAlignment = xDialog.getChild("comboLB_VERTALIGN") + xSnapToText = xDialog.getChild("checkCB_SNAP") + xJustified = xDialog.getChild("radioBTN_JUSTIFYALIGN") + xLastLine = xDialog.getChild("comboLB_LASTLINE") + xExpandChk = xDialog.getChild("checkCB_EXPAND") + + props = {"TEXT": "Left-to-right (LTR)"} + actionProps = mkPropertyValues(props) + xTextDirection.executeAction("SELECT", actionProps) + props2 = {"TEXT": "Top"} + actionProps2 = mkPropertyValues(props2) + xAlignment.executeAction("SELECT", actionProps2) + xSnapToText.executeAction("CLICK", tuple()) + xJustified.executeAction("CLICK", tuple()) + props3 = {"TEXT": "Justified"} + actionProps3 = mkPropertyValues(props3) + xLastLine.executeAction("SELECT", actionProps3) + xExpandChk.executeAction("CLICK", tuple()) + + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + + xTextDirection = xDialog.getChild("comboLB_TEXTDIRECTION") + xAlignment = xDialog.getChild("comboLB_VERTALIGN") + xSnapToText = xDialog.getChild("checkCB_SNAP") + xJustified = xDialog.getChild("radioBTN_JUSTIFYALIGN") + xLastLine = xDialog.getChild("comboLB_LASTLINE") + xExpandChk = xDialog.getChild("checkCB_EXPAND") + + self.assertEqual(get_state_as_dict(xTextDirection)["SelectEntryText"], "Left-to-right (LTR)") + self.assertEqual(get_state_as_dict(xAlignment)["SelectEntryText"], "Top") + self.assertEqual(get_state_as_dict(xSnapToText)["Selected"], "false") + self.assertEqual(get_state_as_dict(xJustified)["Checked"], "true") + self.assertEqual(get_state_as_dict(xLastLine)["SelectEntryText"], "Justified") + self.assertEqual(get_state_as_dict(xExpandChk)["Selected"], "true") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.close_doc() + + def test_format_paragraph_tab_text_flow(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + + xAutomaticaly = xDialog.getChild("checkAuto") + xEnd = xDialog.getChild("spinLineEnd") + xBegin = xDialog.getChild("spinLineBegin") + xMax = xDialog.getChild("spinMaxNum") + xIns = xDialog.getChild("checkInsert") + xType = xDialog.getChild("comboBreakType") + xPosition = xDialog.getChild("comboBreakPosition") + xspinOrphan = xDialog.getChild("spinOrphan") + xspinWidow = xDialog.getChild("spinWidow") + xcheckWidow = xDialog.getChild("checkWidow") + xcheckOrphan = xDialog.getChild("checkOrphan") + xcheckSplitPara = xDialog.getChild("checkSplitPara") + xcheckKeepPara = xDialog.getChild("checkKeepPara") + + xAutomaticaly.executeAction("CLICK", tuple()) + xEnd.executeAction("UP", tuple()) + xBegin.executeAction("UP", tuple()) + xMax.executeAction("UP", tuple()) + xIns.executeAction("CLICK", tuple()) + props = {"TEXT": "Column"} + actionProps = mkPropertyValues(props) + xType.executeAction("SELECT", actionProps) + props2 = {"TEXT": "After"} + actionProps2 = mkPropertyValues(props2) + xPosition.executeAction("SELECT", actionProps2) + xspinOrphan.executeAction("UP", tuple()) + xspinWidow.executeAction("UP", tuple()) + xcheckWidow.executeAction("CLICK", tuple()) + xcheckOrphan.executeAction("CLICK", tuple()) + xcheckSplitPara.executeAction("CLICK", tuple()) + xcheckKeepPara.executeAction("CLICK", tuple()) + + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + + xAutomaticaly = xDialog.getChild("checkAuto") + xEnd = xDialog.getChild("spinLineEnd") + xBegin = xDialog.getChild("spinLineBegin") + xMax = xDialog.getChild("spinMaxNum") + xIns = xDialog.getChild("checkInsert") + xType = xDialog.getChild("comboBreakType") + xPosition = xDialog.getChild("comboBreakPosition") + xspinOrphan = xDialog.getChild("spinOrphan") + xspinWidow = xDialog.getChild("spinWidow") + xcheckWidow = xDialog.getChild("checkWidow") + xcheckOrphan = xDialog.getChild("checkOrphan") + xcheckSplitPara = xDialog.getChild("checkSplitPara") + xcheckKeepPara = xDialog.getChild("checkKeepPara") + + self.assertEqual(get_state_as_dict(xAutomaticaly)["Selected"], "true") + self.assertEqual(get_state_as_dict(xEnd)["Text"], "3") + self.assertEqual(get_state_as_dict(xBegin)["Text"], "3") + self.assertEqual(get_state_as_dict(xMax)["Text"], "1") + self.assertEqual(get_state_as_dict(xIns)["Selected"], "true") + self.assertEqual(get_state_as_dict(xType)["SelectEntryText"], "Column") + self.assertEqual(get_state_as_dict(xPosition)["SelectEntryText"], "After") + self.assertEqual(get_state_as_dict(xspinOrphan)["Text"], "2") + self.assertEqual(get_state_as_dict(xspinWidow)["Text"], "2") + self.assertEqual(get_state_as_dict(xcheckWidow)["Selected"], "false") + self.assertEqual(get_state_as_dict(xcheckOrphan)["Selected"], "false") + self.assertEqual(get_state_as_dict(xcheckSplitPara)["Selected"], "true") + self.assertEqual(get_state_as_dict(xcheckKeepPara)["Selected"], "true") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.close_doc() + + def test_format_paragraph_tab_asian_typography(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "3") + + xcheckForbidList = xDialog.getChild("checkForbidList") + xcheckHangPunct = xDialog.getChild("checkHangPunct") + xcheckApplySpacing = xDialog.getChild("checkApplySpacing") + + xcheckForbidList.executeAction("CLICK", tuple()) + xcheckHangPunct.executeAction("CLICK", tuple()) + xcheckApplySpacing.executeAction("CLICK", tuple()) + + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "3") + + xcheckForbidList = xDialog.getChild("checkForbidList") + xcheckHangPunct = xDialog.getChild("checkHangPunct") + xcheckApplySpacing = xDialog.getChild("checkApplySpacing") + + self.assertEqual(get_state_as_dict(xcheckForbidList)["Selected"], "false") + self.assertEqual(get_state_as_dict(xcheckHangPunct)["Selected"], "false") + self.assertEqual(get_state_as_dict(xcheckApplySpacing)["Selected"], "false") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.close_doc() + + def test_format_paragraph_tab_outline_numbering(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + + xOutline = xDialog.getChild("comboLB_OUTLINE_LEVEL") + xNumbering = xDialog.getChild("comboLB_NUMBER_STYLE") + xPara = xDialog.getChild("checkCB_RESTART_PARACOUNT") + xParaSpin = xDialog.getChild("spinNF_RESTART_PARA") + + props = {"TEXT": "Level 1"} + actionProps = mkPropertyValues(props) + xOutline.executeAction("SELECT", actionProps) + props2 = {"TEXT": "Bullet •"} + actionProps2 = mkPropertyValues(props2) + xNumbering.executeAction("SELECT", actionProps2) + xPara.executeAction("CLICK", tuple()) + xParaSpin.executeAction("UP", tuple()) + + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + + xOutline = xDialog.getChild("comboLB_OUTLINE_LEVEL") + xNumbering = xDialog.getChild("comboLB_NUMBER_STYLE") + xPara = xDialog.getChild("checkCB_RESTART_PARACOUNT") + xParaSpin = xDialog.getChild("spinNF_RESTART_PARA") + + self.assertEqual(get_state_as_dict(xOutline)["SelectEntryText"], "Level 1") + self.assertEqual(get_state_as_dict(xNumbering)["SelectEntryText"], "Bullet •") + self.assertEqual(get_state_as_dict(xPara)["Selected"], "true") + self.assertEqual(get_state_as_dict(xParaSpin)["Text"], "2") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.close_doc() + + def test_format_paragraph_tab_tabs(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialog = self.xUITest.getTopFocusWindow() + xPages = xDialog.getChild("pages") + xWriterEntry = xPages.getChild('3') # Writer + xWriterEntry.executeAction("EXPAND", tuple()) + xWriterGeneralEntry = xWriterEntry.getChild('0') + xWriterGeneralEntry.executeAction("SELECT", tuple()) #General + xMetric = xDialog.getChild("metric") + props = {"TEXT": "Centimeter"} + actionProps = mkPropertyValues(props) + xMetric.executeAction("SELECT", actionProps) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + + xDecimal = xDialog.getChild("radiobuttonBTN_TABTYPE_DECIMAL") + xDecimalTxt = xDialog.getChild("entryED_TABTYPE_DECCHAR") + xFill = xDialog.getChild("radiobuttonBTN_FILLCHAR_OTHER") + xFillTxt = xDialog.getChild("entryED_FILLCHAR_OTHER") + xNewButtn = xDialog.getChild("buttonBTN_NEW") + xED_TABPOS = xDialog.getChild("ED_TABPOS") + + xDecimal.executeAction("CLICK", tuple()) + xDecimalTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xDecimalTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"i"})) + xFill.executeAction("CLICK", tuple()) + xFillTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xFillTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"p"})) + xED_TABPOS.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xED_TABPOS.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + xNewButtn.executeAction("CLICK", tuple()) + + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + + xDecimal = xDialog.getChild("radiobuttonBTN_TABTYPE_DECIMAL") + xDecimalTxt = xDialog.getChild("entryED_TABTYPE_DECCHAR") + xFill = xDialog.getChild("radiobuttonBTN_FILLCHAR_OTHER") + xFillTxt = xDialog.getChild("entryED_FILLCHAR_OTHER") + xNewButtn = xDialog.getChild("buttonBTN_NEW") + xED_TABPOS = xDialog.getChild("ED_TABPOS") + + self.assertEqual(get_state_as_dict(xDecimal)["Checked"], "true") + self.assertEqual(get_state_as_dict(xDecimalTxt)["Text"], "i") + self.assertEqual(get_state_as_dict(xFill)["Checked"], "true") + self.assertEqual(get_state_as_dict(xFillTxt)["Text"], "p") + self.assertEqual(get_state_as_dict(xED_TABPOS)["Text"], "1.00 cm") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + + xCentered = xDialog.getChild("radiobuttonBTN_TABTYPE_CENTER") + xUnderscore = xDialog.getChild("radiobuttonBTN_FILLCHAR_UNDERSCORE") + xNewButtn = xDialog.getChild("buttonBTN_NEW") + + xCentered.executeAction("CLICK", tuple()) + xUnderscore.executeAction("CLICK", tuple()) + xNewButtn.executeAction("CLICK", tuple()) + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + + xCentered = xDialog.getChild("radiobuttonBTN_TABTYPE_CENTER") + xUnderscore = xDialog.getChild("radiobuttonBTN_FILLCHAR_UNDERSCORE") + self.assertEqual(get_state_as_dict(xCentered)["Checked"], "true") + self.assertEqual(get_state_as_dict(xUnderscore)["Checked"], "true") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + + xRight = xDialog.getChild("radiobuttonST_RIGHTTAB_ASIAN") + xDashLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_DASHLINE") + xNewButtn = xDialog.getChild("buttonBTN_NEW") + + xRight.executeAction("CLICK", tuple()) + xDashLine.executeAction("CLICK", tuple()) + xNewButtn.executeAction("CLICK", tuple()) + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + + xRight = xDialog.getChild("radiobuttonST_RIGHTTAB_ASIAN") + xDashLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_DASHLINE") + self.assertEqual(get_state_as_dict(xRight)["Checked"], "true") + self.assertEqual(get_state_as_dict(xDashLine)["Checked"], "true") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + + xLeft = xDialog.getChild("radiobuttonST_LEFTTAB_ASIAN") + xPointsLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_POINTS") + xNewButtn = xDialog.getChild("buttonBTN_NEW") + + xLeft.executeAction("CLICK", tuple()) + xPointsLine.executeAction("CLICK", tuple()) + xNewButtn.executeAction("CLICK", tuple()) + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + + xLeft = xDialog.getChild("radiobuttonST_LEFTTAB_ASIAN") + xPointsLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_POINTS") + self.assertEqual(get_state_as_dict(xLeft)["Checked"], "true") + self.assertEqual(get_state_as_dict(xPointsLine)["Checked"], "true") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.close_doc() + + def test_format_paragraph_tab_drop_caps(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "6") + + xDisplay = xDialog.getChild("checkCB_SWITCH") + xWholeWord = xDialog.getChild("checkCB_WORD") + xLines = xDialog.getChild("spinFLD_LINES") + xSpaceToText = xDialog.getChild("spinFLD_DISTANCE") + xText = xDialog.getChild("entryEDT_TEXT") + xCharStyle = xDialog.getChild("comboBOX_TEMPLATE") + + xDisplay.executeAction("CLICK", tuple()) + xWholeWord.executeAction("CLICK", tuple()) + xLines.executeAction("UP", tuple()) + xSpaceToText.executeAction("UP", tuple()) + xText.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) + props = {"TEXT": "Definition"} + actionProps = mkPropertyValues(props) + xCharStyle.executeAction("SELECT", actionProps) + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "6") + + xDisplay = xDialog.getChild("checkCB_SWITCH") + xWholeWord = xDialog.getChild("checkCB_WORD") + xLines = xDialog.getChild("spinFLD_LINES") + xSpaceToText = xDialog.getChild("spinFLD_DISTANCE") + xText = xDialog.getChild("entryEDT_TEXT") + xCharStyle = xDialog.getChild("comboBOX_TEMPLATE") + + self.assertEqual(get_state_as_dict(xDisplay)["Selected"], "true") + self.assertEqual(get_state_as_dict(xWholeWord)["Selected"], "true") + self.assertEqual(get_state_as_dict(xText)["Text"], "A") + self.assertEqual(get_state_as_dict(xCharStyle)["SelectEntryText"], "Definition") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.close_doc() + + def test_format_paragraph_tab_borders(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialog = self.xUITest.getTopFocusWindow() + xPages = xDialog.getChild("pages") + xWriterEntry = xPages.getChild('3') # Writer + xWriterEntry.executeAction("EXPAND", tuple()) + xWriterGeneralEntry = xWriterEntry.getChild('0') + xWriterGeneralEntry.executeAction("SELECT", tuple()) #General - set centimeter + xMetric = xDialog.getChild("metric") + props = {"TEXT": "Centimeter"} + actionProps = mkPropertyValues(props) + xMetric.executeAction("SELECT", actionProps) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "7") + + xStyle = xDialog.getChild("linestylelb") + xwidth = xDialog.getChild("linewidthmf") + xSync = xDialog.getChild("sync") + xLeft = xDialog.getChild("leftmf") + xRight = xDialog.getChild("rightmf") + xTop = xDialog.getChild("topmf") + xBottom = xDialog.getChild("bottommf") + xMerge = xDialog.getChild("mergewithnext") + + select_pos(xStyle, "1") + xwidth.executeAction("UP", tuple()) + xSync.executeAction("CLICK", tuple()) + xLeft.executeAction("UP", tuple()) + xLeft.executeAction("UP", tuple()) + xRight.executeAction("UP", tuple()) + xTop.executeAction("UP", tuple()) + xBottom.executeAction("UP", tuple()) + xMerge.executeAction("CLICK", tuple()) + + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "7") + + xStyle = xDialog.getChild("linestylelb") + xwidth = xDialog.getChild("linewidthmf") + xSync = xDialog.getChild("sync") + xLeft = xDialog.getChild("leftmf") + xRight = xDialog.getChild("rightmf") + xTop = xDialog.getChild("topmf") + xBottom = xDialog.getChild("bottommf") + xMerge = xDialog.getChild("mergewithnext") + + self.assertEqual(get_state_as_dict(xSync)["Selected"], "false") + self.assertEqual(get_state_as_dict(xMerge)["Selected"], "false") + self.assertEqual(get_state_as_dict(xLeft)["Text"], "0.20 cm") + self.assertEqual(get_state_as_dict(xRight)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(xTop)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(xBottom)["Text"], "0.10 cm") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + self.ui_test.close_doc() + + def test_format_paragraph_area(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "8") + + xColor = xDialog.getChild("btncolor") + xGradient = xDialog.getChild("btngradient") + xBitmap = xDialog.getChild("btnbitmap") + xPattern = xDialog.getChild("btnpattern") + xHatch = xDialog.getChild("btnhatch") + + xColor.executeAction("CLICK", tuple()) + xGradient.executeAction("CLICK", tuple()) + xBitmap.executeAction("CLICK", tuple()) + xPattern.executeAction("CLICK", tuple()) + xHatch.executeAction("CLICK", tuple()) + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + self.ui_test.close_doc() + + def test_format_paragraph_transparency(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "9") + + xTran = xDialog.getChild("RBT_TRANS_LINEAR") + xTranText = xDialog.getChild("MTR_TRANSPARENT") + + xTran.executeAction("CLICK", tuple()) + xTranText.executeAction("UP", tuple()) + + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "9") + + xTran = xDialog.getChild("RBT_TRANS_LINEAR") + xTranText = xDialog.getChild("MTR_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xTran)["Checked"], "true") + self.assertEqual(get_state_as_dict(xTranText)["Text"], "51%") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "9") + + xGradient = xDialog.getChild("RBT_TRANS_GRADIENT") + xType = xDialog.getChild("LB_TRGR_GRADIENT_TYPES") + xAngle = xDialog.getChild("MTR_TRGR_ANGLE") + xBorder = xDialog.getChild("MTR_TRGR_BORDER") + xStart = xDialog.getChild("MTR_TRGR_START_VALUE") + xEnd = xDialog.getChild("MTR_TRGR_END_VALUE") + + xGradient.executeAction("CLICK", tuple()) + props = {"TEXT": "Axial"} + actionProps = mkPropertyValues(props) + xType.executeAction("SELECT", actionProps) + xAngle.executeAction("UP", tuple()) + xBorder.executeAction("UP", tuple()) + xStart.executeAction("UP", tuple()) + xEnd.executeAction("UP", tuple()) + + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "9") + + xGradient = xDialog.getChild("RBT_TRANS_GRADIENT") + xType = xDialog.getChild("LB_TRGR_GRADIENT_TYPES") + xAngle = xDialog.getChild("MTR_TRGR_ANGLE") + xBorder = xDialog.getChild("MTR_TRGR_BORDER") + xStart = xDialog.getChild("MTR_TRGR_START_VALUE") + xEnd = xDialog.getChild("MTR_TRGR_END_VALUE") + + self.assertEqual(get_state_as_dict(xGradient)["Checked"], "true") + self.assertEqual(get_state_as_dict(xType)["SelectEntryText"], "Axial") + self.assertEqual(get_state_as_dict(xAngle)["Text"], "1°") + self.assertEqual(get_state_as_dict(xBorder)["Text"], "1%") + self.assertEqual(get_state_as_dict(xStart)["Text"], "1%") + self.assertEqual(get_state_as_dict(xEnd)["Text"], "1%") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests2/horizontalLine.py b/sw/qa/uitest/writer_tests2/horizontalLine.py new file mode 100644 index 000000000..c102f6031 --- /dev/null +++ b/sw/qa/uitest/writer_tests2/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("name") + 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("name") + 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: diff --git a/sw/qa/uitest/writer_tests2/insertFootnote.py b/sw/qa/uitest/writer_tests2/insertFootnote.py new file mode 100644 index 000000000..6bd4db73f --- /dev/null +++ b/sw/qa/uitest/writer_tests2/insertFootnote.py @@ -0,0 +1,38 @@ +# -*- 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 +import time +from uitest.debug import sleep + +class insertFootnote(UITestCase): + + def test_insert_footnote(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:InsertFootnote") + + type_text(xWriterEdit, "LibreOffice") + self.assertEqual(document.Footnotes[0].String, "LibreOffice") + self.assertEqual(document.Footnotes.getCount(), 1) + + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Footnotes[0].String, "") + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Footnotes.getCount(), 0) + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(document.Footnotes[0].String, "") + self.assertEqual(document.Footnotes.getCount(), 1) + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(document.Footnotes[0].String, "LibreOffice") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests2/tdf116474.py b/sw/qa/uitest/writer_tests2/tdf116474.py new file mode 100644 index 000000000..e5bb89209 --- /dev/null +++ b/sw/qa/uitest/writer_tests2/tdf116474.py @@ -0,0 +1,54 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# 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 +import time +from uitest.path import get_srcdir_url +from uitest.debug import sleep +from uitest.uihelper.common import select_pos + +#Bug 116474 - Undo/redo: The redo of adding caption to an image isn't working: no image + +def get_url_for_data_file(file_name): + return get_srcdir_url() + "/sw/qa/uitest/writer_tests/data/" + file_name + +class tdf116474(UITestCase): + + def test_tdf116474_insert_caption_undo(self): + writer_doc = self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + text = document.getText() + cursor = text.createTextCursor() + textGraphic = document.createInstance('com.sun.star.text.TextGraphicObject') + provider = self.xContext.ServiceManager.createInstance('com.sun.star.graphic.GraphicProvider') + graphic = provider.queryGraphic( mkPropertyValues({"URL": get_url_for_data_file("LibreOffice.jpg")})) + textGraphic.Graphic = graphic + text.insertTextContent(cursor, textGraphic, False) + #select image + document.getCurrentController().select(document.getDrawPage()[0]) + + self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") # caption + xDialogCaption = self.xUITest.getTopFocusWindow() + + xCapt = xDialogCaption.getChild("caption_edit") + xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption"})) + + xOkBtn=xDialogCaption.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + xFrame = document.TextFrames[0] + self.assertEqual(document.TextFrames[0].Text.String, "Figure 1: Caption") + self.assertEqual(document.GraphicObjects.getCount(), 1) #nr. of images + #Undo, redo + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Redo") + #Verify + self.assertEqual(document.TextFrames[0].Text.String, "Figure 1: Caption") + self.assertEqual(document.GraphicObjects.getCount(), 1) #nr. of images + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/insertEndnote.py b/sw/qa/uitest/writer_tests3/insertEndnote.py new file mode 100644 index 000000000..705fce6ce --- /dev/null +++ b/sw/qa/uitest/writer_tests3/insertEndnote.py @@ -0,0 +1,38 @@ +# -*- 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 +import time +from uitest.debug import sleep + +class insertEndnote(UITestCase): + + def test_insert_endnote(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:InsertEndnote") + + type_text(xWriterEdit, "LibreOffice") + + self.assertEqual(document.Endnotes[0].String, "LibreOffice") + self.assertEqual(document.Endnotes.getCount(), 1) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Endnotes[0].String, "") + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Endnotes.getCount(), 0) + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(document.Endnotes[0].String, "") + self.assertEqual(document.Endnotes.getCount(), 1) + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(document.Endnotes[0].String, "LibreOffice") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/insertEnvelope.py b/sw/qa/uitest/writer_tests3/insertEnvelope.py new file mode 100644 index 000000000..a7ccb64e5 --- /dev/null +++ b/sw/qa/uitest/writer_tests3/insertEnvelope.py @@ -0,0 +1,51 @@ +# -*- 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 uitest.debug import sleep +from uitest.path import get_srcdir_url +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text + +#envaddresspage.ui + +class WriterInsertEnvelope(UITestCase): + + def test_insert_envelope(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + self.ui_test.execute_dialog_through_command(".uno:InsertEnvelope") + + xDialog = self.xUITest.getTopFocusWindow() + + xAddrTxt= xDialog.getChild("addredit") + xSenderTxt = xDialog.getChild("senderedit") + xSenderCheckBox = xDialog.getChild("sender") + + xAddrTxt.executeAction("SELECT", mkPropertyValues({"FROM": "1", "TO": "200"})) + xAddrTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xAddrTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"Address"})) + + xSenderTxt.executeAction("SELECT", mkPropertyValues({"FROM": "1", "TO": "200"})) + xSenderTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSenderTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"Sender"})) + + xInsBtn = xDialog.getChild("user") + xInsBtn.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:InsertEnvelope") + xDialog = self.xUITest.getTopFocusWindow() + xAddrTxt= xDialog.getChild("addredit") + xSenderTxt = xDialog.getChild("senderedit") + self.assertEqual(get_state_as_dict(xAddrTxt)["Text"], "Address") + self.assertEqual(get_state_as_dict(xSenderTxt)["Text"], "Sender") + + xcancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancelBtn) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/insertFootEndnote.py b/sw/qa/uitest/writer_tests3/insertFootEndnote.py new file mode 100644 index 000000000..be8597411 --- /dev/null +++ b/sw/qa/uitest/writer_tests3/insertFootEndnote.py @@ -0,0 +1,81 @@ +# -*- 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 + +import time +from uitest.debug import sleep + +class insertFootEndnote(UITestCase): + + def test_insert_foot_endnote(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + +#Automatic - Footnote + self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") + xDialog = self.xUITest.getTopFocusWindow() + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + self.assertEqual(document.Footnotes.getCount(), 1) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Footnotes.getCount(), 0) +#Automatic - Endnote + self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") + xDialog = self.xUITest.getTopFocusWindow() + + xEndnote = xDialog.getChild("endnote") + xEndnote.executeAction("CLICK", tuple()) + + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + self.assertEqual(document.Endnotes.getCount(), 1) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Endnotes.getCount(), 0) +#Character - Footnote + self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") + xDialog = self.xUITest.getTopFocusWindow() + + xChar = xDialog.getChild("character") + xChar.executeAction("CLICK", tuple()) + xCharentry = xDialog.getChild("characterentry") + xCharentry.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) + + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + self.assertEqual(document.Footnotes.getCount(), 1) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Footnotes.getCount(), 0) + +#Character - Endnote + self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") + xDialog = self.xUITest.getTopFocusWindow() + + xChar = xDialog.getChild("character") + xChar.executeAction("CLICK", tuple()) + xCharentry = xDialog.getChild("characterentry") + xCharentry.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) + + xEndnote = xDialog.getChild("endnote") + xEndnote.executeAction("CLICK", tuple()) + + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + self.assertEqual(document.Endnotes.getCount(), 1) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Endnotes.getCount(), 0) + +#Cancel button + self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/insertPageFooter.py b/sw/qa/uitest/writer_tests3/insertPageFooter.py new file mode 100644 index 000000000..94bd3e23e --- /dev/null +++ b/sw/qa/uitest/writer_tests3/insertPageFooter.py @@ -0,0 +1,75 @@ +# -*- 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 uitest.debug import sleep +from uitest.path import get_srcdir_url + +class WriterInsertPageFooter(UITestCase): + + def insert_footer(self): + document = self.ui_test.get_component() + + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FooterIsOn, False) + + self.xUITest.executeCommand( + ".uno:InsertPageFooter?PageStyle:string=Default%20Page%20Style&On:bool=true") + + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FooterIsOn, True) + + def delete_footer(self): + document = self.ui_test.get_component() + + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FooterIsOn, True) + + self.ui_test.execute_dialog_through_command( + ".uno:InsertPageFooter?PageStyle:string=Default%20Page%20Style&On:bool=false") + + xDialog = self.xUITest.getTopFocusWindow() + + xOption = xDialog.getChild("yes") + xOption.executeAction("CLICK", tuple()) + + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FooterIsOn, False) + + def test_footer(self): + self.ui_test.create_doc_in_start_center("writer") + + self.insert_footer() + + self.delete_footer() + + self.ui_test.close_doc() + + def test_tdf107427(self): + self.ui_test.create_doc_in_start_center("writer") + + self.insert_footer() + + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + + xInsertDlg = self.xUITest.getTopFocusWindow() + + xOkBtn = xInsertDlg.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + document = self.ui_test.get_component() + + tables = document.getTextTables() + self.assertEqual(len(tables[0].getRows()), 2) + self.assertEqual(len(tables[0].getColumns()), 2) + + self.xUITest.executeCommand(".uno:SelectAll") + + self.delete_footer() + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/insertQrCodeGen.py b/sw/qa/uitest/writer_tests3/insertQrCodeGen.py new file mode 100644 index 000000000..3124022e0 --- /dev/null +++ b/sw/qa/uitest/writer_tests3/insertQrCodeGen.py @@ -0,0 +1,79 @@ +# -*- 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 com.sun.star.lang import IndexOutOfBoundsException + +class insertQrCode(UITestCase): + + def test_insert_qr_code(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + # cancel the dialog without doing anything + self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") + xDialog = self.xUITest.getTopFocusWindow() + + xURL = xDialog.getChild("edit_text") + type_text(xURL, "www.libreoffice.org") + + xCloseBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCloseBtn) + with self.assertRaises(IndexOutOfBoundsException): + document.DrawPage.getByIndex(0) + + # Reopen the dialog box + self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") + xDialog = self.xUITest.getTopFocusWindow() + + # Get elements in the Dialog Box + xURL = xDialog.getChild("edit_text") + xECC_Low = xDialog.getChild("button_low") #How radio button input is written in text. + xBorder = xDialog.getChild("edit_border") + + type_text(xURL, "www.libreoffice.org") #set the QR code + xECC_Low.executeAction("CLICK", tuple()) + xBorder.executeAction("UP", tuple()) + xBorder.executeAction("DOWN", tuple()) + xOKBtn = xDialog.getChild("ok") + xOKBtn.executeAction("CLICK", tuple()) + + # check the QR code in the document + self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.Payload, "www.libreoffice.org") + self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.ErrorCorrection, 1) + self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.Border, 1) + + self.ui_test.close_doc() + + def test_insert_qr_code_gen2(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") + xDialog = self.xUITest.getTopFocusWindow() + + xURL = xDialog.getChild("edit_text") + xECC_Low = xDialog.getChild("button_low") + xBorder = xDialog.getChild("edit_border") + + type_text(xURL, "www.libreoffice.org") #set the QR code + xECC_Low.executeAction("CLICK", tuple()) + xBorder.executeAction("UP", tuple()) + xBorder.executeAction("DOWN", tuple()) + xOKBtn = xDialog.getChild("ok") + xOKBtn.executeAction("CLICK", tuple()) + + #check the QR Code in the document + self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.Payload, "www.libreoffice.org") + self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.ErrorCorrection, 1) + self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.Border, 1) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/insertSignatureLine.py b/sw/qa/uitest/writer_tests3/insertSignatureLine.py new file mode 100644 index 000000000..8bbbdd65b --- /dev/null +++ b/sw/qa/uitest/writer_tests3/insertSignatureLine.py @@ -0,0 +1,95 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues +from com.sun.star.lang import IndexOutOfBoundsException + +class insertSignatureLine(UITestCase): + + def test_insert_signature_line(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + # cancel the dialog without doing anything + self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine") + xDialog = self.xUITest.getTopFocusWindow() + + xName = xDialog.getChild("edit_name") + xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line + + xCloseBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCloseBtn) + with self.assertRaises(IndexOutOfBoundsException): + document.DrawPage.getByIndex(0) + + # set the signature line + self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine") + xDialog = self.xUITest.getTopFocusWindow() + + xName = xDialog.getChild("edit_name") + xTitle = xDialog.getChild("edit_title") + xEmail = xDialog.getChild("edit_email") + xComment = xDialog.getChild("checkbox_can_add_comments") + xInstructions = xDialog.getChild("edit_instructions") + + xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line + xTitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Title"})) + xEmail.executeAction("TYPE", mkPropertyValues({"TEXT":"Email"})) + xComment.executeAction("CLICK", tuple()) + xInstructions.executeAction("TYPE", mkPropertyValues({"TEXT":"Instructions"})) + xOKBtn = xDialog.getChild("ok") + xOKBtn.executeAction("CLICK", tuple()) + + #check the signature Line in the document + self.assertEqual(document.DrawPage.getByIndex(0).SignatureLineSuggestedSignerName, "Name") + self.assertEqual(document.DrawPage.getByIndex(0).SignatureLineSuggestedSignerTitle, "Title") + self.assertEqual(document.DrawPage.getByIndex(0).SignatureLineSuggestedSignerEmail, "Email") + self.assertEqual(document.DrawPage.getByIndex(0).SignatureLineSuggestedSignerTitle, "Title") + self.assertEqual(document.DrawPage.getByIndex(0).SignatureLineCanAddComment, False) + self.assertEqual(document.DrawPage.getByIndex(0).SignatureLineShowSignDate, True) + self.assertEqual(document.DrawPage.getByIndex(0).SignatureLineSigningInstructions, "Instructions") + + self.ui_test.close_doc() + + def test_insert_signature_line2(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine") + xDialog = self.xUITest.getTopFocusWindow() + + xName = xDialog.getChild("edit_name") + xTitle = xDialog.getChild("edit_title") + xEmail = xDialog.getChild("edit_email") + xComment = xDialog.getChild("checkbox_can_add_comments") + xDate = xDialog.getChild("checkbox_show_sign_date") + xInstructions = xDialog.getChild("edit_instructions") + + xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line + xTitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Title"})) + xEmail.executeAction("TYPE", mkPropertyValues({"TEXT":"Email"})) + xDate.executeAction("CLICK", tuple()) + xComment.executeAction("CLICK", tuple()) + xInstructions.executeAction("TYPE", mkPropertyValues({"TEXT":"Instructions"})) + xOKBtn = xDialog.getChild("ok") + xOKBtn.executeAction("CLICK", tuple()) + + #check the signature Line in the document + self.assertEqual(document.DrawPage.getByIndex(0).SignatureLineSuggestedSignerName, "Name") + self.assertEqual(document.DrawPage.getByIndex(0).SignatureLineSuggestedSignerTitle, "Title") + self.assertEqual(document.DrawPage.getByIndex(0).SignatureLineSuggestedSignerEmail, "Email") + self.assertEqual(document.DrawPage.getByIndex(0).SignatureLineSuggestedSignerTitle, "Title") + self.assertEqual(document.DrawPage.getByIndex(0).SignatureLineCanAddComment, False) + self.assertEqual(document.DrawPage.getByIndex(0).SignatureLineShowSignDate, False) + self.assertEqual(document.DrawPage.getByIndex(0).SignatureLineSigningInstructions, "Instructions") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/lineNumbering.py b/sw/qa/uitest/writer_tests3/lineNumbering.py new file mode 100644 index 000000000..8d1b11036 --- /dev/null +++ b/sw/qa/uitest/writer_tests3/lineNumbering.py @@ -0,0 +1,121 @@ +# -*- 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 uitest.debug import sleep +from uitest.path import get_srcdir_url +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +from uitest.uihelper.common import select_pos + +class WriterLineNumbering(UITestCase): + + def test_line_numbering_dialog(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialog = self.xUITest.getTopFocusWindow() + xPages = xDialog.getChild("pages") + xWriterEntry = xPages.getChild('3') # Writer + xWriterEntry.executeAction("EXPAND", tuple()) + xWriterGeneralEntry = xWriterEntry.getChild('0') + xWriterGeneralEntry.executeAction("SELECT", tuple()) #General - set centimeters + xMetric = xDialog.getChild("metric") + props = {"TEXT": "Centimeter"} + actionProps = mkPropertyValues(props) + xMetric.executeAction("SELECT", actionProps) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.execute_dialog_through_command(".uno:LineNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xshownumbering = xDialog.getChild("shownumbering") + xstyledropdown = xDialog.getChild("styledropdown") + xformatdropdown = xDialog.getChild("formatdropdown") + xpositiondropdown = xDialog.getChild("positiondropdown") + xspacingspin = xDialog.getChild("spacingspin") + xintervalspin = xDialog.getChild("intervalspin") + xtextentry = xDialog.getChild("textentry") + xlinesspin = xDialog.getChild("linesspin") + xblanklines = xDialog.getChild("blanklines") + xlinesintextframes = xDialog.getChild("linesintextframes") + xshowfooterheadernumbering = xDialog.getChild("showfooterheadernumbering") + xrestarteverynewpage = xDialog.getChild("restarteverynewpage") + + xshownumbering.executeAction("CLICK", tuple()) + props = {"TEXT": "Bullets"} + actionProps = mkPropertyValues(props) + xstyledropdown.executeAction("SELECT", actionProps) + props2 = {"TEXT": "A, B, C, ..."} + actionProps2 = mkPropertyValues(props2) + xformatdropdown.executeAction("SELECT", actionProps2) + props3 = {"TEXT": "Right"} + actionProps3 = mkPropertyValues(props3) + xpositiondropdown.executeAction("SELECT", actionProps3) + xspacingspin.executeAction("UP", tuple()) + xintervalspin.executeAction("UP", tuple()) + xtextentry.executeAction("TYPE", mkPropertyValues({"TEXT":";"})) + xlinesspin.executeAction("UP", tuple()) + xblanklines.executeAction("CLICK", tuple()) + xlinesintextframes.executeAction("CLICK", tuple()) + xshowfooterheadernumbering.executeAction("CLICK", tuple()) + xrestarteverynewpage.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.execute_dialog_through_command(".uno:LineNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xshownumbering = xDialog.getChild("shownumbering") + xstyledropdown = xDialog.getChild("styledropdown") + xformatdropdown = xDialog.getChild("formatdropdown") + xpositiondropdown = xDialog.getChild("positiondropdown") + xspacingspin = xDialog.getChild("spacingspin") + xintervalspin = xDialog.getChild("intervalspin") + xtextentry = xDialog.getChild("textentry") + xlinesspin = xDialog.getChild("linesspin") + xblanklines = xDialog.getChild("blanklines") + xlinesintextframes = xDialog.getChild("linesintextframes") + xshowfooterheadernumbering = xDialog.getChild("showfooterheadernumbering") + xrestarteverynewpage = xDialog.getChild("restarteverynewpage") + + self.assertEqual(get_state_as_dict(xshownumbering)["Selected"], "true") + self.assertEqual(get_state_as_dict(xstyledropdown)["SelectEntryText"], "Bullets") + self.assertEqual(get_state_as_dict(xformatdropdown)["SelectEntryText"], "A, B, C, ...") + self.assertEqual(get_state_as_dict(xpositiondropdown)["SelectEntryText"], "Right") + self.assertEqual(get_state_as_dict(xspacingspin)["Text"], "0.60 cm") + self.assertEqual(get_state_as_dict(xintervalspin)["Text"], "6") + self.assertEqual(get_state_as_dict(xtextentry)["Text"], ";") + self.assertEqual(get_state_as_dict(xlinesspin)["Text"], "4") + self.assertEqual(get_state_as_dict(xblanklines)["Selected"], "false") + self.assertEqual(get_state_as_dict(xlinesintextframes)["Selected"], "true") + self.assertEqual(get_state_as_dict(xshowfooterheadernumbering)["Selected"], "true") + self.assertEqual(get_state_as_dict(xrestarteverynewpage)["Selected"], "true") + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + self.ui_test.close_doc() + + def test_tdf86185(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + + self.ui_test.execute_dialog_through_command(".uno:LineNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xshownumbering = xDialog.getChild("shownumbering") + xformatdropdown = xDialog.getChild("formatdropdown") + + xshownumbering.executeAction("CLICK", tuple()) + itemFormat = ["1, 2, 3, ...", "A, B, C, ...", "a, b, c, ...", "I, II, III, ...", "i, ii, iii, ...", "A, .., AA, .., AAA, ..."] + for i in range(6): + props2 = {"TEXT": itemFormat[i]} + actionProps2 = mkPropertyValues(props2) + xformatdropdown.executeAction("SELECT", actionProps2) + self.assertEqual(get_state_as_dict(xformatdropdown)["SelectEntryText"], itemFormat[i]) + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/sort.py b/sw/qa/uitest/writer_tests3/sort.py new file mode 100644 index 000000000..6ae06c5ec --- /dev/null +++ b/sw/qa/uitest/writer_tests3/sort.py @@ -0,0 +1,72 @@ +# -*- 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 +import time +from uitest.debug import sleep +#Tools -Sort dialog + tdf81292 + +class WriterSort(UITestCase): + + def test_sort(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + type_text(xWriterEdit, "a") + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + type_text(xWriterEdit, "c") + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + type_text(xWriterEdit, "v") + + selection = self.xUITest.executeCommand(".uno:SelectAll") #select whole text + #Tools - Sort + self.ui_test.execute_dialog_through_command(".uno:SortDialog") + xDialog = self.xUITest.getTopFocusWindow() + xDown = xDialog.getChild("down1") + xDown.executeAction("CLICK", tuple()) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #check + self.assertEqual(document.Text.String[0:1], "v") + + self.ui_test.close_doc() + + def test_sort_numerical(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + type_text(xWriterEdit, "1;2;3") + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + type_text(xWriterEdit, "2;8;3") + + selection = self.xUITest.executeCommand(".uno:SelectAll") #select whole text + #Tools - Sort + self.ui_test.execute_dialog_through_command(".uno:SortDialog") + xDialog = self.xUITest.getTopFocusWindow() + xDown = xDialog.getChild("down1") + xcolsb1 = xDialog.getChild("colsb1") + xtypelb1 = xDialog.getChild("typelb1") + xcharacter = xDialog.getChild("character") + xseparator = xDialog.getChild("separator") + xDown.executeAction("CLICK", tuple()) + props = {"TEXT": "Numerical"} + actionProps = mkPropertyValues(props) + xtypelb1.executeAction("SELECT", actionProps) + xcharacter.executeAction("CLICK", tuple()) + xseparator.executeAction("TYPE", mkPropertyValues({"TEXT":";"})) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #check + self.assertEqual(document.Text.String[0:5], "2;8;3") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file diff --git a/sw/qa/uitest/writer_tests3/specialCharacter.py b/sw/qa/uitest/writer_tests3/specialCharacter.py new file mode 100644 index 000000000..0589d44fb --- /dev/null +++ b/sw/qa/uitest/writer_tests3/specialCharacter.py @@ -0,0 +1,92 @@ +# -*- 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() + + 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: diff --git a/sw/qa/uitest/writer_tests4/tdf108124.py b/sw/qa/uitest/writer_tests4/tdf108124.py new file mode 100644 index 000000000..929a3d7b4 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf108124.py @@ -0,0 +1,49 @@ +# -*- 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 +import org.libreoffice.unotest +import pathlib +import time +from uitest.debug import sleep + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf108124(UITestCase): + + def test_tdf108124(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf108124.odt")) + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + document = self.ui_test.get_component() + + self.assertEqual(document.GraphicObjects.getCount(), 2) #nr. of images + + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+a"})) # select all + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+c"})) # copy + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+v"})) # paste + self.assertEqual(document.GraphicObjects.getCount(), 2) + xObj1Old = document.GraphicObjects[0] + xObj2Old = document.GraphicObjects[1] + self.xUITest.executeCommand(".uno:Undo") #Undo + self.assertEqual(document.GraphicObjects.getCount(), 2) + xObj1New = document.GraphicObjects[0] + xObj2New = document.GraphicObjects[1] + # there should be 2 different objects now but they have the same names, + # so rely on the object identity for testing... + self.assertNotEqual(xObj1Old, xObj1New) + self.assertNotEqual(xObj1Old, xObj2New) + self.assertNotEqual(xObj2Old, xObj1New) + self.assertNotEqual(xObj2Old, xObj2New) + self.xUITest.executeCommand(".uno:Redo") #Redo + self.assertEqual(document.GraphicObjects.getCount(), 2) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/tdf113252.py b/sw/qa/uitest/writer_tests4/tdf113252.py new file mode 100644 index 000000000..a0b285354 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf113252.py @@ -0,0 +1,49 @@ +# -*- 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 +import time +from uitest.debug import sleep +from uitest.uihelper.common import select_pos +#Bug 113252 - Basic Library Organizer is broken and closing dialogs crashes + +class tdf113252(UITestCase): + + def test_tdf113252_macro_dialog(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + #Start LibreOffice. Go to Tools > Macros > Organize Macros > Basic + self.ui_test.execute_dialog_through_command(".uno:MacroDialog") + xDialog = self.xUITest.getTopFocusWindow() + + #Click Button Organizer + xorganize = xDialog.getChild("organize") + def handle_macro_dlg(dialog): + + xTabs = dialog.getChild("tabcontrol") + select_pos(xTabs, "0") + select_pos(xTabs, "1") + select_pos(xTabs, "2") + #Click on its button Close + xCloseBtn = dialog.getChild("close") + xCloseBtn.executeAction("CLICK", tuple()) + + self.ui_test.execute_blocking_action(xorganize.executeAction, args=('CLICK', ()), + dialog_handler=handle_macro_dlg) + #Click button Close in the next dialog -> crash. + + xClose = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xClose) + + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file diff --git a/sw/qa/uitest/writer_tests4/tdf113284.py b/sw/qa/uitest/writer_tests4/tdf113284.py new file mode 100644 index 000000000..4a4750b00 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf113284.py @@ -0,0 +1,48 @@ +# -*- 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 +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf113284(UITestCase): + + def test_tdf113284(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf113284.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.processEventsToIdle() + + xPageCount = document.CurrentController.PageCount + self.ui_test.execute_dialog_through_command(".uno:GotoPage") + xDialog = self.xUITest.getTopFocusWindow() + xPageText = xDialog.getChild("page") + xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":str(xPageCount)})) # goto last page + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + xToolkit.processEventsToIdle() + + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], str(xPageCount)) + self.ui_test.execute_dialog_through_command(".uno:EditCurIndex") #open index dialog + xDiagIndex = self.xUITest.getTopFocusWindow() + xCancBtn = xDiagIndex.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancBtn) # close dialog + + #page count is not constant + #self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "66") #page 66 start of the Index + #pagecount unchanged + self.assertEqual(document.CurrentController.PageCount, xPageCount) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/tdf115088.py b/sw/qa/uitest/writer_tests4/tdf115088.py new file mode 100644 index 000000000..f10fe7490 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf115088.py @@ -0,0 +1,48 @@ +# -*- 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 +import time +from uitest.debug import sleep + +class tdf115088(UITestCase): + + def test_tdf115088(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + type_text(xWriterEdit, "1") + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + type_text(xWriterEdit, "1") + + selection = self.xUITest.executeCommand(".uno:SelectAll") #select whole text + self.xUITest.executeCommand(".uno:Cut") #cut text + type_text(xWriterEdit, "test") + self.xUITest.executeCommand(".uno:GoLeft") + self.xUITest.executeCommand(".uno:GoLeft") + self.xUITest.executeCommand(".uno:GoLeft") + self.xUITest.executeCommand(".uno:GoLeft") + self.xUITest.executeCommand(".uno:PasteUnformatted") + self.assertEqual(document.Text.String[0:2].replace('\r', '\n'), "1\n") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: + + + + + + + + + + + + diff --git a/sw/qa/uitest/writer_tests4/tdf115572.py b/sw/qa/uitest/writer_tests4/tdf115572.py new file mode 100644 index 000000000..890d4b393 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf115572.py @@ -0,0 +1,80 @@ +# -*- 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 +import time +from uitest.debug import sleep +from uitest.uihelper.common import select_pos + +class tdf115572(UITestCase): + + def insertTextIntoCell(self, table, cellName, text ): + tableText = table.getCellByName( cellName ) + tableText.setString( text ) + + def test_tdf115572_table_format_gets_reset_deleting_row(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #insert table 2x2 + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + xDialog = self.xUITest.getTopFocusWindow() + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + #select font format - Bold and write text "abc" + self.xUITest.executeCommand(".uno:Bold") + tables = document.getTextTables() + self.insertTextIntoCell(tables[0], "A1", "abc" ) + #go to second row - arrow down + self.xUITest.executeCommand(".uno:GoDown") + #delete row + self.xUITest.executeCommand(".uno:DeleteRows") + #now the cursor is in the second column - go left + self.xUITest.executeCommand(".uno:GoLeft") + self.xUITest.executeCommand(".uno:GoLeft") + #check the format of the text (should be still bold) Format-Character-Font-Style-Bold + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xweststylelbcjk = xDialog.getChild("weststylelb-cjk") + self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold") + xCloseBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() + + def test_tdf115572_table_format_gets_reset_deleting_column(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #insert table 2x2 + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + xDialog = self.xUITest.getTopFocusWindow() + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + #select font format - Bold and write text "abc" + self.xUITest.executeCommand(".uno:Bold") + tables = document.getTextTables() + self.insertTextIntoCell(tables[0], "A1", "abc" ) + #go to second column + self.xUITest.executeCommand(".uno:GoRight") + #delete column + self.xUITest.executeCommand(".uno:DeleteColumns") + #check the format of the text (should be still bold) Format-Character-Font-Style-Bold + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xweststylelbcjk = xDialog.getChild("weststylelb-cjk") + self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold") + xCloseBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/tdf115573.py b/sw/qa/uitest/writer_tests4/tdf115573.py new file mode 100644 index 000000000..bfcb872a8 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf115573.py @@ -0,0 +1,138 @@ +# -*- 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 +import time +from uitest.debug import sleep +from uitest.uihelper.common import select_pos + +class tdf115573(UITestCase): + + def insertTextIntoCell(self, table, cellName, text ): + tableText = table.getCellByName( cellName ) + tableText.setString( text ) + + def test_tdf115573_Table_loses_formatting_inserting_row_before(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #insert table 2x2 + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + xDialog = self.xUITest.getTopFocusWindow() + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + #select font format - Bold and write text "abc" + self.xUITest.executeCommand(".uno:Bold") + tables = document.getTextTables() + self.insertTextIntoCell(tables[0], "A1", "abc" ) + #go to second row - arrow down + self.xUITest.executeCommand(".uno:GoDown") + #insert row + self.xUITest.executeCommand(".uno:InsertRowsBefore") + #go up + self.xUITest.executeCommand(".uno:GoUp") + self.xUITest.executeCommand(".uno:GoUp") + #check the format of the text (should be still bold) Format-Character-Font-Style-Bold + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xweststylelbcjk = xDialog.getChild("weststylelb-cjk") + self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold") + xCloseBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() + + def test_tdf115573_Table_loses_formatting_inserting_row_after(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #insert table 2x2 + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + xDialog = self.xUITest.getTopFocusWindow() + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + #select font format - Bold and write text "abc" + self.xUITest.executeCommand(".uno:Bold") + tables = document.getTextTables() + self.insertTextIntoCell(tables[0], "A1", "abc" ) + #go to second row - arrow down + self.xUITest.executeCommand(".uno:GoDown") + #insert row + self.xUITest.executeCommand(".uno:InsertRowsAfter") + #go up + self.xUITest.executeCommand(".uno:GoUp") + self.xUITest.executeCommand(".uno:GoUp") + #check the format of the text (should be still bold) Format-Character-Font-Style-Bold + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xweststylelbcjk = xDialog.getChild("weststylelb-cjk") + self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold") + xCloseBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() + + def test_tdf115573_Table_loses_formatting_inserting_column_left(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #insert table 2x2 + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + xDialog = self.xUITest.getTopFocusWindow() + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + #select font format - Bold and write text "abc" + self.xUITest.executeCommand(".uno:Bold") + tables = document.getTextTables() + self.insertTextIntoCell(tables[0], "A1", "abc" ) + #insert column left + self.xUITest.executeCommand(".uno:InsertColumnsBefore") + #check the format of the text (should be still bold) Format-Character-Font-Style-Bold + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xweststylelbcjk = xDialog.getChild("weststylelb-cjk") + self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold") + xCloseBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() + + def test_tdf115573_Table_loses_formatting_inserting_column_right(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #insert table 2x2 + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + xDialog = self.xUITest.getTopFocusWindow() + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + #select font format - Bold and write text "abc" + self.xUITest.executeCommand(".uno:Bold") + tables = document.getTextTables() + self.insertTextIntoCell(tables[0], "A1", "abc" ) + #insert column left + self.xUITest.executeCommand(".uno:InsertColumnsAfter") + #check the format of the text (should be still bold) Format-Character-Font-Style-Bold + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xweststylelbcjk = xDialog.getChild("weststylelb-cjk") + self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold") + xCloseBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: + diff --git a/sw/qa/uitest/writer_tests4/tdf122449.py b/sw/qa/uitest/writer_tests4/tdf122449.py new file mode 100644 index 000000000..06a603c5c --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf122449.py @@ -0,0 +1,57 @@ +# -*- 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.debug import sleep +from uitest.uihelper.common import get_state_as_dict, type_text +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Bug 122449 - Crash in: mergedlo.dll when closing "Edit Index Entry" dialog (gen/gtk) + +class tdf122449(UITestCase): + + def test_tdf122449_crash_edit_index_entry(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf122449.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + #search word Autocorrect (second find) .uno:SearchDialog + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Autocorrection"})) + xsearch = xDialog.getChild("search") + xsearch.executeAction("CLICK", tuple()) #first search + xsearch.executeAction("CLICK", tuple()) #2nd search + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "6") + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "HOME"})) + # invoke Index dialog Index entry .uno:IndexEntryDialog + self.ui_test.execute_dialog_through_command(".uno:IndexEntryDialog") + xDialog = self.xUITest.getTopFocusWindow() + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + # close + # Go to page 2 + self.ui_test.execute_dialog_through_command(".uno:GotoPage") + xDialog = self.xUITest.getTopFocusWindow() + xPageText = xDialog.getChild("page") + xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + # verify + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/tdf49683.py b/sw/qa/uitest/writer_tests4/tdf49683.py new file mode 100644 index 000000000..3d5af6a71 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf49683.py @@ -0,0 +1,38 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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.path import get_srcdir_url +from uitest.uihelper.common import get_state_as_dict +import time +from uitest.debug import sleep +from uitest.uihelper.common import select_pos + +def get_url_for_data_file(file_name): + return get_srcdir_url() + "/sw/qa/uitest/writer_tests/data/" + file_name + +class tdf49683(UITestCase): + +#tdf 49683 + def test_open_documentProperties_tdf49683(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf49683.rtf")) + self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") #tab description + xKeywordsText = xDialog.getChild("keywords") + self.assertEqual(get_state_as_dict(xKeywordsText)["Text"], "bhavb") + + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file diff --git a/sw/qa/uitest/writer_tests4/tdf51352.py b/sw/qa/uitest/writer_tests4/tdf51352.py new file mode 100644 index 000000000..d65800854 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf51352.py @@ -0,0 +1,53 @@ +# -*- 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.debug import sleep + +class tdf51352(UITestCase): + + def test_convert_nested_table_to_text_tdf51352(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() + #1. New a text document + #2. Insert a table and then in one cell create another table + #-insert a table (by default 2x2) + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + xDialog = self.xUITest.getTopFocusWindow() + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + #-put the cursor inside first cell top left for example + #-insert an inner table (by default 2x2) inside this cell + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + xDialog = self.xUITest.getTopFocusWindow() + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + #3. Select the first table + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + self.assertEqual(document.TextTables.getCount(), 2) + #4. From menu "Table->Convert->Table to Text + self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText") + xDialog = self.xUITest.getTopFocusWindow() + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + self.assertEqual(document.TextTables.getCount(), 0) + #5. Undo/Redo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextTables.getCount(), 2) + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(document.TextTables.getCount(), 0) + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: + diff --git a/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py b/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py new file mode 100644 index 000000000..0a32863d6 --- /dev/null +++ b/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py @@ -0,0 +1,164 @@ +# -*- 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 uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +import org.libreoffice.unotest +import pathlib +import time + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class dateFormFieldDialog(UITestCase): + + def test_setting_date_format(self): + # open a file with a date form field + writer_doc = self.ui_test.load_file(get_url_for_data_file("date_form_field.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + # open the dialog (cursor is at the field) + self.ui_test.execute_dialog_through_command(".uno:ControlProperties") + xDialog = self.xUITest.getTopFocusWindow() + + itemsList = xDialog.getChild("date_formats_treeview") + + # check whether we have the right format selected + self.assertEqual(get_state_as_dict(itemsList)["Children"], "20") + self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12/31/99") + + # select a new format + itemsList.getChild("11").executeAction("SELECT", tuple()); + self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + # open the dialog again + self.ui_test.execute_dialog_through_command(".uno:ControlProperties") + xDialog = self.xUITest.getTopFocusWindow() + itemsList = xDialog.getChild("date_formats_treeview") + self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() + + def test_date_field_with_custom_format(self): + # open a file with a date form field + writer_doc = self.ui_test.load_file(get_url_for_data_file("date_form_field_custom_format.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + # open the dialog (cursor is at the field) + self.ui_test.execute_dialog_through_command(".uno:ControlProperties") + xDialog = self.xUITest.getTopFocusWindow() + + itemsList = xDialog.getChild("date_formats_treeview") + + # check whether we have the right format selected + self.assertEqual(get_state_as_dict(itemsList)["Children"], "20") + self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "1999. december 31., péntek") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() + + def test_date_reformat(self): + # open a file with a date form field + writer_doc = self.ui_test.load_file(get_url_for_data_file("date_form_field.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + self.assertEqual(writer_doc.getText().getString(), "07/17/19") + + # open the dialog (cursor is at the field) + self.ui_test.execute_dialog_through_command(".uno:ControlProperties") + xDialog = self.xUITest.getTopFocusWindow() + + itemsList = xDialog.getChild("date_formats_treeview") + + # check whether we have the right format selected + self.assertEqual(get_state_as_dict(itemsList)["Children"], "20") + self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12/31/99") + + # select a new format + itemsList.getChild("11").executeAction("SELECT", tuple()); + self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + # after applying the new format, the field content should be updated + self.assertEqual(writer_doc.getText().getString(), "07-17") + + self.ui_test.close_doc() + + def test_date_field_with_placeholder(self): + # open a file with a date form field + writer_doc = self.ui_test.load_file(get_url_for_data_file("date_form_field_with_placeholder.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + self.assertEqual(writer_doc.getText().getString(), "[select date]") + + # open the dialog (cursor is at the field) + self.ui_test.execute_dialog_through_command(".uno:ControlProperties") + xDialog = self.xUITest.getTopFocusWindow() + + itemsList = xDialog.getChild("date_formats_treeview") + + # check whether we have the right format selected + self.assertEqual(get_state_as_dict(itemsList)["Children"], "20") + self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "Fri 31/Dec 99") + + # select a new format + itemsList.getChild("11").executeAction("SELECT", tuple()); + self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + # a placeholder text is not changed by format change + self.assertEqual(writer_doc.getText().getString(), "[select date]") + + self.ui_test.close_doc() + + def test_date_field_without_current_date(self): + # current date means the current date fieldmark parameter which contains the current date in YYYY-MM-DD format + # when this parameter is missing LO tries to parse the content string to find out the set date + + # open a file with a date form field + writer_doc = self.ui_test.load_file(get_url_for_data_file("date_form_field_without_current_date.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + self.assertEqual(writer_doc.getText().getString(), "07/17/19") + + # open the dialog (cursor is at the field) + self.ui_test.execute_dialog_through_command(".uno:ControlProperties") + xDialog = self.xUITest.getTopFocusWindow() + + itemsList = xDialog.getChild("date_formats_treeview") + + # check whether we have the right format selected + self.assertEqual(get_state_as_dict(itemsList)["Children"], "20") + self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12/31/99") + + # select a new format + itemsList.getChild("3").executeAction("SELECT", tuple()); + self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "Dec 31, 1999") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + # a placeholder text is not changed by format change + self.assertEqual(writer_doc.getText().getString(), "Jul 17, 2019") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py b/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py new file mode 100644 index 000000000..08797d9bb --- /dev/null +++ b/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py @@ -0,0 +1,275 @@ +# -*- 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 uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +import org.libreoffice.unotest +import pathlib +import time + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class dropDownFormFieldDialog(UITestCase): + + def test_add_new_items(self): + + # open a file with an empty form field + writer_doc = self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + # open the dialog (cursor is at the field) + self.ui_test.execute_dialog_through_command(".uno:ControlProperties") + xDialog = self.xUITest.getTopFocusWindow() + + itemEntry = xDialog.getChild("item_entry") + addButton = xDialog.getChild("add_button") + itemsList = xDialog.getChild("items_treeview") + + # initial state + self.assertEqual(get_state_as_dict(itemEntry)["Text"], "") + self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false") + self.assertEqual(get_state_as_dict(itemsList)["Children"], "0") + + # add some new items + itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"})) + self.assertEqual(get_state_as_dict(addButton)["Enabled"], "true") + addButton.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false") + itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"2000"})) + addButton.executeAction("CLICK", tuple()) + itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"3000"})) + addButton.executeAction("CLICK", tuple()) + itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"4000"})) + addButton.executeAction("CLICK", tuple()) + + # check whether the items are there in the list + self.assertEqual(get_state_as_dict(itemsList)["Children"], "4") + self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000") + self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000") + self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000") + self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + # check whether items are the same after reopening + self.ui_test.execute_dialog_through_command(".uno:ControlProperties") + xDialog = self.xUITest.getTopFocusWindow() + + itemsList = xDialog.getChild("items_treeview") + self.assertEqual(get_state_as_dict(itemsList)["Children"], "4") + self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000") + self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000") + self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000") + self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() + + def test_remove_items(self): + + # open a file with an empty form field + writer_doc = self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + # open the dialog (cursor is at the field) + self.ui_test.execute_dialog_through_command(".uno:ControlProperties") + xDialog = self.xUITest.getTopFocusWindow() + + itemEntry = xDialog.getChild("item_entry") + addButton = xDialog.getChild("add_button") + itemsList = xDialog.getChild("items_treeview") + removeButton = xDialog.getChild("remove_button") + + # initial state + self.assertEqual(get_state_as_dict(itemEntry)["Text"], "") + self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false") + self.assertEqual(get_state_as_dict(itemsList)["Children"], "0") + self.assertEqual(get_state_as_dict(removeButton)["Enabled"], "false") + + # add some new items + itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"})) + self.assertEqual(get_state_as_dict(addButton)["Enabled"], "true") + addButton.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(removeButton)["Enabled"], "true") + itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"2000"})) + addButton.executeAction("CLICK", tuple()) + itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"3000"})) + addButton.executeAction("CLICK", tuple()) + itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"4000"})) + addButton.executeAction("CLICK", tuple()) + + # check whether the items are there in the list + self.assertEqual(get_state_as_dict(itemsList)["Children"], "4") + self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000") + self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000") + self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000") + self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000") + + # select an item from the list and remove it + itemsList.getChild("1").executeAction("SELECT", tuple()); + removeButton.executeAction("CLICK", tuple()) + + # check whether the right item was removed + self.assertEqual(get_state_as_dict(itemsList)["Children"], "3") + self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000") + self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000") + self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + # check whether items are the same after reopening + self.ui_test.execute_dialog_through_command(".uno:ControlProperties") + xDialog = self.xUITest.getTopFocusWindow() + + itemsList = xDialog.getChild("items_treeview") + removeButton = xDialog.getChild("remove_button") + self.assertEqual(get_state_as_dict(itemsList)["Children"], "3") + self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000") + self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000") + self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000") + + # remove all items + itemsList.getChild("1").executeAction("SELECT", tuple()); + removeButton.executeAction("CLICK", tuple()) + removeButton.executeAction("CLICK", tuple()) + removeButton.executeAction("CLICK", tuple()) + + self.assertEqual(get_state_as_dict(removeButton)["Enabled"], "false") + self.assertEqual(get_state_as_dict(itemsList)["Children"], "0") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() + + def test_move_items(self): + + # open a file with an empty form field + writer_doc = self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + # open the dialog (cursor is at the field) + self.ui_test.execute_dialog_through_command(".uno:ControlProperties") + xDialog = self.xUITest.getTopFocusWindow() + + itemEntry = xDialog.getChild("item_entry") + addButton = xDialog.getChild("add_button") + itemsList = xDialog.getChild("items_treeview") + upButton = xDialog.getChild("up_button") + downButton = xDialog.getChild("down_button") + + # initial state + self.assertEqual(get_state_as_dict(itemEntry)["Text"], "") + self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false") + self.assertEqual(get_state_as_dict(itemsList)["Children"], "0") + self.assertEqual(get_state_as_dict(upButton)["Enabled"], "false") + self.assertEqual(get_state_as_dict(downButton)["Enabled"], "false") + + # add some new items + itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"})) + self.assertEqual(get_state_as_dict(addButton)["Enabled"], "true") + addButton.executeAction("CLICK", tuple()) + itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"2000"})) + addButton.executeAction("CLICK", tuple()) + itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"3000"})) + addButton.executeAction("CLICK", tuple()) + itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"4000"})) + addButton.executeAction("CLICK", tuple()) + + # check whether the items are there in the list + self.assertEqual(get_state_as_dict(itemsList)["Children"], "4") + self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000") + self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000") + self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000") + self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000") + + # select an item from the list and move it up + itemsList.getChild("1").executeAction("SELECT", tuple()) + self.assertEqual(get_state_as_dict(upButton)["Enabled"], "true") + self.assertEqual(get_state_as_dict(downButton)["Enabled"], "true") + upButton.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(upButton)["Enabled"], "false") + self.assertEqual(get_state_as_dict(downButton)["Enabled"], "true") + + # check whether the item was correctly moved + self.assertEqual(get_state_as_dict(itemsList)["Children"], "4") + self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "2000") + self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "1000") + self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000") + self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000") + + # move down the selected item + downButton.executeAction("CLICK", tuple()) + downButton.executeAction("CLICK", tuple()) + downButton.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(upButton)["Enabled"], "true") + self.assertEqual(get_state_as_dict(downButton)["Enabled"], "false") + + # check whether the item was correctly moved + self.assertEqual(get_state_as_dict(itemsList)["Children"], "4") + self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000") + self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000") + self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000") + self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "2000") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + # check whether items are the same after reopening + self.ui_test.execute_dialog_through_command(".uno:ControlProperties") + xDialog = self.xUITest.getTopFocusWindow() + + itemsList = xDialog.getChild("items_treeview") + self.assertEqual(get_state_as_dict(itemsList)["Children"], "4") + self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000") + self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000") + self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000") + self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "2000") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() + + def test_drop_down_after_import(self): + + files = ["drop_down_form_field.odt", "drop_down_form_field.doc", "drop_down_form_field.docx"] + for file in files: + # open a file with a drop-down for field with items and selection + writer_doc = self.ui_test.load_file(get_url_for_data_file(file)) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + # open the dialog (cursor is at the field) + self.ui_test.execute_dialog_through_command(".uno:ControlProperties") + xDialog = self.xUITest.getTopFocusWindow() + + itemsList = xDialog.getChild("items_treeview") + + # check whether the items are there in the list + self.assertEqual(get_state_as_dict(itemsList)["Children"], "4") + self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000") + self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000") + self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000") + self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000") + + self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "3000") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/about_test.py b/sw/qa/uitest/writer_tests5/about_test.py new file mode 100644 index 000000000..7005dbb65 --- /dev/null +++ b/sw/qa/uitest/writer_tests5/about_test.py @@ -0,0 +1,25 @@ +# -*- 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 + +class AboutDlgTest(UITestCase): + + def test_about_dlg(self): + + self.ui_test.create_doc_in_start_center("writer") + + self.ui_test.execute_dialog_through_command(".uno:About") + + xAboutDlg = self.xUITest.getTopFocusWindow() + + xCloseBtn = xAboutDlg.getChild("btnClose") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/autocorrectOptions.py b/sw/qa/uitest/writer_tests5/autocorrectOptions.py new file mode 100644 index 000000000..55d4b382c --- /dev/null +++ b/sw/qa/uitest/writer_tests5/autocorrectOptions.py @@ -0,0 +1,94 @@ +# -*- 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 +import time +from uitest.debug import sleep +from uitest.uihelper.common import select_pos + +class autocorrectOptions(UITestCase): + + def test_autocorrect_options_writer(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") #tab replace + origtext = xDialog.getChild("origtext") + newtext = xDialog.getChild("newtext") + xnew = xDialog.getChild("new") + xdelete = xDialog.getChild("delete") + xtabview = xDialog.getChild("tabview") + xreset = xDialog.getChild("reset") + nrRows = get_state_as_dict(xtabview)["VisibleCount"] + + #add new rule + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"})) + xnew.executeAction("CLICK", tuple()) + nrRowsNew = get_state_as_dict(xtabview)["VisibleCount"] + nrRowsDiff = int(nrRowsNew) - int(nrRows) + self.assertEqual(nrRowsDiff, 1) #we have +1 rule + #delete rule + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"})) + xdelete.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(xtabview)["VisibleCount"], nrRows) #we have default nr of rules + + select_pos(xTabs, "1") #tab Exceptions + #abbreviations + abbrev = xDialog.getChild("abbrev") + newabbrev = xDialog.getChild("newabbrev") + delabbrev = xDialog.getChild("delabbrev") + abbrevlist = xDialog.getChild("abbrevlist") + + nrRowsAbb = get_state_as_dict(abbrevlist)["Children"] + abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + abbrev.executeAction("TYPE", mkPropertyValues({"TEXT":"qqqqq"})) + newabbrev.executeAction("CLICK", tuple()) + nrRowsAbbNew = get_state_as_dict(abbrevlist)["Children"] + nrRowsAbbDiff = int(nrRowsAbbNew) - int(nrRowsAbb) + self.assertEqual(nrRowsAbbDiff, 1) #we have +1 rule + delabbrev.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(abbrevlist)["Children"], nrRowsAbb) #we have default nr of rules + + #words with two initial capitals + double = xDialog.getChild("double") + newdouble = xDialog.getChild("newdouble") + deldouble = xDialog.getChild("deldouble") + doublelist = xDialog.getChild("doublelist") + + nrRowsDouble = get_state_as_dict(doublelist)["Children"] + double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + double.executeAction("TYPE", mkPropertyValues({"TEXT":"QQqqq"})) + newdouble.executeAction("CLICK", tuple()) + nrRowsDoubleNew = get_state_as_dict(doublelist)["Children"] + nrRowsDoubleDiff = int(nrRowsDoubleNew) - int(nrRowsDouble) #convert string and + self.assertEqual(nrRowsDoubleDiff, 1) #we have +1 rule + deldouble.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(doublelist)["Children"], nrRowsDouble) #we have default nr of rules + + xCancelButton = xDialog.getChild("cancel") + xCancelButton.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/columns.py b/sw/qa/uitest/writer_tests5/columns.py new file mode 100644 index 000000000..f2a9fe6bc --- /dev/null +++ b/sw/qa/uitest/writer_tests5/columns.py @@ -0,0 +1,71 @@ +# -*- 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 uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from uitest.debug import sleep +from libreoffice.uno.propertyvalue import mkPropertyValues +#uitest sw / Columns dialog + +class columns(UITestCase): + def test_columns(self): + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + #set cm + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialog = self.xUITest.getTopFocusWindow() + + xPages = xDialog.getChild("pages") + xWriterEntry = xPages.getChild('3') # Writer + xWriterEntry.executeAction("EXPAND", tuple()) + xWriterGeneralEntry = xWriterEntry.getChild('0') + xWriterGeneralEntry.executeAction("SELECT", tuple()) #General + xMetric = xDialog.getChild("metric") + props = {"TEXT": "Centimeter"} + actionProps = mkPropertyValues(props) + xMetric.executeAction("SELECT", actionProps) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #dialog Columns + self.ui_test.execute_dialog_through_command(".uno:FormatColumns") + xDialog = self.xUITest.getTopFocusWindow() + + colsnf = xDialog.getChild("colsnf") + colsnf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + colsnf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + colsnf.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) + colsnf.executeAction("UP", tuple()) + colsnf.executeAction("DOWN", tuple()) + spacing1mf = xDialog.getChild("spacing1mf") + spacing1mf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + spacing1mf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + spacing1mf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + autowidth = xDialog.getChild("autowidth") + autowidth.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.ui_test.execute_dialog_through_command(".uno:FormatColumns") + xDialog = self.xUITest.getTopFocusWindow() + colsnf = xDialog.getChild("colsnf") + spacing1mf = xDialog.getChild("spacing1mf") + autowidth = xDialog.getChild("autowidth") + + self.assertEqual(get_state_as_dict(colsnf)["Text"], "2") + self.assertEqual(get_state_as_dict(spacing1mf)["Text"], "1.00 cm") + self.assertEqual(get_state_as_dict(autowidth)["Selected"], "false") + xOKBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/tdf107494.py b/sw/qa/uitest/writer_tests5/tdf107494.py new file mode 100644 index 000000000..0828e26bf --- /dev/null +++ b/sw/qa/uitest/writer_tests5/tdf107494.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 uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.debug import sleep +from uitest.path import get_srcdir_url + +def get_url_for_data_file(file_name): + return get_srcdir_url() + "/sw/qa/uitest/writer_tests/data/" + file_name + +#Bug 107494 - CRASH: LibreOffice crashes while deleting the header containing an image + +class tdf107494(UITestCase): + def test_tdf107494_delete_header_with_image(self): + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #insert header + self.assertEqual(document.StyleFamilies.PageStyles.Standard.HeaderIsOn, False) + self.xUITest.executeCommand(".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=true") + self.assertEqual(document.StyleFamilies.PageStyles.Standard.HeaderIsOn, True) + #insert image + text = document.getText() + cursor = text.createTextCursor() + oStyleFamilies = document.getStyleFamilies() + #https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=71227 + obj2 = oStyleFamilies.getByName("PageStyles") + obj3 = obj2.getByName("Standard") + oHeaderText = obj3.HeaderText + oHeaderText.setString("New text for header") #write text to header + obj4 = oHeaderText.createTextCursor() + text = obj4.getText() + cursor = text.createTextCursor() + + textGraphic = document.createInstance('com.sun.star.text.TextGraphicObject') + provider = self.xContext.ServiceManager.createInstance('com.sun.star.graphic.GraphicProvider') + graphic = provider.queryGraphic( mkPropertyValues({"URL": get_url_for_data_file("LibreOffice_external_logo_100px.png")})) + textGraphic.Graphic = graphic + text.insertTextContent(cursor, textGraphic, False) + # Delete the header + self.ui_test.execute_dialog_through_command(".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=false") + xDialog = self.xUITest.getTopFocusWindow() #question dialog + xOption = xDialog.getChild("yes") + xOption.executeAction("CLICK", tuple()) + + self.assertEqual(document.StyleFamilies.PageStyles.Standard.HeaderIsOn, False) + + self.ui_test.close_doc() + + def test_tdf107494_delete_footer_with_image(self): + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #insert footer + self.assertEqual(document.StyleFamilies.PageStyles.Standard.FooterIsOn, False) + self.xUITest.executeCommand(".uno:InsertPageFooter?PageStyle:string=Default%20Page%20Style&On:bool=true") + self.assertEqual(document.StyleFamilies.PageStyles.Standard.FooterIsOn, True) + #insert image + text = document.getText() + cursor = text.createTextCursor() + oStyleFamilies = document.getStyleFamilies() + #https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=71227 + obj2 = oStyleFamilies.getByName("PageStyles") + obj3 = obj2.getByName("Standard") + oFooterText = obj3.FooterText + oFooterText.setString("New text for footer") #write text to footer + obj4 = oFooterText.createTextCursor() + text = obj4.getText() + cursor = text.createTextCursor() + + textGraphic = document.createInstance('com.sun.star.text.TextGraphicObject') + provider = self.xContext.ServiceManager.createInstance('com.sun.star.graphic.GraphicProvider') + graphic = provider.queryGraphic( mkPropertyValues({"URL": get_url_for_data_file("LibreOffice_external_logo_100px.png")})) + textGraphic.Graphic = graphic + text.insertTextContent(cursor, textGraphic, False) + # Delete the footer + self.ui_test.execute_dialog_through_command(".uno:InsertPageFooter?PageStyle:string=Default%20Page%20Style&On:bool=false") + xDialog = self.xUITest.getTopFocusWindow() #question dialog + xOption = xDialog.getChild("yes") + xOption.executeAction("CLICK", tuple()) + + self.assertEqual(document.StyleFamilies.PageStyles.Standard.FooterIsOn, False) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/tdf117039.py b/sw/qa/uitest/writer_tests5/tdf117039.py new file mode 100644 index 000000000..9045f71c9 --- /dev/null +++ b/sw/qa/uitest/writer_tests5/tdf117039.py @@ -0,0 +1,34 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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 +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Bug 117039 - Print Preview crashes on signed document + +class tdf117039(UITestCase): + def test_tdf117039_preview_signed_document(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf117039.odt")) + document = self.ui_test.get_component() + self.xUITest.executeCommand(".uno:PrintPreview") #open print preview + self.xUITest.executeCommand(".uno:ClosePreview") # close print preview + + self.xUITest.getTopFocusWindow() #Get focus after closing preview + + #verify + self.assertEqual(document.Text.String[0:22], "Test digital signature") + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/tdf118540.py b/sw/qa/uitest/writer_tests5/tdf118540.py new file mode 100644 index 000000000..9b8b34fa3 --- /dev/null +++ b/sw/qa/uitest/writer_tests5/tdf118540.py @@ -0,0 +1,41 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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 +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Bug 118540 - LO6.1b2: DOCX crashes when properties are opened in print preview mode + +class tdf118540(UITestCase): + def test_tdf118540_preview_document_properties(self): + # FIXME flaky test, usually passes, but breaks regularly. + return + writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf118540.docx")) + document = self.ui_test.get_component() + self.xUITest.executeCommand(".uno:PrintPreview") #open print preview + self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") #open properties dialog + xDialog = self.xUITest.getTopFocusWindow() + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + self.xUITest.executeCommand(".uno:ClosePreview") # close print preview + + self.xUITest.getTopFocusWindow() #Get focus after closing preview + + #verify + self.assertEqual(document.Text.String[0:4], "Test") + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/tdf121591.py b/sw/qa/uitest/writer_tests5/tdf121591.py new file mode 100644 index 000000000..df6deac65 --- /dev/null +++ b/sw/qa/uitest/writer_tests5/tdf121591.py @@ -0,0 +1,41 @@ +# -*- 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 +#Bug 121591 - CRASH: Print Preview fails if cursor inside Floating frame +class tdf121591(UITestCase): + + def test_tdf121591_frame_print_preview(self): + # FIXME unstable test + return + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + self.ui_test.execute_dialog_through_command(".uno:InsertFrame") # insert frame + xDialogFr = self.xUITest.getTopFocusWindow() + + xOkBtn=xDialogFr.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + type_text(xWriterEdit, "Text in the frame") + #open and close print preview + self.xUITest.executeCommand(".uno:PrintPreview") #open print preview + self.xUITest.executeCommand(".uno:ClosePreview") # close print preview + + self.xUITest.getTopFocusWindow() #Get focus after closing preview + + #verify nr. of frames + self.assertEqual(document.TextFrames.getCount(), 1) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/tdf122722.py b/sw/qa/uitest/writer_tests5/tdf122722.py new file mode 100644 index 000000000..cbc46e09c --- /dev/null +++ b/sw/qa/uitest/writer_tests5/tdf122722.py @@ -0,0 +1,76 @@ +# -*- 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 +import time +from uitest.debug import sleep +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import select_pos + +#Bug 122722 - Hiding characters will crash. Crash in: SwAttrIter::CtorInitAttrIter(SwTextNode &,SwScriptInfo &,SwTextFrame const *) + +class tdf122722(UITestCase): + def test_tdf122722_format_character_hidden(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + #1. Start LibreOffice + #2. Create New Writer Document + #3. Type "LibreOffice" in Writer + type_text(xWriterEdit, "LibreOffice") + #4. Select "LibreOffice" with mouse, and right click + self.xUITest.executeCommand(".uno:SelectAll") + self.assertEqual(document.Text.String[0:11], "LibreOffice") + #5. Appear Context Menu, Character -> Character + #6. Opened Character, Select "Font Effect" tab + #7. Check Hidden, and click [OK] + #8. Crash a LibreOffice + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + + xEffects = xDialog.getChild("effectslb") + xRelief = xDialog.getChild("relieflb") + xHidden = xDialog.getChild("hiddencb") + xOverline = xDialog.getChild("overlinelb") + xStrikeout = xDialog.getChild("strikeoutlb") + xUnderline = xDialog.getChild("underlinelb") + xEmphasis = xDialog.getChild("emphasislb") + xPosition = xDialog.getChild("positionlb") + + xHidden.executeAction("CLICK", tuple()) + + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #un-hidden + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + + xEffects = xDialog.getChild("effectslb") + xRelief = xDialog.getChild("relieflb") + xHidden = xDialog.getChild("hiddencb") + xOverline = xDialog.getChild("overlinelb") + xStrikeout = xDialog.getChild("strikeoutlb") + xUnderline = xDialog.getChild("underlinelb") + xEmphasis = xDialog.getChild("emphasislb") + xPosition = xDialog.getChild("positionlb") + + self.assertEqual(get_state_as_dict(xHidden)["Selected"], "true") + xHidden.executeAction("CLICK", tuple()) + + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + self.assertEqual(document.Text.String[0:11], "LibreOffice") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/tdf123378.py b/sw/qa/uitest/writer_tests5/tdf123378.py new file mode 100644 index 000000000..d7b832e25 --- /dev/null +++ b/sw/qa/uitest/writer_tests5/tdf123378.py @@ -0,0 +1,27 @@ +# -*- 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 + +#Bug 123378 - Printing always sets "document modified" status + +class tdf123378(UITestCase): + def test_tdf123378_print_sets_modified(self): + # FIXME unstable test + return + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.xUITest.executeCommand(".uno:Print") + xDialog = self.xUITest.getTopFocusWindow() + xOK = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xOK) + + self.assertEqual(document.isModified(), False) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/tdf123446.py b/sw/qa/uitest/writer_tests5/tdf123446.py new file mode 100644 index 000000000..dd39dd9f5 --- /dev/null +++ b/sw/qa/uitest/writer_tests5/tdf123446.py @@ -0,0 +1,46 @@ +# -*- 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 +import time +from uitest.debug import sleep +#Bug 123446 - Writer crashes after undoing + redoing ToC insertion in middle of word + +class tdf123446(UITestCase): + + def test_tsd123446_undo_redo_ToC_crash(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + #- Add a word to an empty document. + type_text(xWriterEdit, "LibreOffice") + #- Change its style to Heading 2. + self.xUITest.executeCommand(".uno:StyleApply?Style:string=Heading%202&FamilyName:string=ParagraphStyles") + #- Position cursor somewhere in the middle of the word, and add Table of Contents + #(no need to change anything in the dialog). + self.xUITest.executeCommand(".uno:GoLeft") + self.xUITest.executeCommand(".uno:GoLeft") + self.xUITest.executeCommand(".uno:GoLeft") + self.xUITest.executeCommand(".uno:GoLeft") + + self.ui_test.execute_dialog_through_command(".uno:InsertMultiIndex") + xDialog = self.xUITest.getTopFocusWindow() + xokbtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xokbtn) + #- Undo the ToC insertion. + self.xUITest.executeCommand(".uno:Undo") + #- Redo the ToC insertion. + self.xUITest.executeCommand(".uno:Redo") + #=> Crash. Now we verify the text + # This second undo crash in Clang build https://bugs.documentfoundation.org/show_bug.cgi?id=123313#c9 + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Text.String[0:7], "LibreOf") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/titlePage.py b/sw/qa/uitest/writer_tests5/titlePage.py new file mode 100644 index 000000000..644406932 --- /dev/null +++ b/sw/qa/uitest/writer_tests5/titlePage.py @@ -0,0 +1,43 @@ +# -*- 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 uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +#uitest sw / Title Page dialog + +class titlePage(UITestCase): + def test_title_page(self): + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #dialog Title Page + self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") + xDialog = self.xUITest.getTopFocusWindow() + #print(xDialog.getChildren()) + + #select new Pages; nr of pages =2 (click UP), save; verify pageCount = 3 + newPages = xDialog.getChild("RB_INSERT_NEW_PAGES") + newPages.executeAction("CLICK", tuple()) + xpageCount = xDialog.getChild("NF_PAGE_COUNT") + xpageCount.executeAction("UP", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + self.assertEqual(document.CurrentController.PageCount, 3) + + # check cancel button + self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + self.assertEqual(document.CurrentController.PageCount, 3) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/xwindow.py b/sw/qa/uitest/writer_tests5/xwindow.py new file mode 100644 index 000000000..49628776b --- /dev/null +++ b/sw/qa/uitest/writer_tests5/xwindow.py @@ -0,0 +1,179 @@ +# -*- 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 +import unittest +import unohelper +from org.libreoffice.unotest import UnoInProcess +from com.sun.star.awt import XMouseListener +from com.sun.star.awt import XToolkitRobot +from com.sun.star.awt import MouseButton +from com.sun.star.awt import MouseEvent +from com.sun.star.awt import KeyEvent +from com.sun.star.awt import XKeyListener + + +mouseListenerCount = 0 +mouseEventsIntercepted = 0 +mousePressedEventsIntercepted = 0 +mouseReleasedEventsIntercepted = 0 +mouseEnteredEventsIntercepted = 0 +mouseExitedEventsIntercepted = 0 +keymousePressedEventsIntercepted = 0 +keymouseReleasedEventsIntercepted = 0 + + +class XMouseListenerExtended(unohelper.Base, XMouseListener): + def __init__(self): + global mouseListenerCount + mouseListenerCount += 1 + super().__init__() + + # is invoked when a mouse button has been pressed on a window. + @classmethod + def mousePressed(self, xMouseEvent): + global mousePressedEventsIntercepted + mousePressedEventsIntercepted += 1 + + # is invoked when a mouse button has been released on a window. + @classmethod + def mouseReleased(self, xMouseEvent): + global mouseReleasedEventsIntercepted + mouseReleasedEventsIntercepted += 1 + + # is invoked when the mouse enters a window. + @classmethod + def mouseEntered(self, xMouseEvent): + global mouseEventsIntercepted + mouseEventsIntercepted += 1 + return super(XMouseListenerExtended, self).mouseEntered(xMouseEvent) + + # is invoked when the mouse exits a window. + @classmethod + def mouseExited(self, xMouseEvent): + global mouseEventsIntercepted + mouseEventsIntercepted += 1 + return super(XMouseListenerExtended, self).mouseExited(xMouseEvent) + + +class XKeyListenerExtended(unohelper.Base, XKeyListener): + # is invoked when a key has been pressed + @classmethod + def keyPressed(self, xKeyEvent): + global keymousePressedEventsIntercepted + keymousePressedEventsIntercepted += 1 + return super(XKeyListenerExtended, self).keyPressed(xKeyEvent) + + # is invoked when a key has been released + @classmethod + def keyReleased(self, xKeyEvent): + global keymouseReleasedEventsIntercepted + keymouseReleasedEventsIntercepted += 1 + return super(XKeyListenerExtended, self).keyReleased(xKeyEvent) + +# Test that registered mouse/key listeners for top window receive mouse/key events +class XWindow(UITestCase): + def test_listeners(self): + global mouseListenerCount + + self.ui_test.create_doc_in_start_center("writer") + xDoc = self.ui_test.get_component() + + # create new mouse listener + xFrame = xDoc.getCurrentController().getFrame() + self.assertIsNotNone(xFrame) + xWindow = xFrame.getContainerWindow() + self.assertIsNotNone(xWindow) + + # add new mouse listener + xMouseListener = XMouseListenerExtended() + self.assertIsNotNone(xMouseListener) + xWindow.addMouseListener(xMouseListener) + self.assertEqual(1, mouseListenerCount) + + # add new key listener + xKeyListener = XKeyListenerExtended() + self.assertIsNotNone(xKeyListener) + xWindow.addKeyListener(xKeyListener) + + # create dummy mouse event + xMouseEvent = MouseEvent() + xMouseEvent.Modifiers = 0 + xMouseEvent.Buttons = MouseButton.LEFT + xMouseEvent.X = 10 + xMouseEvent.Y = 10 + xMouseEvent.ClickCount = 1 + xMouseEvent.PopupTrigger = False + xMouseEvent.Source = xWindow + + xMouseEvent2 = MouseEvent() + xMouseEvent2.Modifiers = 0 + xMouseEvent2.Buttons = MouseButton.LEFT + xMouseEvent2.X = 300 + xMouseEvent2.Y = 300 + xMouseEvent2.ClickCount = 1 + xMouseEvent2.PopupTrigger = False + xMouseEvent2.Source = xWindow + + # send mouse event + xToolkitRobot = xWindow.getToolkit() + self.assertIsNotNone(xToolkitRobot) + + # Click in the menubar/toolbar area + xToolkitRobot.mouseMove(xMouseEvent) + xToolkitRobot.mousePress(xMouseEvent) + xToolkitRobot.mouseRelease(xMouseEvent) + + # Click into the document content + xToolkitRobot.mousePress(xMouseEvent2) + xToolkitRobot.mouseRelease(xMouseEvent2) + + # send key press event + xKeyEvent = KeyEvent() + xKeyEvent.Modifiers = 0 + xKeyEvent.KeyCode = 70 + xKeyEvent.KeyChar = 70 + xKeyEvent.Source = xWindow + + xToolkitRobot.keyPress(xKeyEvent) + xToolkitRobot.keyRelease(xKeyEvent) + + # Wait for async events to be processed + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.processEventsToIdle() + + # remove mouse listener + xWindow.removeMouseListener(xMouseListener) + self.assertEqual(1, mouseListenerCount) + del xMouseListener + + # remove key listener + xWindow.removeKeyListener(xKeyListener) + del xKeyListener + + global keymousePressedEventsIntercepted + # Not expected any interceptions + self.assertEqual(0, keymousePressedEventsIntercepted) + + global keymouseReleasedEventsIntercepted + # Not expected any interceptions + self.assertEqual(0, keymouseReleasedEventsIntercepted) + + global mousePressedEventsIntercepted + self.assertEqual(0, mousePressedEventsIntercepted) + + global mouseReleasedEventsIntercepted + self.assertEqual(0, mouseReleasedEventsIntercepted) + + global mouseEventsIntercepted + # Not expected 3 interceptions + self.assertEqual(0, mouseEventsIntercepted) + + # close document + self.ui_test.close_doc() + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/zoom.py b/sw/qa/uitest/writer_tests5/zoom.py new file mode 100644 index 000000000..3d9e224c1 --- /dev/null +++ b/sw/qa/uitest/writer_tests5/zoom.py @@ -0,0 +1,107 @@ +# -*- 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 uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +#uitest sw / View-Zoom + +class writerZoom(UITestCase): + def test_zoom_writer(self): + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #dialog View-Zoom-Zoom + self.ui_test.execute_dialog_through_command(".uno:Zoom") + xDialog = self.xUITest.getTopFocusWindow() + + #select Optimal & Automatic - OK - open and verify + optimal = xDialog.getChild("optimal") + optimal.executeAction("CLICK", tuple()) + automatic = xDialog.getChild("automatic") + automatic.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.execute_dialog_through_command(".uno:Zoom") + xDialog = self.xUITest.getTopFocusWindow() + optimal = xDialog.getChild("optimal") + automatic = xDialog.getChild("automatic") + self.assertEqual(get_state_as_dict(optimal)["Checked"], "true") + self.assertEqual(get_state_as_dict(automatic)["Checked"], "true") + #select fit weight & Single page - OK - open and verify + fitwandh = xDialog.getChild("fitwandh") + singlepage = xDialog.getChild("singlepage") + fitwandh.executeAction("CLICK", tuple()) + singlepage.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.execute_dialog_through_command(".uno:Zoom") + xDialog = self.xUITest.getTopFocusWindow() + singlepage = xDialog.getChild("singlepage") + fitwandh = xDialog.getChild("fitwandh") + self.assertEqual(get_state_as_dict(singlepage)["Checked"], "true") + self.assertEqual(get_state_as_dict(fitwandh)["Checked"], "true") + #select fit width & columns - OK - open and verify + fitw = xDialog.getChild("fitw") + columnssb = xDialog.getChild("columnssb") + columns = xDialog.getChild("columns") + fitw.executeAction("CLICK", tuple()) + columns.executeAction("CLICK", tuple()) + columnssb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + columnssb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + columnssb.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.execute_dialog_through_command(".uno:Zoom") + xDialog = self.xUITest.getTopFocusWindow() + fitw = xDialog.getChild("fitw") + columnssb = xDialog.getChild("columnssb") + columns = xDialog.getChild("columns") + self.assertEqual(get_state_as_dict(fitw)["Checked"], "true") + self.assertEqual(get_state_as_dict(columns)["Checked"], "true") + self.assertEqual(get_state_as_dict(columnssb)["Text"], "3") + #select 100% & Automatic - OK - open and verify + automatic = xDialog.getChild("automatic") + x100pc = xDialog.getChild("100pc") + x100pc.executeAction("CLICK", tuple()) + automatic.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.execute_dialog_through_command(".uno:Zoom") + xDialog = self.xUITest.getTopFocusWindow() + automatic = xDialog.getChild("automatic") + x100pc = xDialog.getChild("100pc") + self.assertEqual(get_state_as_dict(automatic)["Checked"], "true") + self.assertEqual(get_state_as_dict(x100pc)["Checked"], "true") + #select variable 103% & Automatic - OK - open and verify + variable = xDialog.getChild("variable") + zoomsb = xDialog.getChild("zoomsb") + variable.executeAction("CLICK", tuple()) + zoomsb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + zoomsb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + zoomsb.executeAction("TYPE", mkPropertyValues({"TEXT":"101"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.execute_dialog_through_command(".uno:Zoom") + xDialog = self.xUITest.getTopFocusWindow() + variable = xDialog.getChild("variable") + zoomsb = xDialog.getChild("zoomsb") + self.assertEqual(get_state_as_dict(variable)["Checked"], "true") + self.assertEqual(get_state_as_dict(zoomsb)["Text"], "101%") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/infobar.py b/sw/qa/uitest/writer_tests6/infobar.py new file mode 100644 index 000000000..84dfdb3ac --- /dev/null +++ b/sw/qa/uitest/writer_tests6/infobar.py @@ -0,0 +1,60 @@ +# -*- 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 com.sun.star.beans import StringPair +from com.sun.star.frame import InfobarType +from com.sun.star.lang import IllegalArgumentException +from com.sun.star.container import NoSuchElementException + + +# Test for Infobar API + +class tdf97926(UITestCase): + def test_infobar_add(self): + self.ui_test.create_doc_in_start_center("writer") + controller = self.ui_test.get_component().getCurrentController() + buttons = [StringPair("Close", ".uno:CloseDoc")] + controller.appendInfobar( + "my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True) + + # Adding another infobar with the same ID should throw an exception + with self.assertRaises(IllegalArgumentException): + controller.appendInfobar( + "my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True) + self.ui_test.close_doc() + + def test_infobar_update(self): + self.ui_test.create_doc_in_start_center("writer") + controller = self.ui_test.get_component().getCurrentController() + buttons = [StringPair("Close", ".uno:CloseDoc")] + controller.appendInfobar( + "my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True) + controller.updateInfobar("my", "Hello universe", "", InfobarType.WARNING) + + # Updating non-existing infobars should throw an exception + with self.assertRaises(NoSuchElementException): + controller.updateInfobar("notexisting", "", "", InfobarType.WARNING) + + # Passing invalid values for InfobarType should throw an exception + with self.assertRaises(IllegalArgumentException): + controller.updateInfobar("my", "", "", 120) + + def test_infobar_remove(self): + self.ui_test.create_doc_in_start_center("writer") + controller = self.ui_test.get_component().getCurrentController() + buttons = [StringPair("Close", ".uno:CloseDoc")] + controller.appendInfobar( + "my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True) + + controller.removeInfobar("my") + + # Removing an already removed infobar should throw an exception + with self.assertRaises(NoSuchElementException): + controller.removeInfobar("my") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/tdf107847.py b/sw/qa/uitest/writer_tests6/tdf107847.py new file mode 100644 index 000000000..d653ddb0a --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf107847.py @@ -0,0 +1,40 @@ +# -*- 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.uihelper.common import select_pos +import time +from uitest.debug import sleep +#Bug 107847 - CRASH Opening macro tab of properties dialog (images, frames) causes crash + +class tdf107847(UITestCase): + + def test_tdf_107847_macro_tab_crash(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:InsertFrame") # insert frame + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + select_pos(xTabs, "2") + select_pos(xTabs, "3") + select_pos(xTabs, "4") + select_pos(xTabs, "5") + select_pos(xTabs, "6") + select_pos(xTabs, "7") + select_pos(xTabs, "8") #tab Macro + xokbtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xokbtn) + + self.assertEqual(document.TextFrames.getCount(), 1) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextFrames.getCount(), 0) + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/tdf120731.py b/sw/qa/uitest/writer_tests6/tdf120731.py new file mode 100644 index 000000000..b2d722663 --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf120731.py @@ -0,0 +1,35 @@ +# -*- 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 uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Bug 120731 - Crash cuilo!makeAutoCorrEdit when open character dialog with large amount of text selected + +class tdf120731(UITestCase): + def test_tdf120731_crash_open_char_dialog(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf120731.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.xUITest.executeCommand(".uno:SelectAll") + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + self.assertEqual(document.Text.String[0:5], "Lorem") + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/tdf124586.py b/sw/qa/uitest/writer_tests6/tdf124586.py new file mode 100644 index 000000000..fa71f0551 --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf124586.py @@ -0,0 +1,47 @@ +# -*- 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 uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Bug 124586 - Crash if switch from user outline numbering to chapter numbering with same paragraph style + +class tdf124586(UITestCase): + def test_tdf124586_crash_switch_outline_numbering(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf124586.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + #Goto Tools > Chapter Numbering. + self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xstyle = xDialog.getChild("style") + props = {"TEXT": "MyHeading"} + actionProps = mkPropertyValues(props) + xstyle.executeAction("SELECT", actionProps) + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.assertEqual(document.Text.String[0:8], "Schritte") + + self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xstyle = xDialog.getChild("style") + self.assertEqual(get_state_as_dict(xstyle)["SelectEntryText"], "MyHeading") + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/tdf124675.py b/sw/qa/uitest/writer_tests6/tdf124675.py new file mode 100644 index 000000000..2a02e36bc --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf124675.py @@ -0,0 +1,37 @@ +# -*- 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 uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Bug 124675 - CRASH: after moving the content down and undoing + +class tdf124675(UITestCase): + def test_tdf124675_crash_moving_SwTextFrame_previous_page(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf124675.docx")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + for i in range(52): + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + + self.xUITest.executeCommand(".uno:Undo") + + self.assertEqual(document.CurrentController.PageCount, 15) + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/tdf125104.py b/sw/qa/uitest/writer_tests6/tdf125104.py new file mode 100644 index 000000000..b711b01ca --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf125104.py @@ -0,0 +1,66 @@ +# +# 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 uitest.uihelper.common import select_pos, get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf125104(UITestCase): + + def open_page_style_dialog(self): + self.ui_test.execute_dialog_through_command(".uno:PageDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + return xDialog.getChild("comboLayoutFormat") + + def set_combo_layout_format(self, dialog, format): + comboLayoutFormat = dialog.getChild("comboLayoutFormat") + props = {"TEXT": format} + actionProps = mkPropertyValues(props) + comboLayoutFormat.executeAction("SELECT", actionProps) + okBtn = dialog.getChild("ok") + self.ui_test.close_dialog_through_button(okBtn) + + def test_tdf125104_pageFormat_numbering(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + + # insert page numbers on multiple pages + self.xUITest.executeCommand(".uno:InsertPageNumberField") + self.xUITest.executeCommand(".uno:InsertPagebreak") + self.xUITest.executeCommand(".uno:InsertPageNumberField") + text = document.Text.String.replace('\r\n', '\n') + self.assertEqual(text[0:1], "1") + self.assertEqual(text[2:3], "2") + + # Bug 125104 - Changing page numbering to "1st, 2nd, 3rd,..." causes crashes when trying to change Page settings later + self.set_combo_layout_format(self.open_page_style_dialog(), "1st, 2nd, 3rd, ...") + text = document.Text.String.replace('\r\n', '\n') + self.assertEqual(text[0:3], "1st") + self.assertEqual(text[4:7], "2nd") + + xDialog = self.open_page_style_dialog() + comboLayoutFormat = xDialog.getChild("comboLayoutFormat") + self.assertEqual(get_state_as_dict(comboLayoutFormat)["SelectEntryText"], "1st, 2nd, 3rd, ...") + cancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(cancelBtn) + + # change to devanagari alphabet format + self.set_combo_layout_format(self.open_page_style_dialog(), "क, ख, ग, ...") + text = document.Text.String.replace('\r\n', '\n') + self.assertEqual(text[0:1], "क") + self.assertEqual(text[2:3], "ख") + + # change to devanagari number format + self.set_combo_layout_format(self.open_page_style_dialog(), "१, २, ३, ...") + text = document.Text.String.replace('\r\n', '\n') + self.assertEqual(text[0:1], "१") + self.assertEqual(text[2:3], "२") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/tdf126017.py b/sw/qa/uitest/writer_tests6/tdf126017.py new file mode 100644 index 000000000..99ca14759 --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf126017.py @@ -0,0 +1,61 @@ +# -*- 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 uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Bug 126017 - Crash swlo!SwNode::EndOfSectionIndex + +class tdf126017(UITestCase): + def test_tdf126017_crash_after_undo(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf126017.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + #go to TOC + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"aasasas"})) + xsearch = xDialog.getChild("search") + xsearch.executeAction("CLICK", tuple()) + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + #edit index + self.ui_test.execute_dialog_through_command(".uno:EditCurIndex") #open index dialog + xDiagIndex = self.xUITest.getTopFocusWindow() + xOKBtn = xDiagIndex.getChild("ok") + title = xDiagIndex.getChild("title") + title.executeAction("TYPE", mkPropertyValues({"TEXT":"aaaa"})) + self.ui_test.close_dialog_through_button(xOKBtn) + + self.xUITest.executeCommand(".uno:Undo") + + self.ui_test.execute_dialog_through_command(".uno:EditCurIndex") #open index dialog + xDiagIndex = self.xUITest.getTopFocusWindow() + xOKBtn = xDiagIndex.getChild("ok") + title = xDiagIndex.getChild("title") + title.executeAction("TYPE", mkPropertyValues({"TEXT":"aaaa"})) + self.ui_test.close_dialog_through_button(xOKBtn) + + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") + + self.assertEqual(document.Text.String.replace('\r\n', '\n')[1:7], "CRASHY") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/tdf126168.py b/sw/qa/uitest/writer_tests6/tdf126168.py new file mode 100644 index 000000000..d25ae711e --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf126168.py @@ -0,0 +1,52 @@ +# -*- 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.uihelper.common import select_pos +import time +from uitest.debug import sleep +#Bug 126168 - Crash in: rtl_uString_acquire: frame style undo redo + +class tdf126168(UITestCase): + + def test_tdf126168_frame_undo_redo_crash(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + #2) Menu > Insert > Frame > Frame + #3) Press OK in Frame dialog + self.ui_test.execute_dialog_through_command(".uno:InsertFrame") # insert frame + xDialog = self.xUITest.getTopFocusWindow() + xokbtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xokbtn) + self.assertEqual(document.TextFrames.getCount(), 1) + #New Style from Selection [uno:StyleNewByExample] + self.ui_test.execute_dialog_through_command(".uno:StyleNewByExample") + #5) Enter a name in the Create Style dialog and press OK + xDialog = self.xUITest.getTopFocusWindow() + stylename = xDialog.getChild("stylename") + stylename.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) + xokbtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xokbtn) + #6) ctrl+z 3 times + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextFrames.getCount(), 0) + #7) shift+ctrl+z 3 times + self.xUITest.executeCommand(".uno:Redo") + self.xUITest.executeCommand(".uno:Redo") + self.xUITest.executeCommand(".uno:Redo") + + #Results: crash + self.assertEqual(document.CurrentController.PageCount, 1) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/tdf126627.py b/sw/qa/uitest/writer_tests6/tdf126627.py new file mode 100644 index 000000000..dcce155b3 --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf126627.py @@ -0,0 +1,60 @@ +# -*- 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 uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib +from uitest.path import get_srcdir_url +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Bug 126627 - CRASH: undoing redlinehide deletion + +class tdf126627(UITestCase): + def test_tdf126627_crash_undo_deletion(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf126627.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"bar"})) + xsearch = xDialog.getChild("search") + xsearch.executeAction("CLICK", tuple()) + + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + #2. Place the cursor before 'bar' + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) + #3. Hit backspace 4 times -> Foo and bar are together + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) + self.assertEqual(document.Text.String[0:6], "foobar") + #4. Undo once-> Crash + self.xUITest.executeCommand(".uno:Undo") + #verify that we have now two words + self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog") + xDialog = self.xUITest.getTopFocusWindow() + xselectwords = xDialog.getChild("selectwords") + self.assertEqual(get_state_as_dict(xselectwords)["Text"], "2") + xCloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/tdf128431.py b/sw/qa/uitest/writer_tests6/tdf128431.py new file mode 100644 index 000000000..17dde483e --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf128431.py @@ -0,0 +1,63 @@ +# +# 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 uitest.uihelper.common import select_pos, get_state_as_dict +from com.sun.star.uno import RuntimeException +from com.sun.star.awt.GradientStyle import LINEAR +from com.sun.star.drawing.HatchStyle import SINGLE +from com.sun.star.drawing.BitmapMode import REPEAT +from com.sun.star.drawing.RectanglePoint import MIDDLE_MIDDLE + +from libreoffice.uno.propertyvalue import mkPropertyValues +#Bug 128431 - Synchronize padding in header borders it is not working + +class tdf128431(UITestCase): + + def test_tdf128431_pageFormat_sync_padding(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + + #set cm Tools-options-StarOffice Writer-General + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialog = self.xUITest.getTopFocusWindow() + + xPages = xDialog.getChild("pages") + xWriterEntry = xPages.getChild('3') # Writer + xWriterEntry.executeAction("EXPAND", tuple()) + xWriterGeneralEntry = xWriterEntry.getChild('0') + xWriterGeneralEntry.executeAction("SELECT", tuple()) #General + xMetric = xDialog.getChild("metric") + props = {"TEXT": "Centimeter"} + actionProps = mkPropertyValues(props) + xMetric.executeAction("SELECT", actionProps) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.execute_dialog_through_command(".uno:PageDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, 6) #borders + + sync = xDialog.getChild("sync") + bottomft = xDialog.getChild("bottommf") + topft = xDialog.getChild("topmf") + rightft = xDialog.getChild("rightmf") + leftft = xDialog.getChild("leftmf") + + self.assertEqual(get_state_as_dict(sync)["Selected"], "true") + bottomft.executeAction("UP", tuple()) + self.assertEqual(get_state_as_dict(bottomft)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(topft)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(rightft)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(leftft)["Text"], "0.10 cm") + + okBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(okBtn) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/tdf131041.py b/sw/qa/uitest/writer_tests6/tdf131041.py new file mode 100644 index 000000000..94a6f2b75 --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf131041.py @@ -0,0 +1,50 @@ +# +# 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 uitest.uihelper.common import select_pos, get_state_as_dict + +class tdf131041(UITestCase): + + def test_run(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + + self.ui_test.execute_dialog_through_command(".uno:PageDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, 4) #header + + xHeaderOn = xDialog.getChild("checkHeaderOn") + xMoreBtn = xDialog.getChild("buttonMore") + + self.assertEqual(get_state_as_dict(xHeaderOn)["Selected"], "false") + self.assertEqual(get_state_as_dict(xMoreBtn)["Enabled"], "false") + + xHeaderOn.executeAction("CLICK", tuple()) + + self.assertEqual(get_state_as_dict(xHeaderOn)["Selected"], "true") + self.assertEqual(get_state_as_dict(xMoreBtn)["Enabled"], "true") + + self.ui_test.execute_dialog_through_action(xMoreBtn, "CLICK") + + xBorderDlg = self.xUITest.getTopFocusWindow() + + #modify any property + bottomft = xBorderDlg.getChild("bottommf") + bottomft.executeAction("UP", tuple()) + + #it would crash here + okBtn = xBorderDlg.getChild("ok") + self.ui_test.close_dialog_through_button(okBtn) + + xDialog = self.xUITest.getTopFocusWindow() + okBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(okBtn) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/tdf44837.py b/sw/qa/uitest/writer_tests6/tdf44837.py new file mode 100644 index 000000000..8354709da --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf44837.py @@ -0,0 +1,46 @@ +# +# 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 uitest.uihelper.common import select_pos, get_state_as_dict, type_text +from com.sun.star.uno import RuntimeException +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.debug import sleep +#Bug 44837 - EDITING 'Replace All' clears current selection + +class tdf44837(UITestCase): + + def test_tdf448373_Replace_All_clears_current_selection(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() + + type_text(xWriterEdit, "asd asd") + self.xUITest.executeCommand(".uno:SelectAll") + + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"b"})) #replace textbox + + selectionOnly = xDialog.getChild("selection") + selectionOnly.executeAction("CLICK", tuple()) + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + + self.assertEqual(document.Text.String[0:8], "bsd bsd") + self.assertEqual(len(document.CurrentSelection[0].String) > 1, True) + #follow-up bug 125663 + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/data/tdf127652.odt b/sw/qa/uitest/writer_tests7/data/tdf127652.odt Binary files differnew file mode 100644 index 000000000..12b2b156b --- /dev/null +++ b/sw/qa/uitest/writer_tests7/data/tdf127652.odt diff --git a/sw/qa/uitest/writer_tests7/data/tdf131936.docx b/sw/qa/uitest/writer_tests7/data/tdf131936.docx Binary files differnew file mode 100644 index 000000000..f993d6ee3 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/data/tdf131936.docx diff --git a/sw/qa/uitest/writer_tests7/tdf127652.py b/sw/qa/uitest/writer_tests7/tdf127652.py new file mode 100644 index 000000000..b6e181c61 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf127652.py @@ -0,0 +1,56 @@ +# -*- 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 uitest.path import get_srcdir_url +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict + +def get_url_for_data_file(file_name): + return get_srcdir_url() + "/sw/qa/uitest/writer_tests7/data/" + file_name + +class tdf127652 (UITestCase): + + def test_mark_delete_undo_delete_tdf127652 (self): + + self.ui_test.load_file(get_url_for_data_file("tdf127652.odt")) + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + # go to the start of page 4 + xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "4"})) + xWriterEdit.executeAction("CLICK", tuple()) + + # mark a section that overlaps multiple pages + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "SHIFT+UP"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "SHIFT+UP"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "SHIFT+UP"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "SHIFT+UP"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "SHIFT+UP"})) + + # delete the marked section + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DELETE"})) + + # go to the start of page 4 + xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "4"})) + xWriterEdit.executeAction("CLICK", tuple()) + + # move up to page 3 + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + + # check that we are on the third page + # in the bug one issue was that the cursor was places in the wrong place + # moving up to the previous page would not work any more + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3") + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf131936.py b/sw/qa/uitest/writer_tests7/tdf131936.py new file mode 100644 index 000000000..5d2de2c3a --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf131936.py @@ -0,0 +1,32 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# 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 uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.path import get_srcdir_url +from uitest.config import DEFAULT_SLEEP +import time + +def get_url_for_data_file(file_name): + return get_srcdir_url() + "/sw/qa/uitest/writer_tests7/data/" + file_name + +class tdf131936(UITestCase): + + def test_tdf131936_saveas_docx_version(self): + self.ui_test.load_file(get_url_for_data_file("tdf131936.docx")) + + self.ui_test.execute_dialog_through_command(".uno:SaveAs") + time.sleep(DEFAULT_SLEEP) + xDialog = self.xUITest.getTopFocusWindow() + xFileTypeCombo = xDialog.getChild("file_type") + state = get_state_as_dict(xFileTypeCombo) + self.assertEqual(state["SelectEntryText"], "Office Open XML Text (Transitional) (.docx)") + + xCancel = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancel) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf132169.py b/sw/qa/uitest/writer_tests7/tdf132169.py new file mode 100644 index 000000000..9c884e405 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf132169.py @@ -0,0 +1,68 @@ +# -*- 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 uitest.path import get_srcdir_url +from uitest.uihelper.common import get_state_as_dict, type_text +from libreoffice.uno.propertyvalue import mkPropertyValues + +def get_url_for_data_file(file_name): + return get_srcdir_url() + "/sw/qa/uitest/writer_tests/data/" + file_name + +class tdf132169(UITestCase): + def test_tdf132169(self): + + writer_doc = self.ui_test.load_file(get_url_for_data_file("shape.odt")) + + #set measurement to points + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") + xDialogOpt = self.xUITest.getTopFocusWindow() + xPages = xDialogOpt.getChild("pages") + xWriterEntry = xPages.getChild('3') + xWriterEntry.executeAction("EXPAND", tuple()) + xWriterGeneralEntry = xWriterEntry.getChild('0') + xWriterGeneralEntry.executeAction("SELECT", tuple()) + xMetric = xDialogOpt.getChild("metric") + props = {"TEXT": "Point"} + actionProps = mkPropertyValues(props) + xMetric.executeAction("SELECT", actionProps) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:JumpToNextFrame") + + #wait until the toolbar is available + self.ui_test.wait_until_child_is_available(xWriterEdit, 'metricfield') + xLineMetric = xWriterEdit.getChild('metricfield') + self.assertEqual(get_state_as_dict(xLineMetric)["Text"], "0.0 pt") + + #Check changing value from dialog also works + self.ui_test.execute_dialog_through_command(".uno:FormatLine") + xFormatLineDlg = self.xUITest.getTopFocusWindow() + xWidth = xFormatLineDlg.getChild('MTR_FLD_LINE_WIDTH') + type_text(xWidth, "4.0") + xOKBtn = xFormatLineDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.wait_until_property_is_updated(xLineMetric, "Text", "4.0 pt") + self.assertEqual(get_state_as_dict(xLineMetric)["Text"], "4.0 pt") + + xLineMetric.executeAction("UP", tuple()) + + document = self.ui_test.get_component() + drawPage = document.getDrawPages().getByIndex(0) + shape = drawPage.getByIndex(0) + + #Without the fix in place, it would have been 310 + self.assertEqual(shape.LineWidth, 176) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: + diff --git a/sw/qa/uitest/writer_tests7/tdf133189.py b/sw/qa/uitest/writer_tests7/tdf133189.py new file mode 100644 index 000000000..8b59fcceb --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf133189.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 uitest.uihelper.common import get_state_as_dict, select_pos +from libreoffice.uno.propertyvalue import mkPropertyValues + +def change_metric_units(self, unit): + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") + xDialogOpt = self.xUITest.getTopFocusWindow() + xPages = xDialogOpt.getChild("pages") + xWriterEntry = xPages.getChild('3') + xWriterEntry.executeAction("EXPAND", tuple()) + xWriterGeneralEntry = xWriterEntry.getChild('0') + xWriterGeneralEntry.executeAction("SELECT", tuple()) + xMetric = xDialogOpt.getChild("metric") + props = {"TEXT": unit} + actionProps = mkPropertyValues(props) + xMetric.executeAction("SELECT", actionProps) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + +class tdf133189(UITestCase): + def test_tdf133189(self): + writer_doc = self.ui_test.create_doc_in_start_center("writer") + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:Sidebar") + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "PageStylesPanel"})) + + xPaperSize = xWriterEdit.getChild('papersize') + xPaperWidth = xWriterEdit.getChild('paperwidth') + xPaperHeight = xWriterEdit.getChild('paperheight') + xPaperOrient = xWriterEdit.getChild('paperorientation') + xPaperMargin = xWriterEdit.getChild('marginLB') + + #change measurement to Inches + change_metric_units(self, 'Inch') + + self.ui_test.execute_dialog_through_command(".uno:PageDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + xWidth = xDialog.getChild('spinWidth') + xHeight = xDialog.getChild('spinHeight') + + props = {"VALUE": '8.0'} + actionProps = mkPropertyValues(props) + + xWidth.executeAction("VALUE", actionProps) + xHeight.executeAction("VALUE", actionProps) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.wait_until_property_is_updated(xPaperMargin, "SelectEntryText", "Normal (0.75″)") + self.assertEqual(get_state_as_dict(xPaperMargin)['SelectEntryText'], "Normal (0.75″)") + self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User") + self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User") + self.ui_test.wait_until_property_is_updated(xPaperOrient, "SelectEntryText", "Portrait") + self.assertEqual(get_state_as_dict(xPaperOrient)['SelectEntryText'], "Portrait") + self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "8.00″") + self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "8.00″") + self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "8.00″") + self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "8.00″") + + #change measurement again to Centimeters + change_metric_units(self, 'Centimeter') + + self.ui_test.wait_until_property_is_updated(xPaperMargin, "SelectEntryText", "Normal (1.90 cm)") + # tdf#129267 + self.assertEqual(get_state_as_dict(xPaperMargin)['SelectEntryText'], "Normal (1.90 cm)") + self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User") + self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User") + self.ui_test.wait_until_property_is_updated(xPaperOrient, "SelectEntryText", "Portrait") + self.assertEqual(get_state_as_dict(xPaperOrient)['SelectEntryText'], "Portrait") + self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "20.32 cm") + self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "20.32 cm") + self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "20.32 cm") + self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "20.32 cm") + + self.xUITest.executeCommand(".uno:Sidebar") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: + diff --git a/sw/qa/uitest/writer_tests7/tdf99711.py b/sw/qa/uitest/writer_tests7/tdf99711.py new file mode 100644 index 000000000..1a6b7f069 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf99711.py @@ -0,0 +1,55 @@ +# -*- 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 uitest.path import get_srcdir_url +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +def get_url_for_data_file(file_name): + return get_srcdir_url() + "/sw/qa/uitest/writer_tests/data/" + file_name + +class tdf99711(UITestCase): + def test_tdf99711(self): + + writer_doc = self.ui_test.load_file(get_url_for_data_file("shape.odt")) + + #set measurement to millimeters + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") + xDialogOpt = self.xUITest.getTopFocusWindow() + xPages = xDialogOpt.getChild("pages") + xWriterEntry = xPages.getChild('3') + xWriterEntry.executeAction("EXPAND", tuple()) + xWriterGeneralEntry = xWriterEntry.getChild('0') + xWriterGeneralEntry.executeAction("SELECT", tuple()) + xMetric = xDialogOpt.getChild("metric") + props = {"TEXT": "Millimeter"} + actionProps = mkPropertyValues(props) + xMetric.executeAction("SELECT", actionProps) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:JumpToNextFrame") + + self.xUITest.executeCommand(".uno:Sidebar") + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "TextPropertyPanel"})) + + #wait until the sidebar is available + self.ui_test.wait_until_child_is_available(xWriterEdit, 'selectwidth') + self.assertEqual(get_state_as_dict(xWriterEdit.getChild('selectwidth'))['Text'], '10.00 mm') + + self.ui_test.wait_until_child_is_available(xWriterEdit, 'selectheight') + self.assertEqual(get_state_as_dict(xWriterEdit.getChild('selectheight'))['Text'], '10.00 mm') + + self.xUITest.executeCommand(".uno:Sidebar") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: + |