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/writer_tests3 | |
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/writer_tests3')
-rw-r--r-- | sw/qa/uitest/writer_tests3/insertEndnote.py | 38 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests3/insertEnvelope.py | 51 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests3/insertFootEndnote.py | 81 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests3/insertPageFooter.py | 75 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests3/insertQrCodeGen.py | 79 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests3/insertSignatureLine.py | 95 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests3/lineNumbering.py | 121 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests3/sort.py | 72 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests3/specialCharacter.py | 92 |
9 files changed, 704 insertions, 0 deletions
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: |