diff options
Diffstat (limited to 'sw/qa/uitest')
310 files changed, 15412 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..28a17f235 --- /dev/null +++ b/sw/qa/uitest/chapterNumbering/chapterNumbering.py @@ -0,0 +1,85 @@ +# -*- 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.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text +from uitest.uihelper.common import change_measurement_unit + +#Outline Numbering is now Chapter Numbering + +class WriterChapterNumbering(UITestCase): + + def test_chapter_numbering_dialog(self): + with self.ui_test.create_doc_in_start_center("writer"): + + change_measurement_unit(self, "Millimeter") + + with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog: + 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 + select_by_text(xstyle, "Heading") + select_by_text(xnumbering, "1, 2, 3, ...") + select_by_text(xcharstyle, "Bullets") + 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()) + select_by_text(xnum2alignlb, "Centered") + select_by_text(xnumfollowedbylb, "Tab stop") + xatmf.executeAction("UP", tuple()) + xindentatmf.executeAction("UP", tuple()) + + + with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog", close_button="cancel") as xDialog: + + 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") + +# 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..ae40e3128 --- /dev/null +++ b/sw/qa/uitest/chapterNumbering/tdf123547.py @@ -0,0 +1,27 @@ +# -*- 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.uihelper.common import get_url_for_data_file +from uitest.uihelper.common import select_pos + +#Bug 123547 - Systematic crash after opening Tools > Chapter Numbering + +class tdf123547(UITestCase): + def test_tdf123547_numbering_dialog_crash(self): + with self.ui_test.load_file(get_url_for_data_file("tdf123547.docx")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + #verify we didn't crash + self.assertEqual(writer_doc.CurrentController.PageCount, 1) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/chapterNumbering/tdf140528.py b/sw/qa/uitest/chapterNumbering/tdf140528.py new file mode 100644 index 000000000..5bc25962b --- /dev/null +++ b/sw/qa/uitest/chapterNumbering/tdf140528.py @@ -0,0 +1,51 @@ +# -*- 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.uihelper.common import select_pos + +class Tdf140528(UITestCase): + + def test_tdf140528(self): + with self.ui_test.create_doc_in_start_center("writer"): + + with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog: + + xTab = xDialog.getChild("tabcontrol") + select_pos(xTab, "0") + + xFormat = xDialog.getChild("format") + + with self.ui_test.execute_blocking_action(xFormat.executeAction, args=('OPENFROMLIST', mkPropertyValues({"POS": "10"}))) as dialog: + xEntry = dialog.getChild("entry") + self.assertEqual("Untitled 1", get_state_as_dict(xEntry)['Text']) + + xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xEntry.executeAction("TYPE", mkPropertyValues({"TEXT" : "newFormat"})) + + self.assertEqual("saveas", get_state_as_dict(xFormat)['CurrentItem']) + + # Go to Position tab + select_pos(xTab, "1") + + # Go back to Numbering tab + select_pos(xTab, "0") + + xFormat.executeAction('OPENFROMLIST', mkPropertyValues({"POS": "0"})) + self.assertEqual("form1", get_state_as_dict(xFormat)['CurrentItem']) + + # Without the fix in place, this test would have crashed here + select_pos(xTab, "1") + + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/chapterNumbering/tdf145215.py b/sw/qa/uitest/chapterNumbering/tdf145215.py new file mode 100644 index 000000000..29c119730 --- /dev/null +++ b/sw/qa/uitest/chapterNumbering/tdf145215.py @@ -0,0 +1,37 @@ +# -*- 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.uihelper.common import get_url_for_data_file, get_state_as_dict + +class Tdf145215(UITestCase): + + def test_tdf145215(self): + with self.ui_test.load_file(get_url_for_data_file("tdf145215.docx")) as writer_doc: + with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog: + xTab = xDialog.getChild("tabcontrol") + + # Select level "4" + xLevel = xDialog.getChild("level") + xLevel2 = xLevel.getChild("3") + xLevel2.executeAction("SELECT", tuple()) + self.assertEqual("4", get_state_as_dict(xLevel)['SelectEntryText']) + + # Check value for show upper levels + xSubLevels = xDialog.getChild("sublevelsnf") + self.assertEqual(get_state_as_dict(xSubLevels)["Text"], "1") + + # Check field value (there is only one field) + textfields = writer_doc.getTextFields() + textfields.refresh() + textfield = textfields.createEnumeration().nextElement() + self.assertTrue(textfield.supportsService("com.sun.star.text.TextField.GetReference")) + self.assertEqual(textfield.CurrentPresentation, "1.2.1(i)") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/chart/tdf138556.py b/sw/qa/uitest/chart/tdf138556.py new file mode 100644 index 000000000..b6e2c7d9f --- /dev/null +++ b/sw/qa/uitest/chart/tdf138556.py @@ -0,0 +1,46 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict + +class tdf138556( UITestCase ): + + def test_stock_chart13_insert_series( self ): + #Start LibreOffice Writer + with self.ui_test.create_doc_in_start_center( "writer" ): + xMainTop = self.xUITest.getTopFocusWindow() + + #Insert Chart + self.xUITest.executeCommand( ".uno:InsertObjectChart" ) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild( "chart_window" ) + xChart = xChartMain.getChild( "CID/Page=" ) + + #Change Chart Type to Stock 1 + #TODO: test other subtypes + with self.ui_test.execute_dialog_through_action( xChart, "COMMAND", mkPropertyValues({ "COMMAND" : "DiagramType" })) as xDialog: + xChartType = xDialog.getChild( "charttype" ) + xStockType = xChartType.getChild( "8" ) + xStockType.executeAction( "SELECT", tuple()) + + #Insert Data Series + with self.ui_test.execute_dialog_through_action( xChart, "COMMAND", mkPropertyValues({ "COMMAND" : "DiagramData" }), close_button="close") as xDialog: + xToolbar = xDialog.getChild( "toolbar" ) + xToolbar.executeAction( "CLICK", mkPropertyValues({ "POS" : "1" })) + + #Check Number of Sequences + xDocument = self.ui_test.get_component() + nSequences = len( xDocument.FirstDiagram. + CoordinateSystems[0].ChartTypes[0].DataSeries[0].DataSequences ) + self.assertEqual( nSequences, 3 ) + +# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file diff --git a/sw/qa/uitest/chart/tdf149718.py b/sw/qa/uitest/chart/tdf149718.py new file mode 100644 index 000000000..873379a36 --- /dev/null +++ b/sw/qa/uitest/chart/tdf149718.py @@ -0,0 +1,40 @@ +# -*- 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.uihelper.common import select_pos + +class tdf149718( UITestCase ): + + def test_chart_from_table_with_merged_cells( self ): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + with self.ui_test.execute_dialog_through_command(".uno:InsertTable") as xDialog: + formatlbinstable = xDialog.getChild("formatlbinstable") + entry = formatlbinstable.getChild("1") + entry.executeAction("SELECT", tuple()) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:CharRightSel") + self.xUITest.executeCommand(".uno:MergeCells") + + self.xUITest.executeCommand(".uno:GoDown") + xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "1"})) + self.xUITest.executeCommand(".uno:GoLeft") + self.xUITest.executeCommand(".uno:GoLeft") + xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "1"})) + self.xUITest.executeCommand(".uno:CharRightSel") + with self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart", close_button="finish") as xDialog: + xWizard = xDialog.getChild('Wizard') + +# 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..c4b1f9102 --- /dev/null +++ b/sw/qa/uitest/classification/classification.py @@ -0,0 +1,150 @@ +# -*- 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.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_by_text +from libreoffice.uno.propertyvalue import mkPropertyValues + +#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): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_command(".uno:ClassificationDialog") as xDialog: + classificationEditWindow = xDialog.getChild("classificationEditWindow") + recentlyUsedCB = xDialog.getChild("recentlyUsedCB") + classificationCB = xDialog.getChild("classificationCB") + internationalClassificationCB = xDialog.getChild("internationalClassificationCB") + intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry") + intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton") + + select_by_text(classificationCB, "Confidential") + #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") + + header = document.StyleFamilies.PageStyles.Standard.HeaderText.createEnumeration().nextElement() + self.assertEqual(header.String, "Confidential") + + controller = document.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 + with self.ui_test.execute_dialog_through_command(".uno:Watermark", close_button="cancel") as xDialog: + 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") + + #TODO + #open dialog and add intellectualProperty text, save + #verify + #reopen and verify classification and Content + + #do the same for Paragraph classification + with self.ui_test.execute_dialog_through_command(".uno:ParagraphClassificationDialog") as xDialog: + classificationEditWindow = xDialog.getChild("classificationEditWindow") + recentlyUsedCB = xDialog.getChild("recentlyUsedCB") + classificationCB = xDialog.getChild("classificationCB") + internationalClassificationCB = xDialog.getChild("internationalClassificationCB") + intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry") + intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton") + + select_by_text(classificationCB, "Confidential") + #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") + + self.assertEqual(document.Text.String[0:6], "(Conf)") + self.assertEqual(header.String, "Confidential") + self.assertTrue(controller.hasInfobar("classification")) + + + def test_paragraph_classification_dialog(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + #+ new file and do it only for Paragraph classification (no watermark!) + with self.ui_test.execute_dialog_through_command(".uno:ParagraphClassificationDialog") as xDialog: + classificationEditWindow = xDialog.getChild("classificationEditWindow") + recentlyUsedCB = xDialog.getChild("recentlyUsedCB") + classificationCB = xDialog.getChild("classificationCB") + internationalClassificationCB = xDialog.getChild("internationalClassificationCB") + intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry") + intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton") + + select_by_text(classificationCB, "Confidential") + #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") + + controller = document.getCurrentController() + self.assertEqual(document.Text.String[0:6], "(Conf)") + self.assertFalse(controller.hasInfobar("classification")) + self.assertFalse(document.StyleFamilies.PageStyles.Standard.HeaderIsOn) + + + def test_paragraph_classification_dialog_text(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + #+ new file and do it only for Paragraph classification (no watermark!) + with self.ui_test.execute_dialog_through_command(".uno:ParagraphClassificationDialog") as xDialog: + 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()) + select_by_text(classificationCB, "Internal Only") + #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") + + + controller = document.getCurrentController() + self.assertEqual(document.Text.String[0:6], "(AAIO)") + self.assertFalse(controller.hasInfobar("classification")) + self.assertFalse(document.StyleFamilies.PageStyles.Standard.HeaderIsOn) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/data/3pages.odt b/sw/qa/uitest/data/3pages.odt Binary files differnew file mode 100644 index 000000000..0f2512903 --- /dev/null +++ b/sw/qa/uitest/data/3pages.odt diff --git a/sw/qa/uitest/data/LibreOffice.jpg b/sw/qa/uitest/data/LibreOffice.jpg Binary files differnew file mode 100644 index 000000000..23812dcfd --- /dev/null +++ b/sw/qa/uitest/data/LibreOffice.jpg diff --git a/sw/qa/uitest/data/TC-table-del-add.docx b/sw/qa/uitest/data/TC-table-del-add.docx Binary files differnew file mode 100644 index 000000000..841e63f0d --- /dev/null +++ b/sw/qa/uitest/data/TC-table-del-add.docx diff --git a/sw/qa/uitest/data/TestHiddenHeadersFooters.docx b/sw/qa/uitest/data/TestHiddenHeadersFooters.docx Binary files differnew file mode 100644 index 000000000..f33482a93 --- /dev/null +++ b/sw/qa/uitest/data/TestHiddenHeadersFooters.docx diff --git a/sw/qa/uitest/data/bookmark-metadata.odt b/sw/qa/uitest/data/bookmark-metadata.odt Binary files differnew file mode 100644 index 000000000..3eec9abcf --- /dev/null +++ b/sw/qa/uitest/data/bookmark-metadata.odt diff --git a/sw/qa/uitest/data/customStyles.odt b/sw/qa/uitest/data/customStyles.odt Binary files differnew file mode 100644 index 000000000..2cf4bbbb1 --- /dev/null +++ b/sw/qa/uitest/data/customStyles.odt diff --git a/sw/qa/uitest/data/date_form_field.odt b/sw/qa/uitest/data/date_form_field.odt Binary files differnew file mode 100644 index 000000000..8335a1cc1 --- /dev/null +++ b/sw/qa/uitest/data/date_form_field.odt diff --git a/sw/qa/uitest/data/date_form_field_custom_format.odt b/sw/qa/uitest/data/date_form_field_custom_format.odt Binary files differnew file mode 100644 index 000000000..fadd890ed --- /dev/null +++ b/sw/qa/uitest/data/date_form_field_custom_format.odt diff --git a/sw/qa/uitest/data/date_form_field_with_placeholder.odt b/sw/qa/uitest/data/date_form_field_with_placeholder.odt Binary files differnew file mode 100644 index 000000000..6f8a63784 --- /dev/null +++ b/sw/qa/uitest/data/date_form_field_with_placeholder.odt diff --git a/sw/qa/uitest/data/date_form_field_without_current_date.odt b/sw/qa/uitest/data/date_form_field_without_current_date.odt Binary files differnew file mode 100644 index 000000000..802dff32d --- /dev/null +++ b/sw/qa/uitest/data/date_form_field_without_current_date.odt diff --git a/sw/qa/uitest/data/drop_down_form_field.doc b/sw/qa/uitest/data/drop_down_form_field.doc Binary files differnew file mode 100644 index 000000000..cf94a1fda --- /dev/null +++ b/sw/qa/uitest/data/drop_down_form_field.doc diff --git a/sw/qa/uitest/data/drop_down_form_field.docx b/sw/qa/uitest/data/drop_down_form_field.docx Binary files differnew file mode 100644 index 000000000..d039cd2b6 --- /dev/null +++ b/sw/qa/uitest/data/drop_down_form_field.docx diff --git a/sw/qa/uitest/data/drop_down_form_field.odt b/sw/qa/uitest/data/drop_down_form_field.odt Binary files differnew file mode 100644 index 000000000..f27b11574 --- /dev/null +++ b/sw/qa/uitest/data/drop_down_form_field.odt diff --git a/sw/qa/uitest/data/empty_drop_down_form_field.odt b/sw/qa/uitest/data/empty_drop_down_form_field.odt Binary files differnew file mode 100644 index 000000000..bd85dc2a9 --- /dev/null +++ b/sw/qa/uitest/data/empty_drop_down_form_field.odt diff --git a/sw/qa/uitest/data/findReplace.odt b/sw/qa/uitest/data/findReplace.odt Binary files differnew file mode 100644 index 000000000..97f92b778 --- /dev/null +++ b/sw/qa/uitest/data/findReplace.odt diff --git a/sw/qa/uitest/data/hiddenRow.ods b/sw/qa/uitest/data/hiddenRow.ods Binary files differnew file mode 100644 index 000000000..8b5d98a18 --- /dev/null +++ b/sw/qa/uitest/data/hiddenRow.ods diff --git a/sw/qa/uitest/data/hyperlink_multiple_spans.fodt b/sw/qa/uitest/data/hyperlink_multiple_spans.fodt new file mode 100644 index 000000000..bdf405ffd --- /dev/null +++ b/sw/qa/uitest/data/hyperlink_multiple_spans.fodt @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:officeooo="http://openoffice.org/2009/office" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:styles> + <style:style style:name="Emphasis" style:family="text"> + <style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic"/> + </style:style> + <style:style style:name="Strong_20_Emphasis" style:display-name="Strong Emphasis" style:family="text"> + <style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"/> + </style:style> + <style:style style:name="Internet_20_link" style:display-name="Internet link" style:family="text"> + <style:text-properties fo:color="#000080" loext:opacity="100%" fo:language="zxx" fo:country="none" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color" style:language-asian="zxx" style:country-asian="none" style:language-complex="zxx" style:country-complex="none"/> + </style:style> + <style:style style:name="Visited_20_Internet_20_Link" style:display-name="Visited Internet Link" style:family="text"> + <style:text-properties fo:color="#800000" loext:opacity="100%" fo:language="zxx" fo:country="none" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color" style:language-asian="zxx" style:country-asian="none" style:language-complex="zxx" style:country-complex="none"/> + </style:style> + <style:style style:name="Footnote_20_Symbol" style:display-name="Footnote Symbol" style:family="text"/> + <style:style style:name="Footnote_20_anchor" style:display-name="Footnote anchor" style:family="text"> + <style:text-properties style:text-position="super 58%"/> + </style:style> + <text:notes-configuration text:note-class="footnote" text:citation-style-name="Footnote_20_Symbol" text:citation-body-style-name="Footnote_20_anchor" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/> + </office:styles> + <office:automatic-styles> + <style:style style:name="T1" style:family="text"> + <style:text-properties officeooo:rsid="00083fb4"/> + </style:style> + <style:style style:name="gr1" style:family="graphic"> + <style:graphic-properties draw:stroke="none" svg:stroke-color="#000000" draw:fill="solid" draw:fill-color="#ffff80" fo:min-height="2cm" style:run-through="foreground" style:wrap="run-through" style:number-wrapped-paragraphs="no-limit" style:vertical-pos="from-top" style:vertical-rel="paragraph" style:horizontal-pos="from-left" style:horizontal-rel="paragraph" draw:wrap-influence-on-position="once-concurrent" loext:allow-overlap="true" style:flow-with-text="false"/> + <style:paragraph-properties style:writing-mode="lr-tb"/> + </style:style> + </office:automatic-styles> + <office:body> + <office:text> + <text:p><text:bookmark-start text:name="Bookmark"/>This is a bookmark<text:bookmark-end text:name="Bookmark"/></text:p> + <text:p/> + <text:p>No hyperlink; <text:a xlink:type="simple" xlink:href="#Bookmark" office:target-frame-name="_top" xlink:show="replace" text:style-name="Internet_20_link" text:visited-style-name="Visited_20_Internet_20_Link"><text:span text:style-name="Strong_20_Emphasis">a hyperlink with an anchor</text:span><draw:frame text:anchor-type="char" draw:z-index="0" draw:name="Text Frame 1" draw:style-name="gr1" draw:text-style-name="P4" svg:width="2cm" svg:height="2cm" svg:x="6cm" svg:y="2cm"> + <draw:text-box> + <text:p>text</text:p> + </draw:text-box> + </draw:frame>, <text:span text:style-name="Emphasis">different character styles</text:span>, a footnote<text:span text:style-name="Emphasis"><text:note text:id="ftn1" text:note-class="footnote"><text:note-citation>1</text:note-citation><text:note-body> + <text:p>A footnote</text:p></text:note-body></text:note></text:span>, a field <text:bookmark-ref text:reference-format="text" text:ref-name="Bookmark">This is a bookmark</text:bookmark-ref>, and <text:span text:style-name="T1">a rsid</text:span></text:a>; no hyperlink; <text:a xlink:type="simple" xlink:href="#Bookmark" office:target-frame-name="_top" xlink:show="replace" text:style-name="Internet_20_link" text:visited-style-name="Visited_20_Internet_20_Link">another hyperlink</text:a>; no hyperlink</text:p> + </office:text> + </office:body> +</office:document>
\ No newline at end of file diff --git a/sw/qa/uitest/data/image-rel-size.fodt b/sw/qa/uitest/data/image-rel-size.fodt new file mode 100644 index 000000000..9df285861 --- /dev/null +++ b/sw/qa/uitest/data/image-rel-size.fodt @@ -0,0 +1,40 @@ +<?xml version='1.0' encoding='UTF-8'?> +<office:document xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:automatic-styles> + <style:style style:name="fr1" style:family="graphic" style:parent-style-name="Graphics"> + <style:graphic-properties style:vertical-pos="top" style:vertical-rel="baseline"/> + </style:style> + <style:page-layout style:name="pm1"> + <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm"> + </style:page-layout-properties> + <style:header-style/> + <style:footer-style/> + </style:page-layout> + <style:style style:name="dp1" style:family="drawing-page"> + <style:drawing-page-properties draw:background-size="full"/> + </style:style> + </office:automatic-styles> + <office:master-styles> + <style:master-page style:name="Standard" style:page-layout-name="pm1" draw:style-name="dp1"/> + </office:master-styles> + <office:body> + <office:text> + <text:p text:style-name="Standard"><draw:frame draw:style-name="fr1" draw:name="Bild1" text:anchor-type="as-char" svg:width="40.282cm" style:rel-width="80%" svg:height="15.88cm" style:rel-height="scale" draw:z-index="0"><draw:image draw:mime-type="image/png"><office:binary-data>iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAABGdBTUEAALGPC/xhBQAAAAFz + UkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA + AAJiS0dEAACqjSMyAAAACW9GRnMAAAAGAAAAAAAMc1XTAAAACXBIWXMAAA3XAAAN1wFCKJt4 + AAAACXZwQWcAAABMAAAAQACdMTgbAAABzUlEQVRo3u3ZPU/CQBjA8X+Jxs3ESUDj4iK+LA5+ + BBfjqBE1cXB2MlFAEqMgxvhNNL4sLsK3UPQL6ObkoAETz+FKW2mxCPRYnucWUu76/OC59C49 + cGOCKqrD9kHRc6ddPv7oW2WCwMh0nF63Myz7Tm8hPTNu0pgHMER3scepTbgK6enJNND83RLn + /878yRaPmgBZFDuMsNLeWB9gmFQHP77MIg9gsYciR50NFKvtjIy10yk84pSZA7DYpwR8scmF + QQCMuoQMpzbh0iAARrlnVn90CWHTsZcAiHPPdINQAuqsc2MQAAnKDUKWEhZ10twaBEDSJWQo + YlFj7S9CzwEegkXWIbQsRAQASFJhpplwbRAACS+hANRJBxMiAkDcJeQ4sQkBhYgMoJ+Ozlwo + 2YQ7AJ6CRxyiUGnVy3hVKb0Af9v7hUG2Wy9TEQCUelFTDULB2S+YKYGOMcpM6UIccOQnRA6A + cSp6ibfI+wkGADBGpTEd8xz1AaAfTQ7huA8AvUw5hVjuA0D/C5OaMN8XACRZ8F0zCggKAQhA + AAIQgAAEIAABCEAAAhCAAAQgAAH4zg3feY4w3Xs44M5+oW0qvCWoGcvaIlM3x/f/ab+O738A + hOCNQr34oD4AAAAldEVYdGNyZWF0ZS1kYXRlADIwMTAtMTItMjBUMTc6MDg6MzYrMDE6MDB6 + 5RscAAAAJXRFWHRtb2RpZnktZGF0ZQAyMDEwLTEyLTIwVDE3OjA4OjM3KzAxOjAwgyNmnAAA + AABJRU5ErkJggg== + </office:binary-data></draw:image></draw:frame></text:p> + </office:text> + </office:body> +</office:document> diff --git a/sw/qa/uitest/data/metacolor.odt b/sw/qa/uitest/data/metacolor.odt Binary files differnew file mode 100644 index 000000000..88cfb7212 --- /dev/null +++ b/sw/qa/uitest/data/metacolor.odt diff --git a/sw/qa/uitest/data/metadata.odt b/sw/qa/uitest/data/metadata.odt Binary files differnew file mode 100644 index 000000000..1566f4ae1 --- /dev/null +++ b/sw/qa/uitest/data/metadata.odt diff --git a/sw/qa/uitest/data/redline-autocorrect.fodt b/sw/qa/uitest/data/redline-autocorrect.fodt new file mode 100644 index 000000000..ce874d299 --- /dev/null +++ b/sw/qa/uitest/data/redline-autocorrect.fodt @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:officeooo="http://openoffice.org/2009/office" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text" xmlns:dc="http://purl.org/dc/elements/1.1/"> + <office:styles> + <style:style style:name="Standard" style:family="paragraph" style:class="text"/> + <style:default-style style:family="paragraph"> + <style:text-properties fo:language="en" fo:country="US"/> + </style:default-style> + </office:styles> + <office:body> + <office:text> + <text:tracked-changes text:track-changes="false"> + <text:changed-region xml:id="ct94099223789984" text:id="ct94099223789984"> + <text:deletion> + <office:change-info> + <dc:creator>NL</dc:creator> + <dc:date>2020-11-03T19:19:05</dc:date> + </office:change-info> + </text:deletion> + </text:changed-region> + </text:tracked-changes> + <text:p text:style-name="P1"><text:change-start text:change-id="ct94099223789984"/>t<text:change-end text:change-id="ct94099223789984"/>s</text:p> + </office:text> + </office:body> +</office:document> diff --git a/sw/qa/uitest/data/redline-para-join.docx b/sw/qa/uitest/data/redline-para-join.docx Binary files differnew file mode 100644 index 000000000..c1ed90f80 --- /dev/null +++ b/sw/qa/uitest/data/redline-para-join.docx diff --git a/sw/qa/uitest/data/redlinesuccessordata.docx b/sw/qa/uitest/data/redlinesuccessordata.docx Binary files differnew file mode 100644 index 000000000..c4dc0d280 --- /dev/null +++ b/sw/qa/uitest/data/redlinesuccessordata.docx diff --git a/sw/qa/uitest/data/shape.odt b/sw/qa/uitest/data/shape.odt Binary files differnew file mode 100644 index 000000000..7b3ebf027 --- /dev/null +++ b/sw/qa/uitest/data/shape.odt diff --git a/sw/qa/uitest/data/splitTable.odt b/sw/qa/uitest/data/splitTable.odt Binary files differnew file mode 100644 index 000000000..269f1f654 --- /dev/null +++ b/sw/qa/uitest/data/splitTable.odt diff --git a/sw/qa/uitest/data/styles.odt b/sw/qa/uitest/data/styles.odt Binary files differnew file mode 100644 index 000000000..560205cab --- /dev/null +++ b/sw/qa/uitest/data/styles.odt diff --git a/sw/qa/uitest/data/tableToText.odt b/sw/qa/uitest/data/tableToText.odt Binary files differnew file mode 100644 index 000000000..5f8f9b01d --- /dev/null +++ b/sw/qa/uitest/data/tableToText.odt diff --git a/sw/qa/uitest/data/tdf104795.odt b/sw/qa/uitest/data/tdf104795.odt Binary files differnew file mode 100644 index 000000000..4b359cdf5 --- /dev/null +++ b/sw/qa/uitest/data/tdf104795.odt diff --git a/sw/qa/uitest/data/tdf106899.odt b/sw/qa/uitest/data/tdf106899.odt Binary files differnew file mode 100644 index 000000000..3f77c8265 --- /dev/null +++ b/sw/qa/uitest/data/tdf106899.odt diff --git a/sw/qa/uitest/data/tdf106899.sdi b/sw/qa/uitest/data/tdf106899.sdi new file mode 100644 index 000000000..6b110b259 --- /dev/null +++ b/sw/qa/uitest/data/tdf106899.sdi @@ -0,0 +1 @@ +Nguyễn Khánh
\ No newline at end of file diff --git a/sw/qa/uitest/data/tdf113284.odt b/sw/qa/uitest/data/tdf113284.odt Binary files differnew file mode 100644 index 000000000..b062fc2e8 --- /dev/null +++ b/sw/qa/uitest/data/tdf113284.odt diff --git a/sw/qa/uitest/data/tdf114724.odt b/sw/qa/uitest/data/tdf114724.odt Binary files differnew file mode 100644 index 000000000..6c5110868 --- /dev/null +++ b/sw/qa/uitest/data/tdf114724.odt diff --git a/sw/qa/uitest/data/tdf116242.odt b/sw/qa/uitest/data/tdf116242.odt Binary files differnew file mode 100644 index 000000000..6f995b065 --- /dev/null +++ b/sw/qa/uitest/data/tdf116242.odt diff --git a/sw/qa/uitest/data/tdf117039.odt b/sw/qa/uitest/data/tdf117039.odt Binary files differnew file mode 100644 index 000000000..6f8f61d83 --- /dev/null +++ b/sw/qa/uitest/data/tdf117039.odt diff --git a/sw/qa/uitest/data/tdf117703.odt b/sw/qa/uitest/data/tdf117703.odt Binary files differnew file mode 100644 index 000000000..2e72fb541 --- /dev/null +++ b/sw/qa/uitest/data/tdf117703.odt diff --git a/sw/qa/uitest/data/tdf118208.odt b/sw/qa/uitest/data/tdf118208.odt Binary files differnew file mode 100644 index 000000000..8390f28e8 --- /dev/null +++ b/sw/qa/uitest/data/tdf118208.odt diff --git a/sw/qa/uitest/data/tdf118540.docx b/sw/qa/uitest/data/tdf118540.docx Binary files differnew file mode 100644 index 000000000..64022073e --- /dev/null +++ b/sw/qa/uitest/data/tdf118540.docx diff --git a/sw/qa/uitest/data/tdf120731.odt b/sw/qa/uitest/data/tdf120731.odt Binary files differnew file mode 100644 index 000000000..30638ec2c --- /dev/null +++ b/sw/qa/uitest/data/tdf120731.odt diff --git a/sw/qa/uitest/data/tdf122449.odt b/sw/qa/uitest/data/tdf122449.odt Binary files differnew file mode 100644 index 000000000..fb809c1ba --- /dev/null +++ b/sw/qa/uitest/data/tdf122449.odt diff --git a/sw/qa/uitest/data/tdf122780.docx b/sw/qa/uitest/data/tdf122780.docx Binary files differnew file mode 100644 index 000000000..eca63620d --- /dev/null +++ b/sw/qa/uitest/data/tdf122780.docx diff --git a/sw/qa/uitest/data/tdf123547.docx b/sw/qa/uitest/data/tdf123547.docx Binary files differnew file mode 100644 index 000000000..2b6ed9bd5 --- /dev/null +++ b/sw/qa/uitest/data/tdf123547.docx diff --git a/sw/qa/uitest/data/tdf124586.odt b/sw/qa/uitest/data/tdf124586.odt Binary files differnew file mode 100644 index 000000000..4d3852ae5 --- /dev/null +++ b/sw/qa/uitest/data/tdf124586.odt diff --git a/sw/qa/uitest/data/tdf124675.docx b/sw/qa/uitest/data/tdf124675.docx Binary files differnew file mode 100644 index 000000000..a012a496a --- /dev/null +++ b/sw/qa/uitest/data/tdf124675.docx diff --git a/sw/qa/uitest/data/tdf126017.odt b/sw/qa/uitest/data/tdf126017.odt Binary files differnew file mode 100644 index 000000000..96d6a67a8 --- /dev/null +++ b/sw/qa/uitest/data/tdf126017.odt diff --git a/sw/qa/uitest/data/tdf126226.odt b/sw/qa/uitest/data/tdf126226.odt Binary files differnew file mode 100644 index 000000000..aa0b4cd2b --- /dev/null +++ b/sw/qa/uitest/data/tdf126226.odt diff --git a/sw/qa/uitest/data/tdf126627.odt b/sw/qa/uitest/data/tdf126627.odt Binary files differnew file mode 100644 index 000000000..79b481015 --- /dev/null +++ b/sw/qa/uitest/data/tdf126627.odt diff --git a/sw/qa/uitest/data/tdf127166_prstDash_Word97.docx b/sw/qa/uitest/data/tdf127166_prstDash_Word97.docx Binary files differnew file mode 100644 index 000000000..b89f52fdc --- /dev/null +++ b/sw/qa/uitest/data/tdf127166_prstDash_Word97.docx diff --git a/sw/qa/uitest/data/tdf127166_prstDash_round_cap.docx b/sw/qa/uitest/data/tdf127166_prstDash_round_cap.docx Binary files differnew file mode 100644 index 000000000..52f9aaa55 --- /dev/null +++ b/sw/qa/uitest/data/tdf127166_prstDash_round_cap.docx diff --git a/sw/qa/uitest/data/tdf128744.docx b/sw/qa/uitest/data/tdf128744.docx Binary files differnew file mode 100644 index 000000000..b03bef21b --- /dev/null +++ b/sw/qa/uitest/data/tdf128744.docx diff --git a/sw/qa/uitest/data/tdf130960.odt b/sw/qa/uitest/data/tdf130960.odt Binary files differnew file mode 100644 index 000000000..788db8e96 --- /dev/null +++ b/sw/qa/uitest/data/tdf130960.odt diff --git a/sw/qa/uitest/data/tdf130960_2.odt b/sw/qa/uitest/data/tdf130960_2.odt Binary files differnew file mode 100644 index 000000000..2123a85c4 --- /dev/null +++ b/sw/qa/uitest/data/tdf130960_2.odt diff --git a/sw/qa/uitest/data/tdf131931.odt b/sw/qa/uitest/data/tdf131931.odt Binary files differnew file mode 100644 index 000000000..7a2eae064 --- /dev/null +++ b/sw/qa/uitest/data/tdf131931.odt diff --git a/sw/qa/uitest/data/tdf131936.docx b/sw/qa/uitest/data/tdf131936.docx Binary files differnew file mode 100644 index 000000000..f993d6ee3 --- /dev/null +++ b/sw/qa/uitest/data/tdf131936.docx diff --git a/sw/qa/uitest/data/tdf132714.odt b/sw/qa/uitest/data/tdf132714.odt Binary files differnew file mode 100644 index 000000000..e1a4a2c5a --- /dev/null +++ b/sw/qa/uitest/data/tdf132714.odt diff --git a/sw/qa/uitest/data/tdf134243.odt b/sw/qa/uitest/data/tdf134243.odt Binary files differnew file mode 100644 index 000000000..28732b337 --- /dev/null +++ b/sw/qa/uitest/data/tdf134243.odt diff --git a/sw/qa/uitest/data/tdf134439.odt b/sw/qa/uitest/data/tdf134439.odt Binary files differnew file mode 100644 index 000000000..011a75a34 --- /dev/null +++ b/sw/qa/uitest/data/tdf134439.odt diff --git a/sw/qa/uitest/data/tdf134881_colProportionalAdjust.odt b/sw/qa/uitest/data/tdf134881_colProportionalAdjust.odt Binary files differnew file mode 100644 index 000000000..dd7752518 --- /dev/null +++ b/sw/qa/uitest/data/tdf134881_colProportionalAdjust.odt diff --git a/sw/qa/uitest/data/tdf134960.odt b/sw/qa/uitest/data/tdf134960.odt Binary files differnew file mode 100644 index 000000000..d75337522 --- /dev/null +++ b/sw/qa/uitest/data/tdf134960.odt diff --git a/sw/qa/uitest/data/tdf135018.odt b/sw/qa/uitest/data/tdf135018.odt Binary files differnew file mode 100644 index 000000000..9c255f81f --- /dev/null +++ b/sw/qa/uitest/data/tdf135018.odt diff --git a/sw/qa/uitest/data/tdf135413.docx b/sw/qa/uitest/data/tdf135413.docx Binary files differnew file mode 100644 index 000000000..89a56ad34 --- /dev/null +++ b/sw/qa/uitest/data/tdf135413.docx diff --git a/sw/qa/uitest/data/tdf135636.odt b/sw/qa/uitest/data/tdf135636.odt Binary files differnew file mode 100644 index 000000000..7b11ef66f --- /dev/null +++ b/sw/qa/uitest/data/tdf135636.odt diff --git a/sw/qa/uitest/data/tdf135693.odt b/sw/qa/uitest/data/tdf135693.odt Binary files differnew file mode 100644 index 000000000..b13ed48e5 --- /dev/null +++ b/sw/qa/uitest/data/tdf135693.odt diff --git a/sw/qa/uitest/data/tdf136578.odt b/sw/qa/uitest/data/tdf136578.odt Binary files differnew file mode 100644 index 000000000..15a1269c9 --- /dev/null +++ b/sw/qa/uitest/data/tdf136578.odt diff --git a/sw/qa/uitest/data/tdf136855.odt b/sw/qa/uitest/data/tdf136855.odt Binary files differnew file mode 100644 index 000000000..10d951dcf --- /dev/null +++ b/sw/qa/uitest/data/tdf136855.odt diff --git a/sw/qa/uitest/data/tdf137737.odt b/sw/qa/uitest/data/tdf137737.odt Binary files differnew file mode 100644 index 000000000..dc840b179 --- /dev/null +++ b/sw/qa/uitest/data/tdf137737.odt diff --git a/sw/qa/uitest/data/tdf137802.odt b/sw/qa/uitest/data/tdf137802.odt Binary files differnew file mode 100644 index 000000000..2d5ac8b04 --- /dev/null +++ b/sw/qa/uitest/data/tdf137802.odt diff --git a/sw/qa/uitest/data/tdf137803.odt b/sw/qa/uitest/data/tdf137803.odt Binary files differnew file mode 100644 index 000000000..8f2f7d5dc --- /dev/null +++ b/sw/qa/uitest/data/tdf137803.odt diff --git a/sw/qa/uitest/data/tdf137855.odt b/sw/qa/uitest/data/tdf137855.odt Binary files differnew file mode 100644 index 000000000..9657ebdb2 --- /dev/null +++ b/sw/qa/uitest/data/tdf137855.odt diff --git a/sw/qa/uitest/data/tdf137855_2.odt b/sw/qa/uitest/data/tdf137855_2.odt Binary files differnew file mode 100644 index 000000000..0b0f9cbe6 --- /dev/null +++ b/sw/qa/uitest/data/tdf137855_2.odt diff --git a/sw/qa/uitest/data/tdf138271.odt b/sw/qa/uitest/data/tdf138271.odt Binary files differnew file mode 100644 index 000000000..ea09b5577 --- /dev/null +++ b/sw/qa/uitest/data/tdf138271.odt diff --git a/sw/qa/uitest/data/tdf138546.odt b/sw/qa/uitest/data/tdf138546.odt Binary files differnew file mode 100644 index 000000000..8bfa9f6e5 --- /dev/null +++ b/sw/qa/uitest/data/tdf138546.odt diff --git a/sw/qa/uitest/data/tdf138907_titlePageDialog.odt b/sw/qa/uitest/data/tdf138907_titlePageDialog.odt Binary files differnew file mode 100644 index 000000000..837e0d013 --- /dev/null +++ b/sw/qa/uitest/data/tdf138907_titlePageDialog.odt diff --git a/sw/qa/uitest/data/tdf140117.fodt b/sw/qa/uitest/data/tdf140117.fodt new file mode 100644 index 000000000..8487346d1 --- /dev/null +++ b/sw/qa/uitest/data/tdf140117.fodt @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="UTF-8"?> +<office:document xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:ooo="http://openoffice.org/2004/office" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:styles> + <style:default-style style:family="graphic"> + <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/> + <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false"> + <style:tab-stops/> + </style:paragraph-properties> + <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="en" fo:country="US" style:letter-kerning="true" style:font-name-asian="NSimSun" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lucida Sans" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/> + </style:default-style> + <style:default-style style:family="paragraph"> + <style:paragraph-properties fo:orphans="2" fo:widows="2" fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/> + <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="en" fo:country="US" style:letter-kerning="true" style:font-name-asian="NSimSun" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lucida Sans" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" loext:hyphenation-no-caps="false"/> + </style:default-style> + <style:style style:name="Standard" style:family="paragraph" style:class="text"/> + <style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="text"> + <style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" style:contextual-spacing="false" fo:keep-with-next="always"/> + <style:text-properties style:font-name="Liberation Sans" fo:font-family="'Liberation Sans'" style:font-family-generic="swiss" style:font-pitch="variable" fo:font-size="14pt" style:font-name-asian="Microsoft YaHei" style:font-family-asian="'Microsoft YaHei'" style:font-family-generic-asian="system" style:font-pitch-asian="variable" style:font-size-asian="14pt" style:font-name-complex="Lucida Sans" style:font-family-complex="'Lucida Sans'" style:font-family-generic-complex="system" style:font-pitch-complex="variable" style:font-size-complex="14pt"/> + </style:style> + <style:style style:name="Text_20_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text"> + <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.247cm" style:contextual-spacing="false" fo:line-height="115%"/> + </style:style> + <style:style style:name="List" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="list"> + <style:text-properties style:font-size-asian="12pt" style:font-name-complex="Lucida Sans1" style:font-family-complex="'Lucida Sans'" style:font-family-generic-complex="swiss"/> + </style:style> + <style:style style:name="Caption" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"> + <style:paragraph-properties fo:margin-top="0.212cm" fo:margin-bottom="0.212cm" style:contextual-spacing="false" text:number-lines="false" text:line-number="0"/> + <style:text-properties fo:font-size="12pt" fo:font-style="italic" style:font-size-asian="12pt" style:font-style-asian="italic" style:font-name-complex="Lucida Sans1" style:font-family-complex="'Lucida Sans'" style:font-family-generic-complex="swiss" style:font-size-complex="12pt" style:font-style-complex="italic"/> + </style:style> + <style:style style:name="Index" style:family="paragraph" style:parent-style-name="Standard" style:class="index"> + <style:paragraph-properties text:number-lines="false" text:line-number="0"/> + <style:text-properties style:font-size-asian="12pt" style:font-name-complex="Lucida Sans1" style:font-family-complex="'Lucida Sans'" style:font-family-generic-complex="swiss"/> + </style:style> + <style:style style:name="Header_20_and_20_Footer" style:display-name="Header and Footer" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"> + <style:paragraph-properties text:number-lines="false" text:line-number="0"> + <style:tab-stops> + <style:tab-stop style:position="8.5cm" style:type="center"/> + <style:tab-stop style:position="17cm" style:type="right"/> + </style:tab-stops> + </style:paragraph-properties> + </style:style> + <style:style style:name="Header" style:family="paragraph" style:parent-style-name="Header_20_and_20_Footer" style:class="extra"> + <style:paragraph-properties text:number-lines="false" text:line-number="0"> + <style:tab-stops> + <style:tab-stop style:position="8.5cm" style:type="center"/> + <style:tab-stop style:position="17cm" style:type="right"/> + </style:tab-stops> + </style:paragraph-properties> + </style:style> + </office:styles> + <office:automatic-styles> + <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Header"> + <style:text-properties officeooo:rsid="0021d80c" officeooo:paragraph-rsid="0021d80c"/> + </style:style> + <style:style style:name="P2" style:family="paragraph" style:parent-style-name="Standard"> + <style:paragraph-properties fo:break-before="page"/> + <style:text-properties officeooo:rsid="001a8fea" officeooo:paragraph-rsid="001a8fea"/> + </style:style> + <style:style style:name="P3" style:family="paragraph" style:parent-style-name="Standard"> + <style:text-properties fo:font-size="18pt" officeooo:rsid="0021d80c" officeooo:paragraph-rsid="0021d80c" style:font-size-asian="15.75pt" style:font-size-complex="18pt"/> + </style:style> + <style:style style:name="P4" style:family="paragraph" style:parent-style-name="Header"> + <style:text-properties officeooo:rsid="0021d80c" officeooo:paragraph-rsid="0021d80c"/> + </style:style> + <style:page-layout style:name="pm1"> + <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:footnote-max-height="0cm" loext:margin-gutter="0cm"> + <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/> + </style:page-layout-properties> + <style:header-style> + <style:header-footer-properties fo:min-height="0.6cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-bottom="0.499cm" fo:background-color="transparent" style:dynamic-spacing="false" draw:fill="none" draw:fill-color="#729fcf"/> + </style:header-style> + <style:footer-style/> + </style:page-layout> + </office:automatic-styles> + <office:master-styles> + <style:master-page style:name="Standard" style:page-layout-name="pm1"> + <style:header> + <text:p text:style-name="P1">right</text:p> + </style:header> + <style:header-left> + <text:p text:style-name="P1">left</text:p> + </style:header-left> + <style:header-first> + <text:p text:style-name="P1">first</text:p> + </style:header-first> + </style:master-page> + </office:master-styles> + <office:body> + <office:text text:use-soft-page-breaks="true"> + <text:p text:style-name="P3">a</text:p> + <text:p text:style-name="P2"/> + <text:p text:style-name="P2"/> + </office:text> + </office:body> +</office:document> diff --git a/sw/qa/uitest/data/tdf140198.odt b/sw/qa/uitest/data/tdf140198.odt Binary files differnew file mode 100644 index 000000000..087466b81 --- /dev/null +++ b/sw/qa/uitest/data/tdf140198.odt diff --git a/sw/qa/uitest/data/tdf140239.odt b/sw/qa/uitest/data/tdf140239.odt Binary files differnew file mode 100644 index 000000000..53d2537e9 --- /dev/null +++ b/sw/qa/uitest/data/tdf140239.odt diff --git a/sw/qa/uitest/data/tdf140486.odt b/sw/qa/uitest/data/tdf140486.odt Binary files differnew file mode 100644 index 000000000..cc5bf277e --- /dev/null +++ b/sw/qa/uitest/data/tdf140486.odt diff --git a/sw/qa/uitest/data/tdf140506.odt b/sw/qa/uitest/data/tdf140506.odt Binary files differnew file mode 100644 index 000000000..585efeb53 --- /dev/null +++ b/sw/qa/uitest/data/tdf140506.odt diff --git a/sw/qa/uitest/data/tdf140661.odt b/sw/qa/uitest/data/tdf140661.odt Binary files differnew file mode 100644 index 000000000..4cc57724e --- /dev/null +++ b/sw/qa/uitest/data/tdf140661.odt diff --git a/sw/qa/uitest/data/tdf141557.docx b/sw/qa/uitest/data/tdf141557.docx Binary files differnew file mode 100644 index 000000000..9b0c6849b --- /dev/null +++ b/sw/qa/uitest/data/tdf141557.docx diff --git a/sw/qa/uitest/data/tdf141957.odt b/sw/qa/uitest/data/tdf141957.odt Binary files differnew file mode 100644 index 000000000..707c798c7 --- /dev/null +++ b/sw/qa/uitest/data/tdf141957.odt diff --git a/sw/qa/uitest/data/tdf142847.fodt b/sw/qa/uitest/data/tdf142847.fodt new file mode 100644 index 000000000..5ceed7151 --- /dev/null +++ b/sw/qa/uitest/data/tdf142847.fodt @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<office:document xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:officeooo="http://openoffice.org/2009/office" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:meta><dc:date>2021-08-25T15:50:24.334000000</dc:date><meta:editing-duration>PT5M16S</meta:editing-duration><meta:editing-cycles>4</meta:editing-cycles><meta:generator>LibreOffice/7.1.1.2$Windows_X86_64 LibreOffice_project/fe0b08f4af1bacafe4c7ecc87ce55bb426164676</meta:generator><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="1" meta:paragraph-count="1" meta:word-count="298" meta:character-count="795" meta:non-whitespace-character-count="480"/></office:meta> + <office:font-face-decls> + <style:font-face style:name="Lucida Sans1" svg:font-family="'Lucida Sans'" style:font-family-generic="swiss"/> + <style:font-face style:name="Liberation Mono" svg:font-family="'Liberation Mono'" style:font-family-generic="modern" style:font-pitch="fixed"/> + <style:font-face style:name="NSimSun" svg:font-family="NSimSun" style:font-family-generic="modern" style:font-pitch="fixed"/> + <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable"/> + <style:font-face style:name="Liberation Sans" svg:font-family="'Liberation Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/> + <style:font-face style:name="Lucida Sans" svg:font-family="'Lucida Sans'" style:font-family-generic="system" style:font-pitch="variable"/> + <style:font-face style:name="Microsoft YaHei" svg:font-family="'Microsoft YaHei'" style:font-family-generic="system" style:font-pitch="variable"/> + <style:font-face style:name="Segoe UI" svg:font-family="'Segoe UI'" style:font-family-generic="system" style:font-pitch="variable"/> + <style:font-face style:name="Tahoma" svg:font-family="Tahoma" style:font-family-generic="system" style:font-pitch="variable"/> + </office:font-face-decls> + <office:automatic-styles> + <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard"> + <style:text-properties officeooo:rsid="000eedc1" officeooo:paragraph-rsid="000eedc1"/> + </style:style> + <style:style style:name="gr1" style:family="graphic" style:parent-style-name="Frame"> + <style:graphic-properties draw:textarea-horizontal-align="justify" draw:textarea-vertical-align="middle" draw:auto-grow-height="false" fo:min-height="1.132cm" fo:min-width="2.106cm" style:run-through="foreground" style:wrap="parallel" style:number-wrapped-paragraphs="no-limit" style:wrap-contour="false" style:vertical-pos="middle" style:vertical-rel="baseline" style:horizontal-pos="from-left" style:horizontal-rel="paragraph" draw:wrap-influence-on-position="once-concurrent" loext:allow-overlap="true" style:flow-with-text="false"/> + </style:style> + <style:page-layout style:name="pm1"> + <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:footnote-max-height="0cm"> + <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/> + </style:page-layout-properties> + <style:header-style/> + <style:footer-style/> + </style:page-layout> + </office:automatic-styles> + <office:master-styles> + <style:master-page style:name="Standard" style:page-layout-name="pm1"/> + </office:master-styles> + <office:body> + <office:text> + <text:sequence-decls> + <text:sequence-decl text:display-outline-level="0" text:name="Illustration"/> + <text:sequence-decl text:display-outline-level="0" text:name="Table"/> + <text:sequence-decl text:display-outline-level="0" text:name="Text"/> + <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/> + <text:sequence-decl text:display-outline-level="0" text:name="Figure"/> + </text:sequence-decls> + <text:p text:style-name="Standard">Xx xx x xx x x xx xxxx x <text:s/>x x xx x x xx x x x xxxxx xx x x x xx <text:s/>xx <text:s/>x xx x x x x x x x x x x xx x x x x xxxx x x x x x xxxxxxx xxxx Xx xx x xx x x xx xxxx x <text:s/>x x xx x x xx x x x xxxxx xx x x x xx <text:s/>xx <text:s/>x xx x x x x x x x x x x xx x x x x<draw:custom-shape text:anchor-type="as-char" draw:z-index="0" draw:name="Shape1" draw:style-name="gr1" svg:width="4.211cm" svg:height="2.262cm"> + <text:p text:style-name="Frame_20_contents"/> + <draw:enhanced-geometry svg:viewBox="0 0 21600 21600" draw:glue-points="10800 0 0 10800 10800 21600 21600 10800" draw:text-areas="5400 5400 16200 16200" draw:type="diamond" draw:enhanced-path="M 10800 0 L 21600 10800 10800 21600 0 10800 10800 0 Z N"/> + </draw:custom-shape> xxxx x x x x x xxxxxx xxxxxXx xx x xx x x xx xxxx x <text:s/>x x xx x x xx x x x xxxxx xx x x x xx <text:s/>xx <text:s/>x xx x x x x x x x x x x xx x x x x xxxx x x x x x xxxxxx xxxxxXx xx x xx x x xx xxxx x <text:s/>x x xx x x xx x x x xxxxx xx x x x xx <text:s/>xx <text:s/>x xx x x x x x x x x x x xx x x x x xxxx x x x x x xxxxx xxxx xxXx xx x xx x x xx xxxx x <text:s/>x x xx x x xx x x x xxxxx xx x x x xx <text:s/>xx <text:s/>x xx x x x x x x x x x x xx x x x x xxxx x x x x x xxxx xxxx xxxXx xx x xx x x xx xxxx x <text:s/>x x xx x x xx x x x xxxxx xx x x x xx <text:s/>xx <text:s/>x xx x x x x x x x x x x xx x x x x xxxx x x x x x xxxxx xxxxxx</text:p> + </office:text> + </office:body> +</office:document>
\ No newline at end of file diff --git a/sw/qa/uitest/data/tdf143483.odt b/sw/qa/uitest/data/tdf143483.odt Binary files differnew file mode 100644 index 000000000..0b80ab196 --- /dev/null +++ b/sw/qa/uitest/data/tdf143483.odt diff --git a/sw/qa/uitest/data/tdf143569.odt b/sw/qa/uitest/data/tdf143569.odt Binary files differnew file mode 100644 index 000000000..325d2bf5b --- /dev/null +++ b/sw/qa/uitest/data/tdf143569.odt diff --git a/sw/qa/uitest/data/tdf143574.odt b/sw/qa/uitest/data/tdf143574.odt Binary files differnew file mode 100644 index 000000000..a2e961e11 --- /dev/null +++ b/sw/qa/uitest/data/tdf143574.odt diff --git a/sw/qa/uitest/data/tdf144578.odt b/sw/qa/uitest/data/tdf144578.odt Binary files differnew file mode 100644 index 000000000..d8f0f0f83 --- /dev/null +++ b/sw/qa/uitest/data/tdf144578.odt diff --git a/sw/qa/uitest/data/tdf144672.odt b/sw/qa/uitest/data/tdf144672.odt Binary files differnew file mode 100644 index 000000000..de7f588b7 --- /dev/null +++ b/sw/qa/uitest/data/tdf144672.odt diff --git a/sw/qa/uitest/data/tdf145178.fodt b/sw/qa/uitest/data/tdf145178.fodt new file mode 100644 index 000000000..d0cbfb9a0 --- /dev/null +++ b/sw/qa/uitest/data/tdf145178.fodt @@ -0,0 +1,121 @@ +<?xml version='1.0' encoding='UTF-8'?> +<office:document xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:meta><meta:creation-date>2022-05-30T17:42:38.550360355</meta:creation-date><dc:date>2022-05-30T18:10:38.856010092</dc:date><meta:editing-duration>PT1M8S</meta:editing-duration><meta:editing-cycles>3</meta:editing-cycles><meta:generator>LibreOfficeDev/7.4.0.0.alpha1$Linux_X86_64 LibreOffice_project/c3baf2a7f48b5ee46c6792b3106cb4fedb4a2ad2</meta:generator><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="1" meta:paragraph-count="0" meta:word-count="0" meta:character-count="0" meta:non-whitespace-character-count="0"/></office:meta> + <office:font-face-decls> + <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable"/> + <style:font-face style:name="Lohit Devanagari1" svg:font-family="'Lohit Devanagari'" style:font-family-generic="system" style:font-pitch="variable"/> + <style:font-face style:name="Noto Serif CJK SC" svg:font-family="'Noto Serif CJK SC'" style:font-family-generic="system" style:font-pitch="variable"/> + </office:font-face-decls> + <office:styles> + <style:default-style style:family="graphic"> + <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/> + <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:font-independent-line-spacing="false"> + <style:tab-stops/> + </style:paragraph-properties> + <style:text-properties style:use-window-font-color="true" loext:opacity="0%" loext:color-lum-mod="100%" loext:color-lum-off="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="es" fo:country="ES" style:letter-kerning="true" style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari1" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/> + </style:default-style> + <style:default-style style:family="paragraph"> + <style:paragraph-properties fo:orphans="2" fo:widows="2" fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/> + <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="es" fo:country="ES" style:letter-kerning="true" style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari1" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" loext:hyphenation-no-caps="false" loext:hyphenation-no-last-word="false" loext:hyphenation-word-char-count="no-limit"/> + </style:default-style> + <style:default-style style:family="table"> + <style:table-properties table:border-model="collapsing"/> + </style:default-style> + <style:default-style style:family="table-row"> + <style:table-row-properties fo:keep-together="auto"/> + </style:default-style> + <style:style style:name="Standard" style:family="paragraph" style:class="text"/> + <text:outline-style style:name="Outline"> + <text:outline-level-style text:level="1" loext:num-list-format="%1%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="2" loext:num-list-format="%2%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="3" loext:num-list-format="%3%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="4" loext:num-list-format="%4%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="5" loext:num-list-format="%5%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="6" loext:num-list-format="%6%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="7" loext:num-list-format="%7%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="8" loext:num-list-format="%8%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="9" loext:num-list-format="%9%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="10" loext:num-list-format="%10%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + </text:outline-style> + <text:notes-configuration text:note-class="footnote" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/> + <text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/> + <text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/> + </office:styles> + <office:automatic-styles> + <style:style style:name="Sect1" style:family="section"> + <style:section-properties style:editable="false"> + <style:columns fo:column-count="1" fo:column-gap="0cm"/> + <text:notes-configuration text:note-class="footnote" text:start-value="3" style:num-prefix="(" style:num-suffix=")" style:num-format="1"/> + <text:notes-configuration text:note-class="endnote" text:start-value="2" style:num-prefix="[" style:num-suffix="]" style:num-format="i"/> + </style:section-properties> + </style:style> + <style:page-layout style:name="pm1"> + <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:footnote-max-height="0cm" loext:margin-gutter="0cm"> + <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/> + </style:page-layout-properties> + <style:header-style/> + <style:footer-style/> + </style:page-layout> + <style:style style:name="dp1" style:family="drawing-page"> + <style:drawing-page-properties draw:background-size="full"/> + </style:style> + </office:automatic-styles> + <office:master-styles> + <style:master-page style:name="Standard" style:page-layout-name="pm1" draw:style-name="dp1"/> + </office:master-styles> + <office:body> + <office:text> + <text:sequence-decls> + <text:sequence-decl text:display-outline-level="0" text:name="Illustration"/> + <text:sequence-decl text:display-outline-level="0" text:name="Table"/> + <text:sequence-decl text:display-outline-level="0" text:name="Text"/> + <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/> + <text:sequence-decl text:display-outline-level="0" text:name="Figure"/> + </text:sequence-decls> + <text:section text:style-name="Sect1" text:name="Section1"> + <text:p text:style-name="Standard"/> + </text:section> + <text:p text:style-name="Standard"/> + </office:text> + </office:body> +</office:document>
\ No newline at end of file diff --git a/sw/qa/uitest/data/tdf145215.docx b/sw/qa/uitest/data/tdf145215.docx Binary files differnew file mode 100644 index 000000000..b91d13b28 --- /dev/null +++ b/sw/qa/uitest/data/tdf145215.docx diff --git a/sw/qa/uitest/data/tdf145326.odt b/sw/qa/uitest/data/tdf145326.odt Binary files differnew file mode 100644 index 000000000..490f1cdcf --- /dev/null +++ b/sw/qa/uitest/data/tdf145326.odt diff --git a/sw/qa/uitest/data/tdf146248.docx b/sw/qa/uitest/data/tdf146248.docx Binary files differnew file mode 100644 index 000000000..2b5ed2959 --- /dev/null +++ b/sw/qa/uitest/data/tdf146248.docx diff --git a/sw/qa/uitest/data/tdf146605.odt b/sw/qa/uitest/data/tdf146605.odt Binary files differnew file mode 100644 index 000000000..88dda70a0 --- /dev/null +++ b/sw/qa/uitest/data/tdf146605.odt diff --git a/sw/qa/uitest/data/tdf149268.odt b/sw/qa/uitest/data/tdf149268.odt Binary files differnew file mode 100644 index 000000000..a68b81f4a --- /dev/null +++ b/sw/qa/uitest/data/tdf149268.odt diff --git a/sw/qa/uitest/data/tdf150443.docx b/sw/qa/uitest/data/tdf150443.docx Binary files differnew file mode 100644 index 000000000..162aec01f --- /dev/null +++ b/sw/qa/uitest/data/tdf150443.docx diff --git a/sw/qa/uitest/data/tdf39721.fodt b/sw/qa/uitest/data/tdf39721.fodt new file mode 100644 index 000000000..1acf06c5e --- /dev/null +++ b/sw/qa/uitest/data/tdf39721.fodt @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:officeooo="http://openoffice.org/2009/office" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text" xmlns:dc="http://purl.org/dc/elements/1.1/"> + <office:styles> + <style:style style:name="Standard" style:family="paragraph" style:class="text"/> + <style:default-style style:family="paragraph"> + <style:text-properties fo:language="en" fo:country="US"/> + </style:default-style> + </office:styles> + <office:body> + <office:text> + <text:tracked-changes text:track-changes="false"> + <text:changed-region xml:id="ct94454449144064" text:id="ct94454449144064"> + <text:deletion> + <office:change-info> + <dc:creator>Unknown Author</dc:creator> + <dc:date>2021-01-06T16:18:57</dc:date> + </office:change-info> + </text:deletion> + </text:changed-region> + <text:changed-region xml:id="ct94454455394000" text:id="ct94454455394000"> + <text:deletion> + <office:change-info> + <dc:creator>Unknown Author</dc:creator> + <dc:date>2021-01-06T16:20:17</dc:date> + </office:change-info> + </text:deletion> + </text:changed-region> + </text:tracked-changes> + <text:list xml:id="list627175737" text:style-name="L3"> + <text:list-item> + <text:p text:style-name="P1">Lorem<text:change-start text:change-id="ct94454449144064"/> ipsu<text:change-end text:change-id="ct94454449144064"/>m</text:p> + </text:list-item> + <text:list-item> + <text:p text:style-name="P1">dol<text:change-start text:change-id="ct94454455394000"/>or <text:change-end text:change-id="ct94454455394000"/>sit</text:p> + </text:list-item> + <text:list-item> + <text:p text:style-name="P1">amet.</text:p> + </text:list-item> + </text:list> + </office:text> + </office:body> +</office:document> diff --git a/sw/qa/uitest/data/tdf40427_SectionPositions.odt b/sw/qa/uitest/data/tdf40427_SectionPositions.odt Binary files differnew file mode 100644 index 000000000..67d30d0cc --- /dev/null +++ b/sw/qa/uitest/data/tdf40427_SectionPositions.odt diff --git a/sw/qa/uitest/data/tdf46561.odt b/sw/qa/uitest/data/tdf46561.odt Binary files differnew file mode 100644 index 000000000..c9f994252 --- /dev/null +++ b/sw/qa/uitest/data/tdf46561.odt diff --git a/sw/qa/uitest/data/tdf51816.odt b/sw/qa/uitest/data/tdf51816.odt Binary files differnew file mode 100644 index 000000000..a7816a74f --- /dev/null +++ b/sw/qa/uitest/data/tdf51816.odt diff --git a/sw/qa/uitest/data/tdf58050.html b/sw/qa/uitest/data/tdf58050.html new file mode 100644 index 000000000..9d61cf1c4 --- /dev/null +++ b/sw/qa/uitest/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/data/tdf66043.fodt b/sw/qa/uitest/data/tdf66043.fodt new file mode 100644 index 000000000..5fcdde71d --- /dev/null +++ b/sw/qa/uitest/data/tdf66043.fodt @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:officeooo="http://openoffice.org/2009/office" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text" xmlns:dc="http://purl.org/dc/elements/1.1/"> + <office:styles> + <style:style style:name="Standard" style:family="paragraph" style:class="text"/> + <style:default-style style:family="paragraph"> + <style:text-properties fo:language="en" fo:country="US"/> + </style:default-style> + </office:styles> + <office:body> + <office:text> + <text:tracked-changes> + <text:changed-region xml:id="ct94277392414656" text:id="ct94277392414656"> + <text:deletion> + <office:change-info> + <dc:creator>Unknown Author</dc:creator> + <dc:date>2020-12-01T12:49:53</dc:date> + </office:change-info> + <text:p text:style-name="P1">o</text:p> + </text:deletion> + </text:changed-region> + <text:changed-region xml:id="ct94277392490096" text:id="ct94277392490096"> + <text:deletion> + <office:change-info> + <dc:creator>Unknown Author</dc:creator> + <dc:date>2020-12-01T12:50:00</dc:date> + </office:change-info> + <text:p text:style-name="P1">a</text:p> + </text:deletion> + </text:changed-region> + </text:tracked-changes> + <text:p text:style-name="P1">goo<text:change text:change-id="ct94277392414656"/>d baa<text:change text:change-id="ct94277392490096"/>d eeend</text:p> + </office:text> + </office:body> +</office:document> + diff --git a/sw/qa/uitest/data/tdf68347.odt b/sw/qa/uitest/data/tdf68347.odt Binary files differnew file mode 100644 index 000000000..2e72fb541 --- /dev/null +++ b/sw/qa/uitest/data/tdf68347.odt diff --git a/sw/qa/uitest/data/tdf81292.odt b/sw/qa/uitest/data/tdf81292.odt Binary files differnew file mode 100644 index 000000000..47e4ee9ab --- /dev/null +++ b/sw/qa/uitest/data/tdf81292.odt diff --git a/sw/qa/uitest/data/tdf81457.odt b/sw/qa/uitest/data/tdf81457.odt Binary files differnew file mode 100644 index 000000000..04c18dd3a --- /dev/null +++ b/sw/qa/uitest/data/tdf81457.odt diff --git a/sw/qa/uitest/data/tdf99334.odt b/sw/qa/uitest/data/tdf99334.odt Binary files differnew file mode 100644 index 000000000..9cbdcbc41 --- /dev/null +++ b/sw/qa/uitest/data/tdf99334.odt diff --git a/sw/qa/uitest/data/textToTable.odt b/sw/qa/uitest/data/textToTable.odt Binary files differnew file mode 100644 index 000000000..088b6b4c1 --- /dev/null +++ b/sw/qa/uitest/data/textToTable.odt diff --git a/sw/qa/uitest/data/trackedChanges.odt b/sw/qa/uitest/data/trackedChanges.odt Binary files differnew file mode 100644 index 000000000..61f546695 --- /dev/null +++ b/sw/qa/uitest/data/trackedChanges.odt diff --git a/sw/qa/uitest/data/writeprotection.docx b/sw/qa/uitest/data/writeprotection.docx Binary files differnew file mode 100644 index 000000000..f0fab46a9 --- /dev/null +++ b/sw/qa/uitest/data/writeprotection.docx diff --git a/sw/qa/uitest/fieldDialog/tdf129796.py b/sw/qa/uitest/fieldDialog/tdf129796.py new file mode 100644 index 000000000..fb764f7ae --- /dev/null +++ b/sw/qa/uitest/fieldDialog/tdf129796.py @@ -0,0 +1,76 @@ +# -*- 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.uihelper.common import select_pos + +class Tdf129796(UITestCase): + + def test_tdf129796(self): + + with self.ui_test.create_doc_in_start_center("writer") as writer_doc: + + with self.ui_test.execute_modeless_dialog_through_command(".uno:InsertField", close_button="cancel") as xDialog: + xTab = xDialog.getChild("tabcontrol") + select_pos(xTab, "4") + + xType = xDialog.getChild("type-var") + xType.getChild('8').executeAction("SELECT", tuple()) + self.assertEqual("User Field", get_state_as_dict(xType)['SelectEntryText']) + + xNumFormat = xDialog.getChild("numformat-var") + xNumFormat.getChild('0').executeAction("SELECT", tuple()) + self.assertEqual("Text", get_state_as_dict(xNumFormat)['SelectEntryText']) + + xName = xDialog.getChild("name-var") + xName.executeAction("TYPE", mkPropertyValues({"TEXT": "MyField"})) + + xValue = xDialog.getChild("value-var") + xValue.executeAction("TYPE", mkPropertyValues({"TEXT": "abc"})) + + xApplyBtn = xDialog.getChild("apply") + xApplyBtn.executeAction("CLICK", ()) + + xType.getChild('4').executeAction("SELECT", tuple()) + self.assertEqual("Input field", get_state_as_dict(xType)['SelectEntryText']) + + self.assertEqual("MyField", get_state_as_dict(xDialog.getChild("select-var"))["SelectEntryText"]) + + xValue.executeAction("TYPE", mkPropertyValues({"TEXT": "ref"})) + + xOkBtn = xDialog.getChild("ok") + with self.ui_test.execute_blocking_action(xOkBtn.executeAction, args=('CLICK', ())) as xFieldDialog: + xName = xFieldDialog.getChild("name") + self.assertEqual("ref", get_state_as_dict(xName)['Text']) + xText = xFieldDialog.getChild("text") + self.assertEqual("abc", get_state_as_dict(xText)['Text']) + + textfields = writer_doc.getTextFields() + textfield = textfields.createEnumeration().nextElement() + self.assertEqual('MyField', textfield.Content) + self.assertTrue(textfield.supportsService("com.sun.star.text.TextField.InputUser")) + + # Move the cursor to the field + self.xUITest.executeCommand(".uno:GoLeft") + + with self.ui_test.execute_dialog_through_command(".uno:FieldDialog") as xDialog: + xType = xDialog.getChild("type-var") + xNumFormat = xDialog.getChild("numformat-var") + xValue = xDialog.getChild("value-var") + xName = xDialog.getChild("name-var") + + # Without the fix in place, this test would have crashed here + self.assertEqual("ref", get_state_as_dict(xValue)['Text']) + self.assertEqual("Input field", get_state_as_dict(xType)['SelectEntryText']) + self.assertEqual("General", get_state_as_dict(xNumFormat)['SelectEntryText']) + self.assertEqual("MyField", get_state_as_dict(xName)['Text']) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/fieldDialog/tdf135377.py b/sw/qa/uitest/fieldDialog/tdf135377.py new file mode 100644 index 000000000..b5751bedf --- /dev/null +++ b/sw/qa/uitest/fieldDialog/tdf135377.py @@ -0,0 +1,46 @@ +# -*- 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.uihelper.common import select_pos + +class Tdf135377(UITestCase): + + def test_tdf135377(self): + + with self.ui_test.create_doc_in_start_center("writer") as writer_doc: + + with self.ui_test.execute_modeless_dialog_through_command(".uno:InsertField", close_button="cancel") as xDialog: + xTab = xDialog.getChild("tabcontrol") + select_pos(xTab, "4") + + xType = xDialog.getChild("type-var") + xType.getChild('8').executeAction("SELECT", tuple()) + self.assertEqual("User Field", get_state_as_dict(xType)['SelectEntryText']) + + xName = xDialog.getChild("name-var") + xName.executeAction("TYPE", mkPropertyValues({"TEXT": "AA"})) + + xValue = xDialog.getChild("value-var") + xValue.executeAction("TYPE", mkPropertyValues({"TEXT": "BB"})) + + xNumFormat = xDialog.getChild("numformat-var") + + # Without the fix in place, this test would have failed with + # AssertionError: 'General' != '' + self.assertEqual("General", get_state_as_dict(xNumFormat)['SelectEntryText']) + + xApplyBtn = xDialog.getChild("apply") + xApplyBtn.executeAction("CLICK", ()) + + self.assertEqual("AA", get_state_as_dict(xDialog.getChild("select-var"))["SelectEntryText"]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/fieldDialog/tdf143483.py b/sw/qa/uitest/fieldDialog/tdf143483.py new file mode 100644 index 000000000..346fe6074 --- /dev/null +++ b/sw/qa/uitest/fieldDialog/tdf143483.py @@ -0,0 +1,57 @@ +# -*- 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, get_url_for_data_file + +class Tdf143483(UITestCase): + + def test_tdf143483(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf143483.odt")) as document: + + self.xUITest.executeCommand(".uno:JumpToNextBookmark") + + with self.ui_test.execute_dialog_through_command(".uno:FieldDialog") as xDialog: + + xDoc = xDialog.getChild("type-doc") + self.assertEqual("Chapter", get_state_as_dict(xDoc)['SelectEntryText']) + + xFormat = xDialog.getChild("format-doc") + self.assertEqual("Chapter name", get_state_as_dict(xFormat)['SelectEntryText']) + + xNext = xDialog.getChild("next") + xNext.executeAction("CLICK", tuple()) + + self.assertEqual("Chapter", get_state_as_dict(xDoc)['SelectEntryText']) + self.assertEqual("Chapter number", get_state_as_dict(xFormat)['SelectEntryText']) + + xNext.executeAction("CLICK", tuple()) + + self.assertEqual("Chapter", get_state_as_dict(xDoc)['SelectEntryText']) + self.assertEqual("Chapter number and name", get_state_as_dict(xFormat)['SelectEntryText']) + + xNext.executeAction("CLICK", tuple()) + + self.assertEqual("Chapter", get_state_as_dict(xDoc)['SelectEntryText']) + self.assertEqual("Chapter number without separator", get_state_as_dict(xFormat)['SelectEntryText']) + + xEnumeration = document.Text.createEnumeration() + self.assertEqual("Another title", xEnumeration.nextElement().String) + self.assertEqual("", xEnumeration.nextElement().String) + self.assertEqual("1. Another title", xEnumeration.nextElement().String) + + # Without the fix in place, this test would have failed with + # AssertionError: '2. Chapter 1 -' != '2. Another title' + self.assertEqual("2. Chapter 1 -", xEnumeration.nextElement().String) + self.assertEqual("3. Chapter 1 - Another title", xEnumeration.nextElement().String) + self.assertEqual("4. 1", xEnumeration.nextElement().String) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/fieldDialog/tdf145062.py b/sw/qa/uitest/fieldDialog/tdf145062.py new file mode 100644 index 000000000..09bcec80f --- /dev/null +++ b/sw/qa/uitest/fieldDialog/tdf145062.py @@ -0,0 +1,63 @@ +# -*- 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.uihelper.common import select_pos + +class Tdf145062(UITestCase): + + def test_tdf145062(self): + + with self.ui_test.create_doc_in_start_center("writer") as writer_doc: + + with self.ui_test.execute_modeless_dialog_through_command(".uno:InsertField", close_button="") as xDialog: + xTab = xDialog.getChild("tabcontrol") + select_pos(xTab, "2") + + xType = xDialog.getChild("type-func") + xType.getChild('2').executeAction("SELECT", tuple()) + self.assertEqual("Input field", get_state_as_dict(xType)['SelectEntryText']) + + xOkBtn = xDialog.getChild("ok") + with self.ui_test.execute_blocking_action(xOkBtn.executeAction, args=('CLICK', ())) as xFieldDialog: + xText = xFieldDialog.getChild("text") + xText.executeAction("TYPE", mkPropertyValues({"TEXT": "AAA"})) + + # move cursor to the middle of the field + self.xUITest.executeCommand(".uno:GoLeft") + self.xUITest.executeCommand(".uno:GoLeft") + + xType.getChild('6').executeAction("SELECT", tuple()) + self.assertEqual("Hidden text", get_state_as_dict(xType)['SelectEntryText']) + + # try to insert a hidden text a few times + # Without the fix in place, this test would have crashed here + for i in range(10): + xOkBtn.executeAction("CLICK", ()) + + # close_dialog_through_button should be used here but it hangs and + # the reason seems to be that interacting with the document while + # the dialog is open doesn't play well together in the uitests + # As a workaround, leave the dialog open, close the document, + # open a new one and then, close the dialog. + # If the dialog is not closed, it will be displayed in other tests + + textfields = writer_doc.getTextFields() + textfield = textfields.createEnumeration().nextElement() + self.assertTrue(textfield.supportsService("com.sun.star.text.TextField.Input")) + self.assertEqual('AAA', textfield.Content) + + with self.ui_test.load_empty_file("writer"): + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/fieldDialog/tdf146462.py b/sw/qa/uitest/fieldDialog/tdf146462.py new file mode 100644 index 000000000..95eae5ac0 --- /dev/null +++ b/sw/qa/uitest/fieldDialog/tdf146462.py @@ -0,0 +1,45 @@ +# -*- 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, type_text +from uitest.uihelper.common import select_pos + +class Tdf146462(UITestCase): + + def test_tdf146462(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + type_text(xWriterEdit, "Header") + + self.xUITest.executeCommand(".uno:StyleApply?Style:string=Heading%201&FamilyName:string=ParagraphStyles") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:InsertField", close_button="cancel") as xDialog: + xTab = xDialog.getChild("tabcontrol") + select_pos(xTab, "1") + + xType = xDialog.getChild("type-ref") + xType.getChild('2').executeAction("SELECT", tuple()) + self.assertEqual("Headings", get_state_as_dict(xType)['SelectEntryText']) + + xFormat = xDialog.getChild("format-ref") + self.assertEqual("Page number (unstyled)", get_state_as_dict(xFormat)['SelectEntryText']) + + xSelect = xDialog.getChild("selecttip") + + # Without the fix in place, this test would have failed with + # AssertionError: 'Header' != '' + self.assertEqual("Header", get_state_as_dict(xSelect)['SelectEntryText']) + self.assertEqual("1", get_state_as_dict(xSelect)['Children']) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/fieldDialog/tdf148551.py b/sw/qa/uitest/fieldDialog/tdf148551.py new file mode 100644 index 000000000..2d0de314b --- /dev/null +++ b/sw/qa/uitest/fieldDialog/tdf148551.py @@ -0,0 +1,44 @@ +# -*- 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, type_text +from uitest.uihelper.common import select_pos + +class Tdf148551(UITestCase): + + def test_tdf148551(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:InsertField", close_button="cancel") as xDialog: + xTab = xDialog.getChild("tabcontrol") + select_pos(xTab, "0") + + xDoc = xDialog.getChild("type-doc") + xDoc.getChild('7').executeAction("SELECT", tuple()) + self.assertEqual("Statistics", get_state_as_dict(xDoc)['SelectEntryText']) + + xSelect = xDialog.getChild("select-doc") + self.assertEqual("Pages", get_state_as_dict(xSelect)['SelectEntryText']) + + xFormat = xDialog.getChild("format-doc") + self.assertEqual("As Page Style", get_state_as_dict(xFormat)['SelectEntryText']) + + xOk = xDialog.getChild("ok") + xOk.executeAction("CLICK", tuple()) + + # Without the fix in place, this test would have failed with + # AssertionError: '1' != 'A' + self.assertEqual("1", document.Text.createEnumeration().nextElement().String) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/findBar/findbar.py b/sw/qa/uitest/findBar/findbar.py new file mode 100644 index 000000000..577885411 --- /dev/null +++ b/sw/qa/uitest/findBar/findbar.py @@ -0,0 +1,68 @@ +# -*- 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.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +#test Find Bar +class FindBar(UITestCase): + + def test_find_bar(self): + + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + # Type some lines to search for words on them + xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "LibreOffice"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "LibreOffice Writer"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "LibreOffice Calc"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "The Document Foundation"})) + + # open the Find Bar + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+f"})) + + # Type the Word that we want to search for it + xfind = xWriterDoc.getChild("find") + xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "Libre"})) + + # Select the Find Bar + xfind_bar = xWriterDoc.getChild("FindBar") + self.assertEqual(get_state_as_dict(xfind_bar)["ItemCount"], "14") + + # Press on FindAll in the Find Bar + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"})) + self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemID"], "5") # 5 is FindAll id for Pos 4 + self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemText"], "Find All") + self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemCommand"], ".uno:FindAll") + self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "LibreLibreLibre") + + # Press on Find Next in the Find Bar + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"})) # 3 is Find Next pos + self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemID"], "4") + self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemText"], "Find Next") + self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemCommand"], ".uno:DownSearch") + self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "Libre") + + # Press on Find Previous in the Find Bar + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "2"})) # 2 is Find Previous pos + self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemID"], "3") + self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemText"], "Find Previous") + self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemCommand"], ".uno:UpSearch") + self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "Libre") + + # Close the Find Bar + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 0 is pos for close + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/findBar/tdf136941.py b/sw/qa/uitest/findBar/tdf136941.py new file mode 100644 index 000000000..f1d147b1a --- /dev/null +++ b/sw/qa/uitest/findBar/tdf136941.py @@ -0,0 +1,67 @@ +# -*- 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.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf136941(UITestCase): + + def test_tdf136941(self): + + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello World"})) + + self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar") + + xfind = xWriterDoc.getChild("find") + xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"})) + + self.assertEqual("Hello", get_state_as_dict(xfind)['Text']) + + xfind_bar = xWriterDoc.getChild("FindBar") + + # Search Next + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"})) + + # Close button + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) + + # Check the toolbar is closed + self.assertTrue("find" not in xWriterDoc.getChildren()) + self.assertEqual("Hello", get_state_as_dict(xWriterEdit)['SelectedText']) + + self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar") + + xfind = xWriterDoc.getChild("find") + self.ui_test.wait_until_property_is_updated(xfind, 'SelectedText', "Hello") + self.assertEqual("Hello", get_state_as_dict(xfind)['SelectedText']) + + xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "World"})) + + # Without the fix in place, this test would have failed with + # AssertionError: 'World' != 'WorldHello' + self.assertEqual("World", get_state_as_dict(xfind)['Text']) + + xfind_bar = xWriterDoc.getChild("FindBar") + + # Search Next + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"})) + + # Close button + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) + + # Check the toolbar is closed + self.assertTrue("find" not in xWriterDoc.getChildren()) + self.assertEqual("World", get_state_as_dict(xWriterEdit)['SelectedText']) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/findBar/tdf138232.py b/sw/qa/uitest/findBar/tdf138232.py new file mode 100644 index 000000000..060fe8de2 --- /dev/null +++ b/sw/qa/uitest/findBar/tdf138232.py @@ -0,0 +1,52 @@ +# -*- 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.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf138232(UITestCase): + + def test_tdf138232(self): + + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"})) + + self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar") + + xfind = xWriterDoc.getChild("find") + self.ui_test.wait_until_property_is_updated(xfind, 'HasFocus', "true") + self.assertEqual("true", get_state_as_dict(xfind)['HasFocus']) + + xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"})) + self.assertEqual("Hello", get_state_as_dict(xfind)['Text']) + + xfind_bar = xWriterDoc.getChild("FindBar") + + # Click on Find All + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"})) + + self.assertEqual("HelloHello", get_state_as_dict(xWriterEdit)['SelectedText']) + + xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "World"})) + + # Without the fix in place, this test would have failed with + # AssertionError: 'HelloWorld' != 'World' + self.assertEqual("HelloWorld", get_state_as_dict(xfind)['Text']) + + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"})) + + self.assertEqual("", get_state_as_dict(xWriterEdit)['SelectedText']) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/findBar/tdf88608.py b/sw/qa/uitest/findBar/tdf88608.py new file mode 100644 index 000000000..83e99d8e1 --- /dev/null +++ b/sw/qa/uitest/findBar/tdf88608.py @@ -0,0 +1,56 @@ +# -*- 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.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf88608(UITestCase): + + def test_tdf88608(self): + + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello World"})) + + self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar") + + # Search a word that doesn't exist + xfind = xWriterDoc.getChild("find") + xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "X"})) + self.assertEqual("X", get_state_as_dict(xfind)['Text']) + + xfind_bar = xWriterDoc.getChild("FindBar") + self.assertEqual('', get_state_as_dict(xfind_bar.getChild('label'))['Text']) + + # Search Next + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"})) + + self.assertEqual('Search key not found', get_state_as_dict(xfind_bar.getChild('label'))['Text']) + + self.assertEqual("", get_state_as_dict(xWriterEdit)['SelectedText']) + + xfind.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) + xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "World"})) + self.assertEqual("World", get_state_as_dict(xfind)['Text']) + + # Without the fix in place, this test would have failed with + # AssertionError: '' != 'Search key not found' + self.assertEqual('', get_state_as_dict(xfind_bar.getChild('label'))['Text']) + + # Search Next + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"})) + + self.assertEqual('Reached the end of the document', get_state_as_dict(xfind_bar.getChild('label'))['Text']) + + self.assertEqual("World", get_state_as_dict(xWriterEdit)['SelectedText']) + + +# 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..d5cc19847 --- /dev/null +++ b/sw/qa/uitest/findReplace/findReplace.py @@ -0,0 +1,215 @@ +# -*- 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.uihelper.common import select_pos +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, type_text + +class findReplace(UITestCase): + def test_find_writer(self): + with self.ui_test.load_file(get_url_for_data_file("findReplace.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + + 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 + + + #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" + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + 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(writer_doc.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(writer_doc.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") + with self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ())) as dialog: + xTabs = dialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xSizeFont = dialog.getChild("cbWestSize") + xSizeFont.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSizeFont.executeAction("TYPE", mkPropertyValues({"TEXT":"16"})) #set font size 16 + + # 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 + + + #Bug 39022 - find-replace->$1, not pattern + def test_tdf39022_replace_regexp(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + type_text(xWriterEdit, "test number1 testnot") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + 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 + + # Deselect similarity before selecting regex + xSimilarity = xDialog.getChild("similarity") + if get_state_as_dict(xSimilarity)['Selected'] == 'true': + xSimilarity.executeAction("CLICK", tuple()) + + regexp = xDialog.getChild("regexp") + regexp.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(regexp)['Selected']) + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) + #verify + self.assertEqual(document.Text.String[0:27], "replacedest number1 testnot") + + # Deselect regex button, otherwise it might affect other tests + regexp.executeAction("CLICK", tuple()) + self.assertEqual("false", get_state_as_dict(regexp)['Selected']) + + #tdf116242 ţ ț + def test_tdf116242_replace_t_with_cedilla(self): + with self.ui_test.load_file(get_url_for_data_file("tdf116242.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + 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(writer_doc.Text.String[0:13], "țoootdf116242") + + + #Bug 98417 - FIND & REPLACE: Add 'Find Previous' button + def test_tdf98417_find_previous_writer(self): + with self.ui_test.load_file(get_url_for_data_file("findReplace.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + + 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") + + def test_tdf136577(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + type_text(xWriterEdit, "x") + + self.assertEqual(document.Text.String, "x") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"x"})) + + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) + + self.assertEqual(document.Text.String, "") + + self.xUITest.executeCommand(".uno:Undo") + + # Without the fix in place, this test would have failed with AssertionError: '' != 'x' + self.assertEqual(document.Text.String, "x") + + def test_tdf143128(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + type_text(xWriterEdit, "ß") + + self.assertEqual(document.Text.String, "ß") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"ẞ"})) + + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"SS"})) + + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) + + # Without the fix in place, this test would have failed with + # AssertionError: 'ß' != 'SS' + self.assertEqual(document.Text.String, "SS") + + self.xUITest.executeCommand(".uno:Undo") + + self.assertEqual(document.Text.String, "ß") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/findReplace/findSimilarity.py b/sw/qa/uitest/findReplace/findSimilarity.py new file mode 100644 index 000000000..7c532cc20 --- /dev/null +++ b/sw/qa/uitest/findReplace/findSimilarity.py @@ -0,0 +1,73 @@ +# -*- 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, get_url_for_data_file + +#Find similarities + +class findSimilarities(UITestCase): + def test_find_similarities(self): + with self.ui_test.load_file(get_url_for_data_file("findReplace.odt")) as writer_doc: + 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 + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="") as xDialog: + 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") + if get_state_as_dict(similarity)['Selected'] == 'false': + similarity.executeAction("CLICK", tuple()) + + similaritybtn = xDialog.getChild("similaritybtn") + + with self.ui_test.execute_blocking_action(similaritybtn.executeAction, args=('CLICK', ())) as 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()) + + #open dialog again, verify values = 1; close dialog with cancel + with self.ui_test.execute_blocking_action(similaritybtn.executeAction, args=('CLICK', ()), close_button="cancel") as 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") + + 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") + +# 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..39f95faad --- /dev/null +++ b/sw/qa/uitest/findReplace/tdf106099.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 uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text +from uitest.uihelper.common import get_state_as_dict + +#Bug 106099 - Find and replace by format, font color added by force + +class tdf106099(UITestCase): + def test_tdf106099_find_format_underline(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + #Find and replace + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + #2. Choose Format + format = xDialog.getChild("format") + with self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ())) as dialog: + #Font effects - Underline Single. OK. + xTabs = dialog.getChild("tabcontrol") + select_pos(xTabs, "1") #tab font effects + underlinelb = dialog.getChild("underlinelb") + select_by_text(underlinelb, "Single") + + #verify label searchdesc + searchdesc = xDialog.getChild("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"], "") + +# 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..d05624352 --- /dev/null +++ b/sw/qa/uitest/findReplace/tdf118208.py @@ -0,0 +1,67 @@ +# -*- 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.uihelper.common import get_state_as_dict, get_url_for_data_file + +#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): + with self.ui_test.load_file(get_url_for_data_file("tdf118208.odt")) as writer_doc: + 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. + with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog: + + 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()) + + + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + + format = xDialog.getChild("format") + + with self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ())): + pass + + #verify + self.assertEqual(writer_doc.Text.String[0:14], "Aaaaaaaaaaaaaa") + + #enable lang support again + with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog: + + 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()) + +# 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..ff11f044e --- /dev/null +++ b/sw/qa/uitest/findReplace/tdf119462.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 uitest.uihelper.common import select_pos +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict + +#Bug 119462 - Find with formatting adds 0pt text size + +class tdf119462(UITestCase): + def test_tdf119462_find_format(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + #1. Choose Edit > Find and Replace + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + #2. Choose Format + format = xDialog.getChild("format") + with self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ())) as dialog: + #3. Choose Bold + xTabs = dialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xweststylelbcjk = dialog.getChild("cbWestStyle") + xweststylelbcjk.executeAction("TYPE", mkPropertyValues({"TEXT":"Bold"})) + + #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"], "") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/findReplace/tdf126627.py b/sw/qa/uitest/findReplace/tdf126627.py new file mode 100644 index 000000000..aba465826 --- /dev/null +++ b/sw/qa/uitest/findReplace/tdf126627.py @@ -0,0 +1,44 @@ +# -*- 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, get_url_for_data_file + +#Bug 126627 - CRASH: undoing redlinehide deletion + +class tdf126627(UITestCase): + def test_tdf126627_crash_undo_deletion(self): + with self.ui_test.load_file(get_url_for_data_file("tdf126627.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"bar"})) + xsearch = xDialog.getChild("search") + xsearch.executeAction("CLICK", tuple()) + + #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(writer_doc.Text.String[0:6], "foobar") + #4. Undo once-> Crash + self.xUITest.executeCommand(".uno:Undo") + #verify that we have now two words + with self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog", close_button="close") as xDialog: + xselectwords = xDialog.getChild("selectwords") + self.assertEqual(get_state_as_dict(xselectwords)["Text"], "2") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/findReplace/tdf137737.py b/sw/qa/uitest/findReplace/tdf137737.py new file mode 100644 index 000000000..b2abf3f95 --- /dev/null +++ b/sw/qa/uitest/findReplace/tdf137737.py @@ -0,0 +1,52 @@ +# -*- 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.uihelper.common import type_text, get_url_for_data_file, get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf137737(UITestCase): + + def test_tdf137737(self): + with self.ui_test.load_file(get_url_for_data_file("tdf137737.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.assertEqual(2, writer_doc.Endnotes.Count) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + xSearchterm = xDialog.getChild("searchterm") + xSearchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSearchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xSearchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"[:control:]"})) + + xReplaceterm = xDialog.getChild("replaceterm") + xReplaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) + + # Deselect similarity before selecting regex + xSimilarity = xDialog.getChild("similarity") + if get_state_as_dict(xSimilarity)['Selected'] == 'true': + xSimilarity.executeAction("CLICK", tuple()) + + xRegexp = xDialog.getChild("regexp") + xRegexp.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(xRegexp)['Selected']) + + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) + + # Deselect regex button, otherwise it might affect other tests + xRegexp.executeAction("CLICK", tuple()) + self.assertEqual("false", get_state_as_dict(xRegexp)['Selected']) + + # Without the fix in place, this test would have failed with + # AssertionError: 0 != 1 + self.assertEqual(0, writer_doc.Endnotes.Count) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/findReplace/tdf144089.py b/sw/qa/uitest/findReplace/tdf144089.py new file mode 100644 index 000000000..ae26ffd24 --- /dev/null +++ b/sw/qa/uitest/findReplace/tdf144089.py @@ -0,0 +1,60 @@ +# -*- 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.uihelper.common import type_text, get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf144089(UITestCase): + + def test_tdf144089(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + type_text(xWriterEdit, "This is a test") + xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "10", "END_POS": "14"})) + + self.assertEqual("test", document.CurrentSelection[0].String) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + xSearchterm = xDialog.getChild("searchterm") + xSearchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSearchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xSearchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"^."})) + + xReplaceterm = xDialog.getChild("replaceterm") + xReplaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) + + xSelectionOnly = xDialog.getChild("selection") + xSelectionOnly.executeAction("CLICK", tuple()) + + # Deselect similarity before selecting regex + xSimilarity = xDialog.getChild("similarity") + if get_state_as_dict(xSimilarity)['Selected'] == 'true': + xSimilarity.executeAction("CLICK", tuple()) + + xRegexp = xDialog.getChild("regexp") + xRegexp.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(xRegexp)['Selected']) + + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) + + # Deselect regex button, otherwise it might affect other tests + xRegexp.executeAction("CLICK", tuple()) + self.assertEqual("false", get_state_as_dict(xRegexp)['Selected']) + + # Without the fix in place, this test would have failed with + # AssertionError: 'This is a test' != 'This is a AAAA' + self.assertEqual("This is a test", document.Text.String) + + self.assertEqual("test", document.CurrentSelection[0].String) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/findReplace/tdf44837.py b/sw/qa/uitest/findReplace/tdf44837.py new file mode 100644 index 000000000..79189a55e --- /dev/null +++ b/sw/qa/uitest/findReplace/tdf44837.py @@ -0,0 +1,42 @@ +# -*- 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.uihelper.common import type_text +from libreoffice.uno.propertyvalue import mkPropertyValues +#Bug 44837 - EDITING 'Replace All' clears current selection + +class tdf44837(UITestCase): + + def test_tdf448373_Replace_All_clears_current_selection(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + type_text(xWriterEdit, "asd asd") + self.xUITest.executeCommand(".uno:SelectAll") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + 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()) + + self.assertEqual(document.Text.String[0:8], "bsd bsd") + self.assertEqual(len(document.CurrentSelection[0].String) > 1, True) + #follow-up bug 125663 + +# 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..3cc1198cc --- /dev/null +++ b/sw/qa/uitest/librelogo/compile.py @@ -0,0 +1,130 @@ +# -*- 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 re + +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..1f01fbf0d --- /dev/null +++ b/sw/qa/uitest/librelogo/run.py @@ -0,0 +1,98 @@ +# -*- 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.uihelper.common import type_text + +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): + with self.ui_test.create_doc_in_start_center("writer") as document: + 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) + + +# 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..671fc9163 --- /dev/null +++ b/sw/qa/uitest/macro_tests/tdf124413.py @@ -0,0 +1,45 @@ +# -*- 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.uihelper.common import get_state_as_dict + +class tdf124413(UITestCase): + + def test_copy_paste_overwriting_undo_redo_in_macro_editor_tdf124413(self): + + with self.ui_test.create_doc_in_start_center("writer"): + #Start LibreOffice. Go to Tools > Macros > Organize Macros > Basic + with self.ui_test.execute_dialog_through_command(".uno:MacroDialog", close_button="") as xDialog: + #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/macro_tests/tdf64690.py b/sw/qa/uitest/macro_tests/tdf64690.py new file mode 100644 index 000000000..5e691117b --- /dev/null +++ b/sw/qa/uitest/macro_tests/tdf64690.py @@ -0,0 +1,73 @@ +# -*- 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.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf64690(UITestCase): + + def test_tdf64690(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + with self.ui_test.execute_dialog_through_command(".uno:MacroDialog", close_button="edit"): + pass + + xMacroWin = self.xUITest.getTopFocusWindow() + xEditWin = xMacroWin.getChild('EditorWindow') + + self.xUITest.executeCommand(".uno:SelectAll") + xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + + self.assertEqual("\n", get_state_as_dict(xEditWin)['Text']) + + xEditWin.executeAction("TYPE", mkPropertyValues({"TEXT":"'abc"})) + xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + xEditWin.executeAction("TYPE", mkPropertyValues({"TEXT":"'def"})) + + self.assertEqual("'abc\n'def\n", get_state_as_dict(xEditWin)['Text']) + + self.xUITest.executeCommand(".uno:SelectAll") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"."})) + + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"ABC"})) + + regexp = xDialog.getChild("regexp") + regexp.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(regexp)['Selected']) + + selection = xDialog.getChild("selection") + if get_state_as_dict(selection)['Selected'] == 'false': + selection.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(selection)['Selected']) + + replaceall = xDialog.getChild("replaceall") + + # Without the fix in place, this test would have hung here + with self.ui_test.execute_blocking_action(replaceall.executeAction, args=('CLICK', ())): + pass + + # Deselect regex button, otherwise it might affect other tests + regexp.executeAction("CLICK", tuple()) + self.assertEqual("false", get_state_as_dict(regexp)['Selected']) + + + self.assertEqual("ABCABCABCABC\nABCABCABCABC\n", get_state_as_dict(xEditWin)['Text']) + + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/navigator/tdf114724.py b/sw/qa/uitest/navigator/tdf114724.py new file mode 100644 index 000000000..841c9f121 --- /dev/null +++ b/sw/qa/uitest/navigator/tdf114724.py @@ -0,0 +1,56 @@ +# -*- 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, get_url_for_data_file + +class tdf114724(UITestCase): + + def test_track_headings_outline(self): + with self.ui_test.load_file(get_url_for_data_file("tdf114724.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:Sidebar") + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) + + xNavigatorPanel = xWriterEdit.getChild("NavigatorPanel") + xToolBar = xNavigatorPanel.getChild("content5") + xToolBar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'root' button + + xWriterEdit.executeAction("FOCUS", tuple()) + + xContentTree = xNavigatorPanel.getChild("contenttree") + + self.ui_test.wait_until_property_is_updated(xContentTree, "SelectEntryText", "HEADING 1") + self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "HEADING 1") + self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1") + for _ in range(0,3): + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + + self.ui_test.wait_until_property_is_updated(xContentTree, "SelectEntryText", "HEADING 4") + self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "HEADING 4") + self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1") + + for _ in range(0,3): + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + + self.ui_test.wait_until_property_is_updated(xContentTree, "SelectEntryText", "HEADING 1") + self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "HEADING 1") + self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1") + + # tdf#124456 makes the sidebar navigator consistent with the floating navigator's use + # of the stored root mode setting. This requires the root mode button to be clicked + # here to change the content navigation view back to all categories view for subsequent + # tests that expect the navigator tree to not be in root mode. + xToolBar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'root' button + self.xUITest.executeCommand(".uno:Sidebar") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/navigator/tdf134960.py b/sw/qa/uitest/navigator/tdf134960.py new file mode 100644 index 000000000..de5da7759 --- /dev/null +++ b/sw/qa/uitest/navigator/tdf134960.py @@ -0,0 +1,81 @@ +# -*- 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, get_url_for_data_file + +class tdf134960_hyperlinks(UITestCase): + + def launch_sidebar(self, xWriterEdit): + + self.xUITest.executeCommand(".uno:Sidebar") + + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) + + # wait until the navigator panel is available + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') + + xContentTree = xNavigatorPanel.getChild("contenttree") + xHyperlinks = xContentTree.getChild('7') + self.assertEqual('Hyperlinks', get_state_as_dict(xHyperlinks)['Text']) + + xHyperlinks.executeAction("EXPAND", tuple()) + + expectedHyperlinksOrder = [1, 2, 8, 9, 7, 10, 11, 3, 12, 4, 5, 6] + for i in range(12): + self.assertEqual('Hyperlink ' + str(expectedHyperlinksOrder[i]), get_state_as_dict(xHyperlinks.getChild(str(i)))['Text']) + + xHyperlinks.executeAction("COLLAPSE", tuple()) + + self.xUITest.executeCommand(".uno:Sidebar") + + def test_tdf134960_hyperlinks(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf134960.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + # Without the fix in place, this test would have failed with + # AssertionError: 'Hyperlink 2' != 'Hyperlink 6' + self.launch_sidebar(xWriterEdit) + + def test_tdf134960_hyperlinks_with_multiple_pages(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf134960.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + # Insert a page break so we have different links in different pages + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + self.xUITest.executeCommand(".uno:InsertPagebreak") + self.assertEqual("3", get_state_as_dict(xWriterEdit)["Pages"]) + + # Change view to 20% and 2 columns + with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog: + variable = xDialog.getChild("variable") + variable.executeAction("CLICK", tuple()) + + zoomsb = xDialog.getChild("zoomsb") + zoomsb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + zoomsb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + zoomsb.executeAction("TYPE", mkPropertyValues({"TEXT":"20"})) + + columns = xDialog.getChild("columns") + columns.executeAction("CLICK", tuple()) + + columnssb = xDialog.getChild("columnssb") + columnssb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + columnssb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + columnssb.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) + + # Without the fix in place, this test would have failed with + # AssertionError: 'Hyperlink 2' != 'Hyperlink 8' + self.launch_sidebar(xWriterEdit) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/navigator/tdf137274.py b/sw/qa/uitest/navigator/tdf137274.py new file mode 100644 index 000000000..a25f449ab --- /dev/null +++ b/sw/qa/uitest/navigator/tdf137274.py @@ -0,0 +1,70 @@ +# -*- 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 + +class tdf137274(UITestCase): + + def test_tdf137274(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + xMainWindow = self.xUITest.getTopFocusWindow() + xWriterEdit = xMainWindow.getChild("writer_edit") + + xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Test"})) + + # Insert first comment + xArgs = mkPropertyValues({"Text": "C1"}) + self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) + + # wait until the comment is available + self.ui_test.wait_until_child_is_available('Comment1') + + self.xUITest.executeCommand(".uno:Sidebar") + + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) + + # wait until the navigator panel is available + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') + + xContentTree = xNavigatorPanel.getChild("contenttree") + xComments = xContentTree.getChild('10') + self.assertEqual('Comments', get_state_as_dict(xComments)['Text']) + + xComments.executeAction("EXPAND", tuple()) + + self.assertEqual(1, len(xComments.getChildren())) + self.assertEqual('C1', get_state_as_dict(xComments.getChild('0'))['Text']) + + xComments.executeAction("COLLAPSE", tuple()) + + xArgs = mkPropertyValues({"Text": "C2"}) + self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) + + # wait until the second comment is available + self.ui_test.wait_until_child_is_available('Comment2') + + # xComments needs reassigned after content tree change + xComments = xContentTree.getChild('10') + self.assertEqual('Comments', get_state_as_dict(xComments)['Text']) + + xComments.executeAction("EXPAND", tuple()) + + # Without the fix in place, this test would have failed with AssertionError: 2 != 0 + self.assertEqual(2, len(xComments.getChildren())) + self.assertEqual('C1', get_state_as_dict(xComments.getChild('0'))['Text']) + + xComments.executeAction("COLLAPSE", tuple()) + + self.xUITest.executeCommand(".uno:Sidebar") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/navigator/tdf140257.py b/sw/qa/uitest/navigator/tdf140257.py new file mode 100644 index 000000000..fc2787bf0 --- /dev/null +++ b/sw/qa/uitest/navigator/tdf140257.py @@ -0,0 +1,112 @@ +# -*- 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, type_text +from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text + +class Tdf140257(UITestCase): + + def change_outline_level(self, sText): + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + + xOutline = xDialog.getChild("comboLB_OUTLINE_LEVEL") + + select_by_text(xOutline, sText) + + + def test_tdf140257(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xMainWindow = self.xUITest.getTopFocusWindow() + xWriterEdit = xMainWindow.getChild("writer_edit") + + self.change_outline_level("Level 1") + + for i in range(4): + type_text(xWriterEdit, 'P' + str(i + 1)) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + + type_text(xWriterEdit, 'P5') + + self.xUITest.executeCommand(".uno:Sidebar") + + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) + + # wait until the navigator panel is available + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') + + xContentTree = xNavigatorPanel.getChild("contenttree") + xHeadings = xContentTree.getChild('0') + self.assertEqual('Headings', get_state_as_dict(xHeadings)['Text']) + + xHeadings.executeAction("EXPAND", tuple()) + + self.assertEqual(5, len(xHeadings.getChildren())) + + for i in range(5): + self.assertEqual('P' + str(i + 1), get_state_as_dict(xHeadings.getChild(str(i)))['Text']) + + self.xUITest.executeCommand(".uno:Sidebar") + + cursor = document.getCurrentController().getViewCursor() + + # Use Adding Selection + selectionProperty = mkPropertyValues({"SelectionMode": 2}) + self.xUITest.executeCommandWithParameters(".uno:SelectionMode", selectionProperty) + + # Go to P2 and select it + cursor.goUp(3, False) + cursor.gotoStartOfLine(False) + cursor.gotoEndOfLine(True) + + # Go to P4 and select it + cursor.goDown(2, False) + cursor.gotoStartOfLine(False) + cursor.gotoEndOfLine(True) + + self.change_outline_level("Level 2") + + self.xUITest.executeCommand(".uno:Sidebar") + + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) + + # wait until the navigator panel is available + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') + + xContentTree = xNavigatorPanel.getChild("contenttree") + xHeadings = xContentTree.getChild('0') + self.assertEqual('Headings', get_state_as_dict(xHeadings)['Text']) + + xHeadings.executeAction("EXPAND", tuple()) + + # Without the fix in place, this test would have failed with + # AssertionError: 3 != 4 + self.assertEqual(3, len(xHeadings.getChildren())) + xChild1 = xHeadings.getChild('0') + self.assertEqual('P1', get_state_as_dict(xChild1)['Text']) + xChild1.executeAction("EXPAND", tuple()) + self.assertEqual(1, len(xChild1.getChildren())) + self.assertEqual('P2', get_state_as_dict(xChild1.getChild('0'))['Text']) + + xChild2 = xHeadings.getChild('1') + self.assertEqual('P3', get_state_as_dict(xChild2)['Text']) + xChild2.executeAction("EXPAND", tuple()) + self.assertEqual(1, len(xChild2.getChildren())) + self.assertEqual('P4', get_state_as_dict(xChild2.getChild('0'))['Text']) + + self.assertEqual('P5', get_state_as_dict(xHeadings.getChild('2'))['Text']) + + self.xUITest.executeCommand(".uno:Sidebar") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/navigator/tdf140661.py b/sw/qa/uitest/navigator/tdf140661.py new file mode 100644 index 000000000..d6c79eb2a --- /dev/null +++ b/sw/qa/uitest/navigator/tdf140661.py @@ -0,0 +1,64 @@ +# -*- 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, get_url_for_data_file + +class tdf140661(UITestCase): + + def launch_navigator(self, bIsBeforeUngroup): + xMainWindow = self.xUITest.getTopFocusWindow() + xWriterEdit = xMainWindow.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:Sidebar") + + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) + + # wait until the navigator panel is available + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') + + xContentTree = xNavigatorPanel.getChild("contenttree") + xDrawings = xContentTree.getChild('11') + self.assertEqual('Drawing objects', get_state_as_dict(xDrawings)['Text']) + + xDrawings.executeAction("EXPAND", tuple()) + + if bIsBeforeUngroup: + self.assertEqual(1, len(xDrawings.getChildren())) + self.assertEqual('DrawObject1', get_state_as_dict(xDrawings.getChild('0'))['Text']) + else: + self.assertEqual(12, len(xDrawings.getChildren())) + + # tdf#134960 + expectedShapeOrder = [1, 2, 8, 9, 7, 10, 11, 3, 12, 4, 5, 6] + for i in range(12): + self.assertEqual('Shape' + str(expectedShapeOrder[i]), get_state_as_dict(xDrawings.getChild(str(i)))['Text']) + + xDrawings.executeAction("COLLAPSE", tuple()) + + self.xUITest.executeCommand(".uno:Sidebar") + + def test_tdf140661(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf140661.odt")) as writer_doc: + + self.launch_navigator(True) + + # Select the shape and ungroup it + self.xUITest.executeCommand(".uno:JumpToNextFrame") + + self.ui_test.wait_until_child_is_available('metricfield') + + self.xUITest.executeCommand(".uno:FormatUngroup") + + # Without the fix in place, this test would have failed with + # AssertionError: 12 != 0 + self.launch_navigator(False) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/navigator/tdf143569.py b/sw/qa/uitest/navigator/tdf143569.py new file mode 100644 index 000000000..95dbc2dc9 --- /dev/null +++ b/sw/qa/uitest/navigator/tdf143569.py @@ -0,0 +1,69 @@ +# -*- 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, get_url_for_data_file + +class tdf143569(UITestCase): + + def test_Tdf143569(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf143569.odt")) as writer_doc: + + xMainWindow = self.xUITest.getTopFocusWindow() + xWriterEdit = xMainWindow.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:Sidebar") + + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) + + # wait until the navigator panel is available + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') + + xContentTree = xNavigatorPanel.getChild("contenttree") + + xHeadings = xContentTree.getChild('0') + self.assertEqual('Headings', get_state_as_dict(xHeadings)['Text']) + self.assertEqual("1", get_state_as_dict(xHeadings)['Children']) + + xHeadings.executeAction("EXPAND", tuple()) + + xChild = xHeadings.getChild('0') + + # Without the fix in place, this test would have failed with + # AssertionError: 'Introduction' != 'Anchored to Paragraph' + self.assertEqual('Introduction', get_state_as_dict(xChild)['Text']) + self.assertEqual("1", get_state_as_dict(xChild)['Children']) + + xChild.executeAction("EXPAND", tuple()) + + xChild = xChild.getChild('0') + self.assertEqual('Problem', get_state_as_dict(xChild)['Text']) + self.assertEqual("1", get_state_as_dict(xChild)['Children']) + + xChild.executeAction("EXPAND", tuple()) + + xChild = xChild.getChild('0') + self.assertEqual('Discussion Agenda', get_state_as_dict(xChild)['Text']) + self.assertEqual("2", get_state_as_dict(xChild)['Children']) + + xChild.executeAction("EXPAND", tuple()) + + xChild1 = xChild.getChild('0') + self.assertEqual('Anchored to Paragraph', get_state_as_dict(xChild1)['Text']) + self.assertEqual("0", get_state_as_dict(xChild1)['Children']) + + xChild2 = xChild.getChild('1') + self.assertEqual('Anchored as Character', get_state_as_dict(xChild2)['Text']) + self.assertEqual("0", get_state_as_dict(xChild2)['Children']) + + self.xUITest.executeCommand(".uno:Sidebar") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/navigator/tdf144672.py b/sw/qa/uitest/navigator/tdf144672.py new file mode 100644 index 000000000..5d64d63b2 --- /dev/null +++ b/sw/qa/uitest/navigator/tdf144672.py @@ -0,0 +1,55 @@ +# -*- 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, get_url_for_data_file + +class tdf144672(UITestCase): + + def test_Tdf144672(self): + with self.ui_test.load_file(get_url_for_data_file("tdf144672.odt")) as writer_doc: + + xMainWindow = self.xUITest.getTopFocusWindow() + xWriterEdit = xMainWindow.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:Sidebar") + + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) + + # wait until the navigator panel is available + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') + + xContentTree = xNavigatorPanel.getChild("contenttree") + + xReferences = xContentTree.getChild('8') + self.assertEqual('References', get_state_as_dict(xReferences)['Text']) + + # tdf#129625: Without the fix in place, this test would have failed with + # AssertionError: 'true' != 'false' + self.assertEqual('true', get_state_as_dict(xReferences)['IsSemiTransparent']) + + xIndexes = xContentTree.getChild('9') + self.assertEqual('Indexes', get_state_as_dict(xIndexes)['Text']) + self.assertEqual('false', get_state_as_dict(xIndexes)['IsSemiTransparent']) + + xIndexes.executeAction("EXPAND", tuple()) + + self.assertEqual('3', get_state_as_dict(xIndexes)['Children']) + + for i in range(3): + # Without the fix in place, this test would have failed here with + # AssertionError: 'false' != 'true' + self.assertEqual('false', get_state_as_dict(xIndexes.getChild(i))['IsSemiTransparent']) + + xIndexes.executeAction("COLLAPSE", tuple()) + + self.xUITest.executeCommand(".uno:Sidebar") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/navigator/tdf148198.py b/sw/qa/uitest/navigator/tdf148198.py new file mode 100644 index 000000000..d273bb6b5 --- /dev/null +++ b/sw/qa/uitest/navigator/tdf148198.py @@ -0,0 +1,61 @@ +# -*- 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, get_url_for_data_file + +class tdf148198(UITestCase): + + def test_tdf148198(self): + sHyperlink0 = 'a hyperlink with an anchor, different character styles, a footnote1, a field This is a bookmark, and a rsid' + sHyperlink1 = 'another hyperlink' + + with self.ui_test.load_file(get_url_for_data_file('hyperlink_multiple_spans.fodt')): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild('writer_edit') + + self.xUITest.executeCommand('.uno:Sidebar') + xWriterEdit.executeAction('SIDEBAR', mkPropertyValues({'PANEL': 'SwNavigatorPanel'})) + + # wait until the navigator panel is available + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') + + xContentTree = xNavigatorPanel.getChild('contenttree') + xHyperlinks = xContentTree.getChild('7') + self.assertEqual('Hyperlinks', get_state_as_dict(xHyperlinks)['Text']) + + xHyperlinks.executeAction('EXPAND', tuple()) + + self.assertEqual('2', get_state_as_dict(xHyperlinks)['Children']) + self.assertEqual(sHyperlink0, get_state_as_dict(xHyperlinks.getChild('0'))['Text']) + self.assertEqual(sHyperlink1, get_state_as_dict(xHyperlinks.getChild('1'))['Text']) + + # save and reload: the first hyperlink must be kept in one piece + self.xUITest.executeCommand('.uno:Save') + self.xUITest.executeCommand('.uno:Reload') + + # wait until the navigator panel is available + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') + + xContentTree = xNavigatorPanel.getChild('contenttree') + xHyperlinks = xContentTree.getChild('7') + self.assertEqual('Hyperlinks', get_state_as_dict(xHyperlinks)['Text']) + + xHyperlinks.executeAction('EXPAND', tuple()) + + # without the fix in place, this would fail: + # AssertionError: '2' != '11' + self.assertEqual('2', get_state_as_dict(xHyperlinks)['Children']) + self.assertEqual(sHyperlink0, get_state_as_dict(xHyperlinks.getChild('0'))['Text']) + self.assertEqual(sHyperlink1, get_state_as_dict(xHyperlinks.getChild('1'))['Text']) + + self.xUITest.executeCommand('.uno:Sidebar') + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/navigator/tdf149268.py b/sw/qa/uitest/navigator/tdf149268.py new file mode 100644 index 000000000..3a0943c76 --- /dev/null +++ b/sw/qa/uitest/navigator/tdf149268.py @@ -0,0 +1,43 @@ +# -*- 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, get_url_for_data_file + +class tdf149268(UITestCase): + + def test_tdf149268(self): + with self.ui_test.load_file(get_url_for_data_file("tdf149268.odt")): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:Sidebar") + + # Without the fix in place, this test would have crashed here + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) + + # wait until the navigator panel is available + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') + + xContentTree = xNavigatorPanel.getChild("contenttree") + xHyperlinks = xContentTree.getChild('7') + self.assertEqual('Hyperlinks', get_state_as_dict(xHyperlinks)['Text']) + + xHyperlinks.executeAction("EXPAND", tuple()) + + self.assertEqual("4", get_state_as_dict(xHyperlinks)['Children']) + self.assertEqual('Internet', get_state_as_dict(xHyperlinks.getChild('0'))['Text']) + self.assertEqual('1234567', get_state_as_dict(xHyperlinks.getChild('1'))['Text']) + self.assertEqual('yyyy', get_state_as_dict(xHyperlinks.getChild('2'))['Text']) + self.assertEqual('zzz', get_state_as_dict(xHyperlinks.getChild('3'))['Text']) + + self.xUITest.executeCommand(".uno:Sidebar") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/navigator/tdf40427.py b/sw/qa/uitest/navigator/tdf40427.py new file mode 100644 index 000000000..3192dc71d --- /dev/null +++ b/sw/qa/uitest/navigator/tdf40427.py @@ -0,0 +1,77 @@ +# -*- 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, get_url_for_data_file + +class tdf40427(UITestCase): + + def test_tdf40427(self): + with self.ui_test.load_file(get_url_for_data_file("tdf40427_SectionPositions.odt")) as document: + xMainWindow = self.xUITest.getTopFocusWindow() + xWriterEdit = xMainWindow.getChild("writer_edit") + + self.assertEqual(2, document.CurrentController.PageCount) + + # Make sure that the view is 2 pages side-by-side - look at dialog View-Zoom-Zoom + with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog: + + columnssb = xDialog.getChild("columnssb") + columns = xDialog.getChild("columns") + bookmode = xDialog.getChild("bookmode") + self.assertEqual("true", get_state_as_dict(columns)["Checked"]) + self.assertEqual("2", get_state_as_dict(columnssb)["Text"]) + self.assertEqual("false", get_state_as_dict(bookmode)["Selected"]) + + + # In this view, the sections "SectionB" and "SectionC" on second page are positioned on screen + # higher than "SectionY" and "SectionA" respectively; there are nested and anchored sections. + # Make sure that order in Navigator follows their relative position in document, not vertical + # position on screen, nor sorted alphabetically. Sections in flying frames are sorted by their + # anchor position in the document. + + self.xUITest.executeCommand(".uno:Sidebar") + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) + + # wait until the navigator panel is available + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') + + xContentTree = xNavigatorPanel.getChild("contenttree") + xSections = xContentTree.getChild('6') + self.assertEqual('Sections', get_state_as_dict(xSections)['Text']) + xSections.executeAction("EXPAND", ()) + + refSectionNames = [ + 'SectionZ', + 'SectionY', # SectionB should not get before this, despite its Y position on screen is higher + 'SectionT3', # Sections in tables go in rows, then across rows + 'SectionT1', + 'SectionT2', + 'SectionT0', + 'SectionF2', # Goes before SectionF1, because their fly anchors go in that order + 'SectionF3', # Same as SectionF1, but anchor section is in fly itself + 'SectionFinF3', # Check order of nested sections inside fly + 'SectionA', + 'SectionF1', # Section in fly anchored in a section goes immediately after its anchor section + 'SectionB', # High on screen, but late in list because it's on second page + 'SectionC', + ] + self.assertEqual(len(refSectionNames), len(xSections.getChildren())) + + actSectionNames = [] + for i in range(len(refSectionNames)): + actSectionNames.append(get_state_as_dict(xSections.getChild(str(i)))['Text']) + # Without the fix in place, this would fail with + # AssertionError: Lists differ: ['SectionZ', 'SectionY', 'SectionT3', 'SectionT1', 'SectionT2'[100 chars]onC'] != ['SectionZ', 'SectionB', 'SectionF3', 'SectionFinF3', 'Section[100 chars]onA'] + self.assertEqual(refSectionNames, actSectionNames) + + self.xUITest.executeCommand(".uno:Sidebar") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/options/optionsDialog.py b/sw/qa/uitest/options/optionsDialog.py new file mode 100644 index 000000000..790d30c9b --- /dev/null +++ b/sw/qa/uitest/options/optionsDialog.py @@ -0,0 +1,52 @@ +# -*- 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 + +class optionsDialog(UITestCase): + + def test_moreIconsDialog(self): + with self.ui_test.create_doc_in_start_center("writer"): + + with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog: + + xPages = xDialog.getChild("pages") + xLOEntry = xPages.getChild('0') + xLOEntry.executeAction("EXPAND", tuple()) + xViewEntry = xLOEntry.getChild('2') + xViewEntry.executeAction("SELECT", tuple()) + + xMoreIconsBtn = xDialog.getChild("btnMoreIcons") + + with self.ui_test.execute_blocking_action(xMoreIconsBtn.executeAction, args=('CLICK', ()), close_button="buttonClose") as dialog: + # Check it doesn't crash while opening it + xCloseBtn = dialog.getChild("buttonClose") + self.ui_test.wait_until_property_is_updated(xCloseBtn, "Enabled", "true") + + + + def test_tdf138596(self): + with self.ui_test.create_doc_in_start_center("writer"): + + with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog: + xPages = xDialog.getChild("pages") + xWriterEntry = xPages.getChild('3') + xWriterEntry.executeAction("EXPAND", tuple()) + xFormattingAidsEntry = xWriterEntry.getChild('2') + xFormattingAidsEntry.executeAction("SELECT", tuple()) + + xApplyBtn = xDialog.getChild("apply") + + # Click apply button twice + # Without the fix in place, this test would have crashed here + xApplyBtn.executeAction("CLICK", tuple()) + xApplyBtn.executeAction("CLICK", tuple()) + + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/options/tdf131581.py b/sw/qa/uitest/options/tdf131581.py new file mode 100644 index 000000000..5a4f83443 --- /dev/null +++ b/sw/qa/uitest/options/tdf131581.py @@ -0,0 +1,36 @@ +# -*- 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 + +class tdf131581(UITestCase): + + def test_tdf131581(self): + with self.ui_test.create_doc_in_start_center("writer"): + + self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialogOpt: + + xPages = xDialogOpt.getChild("pages") + xLOEntry = xPages.getChild('0') + xLOEntry.executeAction("EXPAND", tuple()) + xAdvancedEntry = xLOEntry.getChild('10') + xAdvancedEntry.executeAction("SELECT", tuple()) + + xExpertBtn = xDialogOpt.getChild("expertconfig") + + with self.ui_test.execute_blocking_action(xExpertBtn.executeAction, args=('CLICK', ())) as dialog: + # Without the fix in place, this would have hung + xSearchBtn = dialog.getChild("searchButton") + xSearchBtn.executeAction("CLICK", tuple()) + + + +# 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..6223c307d --- /dev/null +++ b/sw/qa/uitest/options/tdf78133.py @@ -0,0 +1,45 @@ +# -*- 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.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): + + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + #New text document + #open option, go to App colors + with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog: + + 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()) + #verify - reopen dialog and check if "text boundaries" is still unchecked + with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog: + + 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") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/sidebar/stylesSidebar.py b/sw/qa/uitest/sidebar/stylesSidebar.py new file mode 100644 index 000000000..1107f0bf5 --- /dev/null +++ b/sw/qa/uitest/sidebar/stylesSidebar.py @@ -0,0 +1,75 @@ +# -*- 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.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_by_text +from libreoffice.uno.propertyvalue import mkPropertyValues + +class StylesSidebar(UITestCase): + + def test_load_styles_from_template(self): + with self.ui_test.create_doc_in_start_center("writer"): + + with self.ui_test.execute_dialog_through_command(".uno:LoadStyles", close_button="") as xDialog: + xText = xDialog.getChild("text") + xNumbering = xDialog.getChild("numbering") + xFrame = xDialog.getChild("frame") + xPages = xDialog.getChild("pages") + + self.assertEqual('true', get_state_as_dict(xText)['Selected']) + self.assertEqual('false', get_state_as_dict(xNumbering)['Selected']) + self.assertEqual('false', get_state_as_dict(xFrame)['Selected']) + self.assertEqual('false', get_state_as_dict(xPages)['Selected']) + + xNumbering.executeAction("CLICK", tuple()) + xFrame.executeAction("CLICK", tuple()) + xPages.executeAction("CLICK", tuple()) + + self.assertEqual('true', get_state_as_dict(xText)['Selected']) + self.assertEqual('true', get_state_as_dict(xNumbering)['Selected']) + self.assertEqual('true', get_state_as_dict(xFrame)['Selected']) + self.assertEqual('true', get_state_as_dict(xPages)['Selected']) + + xFileName = xDialog.getChild("fromfile") + + with self.ui_test.execute_dialog_through_action(xFileName, 'CLICK', close_button="open") as dialog: + xFileName = dialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("customStyles.odt")})) + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + expectedResults = ["customParagraphStyle", "customCharacterStyle", "customFrameStyle", + "customPageStyle", "customNumberingStyle"] + + for i in range(5): + + self.xUITest.executeCommand(".uno:Sidebar") + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "StyleListPanel"})) + + xFilter = xWriterEdit.getChild('filter') + select_by_text(xFilter, "Custom Styles") + + xLeft = xWriterEdit.getChild('left') + + #change to another style type + xLeft.executeAction("CLICK", mkPropertyValues({"POS": str( i )})) + + xFlatView = xWriterEdit.getChild("flatview") + + self.assertEqual(1, len(xFlatView.getChildren())) + + xFlatView.getChild('0').executeAction("SELECT", tuple()) + self.assertEqual(expectedResults[i], get_state_as_dict(xFlatView)['SelectEntryText']) + + self.xUITest.executeCommand(".uno:Sidebar") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/sidebar/tdf133189.py b/sw/qa/uitest/sidebar/tdf133189.py new file mode 100644 index 000000000..9274de35e --- /dev/null +++ b/sw/qa/uitest/sidebar/tdf133189.py @@ -0,0 +1,75 @@ +# -*- 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.uihelper.common import get_state_as_dict, select_pos +from uitest.uihelper.common import change_measurement_unit +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf133189(UITestCase): + def test_tdf133189(self): + with 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_measurement_unit(self, 'Inch') + + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: + 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) + + + 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_measurement_unit(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") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/sidebar/tdf135590.py b/sw/qa/uitest/sidebar/tdf135590.py new file mode 100644 index 000000000..399d90bfa --- /dev/null +++ b/sw/qa/uitest/sidebar/tdf135590.py @@ -0,0 +1,74 @@ +# -*- 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.uihelper.common import get_state_as_dict, select_pos +from uitest.uihelper.common import change_measurement_unit +from uitest.uihelper.common import select_by_text +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf135590(UITestCase): + def test_tdf135590(self): + with self.ui_test.create_doc_in_start_center("writer"): + + #change measurement to Centimeter + change_measurement_unit(self, 'Centimeter') + + with self.ui_test.execute_dialog_through_command(".uno:InsertEnvelope") as xDialog: + + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + xWidth = xDialog.getChild('width') + xHeight = xDialog.getChild('height') + xFormat = xDialog.getChild("format") + + select_by_text(xFormat, "C6 Envelope") + + self.assertEqual("16.2", get_state_as_dict(xWidth)['Value']) + self.assertEqual("11.4", get_state_as_dict(xHeight)['Value']) + + + # A new document is created + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + xWidth = xDialog.getChild('spinWidth') + xHeight = xDialog.getChild('spinHeight') + xFormatList = xDialog.getChild("comboPageFormat") + + # Without the fix in place, this test would have failed with + # AssertionError: '16.2' != '11.4' + self.assertEqual("16.2", get_state_as_dict(xWidth)['Value']) + self.assertEqual("11.4", get_state_as_dict(xHeight)['Value']) + self.assertEqual("User", get_state_as_dict(xFormatList)['SelectEntryText']) + + + self.xUITest.executeCommand(".uno:Sidebar") + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "PageStylesPanel"})) + + xPaperSize = xWriterEdit.getChild('papersize') + self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User") + self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User") + + xPaperHeight = xWriterEdit.getChild('paperheight') + self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "11.40 cm") + self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "11.40 cm") + + xPaperWidth = xWriterEdit.getChild('paperwidth') + self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "16.20 cm") + self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "16.20 cm") + + self.xUITest.executeCommand(".uno:Sidebar") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/sidebar/tdf99711.py b/sw/qa/uitest/sidebar/tdf99711.py new file mode 100644 index 000000000..8e4343741 --- /dev/null +++ b/sw/qa/uitest/sidebar/tdf99711.py @@ -0,0 +1,39 @@ +# -*- 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.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import change_measurement_unit + +class tdf99711(UITestCase): + def test_tdf99711(self): + + with self.ui_test.load_file(get_url_for_data_file("shape.odt")) as writer_doc: + + #set measurement to millimeters + change_measurement_unit(self, "Millimeter") + + 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 + xChild = self.ui_test.wait_until_child_is_available('selectwidth') + self.assertEqual(get_state_as_dict(xChild)['Text'], '10.00 mm') + + xChild = self.ui_test.wait_until_child_is_available('selectheight') + self.assertEqual(get_state_as_dict(xChild)['Text'], '10.00 mm') + + self.xUITest.executeCommand(".uno:Sidebar") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/styleInspector/styleInspector.py b/sw/qa/uitest/styleInspector/styleInspector.py new file mode 100644 index 000000000..f5ce2cd6b --- /dev/null +++ b/sw/qa/uitest/styleInspector/styleInspector.py @@ -0,0 +1,357 @@ +# -*- 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.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues +from com.sun.star.rdf.URIs import RDF_TYPE, RDFS_COMMENT, RDFS_LABEL, ODF_PREFIX, ODF_SUFFIX, LO_EXT_SHADING + +class styleNavigator(UITestCase): + + def test_listbox_is_updated(self): + with self.ui_test.load_file(get_url_for_data_file("styles.odt")): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:Sidebar") + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "InspectorTextPanel"})) + + xListBox = xWriterEdit.getChild('listbox_fonts') + + # The cursor is on text without formatting and default style + self.assertEqual(1, len(xListBox.getChild('0').getChildren())) + self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text']) + self.assertEqual(140, len(xListBox.getChild('0').getChild('0').getChildren())) + self.assertEqual(0, len(xListBox.getChild('1').getChildren())) + self.assertEqual(0, len(xListBox.getChild('2').getChildren())) + self.assertEqual(0, len(xListBox.getChild('3').getChildren())) + + self.xUITest.executeCommand(".uno:GoDown") + + # The cursor is on text with direct formatting + self.assertEqual(1, len(xListBox.getChild('0').getChildren())) + self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text']) + self.assertEqual(140, len(xListBox.getChild('0').getChild('0').getChildren())) + self.assertEqual(0, len(xListBox.getChild('1').getChildren())) + self.assertEqual(0, len(xListBox.getChild('2').getChildren())) + + xDirFormatting = xListBox.getChild('3') + self.assertEqual(5, len(xDirFormatting.getChildren())) + self.assertEqual("Char Back Color\t0xffff00", get_state_as_dict(xDirFormatting.getChild('0'))['Text']) + self.assertEqual("Char Back Transparent\tFalse", get_state_as_dict(xDirFormatting.getChild('1'))['Text']) + self.assertEqual("Char Color\t0xc9211e", get_state_as_dict(xDirFormatting.getChild('2'))['Text']) + self.assertEqual("Char Shading Value\t0", get_state_as_dict(xDirFormatting.getChild('3'))['Text']) + self.assertEqual("Char Transparence\t0", get_state_as_dict(xDirFormatting.getChild('4'))['Text']) + + + self.xUITest.executeCommand(".uno:GoDown") + + # The cursor is on text with paragraph direct formatting + self.assertEqual(1, len(xListBox.getChild('0').getChildren())) + self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text']) + self.assertEqual(140, len(xListBox.getChild('0').getChild('0').getChildren())) + + xParDirFormatting = xListBox.getChild('1') + self.assertEqual(7, len(xParDirFormatting.getChildren())) + self.assertEqual("Fill Color\t0xff0000", get_state_as_dict(xParDirFormatting.getChild('0'))['Text']) + self.assertEqual("Para Back Color\t0xff0000", get_state_as_dict(xParDirFormatting.getChild('1'))['Text']) + self.assertEqual("Para Back Transparent\tFalse", get_state_as_dict(xParDirFormatting.getChild('2'))['Text']) + self.assertEqual("Para First Line Indent\t0", get_state_as_dict(xParDirFormatting.getChild('3'))['Text']) + self.assertEqual("Para is Auto First Line Indent\tFalse", get_state_as_dict(xParDirFormatting.getChild('4'))['Text']) + self.assertEqual("Para Left Margin\t1482", get_state_as_dict(xParDirFormatting.getChild('5'))['Text']) + self.assertEqual("Para Right Margin\t0", get_state_as_dict(xParDirFormatting.getChild('6'))['Text']) + + self.assertEqual(0, len(xListBox.getChild('2').getChildren())) + self.assertEqual(0, len(xListBox.getChild('3').getChildren())) + + self.xUITest.executeCommand(".uno:GoDown") + + # The cursor is on text with 'Title' style + xParStyle = xListBox.getChild('0') + self.assertEqual(3, len(xParStyle.getChildren())) + self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xParStyle.getChild('0'))['Text']) + self.assertEqual(140, len(xParStyle.getChild('0').getChildren())) + self.assertEqual("Heading\t", get_state_as_dict(xParStyle.getChild('1'))['Text']) + self.assertEqual(28, len(xParStyle.getChild('1').getChildren())) + + xTitleStyle = xParStyle.getChild('2') + self.assertEqual("Title\t", get_state_as_dict(xTitleStyle)['Text']) + self.assertEqual(16, len(xTitleStyle.getChildren())) + self.assertEqual("Char Difference Height\t0", get_state_as_dict(xTitleStyle.getChild('0'))['Text']) + self.assertEqual("Char Difference Height Asian\t0", get_state_as_dict(xTitleStyle.getChild('1'))['Text']) + self.assertEqual("Char Difference Height Complex\t0", get_state_as_dict(xTitleStyle.getChild('2'))['Text']) + self.assertEqual("Char Height\t28", get_state_as_dict(xTitleStyle.getChild('3'))['Text']) + self.assertEqual("Char Height Asian\t28", get_state_as_dict(xTitleStyle.getChild('4'))['Text']) + self.assertEqual("Char Height Complex\t28", get_state_as_dict(xTitleStyle.getChild('5'))['Text']) + self.assertEqual("Char Property Height\t100", get_state_as_dict(xTitleStyle.getChild('6'))['Text']) + self.assertEqual("Char Property Height Asian\t100", get_state_as_dict(xTitleStyle.getChild('7'))['Text']) + self.assertEqual("Char Property Height Complex\t100", get_state_as_dict(xTitleStyle.getChild('8'))['Text']) + self.assertEqual("Char Weight\tBold", get_state_as_dict(xTitleStyle.getChild('9'))['Text']) + self.assertEqual("Char Weight Asian\tBold", get_state_as_dict(xTitleStyle.getChild('10'))['Text']) + self.assertEqual("Char Weight Complex\tBold", get_state_as_dict(xTitleStyle.getChild('11'))['Text']) + self.assertEqual("Follow Style\tText body", get_state_as_dict(xTitleStyle.getChild('12'))['Text']) + self.assertEqual("Para Adjust\t3", get_state_as_dict(xTitleStyle.getChild('13'))['Text']) + self.assertEqual("Para Expand Single Word\tFalse", get_state_as_dict(xTitleStyle.getChild('14'))['Text']) + self.assertEqual("Para Last Line Adjust\t0", get_state_as_dict(xTitleStyle.getChild('15'))['Text']) + + self.assertEqual(0, len(xListBox.getChild('1').getChildren())) + self.assertEqual(0, len(xListBox.getChild('2').getChildren())) + self.assertEqual(0, len(xListBox.getChild('3').getChildren())) + + self.xUITest.executeCommand(".uno:GoDown") + + # The cursor is on text with custom style + xParStyle = xListBox.getChild('0') + self.assertEqual(3, len(xParStyle.getChildren())) + self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xParStyle.getChild('0'))['Text']) + self.assertEqual(140, len(xParStyle.getChild('0').getChildren())) + self.assertEqual("Text Body\t", get_state_as_dict(xParStyle.getChild('1'))['Text']) + self.assertEqual(6, len(xParStyle.getChild('1').getChildren())) + + xCustomStyle = xParStyle.getChild('2') + self.assertEqual("Custom_Style\t", get_state_as_dict(xCustomStyle)['Text']) + self.assertEqual(7, len(xCustomStyle.getChildren())) + self.assertEqual("Char Color\t0xff5429", get_state_as_dict(xCustomStyle.getChild('0'))['Text']) + self.assertEqual("Char Difference Height\t0", get_state_as_dict(xCustomStyle.getChild('1'))['Text']) + self.assertEqual("Char Height\t20", get_state_as_dict(xCustomStyle.getChild('2'))['Text']) + self.assertEqual("Char Property Height\t100", get_state_as_dict(xCustomStyle.getChild('3'))['Text']) + self.assertEqual("Char Transparence\t0", get_state_as_dict(xCustomStyle.getChild('4'))['Text']) + self.assertEqual("Char Weight\tBold", get_state_as_dict(xCustomStyle.getChild('5'))['Text']) + self.assertEqual("Follow Style\tCustom_Style", get_state_as_dict(xCustomStyle.getChild('6'))['Text']) + + self.assertEqual(7, len(xListBox.getChild('0').getChild('2').getChildren())) + self.assertEqual(0, len(xListBox.getChild('1').getChildren())) + self.assertEqual(0, len(xListBox.getChild('2').getChildren())) + self.assertEqual(0, len(xListBox.getChild('3').getChildren())) + + self.xUITest.executeCommand(".uno:Sidebar") + + def test_metadata(self): + with self.ui_test.load_file(get_url_for_data_file("metadata.odt")): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:Sidebar") + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "InspectorTextPanel"})) + + xListBox = xWriterEdit.getChild('listbox_fonts') + + # The cursor is on text without metadata + self.assertEqual(1, len(xListBox.getChild('0').getChildren())) + self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text']) + self.assertEqual(140, len(xListBox.getChild('0').getChild('0').getChildren())) + self.assertEqual(0, len(xListBox.getChild('1').getChildren())) + self.assertEqual(0, len(xListBox.getChild('2').getChildren())) + self.assertEqual(0, len(xListBox.getChild('3').getChildren())) + + self.xUITest.executeCommand(".uno:GoDown") + + # The cursor is on text with paragraph metadata showed under direct paragraph formatting + self.assertEqual(1, len(xListBox.getChild('0').getChildren())) + self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text']) + self.assertEqual(140, len(xListBox.getChild('0').getChild('0').getChildren())) + + xParDirFormatting = xListBox.getChild('1') + self.assertEqual(1, len(xParDirFormatting.getChildren())) + self.assertEqual("Metadata Reference\t", get_state_as_dict(xParDirFormatting.getChild('0'))['Text']) + + xMetadata = xParDirFormatting.getChild('0') + self.assertEqual(4, len(xMetadata.getChildren())) + self.assertEqual("xml:id\tpara1", get_state_as_dict(xMetadata.getChild('0'))['Text']) + self.assertEqual("http://www.w3.org/1999/02/22-rdf-syntax-ns#type\tParagraph", get_state_as_dict(xMetadata.getChild('1'))['Text']) + self.assertEqual("http://www.w3.org/2000/01/rdf-schema#comment\tAbout this paragraph...", get_state_as_dict(xMetadata.getChild('2'))['Text']) + self.assertEqual("http://www.w3.org/2000/01/rdf-schema#label\tAnnotated paragraph", get_state_as_dict(xMetadata.getChild('3'))['Text']) + + self.xUITest.executeCommand(".uno:GoDown") + # FIXME jump over the control character (not visible in getString(), but it affects + # cursor position and availability of NestedTextContent) + self.xUITest.executeCommand(".uno:GoRight") + + # The cursor is on text with annotated text range + xDirFormatting = xListBox.getChild('0') + self.assertEqual("Fields\t", get_state_as_dict(xListBox.getChild('0'))['Text']) + self.assertEqual(1, len(xDirFormatting.getChildren())) + self.assertEqual("Metadata Reference\t", get_state_as_dict(xDirFormatting.getChild('0'))['Text']) + + xMetadata = xDirFormatting.getChild('0') + self.assertEqual(4, len(xMetadata.getChildren())) + self.assertEqual("xml:id\tid2758386667", get_state_as_dict(xMetadata.getChild('0'))['Text']) + self.assertEqual("http://www.w3.org/1999/02/22-rdf-syntax-ns#type\tText span", get_state_as_dict(xMetadata.getChild('1'))['Text']) + self.assertEqual("http://www.w3.org/2000/01/rdf-schema#comment\tComment...", get_state_as_dict(xMetadata.getChild('2'))['Text']) + self.assertEqual("http://www.w3.org/2000/01/rdf-schema#label\tAnnotated paragraph portion", get_state_as_dict(xMetadata.getChild('3'))['Text']) + + xDirFormatting = xListBox.getChild('4') + self.assertEqual(1, len(xDirFormatting.getChildren())) + self.assertEqual("Nested Text Content\tAnnotated text range", get_state_as_dict(xDirFormatting.getChild('0'))['Text']) + + self.assertEqual(0, len(xListBox.getChild('2').getChildren())) + self.assertEqual(0, len(xListBox.getChild('3').getChildren())) + + self.xUITest.executeCommand(".uno:Sidebar") + + def test_bookmark_metadata(self): + with self.ui_test.load_file(get_url_for_data_file("bookmark-metadata.odt")): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:Sidebar") + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "InspectorTextPanel"})) + + xListBox = xWriterEdit.getChild('listbox_fonts') + + # The cursor is on text without metadata + self.assertEqual(1, len(xListBox.getChild('0').getChildren())) + self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text']) + self.assertEqual(140, len(xListBox.getChild('0').getChild('0').getChildren())) + self.assertEqual(0, len(xListBox.getChild('1').getChildren())) + self.assertEqual(0, len(xListBox.getChild('2').getChildren())) + self.assertEqual(0, len(xListBox.getChild('3').getChildren())) + + self.xUITest.executeCommand(".uno:GoDown") + + # The cursor is on text with paragraph metadata showed under direct paragraph formatting + self.assertEqual(1, len(xListBox.getChild('1').getChildren())) + self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('1').getChild('0'))['Text']) + self.assertEqual(140, len(xListBox.getChild('1').getChild('0').getChildren())) + + # Outer bookmark + xBookmarkFormatting = xListBox.getChild('0') + self.assertEqual("Bookmarks\t", get_state_as_dict(xBookmarkFormatting)['Text']) + self.assertEqual(1, len(xBookmarkFormatting.getChildren())) + self.assertEqual("Bookmark 1\t", get_state_as_dict(xBookmarkFormatting.getChild('0'))['Text']) + + self.xUITest.executeCommand(".uno:GoDown") + + # Inner bookmark + xBookmarkFormatting = xListBox.getChild('0') + self.assertEqual(2, len(xBookmarkFormatting.getChildren())) + + self.assertEqual("Bookmark 1\t", get_state_as_dict(xBookmarkFormatting.getChild('0'))['Text']) + xMetadata = xBookmarkFormatting.getChild('0').getChild('0') + self.assertEqual(2, len(xMetadata.getChildren())) + self.assertEqual("xml:id\tID-566430c5-9857-4ff2-be6d-57d127368d88", get_state_as_dict(xMetadata.getChild('0'))['Text']) + self.assertEqual("http://www.w3.org/1999/02/22-rdf-syntax-ns#type\tBookmark", get_state_as_dict(xMetadata.getChild('1'))['Text']) + + self.assertEqual("Bookmark 2\t", get_state_as_dict(xBookmarkFormatting.getChild('1'))['Text']) + xMetadata = xBookmarkFormatting.getChild('1').getChild('0') + self.assertEqual(2, len(xMetadata.getChildren())) + self.assertEqual("xml:id\tID-941142c3-924d-4884-a521-cb6a2dd26f04", get_state_as_dict(xMetadata.getChild('0'))['Text']) + self.assertEqual("http://www.w3.org/1999/02/22-rdf-syntax-ns#type\tBookmark", get_state_as_dict(xMetadata.getChild('1'))['Text']) + + # Only in outer bookmark again + self.xUITest.executeCommand(".uno:GoDown") + xBookmarkFormatting = xListBox.getChild('0') + self.assertEqual(1, len(xBookmarkFormatting.getChildren())) + self.assertEqual("Bookmark 1\t", get_state_as_dict(xBookmarkFormatting.getChild('0'))['Text']) + + self.xUITest.executeCommand(".uno:Sidebar") + + def test_metadata_shading_color(self): + with self.ui_test.load_file(get_url_for_data_file("metacolor.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:Sidebar") + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "InspectorTextPanel"})) + + xListBox = xWriterEdit.getChild('listbox_fonts') + + # The cursor is on text without metadata + self.assertEqual(1, len(xListBox.getChild('0').getChildren())) + self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text']) + self.assertEqual(140, len(xListBox.getChild('0').getChild('0').getChildren())) + self.assertEqual(0, len(xListBox.getChild('1').getChildren())) + self.assertEqual(0, len(xListBox.getChild('2').getChildren())) + + # go to next word with RDF annotation + self.xUITest.executeCommand(".uno:GoToNextWord") + self.xUITest.executeCommand(".uno:GoRight") + + # FIXME jump over the control character (not visible in getString(), but it affects + # cursor position and availability of NestedTextContent) + self.xUITest.executeCommand(".uno:GoRight") + + # The cursor is on text with annotated text range + xDirFormatting = xListBox.getChild('0') + self.assertEqual(1, len(xDirFormatting.getChildren())) + self.assertEqual("Metadata Reference\t", get_state_as_dict(xDirFormatting.getChild('0'))['Text']) + self.assertEqual("Nested Text Content\tipsum", get_state_as_dict(xListBox.getChild(4).getChild('0'))['Text']) + + xMetadata = xDirFormatting.getChild('0') + self.assertEqual(2, len(xMetadata.getChildren())) + self.assertEqual("xml:id\tID-f1a8a096-7a43-4bda-a462-d73c2800dd9a", get_state_as_dict(xMetadata.getChild('0'))['Text']) + # RGB code of the custom shading color of the annotated text range is FFB7E9 + self.assertEqual("urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0odf#shading\tFFB7E9", get_state_as_dict(xMetadata.getChild('1'))['Text']) + + self.assertEqual(0, len(xListBox.getChild('2').getChildren())) + self.assertEqual(0, len(xListBox.getChild('3').getChildren())) + + # go to next word with RDF annotation + self.xUITest.executeCommand(".uno:GoToNextWord") + self.xUITest.executeCommand(".uno:GoToNextWord") + self.xUITest.executeCommand(".uno:GoToNextWord") + self.xUITest.executeCommand(".uno:GoRight") + + # The cursor is on text with annotated text range + xDirFormatting = xListBox.getChild('0') + self.assertEqual(1, len(xDirFormatting.getChildren())) + self.assertEqual("Metadata Reference\t", get_state_as_dict(xDirFormatting.getChild('0'))['Text']) + self.assertEqual("Nested Text Content\tames", get_state_as_dict(xListBox.getChild(4).getChild('0'))['Text']) + + xMetadata = xDirFormatting.getChild('0') + self.assertEqual(2, len(xMetadata.getChildren())) + self.assertEqual("xml:id\tID-24478193-9630-4d03-8976-9e097c843a0b", get_state_as_dict(xMetadata.getChild('0'))['Text']) + # RGB code of the custom shading color of the annotated text range is 97E1E9 (the code can be lower case, see STRtoRGB) + self.assertEqual("urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0odf#shading\t97e1e9", get_state_as_dict(xMetadata.getChild('1'))['Text']) + + self.assertEqual(0, len(xListBox.getChild('2').getChildren())) + self.assertEqual(0, len(xListBox.getChild('3').getChildren())) + + # add a new annotated text range and check it in the Style Inspector + self.xUITest.executeCommand(".uno:GoToStartOfDoc") + + # create annotated text range on "Lorem" + viewCursor = writer_doc.CurrentController.getViewCursor() + viewCursor.goRight(5, True) + rdf = writer_doc.createInstance("com.sun.star.text.InContentMetadata") + writer_doc.Text.insertTextContent(viewCursor, rdf, True) + + # set its custom shading color using the new URI const LO_EXT_SHADING + repository = writer_doc.getRDFRepository() + # get metadata graph of file "custom.rdf" stored in the test document + xCustomGraph = [repository.getGraph(i) for i in repository.getGraphNames() if i.LocalName == "custom.rdf"] + self.assertEqual(1, len(xCustomGraph)) + + smgr = self.xContext.ServiceManager + xShadingURI = smgr.createInstance('com.sun.star.rdf.URI') + xShadingURI.initialize((LO_EXT_SHADING,)) + xShadingColor = smgr.createInstance('com.sun.star.rdf.Literal') + xShadingColor.initialize(('BBFF88',)) + xCustomGraph[0].addStatement(rdf, xShadingURI, xShadingColor) + + # remove the selection + self.xUITest.executeCommand(".uno:GoLeft") + + # FIXME: neither LO_EXT_SHADING, nor odf:prefix/odf:suffix changes update the View, + # so add a temporary bookmark to the text range to trigger the color change immediately + with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="insert"): + pass + + self.xUITest.executeCommand(".uno:Undo") + + xDirFormatting = xListBox.getChild('0') + xMetadata = xDirFormatting.getChild('0') + self.assertEqual(2, len(xMetadata.getChildren())) + # RGB code of the custom shading color of the annotated text range is BBFF88 + self.assertEqual("urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0odf#shading\tBBFF88", get_state_as_dict(xMetadata.getChild('1'))['Text']) + + self.xUITest.executeCommand(".uno:Sidebar") + + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/styleInspector/tdf137105.py b/sw/qa/uitest/styleInspector/tdf137105.py new file mode 100644 index 000000000..bfb8dc779 --- /dev/null +++ b/sw/qa/uitest/styleInspector/tdf137105.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, get_url_for_data_file + +class tdf137105(UITestCase): + + def test_tdf137105(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + 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]) + + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:Sidebar") + # Without the fix in place, this test would have crashed here + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "InspectorTextPanel"})) + + # if the image is selected, there is nothing in the panel + self.assertEqual('0', get_state_as_dict(xWriterEdit.getChild('listbox_fonts'))['Children']) + + self.xUITest.executeCommand(".uno:Sidebar") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/styleInspector/tdf137513.py b/sw/qa/uitest/styleInspector/tdf137513.py new file mode 100644 index 000000000..a0c9ddaaf --- /dev/null +++ b/sw/qa/uitest/styleInspector/tdf137513.py @@ -0,0 +1,62 @@ +# -*- 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, type_text + +class tdf137513(UITestCase): + + def test_tdf137513(self): + with self.ui_test.create_doc_in_start_center("writer"): + + self.xUITest.executeCommand(".uno:InsertTable?Columns:short=2&Rows:short=2") + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + type_text(xWriterEdit, "test") + + self.xUITest.executeCommand(".uno:SelectAll") + + self.xUITest.executeCommand(".uno:Bold") + + self.xUITest.executeCommand(".uno:Sidebar") + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "InspectorTextPanel"})) + + xListBox = xWriterEdit.getChild('listbox_fonts') + + # The cursor is on text inside the table with direct formatting + self.assertEqual(2, len(xListBox.getChild('0').getChildren())) + self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text']) + self.assertEqual("Table Contents\t", get_state_as_dict(xListBox.getChild('0').getChild('1'))['Text']) + self.assertEqual(140, len(xListBox.getChild('0').getChild('0').getChildren())) + + xTableContent = xListBox.getChild('0').getChild('1') + self.assertEqual(5, len(xTableContent.getChildren())) + self.assertEqual("Follow Style\tTable Contents", get_state_as_dict(xTableContent.getChild('0'))['Text']) + self.assertEqual("Para Line Number Count\tFalse", get_state_as_dict(xTableContent.getChild('1'))['Text']) + self.assertEqual("Para Line Number Start Value\t0", get_state_as_dict(xTableContent.getChild('2'))['Text']) + self.assertEqual("Para Orphans\t0", get_state_as_dict(xTableContent.getChild('3'))['Text']) + self.assertEqual("Para Widows\t0", get_state_as_dict(xTableContent.getChild('4'))['Text']) + + xParDirFormatting = xListBox.getChild('1') + + # Without the fix in place, this test would have failed here with + # AssertionError: 3 != 0 + self.assertEqual(3, len(xParDirFormatting.getChildren())) + self.assertEqual("Char Weight\tBold", get_state_as_dict(xParDirFormatting.getChild('0'))['Text']) + self.assertEqual("Char Weight Asian\tBold", get_state_as_dict(xParDirFormatting.getChild('1'))['Text']) + self.assertEqual("Char Weight Complex\tBold", get_state_as_dict(xParDirFormatting.getChild('2'))['Text']) + self.assertEqual(0, len(xListBox.getChild('2').getChildren())) + self.assertEqual(0, len(xListBox.getChild('3').getChildren())) + + self.xUITest.executeCommand(".uno:Sidebar") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/insertTableDialog.py b/sw/qa/uitest/table/insertTableDialog.py new file mode 100644 index 000000000..727334c31 --- /dev/null +++ b/sw/qa/uitest/table/insertTableDialog.py @@ -0,0 +1,63 @@ +# -*- 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 + +class WriterInsertTableDialog(UITestCase): + + def insertTextIntoCell(self, table, cellName, text ): + tableText = table.getCellByName( cellName ) + tableText.setString( text ) + + def test_tdf104158(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + + with self.ui_test.execute_dialog_through_command(".uno:InsertTable") as xDialog: + + xNameEdit = xDialog.getChild("nameedit") + + xNameEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xNameEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Test3"})) + + xColSpin = xDialog.getChild("colspin") + xColSpin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xColSpin.executeAction("TYPE", mkPropertyValues({"TEXT": "2"})) + + xRowSpin = xDialog.getChild("rowspin") + xRowSpin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xRowSpin.executeAction("TYPE", mkPropertyValues({"TEXT": "2"})) + + self.assertEqual(get_state_as_dict(xNameEdit)["Text"], "Test3") + self.assertEqual(get_state_as_dict(xColSpin)["Text"], "2") + self.assertEqual(get_state_as_dict(xRowSpin)["Text"], "2") + + + tables = document.getTextTables() + + self.assertEqual(tables[0].getName(), "Test3") + self.assertEqual(len(tables[0].getRows()), 2) + self.assertEqual(len(tables[0].getColumns()), 2) + + with self.ui_test.execute_dialog_through_command(".uno:TableNumberFormatDialog"): + pass + + + def test_cancel_button_insert_table_dialog(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + with self.ui_test.execute_dialog_through_command(".uno:InsertTable", close_button="cancel"): + pass + + tables = document.getTextTables() + self.assertEqual(len(tables), 0) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/sheetToTable.py b/sw/qa/uitest/table/sheetToTable.py new file mode 100644 index 000000000..e90f65e9f --- /dev/null +++ b/sw/qa/uitest/table/sheetToTable.py @@ -0,0 +1,123 @@ +# -*- 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_url_for_data_file +from uitest.uihelper.calc import enter_text_to_cell + +#Calc sheet to Writer table + +class sheetToTable(UITestCase): + def test_sheet_to_table_without_hidden_rows(self): + with self.ui_test.load_file(get_url_for_data_file("hiddenRow.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:Copy") + + with self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + self.xUITest.executeCommand(".uno:Paste") + #verify (don't copy hidden cells) + self.assertEqual(writer_doc.TextTables.getCount(), 1) + table = writer_doc.getTextTables()[0] + # This was 3 (copied hidden row) + self.assertEqual(len(table.getRows()), 2) + self.assertEqual(table.getCellByName("A1").getString(), "1") + # This was "2 (hidden)" (copied hidden row) + self.assertEqual(table.getCellByName("A2").getString(), "3") + + def test_tdf138688(self): + with self.ui_test.load_file(get_url_for_data_file("hiddenRow.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:Copy") + + with self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + + # set numbering in the paragraph after the table + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:DefaultNumbering") + self.xUITest.executeCommand(".uno:GoUp") + self.xUITest.executeCommand(".uno:GoUp") + + #verify (this was a freezing/crash) + self.xUITest.executeCommand(".uno:Paste") + + #verify also tdf#124646 (don't copy hidden cells) + self.assertEqual(writer_doc.TextTables.getCount(), 1) + table = writer_doc.getTextTables()[0] + # This was 3 (copied hidden row) + self.assertEqual(len(table.getRows()), 2) + self.assertEqual(table.getCellByName("A1").getString(), "1") + # This was "2 (hidden)" (copied hidden row) + self.assertEqual(table.getCellByName("A2").getString(), "3") + + def test_tdf129083(self): + with self.ui_test.create_doc_in_start_center("calc"): + + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "Test 1") + enter_text_to_cell(gridwin, "A2", "Test 2") + enter_text_to_cell(gridwin, "A3", "Test 3") + enter_text_to_cell(gridwin, "A4", "Test 4") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + + self.xUITest.executeCommand(".uno:Copy") + + + with self.ui_test.load_empty_file("writer") as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.xUITest.executeCommand(".uno:InsertTable?Columns:short=1&Rows:short=4") + + self.xUITest.executeCommand(".uno:Paste") + + self.assertEqual(writer_doc.TextTables.getCount(), 1) + table = writer_doc.getTextTables()[0] + self.assertEqual(len(table.getRows()), 4) + self.assertEqual(table.getCellByName("A1").getString(), "Test 1") + self.assertEqual(table.getCellByName("A2").getString(), "Test 2") + self.assertEqual(table.getCellByName("A3").getString(), "Test 3") + self.assertEqual(table.getCellByName("A4").getString(), "Test 4") + + def test_tdf116685(self): + with self.ui_test.create_doc_in_start_center("calc"): + + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "Test 1") + enter_text_to_cell(gridwin, "A2", "Test 2") + enter_text_to_cell(gridwin, "A3", "Test 3") + enter_text_to_cell(gridwin, "A4", "Test 4") + + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:Copy") + + with self.ui_test.load_empty_file("writer") as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.xUITest.executeCommand(".uno:Paste") + + # Without the fix in place, this test would have failed with + # AssertionError: 0 != 1 + self.assertEqual(writer_doc.TextTables.getCount(), 1) + table = writer_doc.getTextTables()[0] + self.assertEqual(len(table.getRows()), 4) + self.assertEqual(table.getCellByName("A1").getString(), "Test 1") + self.assertEqual(table.getCellByName("A2").getString(), "Test 2") + self.assertEqual(table.getCellByName("A3").getString(), "Test 3") + self.assertEqual(table.getCellByName("A4").getString(), "Test 4") + +# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file diff --git a/sw/qa/uitest/table/splitTable.py b/sw/qa/uitest/table/splitTable.py new file mode 100644 index 000000000..033c140bb --- /dev/null +++ b/sw/qa/uitest/table/splitTable.py @@ -0,0 +1,70 @@ +# -*- 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.uihelper.common import get_url_for_data_file + +#Writer Split Table + +class splitTable(UITestCase): + def test_split_table(self): + with self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) as writer_doc: + 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 + with self.ui_test.execute_dialog_through_command(".uno:SplitTable") as xDialog: + + copyheading = xDialog.getChild("copyheading") + copyheading.executeAction("CLICK", tuple()) + self.assertEqual(writer_doc.TextTables.getCount(), 2) + tables = writer_doc.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(writer_doc.TextTables.getCount(), 1) + + #dialog Split table, check Custom heading, OK -> verify 2 tables, 1st has 2 rows, second has 4 rows + with self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + #go to row 2 + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoDown") + with self.ui_test.execute_dialog_through_command(".uno:SplitTable") as xDialog: + + customheading = xDialog.getChild("customheading") + customheading.executeAction("CLICK", tuple()) + self.assertEqual(writer_doc.TextTables.getCount(), 2) + tables = writer_doc.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(writer_doc.TextTables.getCount(), 1) + + #dialog Split table, check No heading, OK -> verify 2 tables, 1st has 2 rows, second has 4 rows + with self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + #go to row 2 + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoDown") + with self.ui_test.execute_dialog_through_command(".uno:SplitTable") as xDialog: + + noheading = xDialog.getChild("noheading") + noheading.executeAction("CLICK", tuple()) + self.assertEqual(writer_doc.TextTables.getCount(), 2) + tables = writer_doc.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(writer_doc.TextTables.getCount(), 1) + +# 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..c0edf484f --- /dev/null +++ b/sw/qa/uitest/table/tableProperties.py @@ -0,0 +1,195 @@ +# -*- 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.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import change_measurement_unit + +#Writer Table Properties + +class tableProperties(UITestCase): + def test_table_properties(self): + with self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + + change_measurement_unit(self, "Centimeter") + + #dialog Table Properties - Table + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + 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"})) + select_by_text(textdirection, "Left-to-right (LTR)") + #verify + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + 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") + + #dialog Table Properties - Text flow + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + 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") + select_by_text(textdirection, "Vertical (bottom to top)") + vertorient = xDialog.getChild("vertorient") + select_by_text(vertorient, "Bottom") + #verify + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + 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") + + #dialog Table Properties - Columns + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "2") + + adaptwidth = xDialog.getChild("adaptwidth") + adaptwidth.executeAction("CLICK", tuple()) + + #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 + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "3") + + sync = xDialog.getChild("sync") + mergeadjacent = xDialog.getChild("mergeadjacent") + sync.executeAction("CLICK", tuple()) + mergeadjacent.executeAction("CLICK", tuple()) + + #verify + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + 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") + + #dialog Table Properties - Background + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + 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... + + #verify + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + 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") + +# 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..87e116bef --- /dev/null +++ b/sw/qa/uitest/table/tableToText.py @@ -0,0 +1,67 @@ +# -*- 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_url_for_data_file + +#Writer Table to text + +class tableToText(UITestCase): + def test_table_to_text(self): + with self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + #dialog Table to text - Tabs; verify + with self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText") as xDialog: + tabs = xDialog.getChild("tabs") + tabs.executeAction("CLICK", tuple()) + #verify + self.assertEqual(writer_doc.Text.String[0:3], "a\ta") + self.assertEqual(writer_doc.TextTables.getCount(), 0) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(writer_doc.TextTables.getCount(), 1) + + #dialog Table to text - Paragraph; verify + with self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText") as xDialog: + paragraph = xDialog.getChild("paragraph") + paragraph.executeAction("CLICK", tuple()) + #verify + self.assertEqual(writer_doc.Text.String.replace('\r\n', '\n')[0:4], "a\na\n") + self.assertEqual(writer_doc.TextTables.getCount(), 0) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(writer_doc.TextTables.getCount(), 1) + + #dialog Table to text - Semicolons; verify + with self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText") as xDialog: + semicolons = xDialog.getChild("semicolons") + semicolons.executeAction("CLICK", tuple()) + #verify + self.assertEqual(writer_doc.Text.String.replace('\r\n', '\n')[0:6], "a;a\n;\n") + self.assertEqual(writer_doc.TextTables.getCount(), 0) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(writer_doc.TextTables.getCount(), 1) + + #dialog Table to text - other; verify + with self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText") as xDialog: + 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":":"})) + #verify + self.assertEqual(writer_doc.Text.String.replace('\r\n', '\n')[0:6], "a:a\n:\n") + self.assertEqual(writer_doc.TextTables.getCount(), 0) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(writer_doc.TextTables.getCount(), 1) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tdf109083.py b/sw/qa/uitest/table/tdf109083.py new file mode 100644 index 000000000..d369ee8a5 --- /dev/null +++ b/sw/qa/uitest/table/tdf109083.py @@ -0,0 +1,62 @@ +# -*- 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.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import select_pos + +#Bug 109083 - Updating table style: changes didn't propagate to other tables when selection was over two columns at the moment of updating +class tdf109083(UITestCase): + def test_tdf109083(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + #generate two 2x2 tables with the same autoformat table style (Default Table Style) + #Note that this style is different than applying nothing! + for i in range(0, 2): + with self.ui_test.execute_dialog_through_command(".uno:InsertTable") as xDialog: + formatlbinstable = xDialog.getChild("formatlbinstable") + entry = formatlbinstable.getChild("1") + entry.executeAction("SELECT", tuple()) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + #select the last row of the first table + for i in range (0,2): + self.xUITest.executeCommand(".uno:GoDown") + for i in range (0,2): + self.xUITest.executeCommand(".uno:CharRightSel") + #set a specific color on the selected cells (last row) + self.xUITest.executeCommandWithParameters(".uno:TableCellBackgroundColor", mkPropertyValues({"TableCellBackgroundColor" : 16776960 })) + + #Sidebar -> Table Styles -> Style Actions -> "Update Selected Style" (note: the row is still selected) + self.xUITest.executeCommand(".uno:Sidebar") + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "StyleListPanel"})) + xLeft = xWriterEdit.getChild('left') + xLeft.executeAction("CLICK", mkPropertyValues({"POS": "5"})) + xRight = xWriterEdit.getChild('right') + xRight.executeAction("CLICK", mkPropertyValues({"POS": "3"})) + #select the second table + for i in range (0,2): + self.xUITest.executeCommand(".uno:GoDown") + + #first row's cells must be yellow, second/last row's cells must be updated to yellow by now + for i in range (0,4): + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") #tab Background + btncolor = xDialog.getChild("btncolor") + btncolor.executeAction("CLICK", tuple()) + hex_custom = xDialog.getChild("hex_custom") + if i >= 2: + self.assertEqual(get_state_as_dict(hex_custom)["Text"], "ffff00") + else: + self.assertEqual(get_state_as_dict(hex_custom)["Text"], "ffffff") + self.xUITest.executeCommand(".uno:GoRight") + +# 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..3b372f643 --- /dev/null +++ b/sw/qa/uitest/table/tdf115026.py @@ -0,0 +1,31 @@ +# -*- 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.uihelper.common import get_state_as_dict + +class tdf115026(UITestCase): + + def test_pageBreak_and_tableAutoFormat(self): + with 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") + + with self.ui_test.execute_dialog_through_command(".uno:InsertTable"): + pass + + with self.ui_test.execute_dialog_through_command(".uno:AutoFormat"): + pass + + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tdf115572.py b/sw/qa/uitest/table/tdf115572.py new file mode 100644 index 000000000..ebd42ab0e --- /dev/null +++ b/sw/qa/uitest/table/tdf115572.py @@ -0,0 +1,66 @@ +# -*- 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.uihelper.common import get_state_as_dict +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): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + #insert table 2x2 + with self.ui_test.execute_dialog_through_command(".uno:InsertTable"): + pass + #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 + with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xweststylelbcjk = xDialog.getChild("cbWestStyle") + self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold") + + + def test_tdf115572_table_format_gets_reset_deleting_column(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + #insert table 2x2 + with self.ui_test.execute_dialog_through_command(".uno:InsertTable"): + pass + #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 + with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xweststylelbcjk = xDialog.getChild("cbWestStyle") + self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tdf115573.py b/sw/qa/uitest/table/tdf115573.py new file mode 100644 index 000000000..2b2ae0a8a --- /dev/null +++ b/sw/qa/uitest/table/tdf115573.py @@ -0,0 +1,109 @@ +# -*- 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.uihelper.common import get_state_as_dict +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): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + #insert table 2x2 + with self.ui_test.execute_dialog_through_command(".uno:InsertTable"): + pass + #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 + with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xweststylelbcjk = xDialog.getChild("cbWestStyle") + self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold") + + + def test_tdf115573_Table_loses_formatting_inserting_row_after(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + #insert table 2x2 + with self.ui_test.execute_dialog_through_command(".uno:InsertTable"): + pass + #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 + with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xweststylelbcjk = xDialog.getChild("cbWestStyle") + self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold") + + + def test_tdf115573_Table_loses_formatting_inserting_column_left(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + #insert table 2x2 + with self.ui_test.execute_dialog_through_command(".uno:InsertTable"): + pass + #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 + with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xweststylelbcjk = xDialog.getChild("cbWestStyle") + self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold") + + + def test_tdf115573_Table_loses_formatting_inserting_column_right(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + #insert table 2x2 + with self.ui_test.execute_dialog_through_command(".uno:InsertTable"): + pass + #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 + with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xweststylelbcjk = xDialog.getChild("cbWestStyle") + self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold") + +# 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..0e6c1b216 --- /dev/null +++ b/sw/qa/uitest/table/tdf116737.py @@ -0,0 +1,46 @@ +# -*- 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.uihelper.common import get_state_as_dict +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): + + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + + #Insert => Insert Table / It's not possible to select a table style + with self.ui_test.execute_dialog_through_command(".uno:InsertTable") as xDialog: + + formatlbinstable = xDialog.getChild("formatlbinstable") + entry = formatlbinstable.getChild("11") #Simple List Shaded + entry.executeAction("SELECT", tuple()) + + + #verify .uno:TableDialog + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + 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") + + +# 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..19158f6e4 --- /dev/null +++ b/sw/qa/uitest/table/tdf128593.py @@ -0,0 +1,39 @@ +# -*- 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, select_pos + +#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): + with self.ui_test.create_doc_in_start_center("writer"): + MainWindow = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:InsertTable"): + pass + + self.xUITest.executeCommandWithParameters(".uno:TableCellBackgroundColor", mkPropertyValues({"TableCellBackgroundColor" : 16776960 }) ) + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as TablePropertiesDialog: + writer_edit = MainWindow.getChild("writer_edit") + writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "0", "START_POS": "0"})) + tabcontrol = TablePropertiesDialog.getChild("tabcontrol") + select_pos(tabcontrol, "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") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tdf134881_colProportionalAdjust.py b/sw/qa/uitest/table/tdf134881_colProportionalAdjust.py new file mode 100644 index 000000000..74bb5d40f --- /dev/null +++ b/sw/qa/uitest/table/tdf134881_colProportionalAdjust.py @@ -0,0 +1,47 @@ +# -*- 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.uihelper.common import select_pos +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import change_measurement_unit +from libreoffice.uno.propertyvalue import mkPropertyValues + +#Writer Table Properties + +class tdf134881(UITestCase): + def test_tdf134881(self): + with self.ui_test.load_file(get_url_for_data_file("tdf134881_colProportionalAdjust.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + + change_measurement_unit(self, "Centimeter") + + #dialog Table Properties + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "2") #columns + + adaptcolumns = xDialog.getChild("adaptcolumns") + width1 = xDialog.getChild("width1") + width2 = xDialog.getChild("width2") + # Get the baseline. The first column is much shorter than the second. + self.assertEqual((get_state_as_dict(width1)["Text"])[0:3], "3.0") + self.assertEqual((get_state_as_dict(width2)["Text"])[0:4], "14.0") + # Set proportional adjust - so all columns are affected. + adaptcolumns.executeAction("CLICK", tuple()) + # Cut the second column in half. + width2.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + width2.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + width2.executeAction("TYPE", mkPropertyValues({"TEXT":"7"})) + width2.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + + # The first column should now be half it's original value, not zero (not 3 - 7) + self.assertEqual((get_state_as_dict(width1)["Text"])[0:2], "1.") #1.5 + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tdf135693.py b/sw/qa/uitest/table/tdf135693.py new file mode 100644 index 000000000..90544a228 --- /dev/null +++ b/sw/qa/uitest/table/tdf135693.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 uitest.uihelper.common import select_pos +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +class tdf135693(UITestCase): + + def test_tdf135693(self): + with self.ui_test.load_file(get_url_for_data_file("tdf135693.odt")) as writer_doc: + + self.xUITest.getTopFocusWindow() + + self.xUITest.executeCommand(".uno:GoRight") + self.xUITest.executeCommand(".uno:GoDown") + + # Without the fix in place, this would have crashed here + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xTableDlg: + + + xTabs = xTableDlg.getChild("tabcontrol") + select_pos(xTabs, "0") + + # Check we are in the right table + self.assertEqual("Table1", get_state_as_dict(xTabs.getChild('name'))['Text']) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tdf140506.py b/sw/qa/uitest/table/tdf140506.py new file mode 100644 index 000000000..220f46bf6 --- /dev/null +++ b/sw/qa/uitest/table/tdf140506.py @@ -0,0 +1,51 @@ +# -*- 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.uihelper.common import select_pos +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf140506(UITestCase): + + def test_tdf140506(self): + with self.ui_test.load_file(get_url_for_data_file("tdf140506.odt")) as writer_doc: + + xMainWindow = self.xUITest.getTopFocusWindow() + xwriter_edit = xMainWindow.getChild("writer_edit") + + tables = writer_doc.getTextTables() + self.assertEqual(len(tables[0].getRows()), 20) + self.assertEqual(len(tables[0].getColumns()), 2) + + self.assertEqual(2, writer_doc.CurrentController.PageCount) + + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + headline = xDialog.getChild("headline") + repeatheader = xDialog.getChild("repeatheadernf") + self.assertEqual('false', get_state_as_dict(headline)["Selected"]) + headline.executeAction("CLICK", tuple()) + self.assertEqual('true', get_state_as_dict(headline)["Selected"]) + self.assertEqual('1', get_state_as_dict(repeatheader)["Value"]) + + + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.processEventsToIdle() + + self.assertEqual(len(tables[0].getRows()), 20) + self.assertEqual(len(tables[0].getColumns()), 2) + + # Without the fix in place, this test would have failed with + # AssertionError: 20 != 2 + self.assertEqual(20, writer_doc.CurrentController.PageCount) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tdf144843.py b/sw/qa/uitest/table/tdf144843.py new file mode 100644 index 000000000..1920cda02 --- /dev/null +++ b/sw/qa/uitest/table/tdf144843.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 + +class tdf144843(UITestCase): + + def test_tdf144843(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + + self.xUITest.executeCommand(".uno:InsertTable?Columns:short=2&Rows:short=2") + + self.xUITest.executeCommand(".uno:SelectAll") + + self.assertEqual(-1, document.TextTables[0].getCellByName("A1").BackColor) + + # Without the fix in place, this test would have crashed here + with self.ui_test.execute_dialog_through_command(".uno:BackgroundDialog") as xDialog: + btncolor = xDialog.getChild("btncolor") + btncolor.executeAction("CLICK", tuple()) + + hex_custom = xDialog.getChild("hex_custom") + hex_custom.executeAction("TYPE", mkPropertyValues({"TEXT":"101010"})) + + self.assertEqual("0x101010", hex(document.TextTables[0].getCellByName("A1").BackColor)) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tdf146145.py b/sw/qa/uitest/table/tdf146145.py new file mode 100644 index 000000000..357ce82a4 --- /dev/null +++ b/sw/qa/uitest/table/tdf146145.py @@ -0,0 +1,157 @@ +# -*- 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.uihelper.common import get_state_as_dict, get_url_for_data_file +import time + +from com.sun.star.accessibility.AccessibleStateType import ENABLED + +class tdf146145(UITestCase): + + # access to the private:resource changes toolbar via accessibility API + def is_enabled_Accept_Track_Change(self): + xFrame = self.document.getCurrentController().getFrame() + + for i in xFrame.getPropertyValue("LayoutManager").getElements(): + if i.getPropertyValue('ResourceURL') == 'private:resource/toolbar/changes': + return ENABLED in i.getRealInterface().getAccessibleContext().getAccessibleChild(5).getAccessibleStateSet().getStates() + + return False + + def test_tdf146145(self): + with self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as self.document: + + # Check enabling Accept/Reject Track Change icons + # and Accept Change/Reject Change context menu items + # on table rows with tracked deletion or insertion + + # enable Track Changes toolbar + self.xUITest.executeCommand(".uno:AvailableToolbars?Toolbar:string=changes") + + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.processEventsToIdle() + + # cursor at changed text: Accept Track Change is enabled + self.assertTrue(self.is_enabled_Accept_Track_Change()) + + # cursor in a changed row, but not at changed text: Accept Track Change is enabled now + self.xUITest.executeCommand(".uno:GoRight") + xToolkit.processEventsToIdle() + # This was false + self.assertTrue(self.is_enabled_Accept_Track_Change()) + + # cursor in a not changed row: Accept Track Change is disabled + self.xUITest.executeCommand(".uno:GoDown") + xToolkit.processEventsToIdle() + while self.is_enabled_Accept_Track_Change(): + time.sleep(0.1) + self.assertFalse(self.is_enabled_Accept_Track_Change()) + + # check the fix again to avoid of the asynchron state changes + self.xUITest.executeCommand(".uno:GoUp") + xToolkit.processEventsToIdle() + while not self.is_enabled_Accept_Track_Change(): + time.sleep(0.1) + self.assertTrue(self.is_enabled_Accept_Track_Change()) + + # check 1-click accept of table row deletion (3 redlines in the row) + + # not at changed text, but Accept Track Change removes the whole row now + + tables = self.document.getTextTables() + self.assertEqual(len(tables[0].getRows()), 4) + + self.xUITest.executeCommand(".uno:AcceptTrackedChange") + xToolkit.processEventsToIdle() + self.assertEqual(len(tables[0].getRows()), 3) + + self.xUITest.executeCommand(".uno:Undo") + xToolkit.processEventsToIdle() + self.assertEqual(len(tables[0].getRows()), 4) + + self.xUITest.executeCommand(".uno:Redo") + xToolkit.processEventsToIdle() + self.assertEqual(len(tables[0].getRows()), 3) + + self.xUITest.executeCommand(".uno:Undo") + xToolkit.processEventsToIdle() + self.assertEqual(len(tables[0].getRows()), 4) + + # check 1-click reject of table row insertion (3 redlines in the row) + + for i in range(3): + self.xUITest.executeCommand(".uno:GoDown") + + # not at changed text (the cursor is there at the end of the text of the table row), + # but Reject Track Change removes the whole row now + + tables = self.document.getTextTables() + self.assertEqual(len(tables[0].getRows()), 4) + + self.xUITest.executeCommand(".uno:RejectTrackedChange") + xToolkit.processEventsToIdle() + self.assertEqual(len(tables[0].getRows()), 3) + + self.xUITest.executeCommand(".uno:Undo") + xToolkit.processEventsToIdle() + self.assertEqual(len(tables[0].getRows()), 4) + + self.xUITest.executeCommand(".uno:Redo") + xToolkit.processEventsToIdle() + self.assertEqual(len(tables[0].getRows()), 3) + + def test_Related_tdf147182(self): + with self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as self.document: + + # Check enabling Accept/Reject Track Change icons + # and Accept Change/Reject Change context menu items + # on table rows with tracked deletion or insertion + + # enable Track Changes toolbar + self.xUITest.executeCommand(".uno:AvailableToolbars?Toolbar:string=changes") + + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.processEventsToIdle() + + # cursor at changed text: Accept Track Change is enabled + self.assertTrue(self.is_enabled_Accept_Track_Change()) + + # cursor in a changed row, but not at changed text: Accept Track Change is enabled now + self.xUITest.executeCommand(".uno:GoRight") + xToolkit.processEventsToIdle() + # This was false + self.assertTrue(self.is_enabled_Accept_Track_Change()) + + # delete first row + self.xUITest.executeCommand(".uno:AcceptTrackedChange") + xToolkit.processEventsToIdle() + # disabled Accept Track Change + while self.is_enabled_Accept_Track_Change(): + time.sleep(0.1) + self.assertFalse(self.is_enabled_Accept_Track_Change()) + + # delete first row + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:SelectAll") + xToolkit.processEventsToIdle() + # This was false + while not self.is_enabled_Accept_Track_Change(): + time.sleep(0.1) + self.assertTrue(self.is_enabled_Accept_Track_Change()) + + # delete all changes in the selected table + self.xUITest.executeCommand(".uno:AcceptTrackedChange") + xToolkit.processEventsToIdle() + while self.is_enabled_Accept_Track_Change(): + time.sleep(0.1) + # disabled Accept Track Change + self.assertFalse(self.is_enabled_Accept_Track_Change()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tdf51352.py b/sw/qa/uitest/table/tdf51352.py new file mode 100644 index 000000000..4a2fa79d5 --- /dev/null +++ b/sw/qa/uitest/table/tdf51352.py @@ -0,0 +1,46 @@ +# -*- 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 + +class tdf51352(UITestCase): + + def test_convert_nested_table_to_text_tdf51352(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + #1. New a text document + #2. Insert a table and then in one cell create another table + #-insert a table (by default 2x2) + with self.ui_test.execute_dialog_through_command(".uno:InsertTable"): + pass + #-put the cursor inside first cell top left for example + #-insert an inner table (by default 2x2) inside this cell + with self.ui_test.execute_dialog_through_command(".uno:InsertTable"): + pass + #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 + with self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText"): + pass + 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) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tdf53460.py b/sw/qa/uitest/table/tdf53460.py new file mode 100644 index 000000000..b0e8fcaba --- /dev/null +++ b/sw/qa/uitest/table/tdf53460.py @@ -0,0 +1,74 @@ +# -*- 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 + +class tdf53460(UITestCase): + + def test_resize_table_with_keyboard_tdf53460(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + #-insert a table (by default 2x2) + with self.ui_test.execute_dialog_through_command(".uno:InsertTable"): + pass + + #-put the cursor inside first cell top left for example + #-insert an inner table (by default 2x2) inside this cell + with self.ui_test.execute_dialog_through_command(".uno:InsertTable"): + pass + + #-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) +# 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..324be1d7f --- /dev/null +++ b/sw/qa/uitest/table/tdf81292.py @@ -0,0 +1,39 @@ +# -*- 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.uihelper.common import get_url_for_data_file + +#Bug 81292 - TABLE: Crashes on sorting table + +class tdf81292(UITestCase): + + def test_tdf81292_table_sort(self): + with self.ui_test.load_file(get_url_for_data_file("tdf81292.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + #select whole table + self.xUITest.executeCommand(".uno:SelectTable") + #Tools - Sort + with self.ui_test.execute_dialog_through_command(".uno:SortDialog") as xDialog: + xDown = xDialog.getChild("down1") + xDown.executeAction("CLICK", tuple()) + #verify + tables = writer_doc.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") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tdf93068.py b/sw/qa/uitest/table/tdf93068.py new file mode 100644 index 000000000..4dae8ae74 --- /dev/null +++ b/sw/qa/uitest/table/tdf93068.py @@ -0,0 +1,51 @@ +# -*- 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 + +class tdf93068(UITestCase): + + def test_tdf93068(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + + + self.xUITest.getTopFocusWindow() + + # tdf#135950: Character dialog crashes if multiple cells in a + # table are selected + with self.ui_test.execute_dialog_through_command(".uno:InsertTable"): + pass + + self.xUITest.executeCommand(".uno:SelectAll") + + # Check the table is selected + self.assertEqual("SwXTextTableCursor", document.CurrentSelection.getImplementationName()) + + with self.ui_test.execute_dialog_through_command(".uno:FontDialog"): + pass + + with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel"): + pass + + with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xFontDlg: + xDiscardBtn = xFontDlg.getChild("reset") + xDiscardBtn.executeAction("CLICK", tuple()) + + self.xUITest.getTopFocusWindow() + + # Check the table is still selected after closing the dialog + self.assertEqual("SwXTextTableCursor", document.CurrentSelection.getImplementationName()) + + self.xUITest.executeCommand(".uno:GoDown") + + # Check the table is no longer selected + self.assertNotEqual("SwXTextTableCursor", document.CurrentSelection.getImplementationName()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file diff --git a/sw/qa/uitest/table/tdf99334.py b/sw/qa/uitest/table/tdf99334.py new file mode 100644 index 000000000..0f5e55b30 --- /dev/null +++ b/sw/qa/uitest/table/tdf99334.py @@ -0,0 +1,36 @@ +# -*- 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.uihelper.common import get_url_for_data_file + +#Bug 99334 - Crashes when sorting table by columns with umlauts + +class tdf99334(UITestCase): + + def test_tdf99334_table_sort_umlauts(self): + with self.ui_test.load_file(get_url_for_data_file("tdf99334.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + #select whole table + self.xUITest.executeCommand(".uno:SelectTable") + #Tools - Sort + with self.ui_test.execute_dialog_through_command(".uno:SortDialog"): + pass + #verify + tables = writer_doc.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") + +# 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..06d4b02da --- /dev/null +++ b/sw/qa/uitest/table/textToTable.py @@ -0,0 +1,62 @@ +# -*- 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_url_for_data_file, type_text + +#Writer Text to table + +class textToTable(UITestCase): + def test_text_to_table(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + 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"})) + with self.ui_test.execute_dialog_through_command(".uno:ConvertTextToTable") as xDialog: + semicolons = xDialog.getChild("semicolons") + semicolons.executeAction("CLICK", tuple()) + #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") + + + def test_text_to_table_header(self): + with self.ui_test.load_file(get_url_for_data_file("textToTable.odt")) as writer_doc: + 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") + with self.ui_test.execute_dialog_through_command(".uno:ConvertTextToTable") as xDialog: + 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()) + #verify + self.assertEqual(writer_doc.TextTables.getCount(), 1) + tables = writer_doc.getTextTables() + self.assertEqual(len(tables[0].getRows()), 4) + self.assertEqual(len(tables[0].getColumns()), 3) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(writer_doc.TextTables.getCount(), 0) + self.assertEqual(writer_doc.Text.String[0:5], "A:B:C") + +# 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..f94784702 --- /dev/null +++ b/sw/qa/uitest/ui/fmtui/fmtui.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/. +# + +"""Covers sw/source/ui/fmtui/ fixes.""" + +from uitest.framework import UITestCase +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): + + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_command(".uno:EditStyle", close_button="cancel") as xDialog: + + 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") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/ui/index/index.py b/sw/qa/uitest/ui/index/index.py new file mode 100644 index 000000000..64c936c6c --- /dev/null +++ b/sw/qa/uitest/ui/index/index.py @@ -0,0 +1,53 @@ +# -*- 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/. +# + +"""Covers sw/source/ui/index/ fixes.""" + +from uitest.framework import UITestCase +from uitest.uihelper.common import select_pos +from uitest.uihelper.common import type_text + + +class TestSwuiidxmrk(UITestCase): + + def test_bibliography_local_page_number_insert(self): + + # Given an empty Writer document: + with self.ui_test.create_doc_in_start_center("writer") as component: + + with self.ui_test.execute_modeless_dialog_through_command(".uno:InsertAuthoritiesEntry", close_button="close") as insert_entry: + from_document = insert_entry.getChild("fromdocument") + from_document.executeAction("CLICK", tuple()) + new = insert_entry.getChild("new") + + # When inserting a biblio entry field with a page number: + with self.ui_test.execute_blocking_action(new.executeAction, args=('CLICK', ())) as define_entry: + entry = define_entry.getChild("entry") + type_text(entry, "aaa") + listbox = define_entry.getChild("listbox") + select_pos(listbox, "16") # WWW document, just select a valid position + pagecb = define_entry.getChild("pagecb-local-visible") + pagecb.executeAction("CLICK", tuple()) + + insert = insert_entry.getChild("insert") + insert.executeAction("CLICK", tuple()) + + # Then make sure the local URL contains that page number: + paragraphs = component.Text.createEnumeration() + paragraph = paragraphs.nextElement() + portions = paragraph.createEnumeration() + portion = portions.nextElement() + for field in portion.TextField.Fields: + if field.Name != "LocalURL": + continue + # Without the accompanying fix in place, this test would have failed with: + # Could not find child with id: pagecb-local-visible + self.assertEqual(field.Value, "#page=1") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/uibase/shells/shells.py b/sw/qa/uitest/uibase/shells/shells.py new file mode 100644 index 000000000..e422c012a --- /dev/null +++ b/sw/qa/uitest/uibase/shells/shells.py @@ -0,0 +1,32 @@ +# -*- 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.uihelper.common import get_state_as_dict +from uitest.uihelper.common import get_url_for_data_file +import time + + +class TestSwGrfShell(UITestCase): + def testFormatGraphicDlg(self): + # Given a document with an image with a relative size: + with self.ui_test.load_file(get_url_for_data_file("image-rel-size.fodt")) as component: + self.xUITest.executeCommand(".uno:JumpToNextFrame") + # 120 ms in the SwView ctor + time.sleep(0.2) + # When opening the properties dialog for the image: + with self.ui_test.execute_dialog_through_command(".uno:GraphicDialog") as dialog: + # Then make sure the width is 80% as in the file: + widthField = dialog.getChild('width') + # Without the accompanying fix in place, this test would have failed with: + # AssertionError: '237%' != '80%' + # i.e. the percent width of the image was wrong. + self.assertEqual(get_state_as_dict(widthField)["Text"], "80%") + +# 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..896d2fd64 --- /dev/null +++ b/sw/qa/uitest/writer_dialogs/openDialogs.py @@ -0,0 +1,145 @@ +# -*- 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 unittest +from uitest.uihelper.testDialog import testDialog + +dialogs = [ + {"command": ".uno:OpenRemote", "closeButton": "cancel"}, + #{"command": ".uno:NewDoc", "closeButton": "close"}, + # tested in sw/qa/uitest/writer_tests2/tdf146375.py + {"command": ".uno:SaveAsTemplate", "closeButton": "cancel"}, + #{"command": ".uno:ExportToPDF", "closeButton": "cancel", "skipTestOK": True}, + # tested in sw/qa/uitest/writer_tests4/exportToPDF.py + #{"command": ".uno:ExportToEPUB", "closeButton": "cancel", "skipTestOK": True}, + # tested in writerperfect/qa/uitest/epubexport/epubexport.py + {"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"}, + # tested in sw/qa/uitest/writer_tests2/pasteSpecial.py + # {"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"}, + # tested in sw/qa/uitest/writer_tests4/tdf148395.py + # {"command": ".uno:InsertSection", "closeButton": "cancel"}, + # tested in sw/qa/uitest/writer_tests7/tdf140863.py + {"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": "cancel"}, + # {"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"}, + # tested in sw/qa/uitest/sidebar/stylesSidebar.py + # {"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 + # tested in sw/qa/uitest/writer_tests7/tdf134243.py + {"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"}, + # used in various places + {"command": ".uno:ShowLicense", "closeButton": "close", "skipTestOK": True}, + # {"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/comments.py b/sw/qa/uitest/writer_tests/comments.py new file mode 100644 index 000000000..3e9d3a630 --- /dev/null +++ b/sw/qa/uitest/writer_tests/comments.py @@ -0,0 +1,153 @@ +# -*- 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.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +#test comments + +class Comments(UITestCase): + + def test_comments_features(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + xMainWindow = self.xUITest.getTopFocusWindow() + + xwriter_edit = xMainWindow.getChild("writer_edit") + xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "Before "})) + + # adding new Comment + self.xUITest.executeCommand(".uno:InsertAnnotation") + + # wait until the comment is available + xComment1 = self.ui_test.wait_until_child_is_available('Comment1') + + xEditView1 = xComment1.getChild("editview") + xEditView1.executeAction("TYPE", mkPropertyValues({"TEXT": "This is the First Comment"})) + self.assertEqual(get_state_as_dict(xComment1)["Text"], "This is the First Comment" ) + self.assertEqual(get_state_as_dict(xComment1)["Resolved"], "false" ) + self.assertEqual(get_state_as_dict(xComment1)["Author"], "Unknown Author" ) + self.assertEqual(get_state_as_dict(xComment1)["ReadOnly"], "false" ) + + xComment1.executeAction("LEAVE", mkPropertyValues({})) + + xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "After"})) + xwriter_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "0", "START_POS": "13"})) + self.assertEqual(get_state_as_dict(xwriter_edit)["SelectedText"], "Before After" ) + + # test Resolve Comment + xComment1.executeAction("RESOLVE", mkPropertyValues({})) + self.assertEqual(get_state_as_dict(xComment1)["Resolved"], "true" ) + + # test Select text from Comment + xComment1.executeAction("SELECT", mkPropertyValues({"FROM": "0", "TO": "4"})) + self.assertEqual(get_state_as_dict(xComment1)["SelectedText"], "This" ) + + # test Hide then Show Comment + xComment1.executeAction("HIDE", mkPropertyValues({})) + self.assertEqual(get_state_as_dict(xComment1)["Visible"], "false" ) + xComment1.executeAction("SHOW", mkPropertyValues({})) + self.assertEqual(get_state_as_dict(xComment1)["Visible"], "true" ) + + # test delete Comment + xComment1.executeAction("DELETE", mkPropertyValues({})) + self.assertTrue("Comment1" not in xMainWindow.getChildren()) + + + def test_multi_comments(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + xMainWindow = self.xUITest.getTopFocusWindow() + + xwriter_edit = xMainWindow.getChild("writer_edit") + + # adding 3 new Comment + xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "Line 1"})) + self.xUITest.executeCommand(".uno:InsertAnnotation") + # wait until the comment is available + xComment1 = self.ui_test.wait_until_child_is_available('Comment1') + xEditView1 = xComment1.getChild("editview") + xEditView1.executeAction("TYPE", mkPropertyValues({"TEXT": "First Comment"})) + xComment1.executeAction("LEAVE", mkPropertyValues({})) + xwriter_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + + xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "Line 2"})) + self.xUITest.executeCommand(".uno:InsertAnnotation") + # wait until the comment is available + xComment2 = self.ui_test.wait_until_child_is_available('Comment2') + xEditView2 = xComment2.getChild("editview") + xEditView2.executeAction("TYPE", mkPropertyValues({"TEXT": "Second Comment"})) + xComment2.executeAction("LEAVE", mkPropertyValues({})) + xwriter_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + + xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "Line 3"})) + self.xUITest.executeCommand(".uno:InsertAnnotation") + # wait until the comment is available + xComment3 = self.ui_test.wait_until_child_is_available('Comment3') + xEditView3 = xComment3.getChild("editview") + xEditView3.executeAction("TYPE", mkPropertyValues({"TEXT": "Third Comment"})) + xComment3.executeAction("LEAVE", mkPropertyValues({})) + xwriter_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + + # Check text + self.assertEqual(get_state_as_dict(xComment1)["Text"], "First Comment" ) + self.assertEqual(get_state_as_dict(xComment2)["Text"], "Second Comment" ) + self.assertEqual(get_state_as_dict(xComment3)["Text"], "Third Comment" ) + + xComment2.executeAction("RESOLVE", mkPropertyValues({})) + xComment3.executeAction("RESOLVE", mkPropertyValues({})) + + # Check Resolved + self.assertEqual(get_state_as_dict(xComment1)["Resolved"], "false" ) + self.assertEqual(get_state_as_dict(xComment2)["Resolved"], "true" ) + self.assertEqual(get_state_as_dict(xComment3)["Resolved"], "true" ) + + # Check ReadOnly + self.assertEqual(get_state_as_dict(xComment1)["ReadOnly"], "false" ) + self.assertEqual(get_state_as_dict(xComment2)["ReadOnly"], "false" ) + self.assertEqual(get_state_as_dict(xComment3)["ReadOnly"], "false" ) + + # Check Select + xComment1.executeAction("SELECT", mkPropertyValues({"FROM": "0", "TO": "5"})) + self.assertEqual(get_state_as_dict(xComment1)["SelectedText"], "First" ) + + xComment2.executeAction("SELECT", mkPropertyValues({"FROM": "0", "TO": "6"})) + self.assertEqual(get_state_as_dict(xComment2)["SelectedText"], "Second" ) + + xComment3.executeAction("SELECT", mkPropertyValues({"FROM": "0", "TO": "5"})) + self.assertEqual(get_state_as_dict(xComment3)["SelectedText"], "Third" ) + + # Check that they all are Visible + self.assertEqual(get_state_as_dict(xComment1)["Visible"], "true" ) + self.assertEqual(get_state_as_dict(xComment2)["Visible"], "true" ) + self.assertEqual(get_state_as_dict(xComment3)["Visible"], "true" ) + + # Hide all + xComment1.executeAction("HIDE", mkPropertyValues({})) + self.assertEqual(get_state_as_dict(xComment1)["Visible"], "false" ) + xComment2.executeAction("HIDE", mkPropertyValues({})) + self.assertEqual(get_state_as_dict(xComment2)["Visible"], "false" ) + xComment3.executeAction("HIDE", mkPropertyValues({})) + self.assertEqual(get_state_as_dict(xComment3)["Visible"], "false" ) + + # Show comment 2 only + xComment2.executeAction("SHOW", mkPropertyValues({})) + self.assertEqual(get_state_as_dict(xComment2)["Visible"], "true" ) + + # Then remove the 3 comments + xComment1.executeAction("DELETE", mkPropertyValues({})) + xComment2.executeAction("DELETE", mkPropertyValues({})) + xComment3.executeAction("DELETE", mkPropertyValues({})) + self.assertTrue("Comment1" not in xMainWindow.getChildren()) + self.assertTrue("Comment2" not in xMainWindow.getChildren()) + self.assertTrue("Comment3" not in xMainWindow.getChildren()) + +# 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..55cbdd047 --- /dev/null +++ b/sw/qa/uitest/writer_tests/compareDocuments.py @@ -0,0 +1,70 @@ +# -*- 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.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues +import datetime + +class compareDocuments(UITestCase): + + def test_tdf130960(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf130960.odt")) as writer_doc: + + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:CompareDocuments", close_button="") as xOpenDialog: + xFileName = xOpenDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf130960_2.odt")})) + xOpenBtn = xOpenDialog.getChild("open") + + # Close the dialog and open it again so the list of changes is updated + with self.ui_test.execute_dialog_through_action(xOpenBtn, 'CLICK', close_button="close"): + pass + + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg: + 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)) + + + def test_tdf137855(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf137855.odt")) as writer_doc: + + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:CompareDocuments", close_button="") as xOpenDialog: + + xFileName = xOpenDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf137855_2.odt")})) + xOpenBtn = xOpenDialog.getChild("open") + + # Close the dialog and open it again so the list of changes is updated + with self.ui_test.execute_dialog_through_action(xOpenBtn, 'CLICK', close_button="close"): + pass + + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg: + changesList = xTrackDlg.getChild("writerchanges") + + # Check the number of changes + self.assertEqual(263, len(changesList.getChildren())) + + # Without the fix in place, this test would have crashed here + xAccBtn = xTrackDlg.getChild("acceptall") + xAccBtn.executeAction("CLICK", tuple()) + + self.assertEqual(0, len(changesList.getChildren())) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests/insertCaption.py b/sw/qa/uitest/writer_tests/insertCaption.py new file mode 100644 index 000000000..5831f3cf3 --- /dev/null +++ b/sw/qa/uitest/writer_tests/insertCaption.py @@ -0,0 +1,62 @@ +# -*- 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 select_pos + +class insertCaption(UITestCase): + + def test_insert_caption(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + with self.ui_test.execute_dialog_through_command(".uno:InsertFrame") as xDialogFr: + + xWidth = xDialogFr.getChild("width") + xWidth.executeAction("UP", tuple()) + xWidth.executeAction("UP", tuple()) + + xHeight = xDialogFr.getChild("height") + xHeight.executeAction("UP", tuple()) + xHeight.executeAction("UP", tuple()) + + + self.assertEqual(document.TextFrames.getCount(), 1) + + with self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") as xDialogCaption: + + xCapt = xDialogCaption.getChild("caption_edit") + xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption"})) + + + xFrame = document.TextFrames[0] + + self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), "\nText 1: Caption") + + with self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") as xDialogCaption: + xCapt = xDialogCaption.getChild("caption_edit") + xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption2"})) + xSep = xDialogCaption.getChild("separator_edit") + xSep.executeAction("TYPE", mkPropertyValues({"TEXT":"-"})) + + + self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), "\nText 1: Caption\nText 2-: Caption2") + + with self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") as xDialogCaption: + 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") + + + self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), "\nText 1: Caption\nText 2-: Caption2\nText 3--: Caption3") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests/tdf134734.py b/sw/qa/uitest/writer_tests/tdf134734.py new file mode 100644 index 000000000..4497649f6 --- /dev/null +++ b/sw/qa/uitest/writer_tests/tdf134734.py @@ -0,0 +1,83 @@ +# -*- 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, select_pos +from com.sun.star.drawing.FillStyle import SOLID +import importlib + +class TestClass(UITestCase): + def test_master_page_background(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + + # set margins and fill color + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as DrawPageDialog: + xTabs = DrawPageDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize") + self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "true") + spinMargLeft = DrawPageDialog.getChild("spinMargLeft") + for _ in range(20): + spinMargLeft.executeAction("UP",tuple()) + spinMargRight = DrawPageDialog.getChild("spinMargRight") + for _ in range(15): + spinMargRight.executeAction("UP",tuple()) + spinMargTop = DrawPageDialog.getChild("spinMargTop") + for _ in range(10): + spinMargTop.executeAction("UP",tuple()) + spinMargBot = DrawPageDialog.getChild("spinMargBot") + for _ in range(5): + spinMargBot.executeAction("UP",tuple()) + xTabs = DrawPageDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + btncolor = DrawPageDialog.getChild("btncolor") + btncolor.executeAction("CLICK",tuple()) + + xStyle = document.StyleFamilies["PageStyles"]["Standard"] + + self.assertEqual(xStyle.FillStyle, SOLID) + self.assertEqual(xStyle.LeftMargin, 2997) + self.assertEqual(xStyle.RightMargin, 2743) + self.assertEqual(xStyle.TopMargin, 2489) + self.assertEqual(xStyle.BottomMargin, 2235) + self.assertEqual(xStyle.BackgroundFullSize, True) + + # uncheck it + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as DrawPageDialog: + xTabs = DrawPageDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize") + self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "true") + checkBackgroundFullSize.executeAction("CLICK",tuple()) + + self.assertEqual(xStyle.FillStyle, SOLID) + self.assertEqual(xStyle.LeftMargin, 2997) + self.assertEqual(xStyle.RightMargin, 2743) + self.assertEqual(xStyle.TopMargin, 2489) + self.assertEqual(xStyle.BottomMargin, 2235) + self.assertEqual(xStyle.BackgroundFullSize, False) + + # check it again + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as DrawPageDialog: + xTabs = DrawPageDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize") + self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "false") + checkBackgroundFullSize.executeAction("CLICK",tuple()) + + self.assertEqual(xStyle.FillStyle, SOLID) + self.assertEqual(xStyle.LeftMargin, 2997) + self.assertEqual(xStyle.RightMargin, 2743) + self.assertEqual(xStyle.TopMargin, 2489) + self.assertEqual(xStyle.BottomMargin, 2235) + self.assertEqual(xStyle.BackgroundFullSize, True) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py b/sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py new file mode 100644 index 000000000..c33890ca9 --- /dev/null +++ b/sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.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 uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf137459(UITestCase): + + def test_tdf137459(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + # adding new Comment + self.xUITest.executeCommand(".uno:InsertAnnotation") + # wait until the comment is available + xComment1 = self.ui_test.wait_until_child_is_available('Comment1') + + xEditView1 = xComment1.getChild("editview") + sText = "Ctrl+Del should not delete BACKWARDS" + xEditView1.executeAction("TYPE", mkPropertyValues({"TEXT": sText})) + self.assertEqual(get_state_as_dict(xComment1)["Text"], sText ) + + xEditView1.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+DELETE"})) + self.assertEqual(get_state_as_dict(xComment1)["Text"], sText ) + + +# 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..9c03e76ee --- /dev/null +++ b/sw/qa/uitest/writer_tests/tdf78068.py @@ -0,0 +1,30 @@ +# -*- 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.uihelper.common import type_text + +from uitest.uihelper.common import select_pos + +class tdf78068(UITestCase): + + def test_tdf78068_format_paragraph_crash(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + #- add some text + type_text(xWriterEdit, "Test") + #- go to Format > Paragraph + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + + self.assertEqual(document.Text.String[0:4], "Test") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests/tdf81457.py b/sw/qa/uitest/writer_tests/tdf81457.py new file mode 100644 index 000000000..ff021a4f7 --- /dev/null +++ b/sw/qa/uitest/writer_tests/tdf81457.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 uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_pos + +class tdf81457(UITestCase): + +#tdf 81457 + def test_open_documentProperties_tdf81457(self): + with self.ui_test.load_file(get_url_for_data_file("tdf81457.odt")) as writer_doc: + with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") #tab Custom properties + + # tdf#123919 - custom document properties are sorted now + aExpectedDocProp = { + 2: {'aAndra': 'Ja'}, + 4: {'BookMarkCount': '78'}, + 5: {'BookMarkInfo1': '00FF0000FF010'}, + 6: {'BookMarkInfo2': '00FF0000FF030'}} + + for pos, aDocProp in aExpectedDocProp.items(): + xNameBox = xDialog.getChild("namebox" + str(pos)) + xTypeBox = xDialog.getChild("typebox" + str(pos)) + xValueEdit = xDialog.getChild("valueedit" + str(pos)) + name, value = aDocProp.popitem() + self.assertEqual(name, get_state_as_dict(xNameBox)['Text']) + self.assertEqual('Text', get_state_as_dict(xTypeBox)['DisplayText']) + self.assertEqual(value, get_state_as_dict(xValueEdit)['Text'][:13]) + + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests/trackedChanges.py b/sw/qa/uitest/writer_tests/trackedChanges.py new file mode 100644 index 000000000..04834aef0 --- /dev/null +++ b/sw/qa/uitest/writer_tests/trackedChanges.py @@ -0,0 +1,471 @@ +# -*- 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/. +# + +# tests for tracked changes ; tdf912270 +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, type_text, select_by_text +from libreoffice.uno.propertyvalue import mkPropertyValues +from tempfile import TemporaryDirectory +from org.libreoffice.unotest import systemPathToFileUrl +import os.path + +class trackedchanges(UITestCase): + + def test_tdf91270(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + type_text(xWriterEdit, "Test") + + self.xUITest.executeCommand(".uno:TrackChanges") + + self.xUITest.executeCommand(".uno:SelectAll") #select whole text + self.xUITest.executeCommand(".uno:Cut") #cut text + + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close"): + pass + + def test_tracked_changes_accept(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:TrackChanges") + type_text(xWriterEdit, "Test LibreOffice") + self.xUITest.executeCommand(".uno:ShowTrackedChanges") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg: + xAccBtn = xTrackDlg.getChild("accept") + xAccBtn.executeAction("CLICK", tuple()) + + self.assertEqual(document.Text.String[0:16], "Test LibreOffice") + + def test_tracked_changes_acceptall(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:TrackChanges") + type_text(xWriterEdit, "Test LibreOffice") + self.xUITest.executeCommand(".uno:ShowTrackedChanges") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg: + + xAccBtn = xTrackDlg.getChild("acceptall") + xAccBtn.executeAction("CLICK", tuple()) + + + self.assertEqual(document.Text.String[0:16], "Test LibreOffice") + + def test_tracked_changes_reject(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:TrackChanges") + type_text(xWriterEdit, "Test LibreOffice") + self.xUITest.executeCommand(".uno:ShowTrackedChanges") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg: + + xRejBtn = xTrackDlg.getChild("reject") + xRejBtn.executeAction("CLICK", tuple()) + + self.assertEqual(document.Text.String[0:1], "") + + def test_tracked_changes_rejectall(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:TrackChanges") + type_text(xWriterEdit, "Test LibreOffice") + self.xUITest.executeCommand(".uno:ShowTrackedChanges") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg: + + xAccBtn = xTrackDlg.getChild("rejectall") + xAccBtn.executeAction("CLICK", tuple()) + + self.assertEqual(document.Text.String[0:1], "") + + def test_tracked_changes_zprev_next(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + 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") + + + def test_list_of_changes(self): + with self.ui_test.load_file(get_url_for_data_file("trackedChanges.odt")) as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + 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"] + + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg: + 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] ) + + + def test_tdf135018(self): + with self.ui_test.load_file(get_url_for_data_file("tdf135018.odt")) as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.assertEqual(5, document.CurrentController.PageCount) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg: + changesList = xTrackDlg.getChild("writerchanges") + self.assertEqual(111, len(changesList.getChildren())) + + # Without the fix in place, it would have crashed here + xAccBtn = xTrackDlg.getChild("acceptall") + xAccBtn.executeAction("CLICK", tuple()) + + self.assertEqual(0, len(changesList.getChildren())) + + xUndoBtn = xTrackDlg.getChild("undo") + xUndoBtn.executeAction("CLICK", tuple()) + + self.assertEqual(111, len(changesList.getChildren())) + + + # Check the changes are shown after opening the Manage Tracked Changes dialog + self.assertGreater(document.CurrentController.PageCount, 5) + + def test_tdf144270_tracked_table_rows(self): + with self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + tables = document.getTextTables() + self.assertEqual(3, len(tables)) + + # Accept + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg: + changesList = xTrackDlg.getChild("writerchanges") + + # This was 14 (every cell is a different change instead of counting rows or tables) + # Now: 4 changes (2 deleted/inserted rows and 2 deleted/inserted tables) + self.assertEqual(4, len(changesList.getChildren())) + + # Without the fix in place, it would have crashed here + for i in (3, 2, 1, 0): + xAccBtn = xTrackDlg.getChild("accept") + xAccBtn.executeAction("CLICK", tuple()) + self.assertEqual(i, len(changesList.getChildren())) + + tables = document.getTextTables() + self.assertEqual(2, len(tables)) + + for i in range(1, 5): + xUndoBtn = xTrackDlg.getChild("undo") + xUndoBtn.executeAction("CLICK", tuple()) + self.assertEqual(i, len(changesList.getChildren())) + + tables = document.getTextTables() + self.assertEqual(3, len(tables)) + + # Accept All + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg: + changesList = xTrackDlg.getChild("writerchanges") + + # This was 14 (every cell is a different change instead of counting rows or tables) + # Now: 4 changes (2 deleted/inserted rows and 2 deleted/inserted tables) + self.assertEqual(4, len(changesList.getChildren())) + + xAccBtn = xTrackDlg.getChild("acceptall") + xAccBtn.executeAction("CLICK", tuple()) + self.assertEqual(0, len(changesList.getChildren())) + + tables = document.getTextTables() + self.assertEqual(2, len(tables)) + + xUndoBtn = xTrackDlg.getChild("undo") + xUndoBtn.executeAction("CLICK", tuple()) + self.assertEqual(4, len(changesList.getChildren())) + + tables = document.getTextTables() + self.assertEqual(3, len(tables)) + + # goto to the start of the document to reject from the first tracked table row change + self.xUITest.executeCommand(".uno:GoToStartOfDoc") + + # Reject + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg: + changesList = xTrackDlg.getChild("writerchanges") + + # This was 14 (every cell is a different change instead of counting rows or tables) + # Now: 4 changes (2 deleted/inserted rows and 2 deleted/inserted tables) + self.assertEqual(4, len(changesList.getChildren())) + + # Without the fix in place, it would have crashed here + for i in (3, 2, 1, 0): + xAccBtn = xTrackDlg.getChild("reject") + xAccBtn.executeAction("CLICK", tuple()) + self.assertEqual(i, len(changesList.getChildren())) + + tables = document.getTextTables() + self.assertEqual(2, len(tables)) + + for i in range(1, 5): + xUndoBtn = xTrackDlg.getChild("undo") + xUndoBtn.executeAction("CLICK", tuple()) + self.assertEqual(i, len(changesList.getChildren())) + + tables = document.getTextTables() + self.assertEqual(3, len(tables)) + + # Reject All + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg: + changesList = xTrackDlg.getChild("writerchanges") + + # This was 14 (every cell is a different change instead of counting rows or tables) + # Now: 4 changes (2 deleted/inserted rows and 2 deleted/inserted tables) + self.assertEqual(4, len(changesList.getChildren())) + + xAccBtn = xTrackDlg.getChild("rejectall") + xAccBtn.executeAction("CLICK", tuple()) + self.assertEqual(0, len(changesList.getChildren())) + + tables = document.getTextTables() + self.assertEqual(2, len(tables)) + + xUndoBtn = xTrackDlg.getChild("undo") + xUndoBtn.executeAction("CLICK", tuple()) + self.assertEqual(4, len(changesList.getChildren())) + + tables = document.getTextTables() + self.assertEqual(3, len(tables)) + + def test_tdf148032(self): + + with self.ui_test.load_file(get_url_for_data_file("trackedChanges.odt")) as document: + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + # adding new Comment + self.xUITest.executeCommand(".uno:InsertAnnotation") + + # wait until the comment is available + xComment1 = self.ui_test.wait_until_child_is_available('Comment1') + + xEditView1 = xComment1.getChild("editview") + xEditView1.executeAction("TYPE", mkPropertyValues({"TEXT": "This is the First Comment"})) + self.assertEqual(get_state_as_dict(xComment1)["Text"], "This is the First Comment" ) + self.assertEqual(get_state_as_dict(xComment1)["Resolved"], "false" ) + self.assertEqual(get_state_as_dict(xComment1)["Author"], "Unknown Author" ) + self.assertEqual(get_state_as_dict(xComment1)["ReadOnly"], "false" ) + + xComment1.executeAction("LEAVE", mkPropertyValues({})) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg: + changesList = xTrackDlg.getChild("writerchanges") + self.assertEqual(6, len(changesList.getChildren())) + + xChild = changesList.getChild(0) + # This was False (missing comment) + self.assertEqual(True, get_state_as_dict(xChild)["Text"].endswith('\tComment added')) + + def test_tdf147179(self): + with self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + tables = document.getTextTables() + self.assertEqual(3, len(tables)) + + # Select text of the tracked row, not only text of its first cell + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg: + changesList = xTrackDlg.getChild("writerchanges") + + # select second tracked table row in tree list + changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + while get_state_as_dict(xWriterEdit)["SelectedText"] != 'klj': + xToolkit.processEventsToIdle() + + # this was "j" (only text of the first cell was selected, not text of the row) + self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "klj" ) + + # select first tracked table row in tree list + changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + while get_state_as_dict(xWriterEdit)["SelectedText"] != 'bca': + xToolkit.processEventsToIdle() + + # this was "a" (only text of the first cell was selected, not text of the row) + self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "bca" ) + + def test_RedlineSuccessorData(self): + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, "redlinesuccessordata-temp.odt") + with self.ui_test.load_file(get_url_for_data_file("redlinesuccessordata.docx")) as document: + + # check tracked deletion in tracked insertion + with self.ui_test.execute_modeless_dialog_through_command('.uno:AcceptTrackedChanges', close_button="close") as xTrackDlg: + changesList = xTrackDlg.getChild('writerchanges') + # four children, but only three visible + state = get_state_as_dict(changesList) + self.assertEqual(state['Children'], '4') + self.assertEqual(state['VisibleCount'], '3') + + # select tracked deletion with RedlineSuccessorData in tree list + changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + state = get_state_as_dict(changesList) + self.assertEqual(state['SelectEntryText'], 'Kelemen Gábor 2\t05/19/2021 12:35:00\t') + self.assertEqual(get_state_as_dict(changesList.getChild(1))['Children'], '1') + self.assertEqual(get_state_as_dict(changesList.getChild(1))['VisibleChildCount'], '0') + + # open tree node with the tracked insertion: four visible children + changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + state = get_state_as_dict(changesList) + self.assertEqual(state['Children'], '4') + self.assertEqual(state['VisibleCount'], '4') + self.assertEqual(get_state_as_dict(changesList.getChild(1))['Children'], '1') + self.assertEqual(get_state_as_dict(changesList.getChild(1))['VisibleChildCount'], '1') + + # select tracked insertion in tree list + changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + state = get_state_as_dict(changesList) + self.assertEqual(state['SelectEntryText'], 'First Person\t10/21/2012 23:45:00\t') + + # Save the DOCX document as ODT with a tracked deletion in a tracked insertion + with self.ui_test.execute_dialog_through_command(".uno:SaveAs", close_button="open") as xSaveDialog: + xFileName = xSaveDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath})) + xFileTypeCombo = xSaveDialog.getChild("file_type") + select_by_text(xFileTypeCombo, "ODF Text Document (.odt)") + + self.ui_test.wait_until_file_is_available(xFilePath) + # load the temporary file, and check ODF roundtrip of the tracked deletion in a tracked insertion + with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document: + # check tracked deletion in tracked insertion + with self.ui_test.execute_modeless_dialog_through_command('.uno:AcceptTrackedChanges', close_button="close") as xTrackDlg: + changesList = xTrackDlg.getChild('writerchanges') + # four children, but only three visible + state = get_state_as_dict(changesList) + self.assertEqual(state['Children'], '4') + self.assertEqual(state['VisibleCount'], '3') + + # select tracked deletion with RedlineSuccessorData in tree list + changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + state = get_state_as_dict(changesList) + self.assertEqual(state['SelectEntryText'], 'Kelemen Gábor 2\t05/19/2021 12:35:00\t') + self.assertEqual(get_state_as_dict(changesList.getChild(1))['Children'], '1') + self.assertEqual(get_state_as_dict(changesList.getChild(1))['VisibleChildCount'], '0') + + # open tree node with the tracked insertion: four visible children + changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + state = get_state_as_dict(changesList) + self.assertEqual(state['Children'], '4') + self.assertEqual(state['VisibleCount'], '4') + self.assertEqual(get_state_as_dict(changesList.getChild(1))['Children'], '1') + self.assertEqual(get_state_as_dict(changesList.getChild(1))['VisibleChildCount'], '1') + + # select tracked insertion in tree list + changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + state = get_state_as_dict(changesList) + self.assertEqual(state['SelectEntryText'], 'First Person\t10/21/2012 23:45:00\t') + + # reject all + xAccBtn = xTrackDlg.getChild("rejectall") + xAccBtn.executeAction("CLICK", tuple()) + # FIXME why we need double rejectall (dialog-only)? + xAccBtn.executeAction("CLICK", tuple()) + self.assertEqual(0, len(changesList.getChildren())) + # This was false, because of not rejected tracked deletion + # of the text "inserts": "Document text inserts document"... + self.assertTrue(document.getText().getString().startswith('Document text document text')) + +# 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..5f34de511 --- /dev/null +++ b/sw/qa/uitest/writer_tests/versionDialog.py @@ -0,0 +1,36 @@ +# -*- 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.uihelper.common import get_state_as_dict, get_url_for_data_file + +class versionDialog(UITestCase): + + def test_tdf131931(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf131931.odt")) as writer_doc: + + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:VersionDialog", close_button="close") as xVersionDialog: + + + 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())) + + +# 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..1ba46cecc --- /dev/null +++ b/sw/qa/uitest/writer_tests/watermark.py @@ -0,0 +1,52 @@ +# -*- 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 + + +class watermark(UITestCase): + + def test_insert_watermark(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:Watermark") as xDialog: + 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()) + + + with self.ui_test.execute_dialog_through_command(".uno:Watermark", close_button="cancel") as xDialog: + 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"], "90°") + self.assertEqual(get_state_as_dict(xTransparency)["Text"], "51%") + + + with self.ui_test.execute_dialog_through_command(".uno:Watermark") as xDialog: + xTextInput = xDialog.getChild("TextInput") + xTextInput.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xTextInput.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + + with self.ui_test.execute_dialog_through_command(".uno:Watermark", close_button="cancel") as xDialog: + xTextInput = xDialog.getChild("TextInput") + + self.assertEqual(get_state_as_dict(xTextInput)["Text"], "") + + +# 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..c1e816337 --- /dev/null +++ b/sw/qa/uitest/writer_tests/wordCount.py @@ -0,0 +1,282 @@ +# -*- 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, get_url_for_data_file, type_text + +class writerWordCount(UITestCase): + + def test_word_count_dialog(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + type_text(xWriterEdit, "Test for word count dialog") #type text + xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "0", "END_POS": "8"})) #select two words + + with self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog", close_button="close") as xDialog: + + 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") + + + def test_tdf68347(self): + #Bug 68347 - Incorrect word count in a document with recorded changes + with self.ui_test.load_file(get_url_for_data_file("tdf68347.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "24", "END_POS": "39"})) #select two words + + with self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog", close_button="close") as xDialog: + 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 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") + + def test_tdf91100(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog", close_button="close"): + pass + + def test_tdf58050(self): + with self.ui_test.load_file(get_url_for_data_file("tdf58050.html")) as writer_doc: + + with self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog", close_button="close") as xDialog: + + 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") + + def test_word_count_interpunction_counted_tdf56975_a(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + #Open writer, enter "Testing one two! Test?" + type_text(xWriterEdit, "Testing one two! Test?") + #-> LO says: 4 words. SUCCESS! :) + with self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog", close_button="close") as xDialog: + + 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") + + + def test_word_count_interpunction_counted_tdf56975_b(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + #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. + with self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog", close_button="close") as xDialog: + + 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") + #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. + with self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog", close_button="close") as xDialog: + + 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") + #6. Move the cursor by pressing Left. + self.xUITest.executeCommand(".uno:GoLeft") + # Word count in both, dialogue and status line, shows 5 words. + with self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog", close_button="close") as xDialog: + + 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") + + def test_tdf51816(self): + with self.ui_test.load_file(get_url_for_data_file("tdf51816.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + #1. Open attached document + #2. Tools> Word count + with self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog", close_button="close") as xDialog: + 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") + + + def test_tdf117703(self): + with self.ui_test.load_file(get_url_for_data_file("tdf117703.odt")): + self.xUITest.getTopFocusWindow() + + self.xUITest.executeCommand(".uno:SelectAll") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog", close_button="close") as xDialog: + + 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"], "12") + self.assertEqual(get_state_as_dict(xdocwords)["Text"], "12") + self.assertEqual(get_state_as_dict(xselectchars)["Text"], "54") + self.assertEqual(get_state_as_dict(xdocchars)["Text"], "54") + + # Without the fix in place it would have failed with: AssertionError: '0' != '44' + self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "44") + 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") + +# 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..7302dd89e --- /dev/null +++ b/sw/qa/uitest/writer_tests2/asianPhoneticGuide.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.uihelper.common import select_by_text + +class asianPhoneticGuide(UITestCase): + + def test_asian_phonetic_guide(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_modeless_dialog_through_command(".uno:RubyDialog", close_button="close") as xDialog: + + 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"})) + select_by_text(xadjustlb, "Right") + select_by_text(xpositionlb, "Right") + select_by_text(xstylelb, "Quotation") + + xApplyBtn = xDialog.getChild("ok") + xApplyBtn.executeAction("CLICK", tuple()) + + self.assertEqual(document.Text.String[0:1], "a") +# 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..62cf57735 --- /dev/null +++ b/sw/qa/uitest/writer_tests2/bookmark.py @@ -0,0 +1,94 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +from libreoffice.uno.propertyvalue import mkPropertyValues +#test bookmark dialog +class bookmarkDialog(UITestCase): + + def test_bookmark_dialog(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="insert"): + pass + + with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="insert") as xBookDlg: + xBmk = xBookDlg.getChild("bookmarks") + self.assertEqual(get_state_as_dict(xBmk)["VisibleCount"], "1") #check for 1st bookmark exist + + with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="close"): + pass + + with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="close") as xBookDlg: + xBmk = xBookDlg.getChild("bookmarks") + self.assertEqual(get_state_as_dict(xBmk)["VisibleCount"], "2") #check for 2 bookmarks + +#now delete one bookmark + with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="close") as xBookDlg: + 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 + + with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="close") as xBookDlg: + xBmk2 = xBookDlg.getChild("bookmarks") + self.assertEqual(get_state_as_dict(xBmk2)["VisibleCount"], "1") #check for 1 bookmark + + + def test_bookmark_dialog_rename(self): + with self.ui_test.create_doc_in_start_center("writer"): + + with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="insert"): + pass + + with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="close") as xBookDlg: + xBmk = xBookDlg.getChild("bookmarks") + xFirstListEntry = xBmk.getChild("0") # select first bookmark + xFirstListEntry.executeAction("SELECT", tuple()) + xRenameBtn = xBookDlg.getChild("rename") + + with self.ui_test.execute_blocking_action(xRenameBtn.executeAction, args=('CLICK', ())) as dialog: + xNewNameTxt=dialog.getChild("entry") + xNewNameTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"newname"})) + + 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" + + + + def test_bookmark_dialog_goto(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="insert"): + pass + + type_text(xWriterEdit, "Test for bookmark") + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + type_text(xWriterEdit, "Test2 for bookmark") + + with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="insert"): + pass + + with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="close") as xBookDlg: + 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 + + +# 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..e655a2f8a --- /dev/null +++ b/sw/qa/uitest/writer_tests2/deleteAllComments.py @@ -0,0 +1,50 @@ +# -*- 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.uihelper.common import type_text + +class DeleteAllComments(UITestCase): + + def test_comments_delete(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + + type_text(xWriterEdit, "Test LibreOffice") + + + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:InsertAnnotation") + cursor = document.getCurrentController().getViewCursor() + type_text(xWriterEdit, "EEEEE") + self.xUITest.executeCommand(".uno:InsertAnnotation") + self.xUITest.executeCommand(".uno:DeleteAllNotes") + self.assertEqual(document.Text.String[0:4], "Test") + + + def test_comment_trackchanges(self): +#tdf111524 + with self.ui_test.create_doc_in_start_center("writer") as document: + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + type_text(xWriterEdit, "foo") + + + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:InsertAnnotation") + self.xUITest.executeCommand(".uno:TrackChanges") + self.xUITest.executeCommand(".uno:DeleteAllNotes") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests2/deleteFootnotes.py b/sw/qa/uitest/writer_tests2/deleteFootnotes.py new file mode 100644 index 000000000..162cc7d3e --- /dev/null +++ b/sw/qa/uitest/writer_tests2/deleteFootnotes.py @@ -0,0 +1,46 @@ +# -*- 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.uihelper.common import type_text +from libreoffice.uno.propertyvalue import mkPropertyValues +import time + + +class tdf150457(UITestCase): + + def test_delete_footnotes(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + type_text(xWriterEdit, "a") + self.xUITest.executeCommand(".uno:InsertFootnote") + type_text(xWriterEdit, "abc") + self.assertEqual(document.Footnotes[0].String, "abc") + self.assertEqual(document.Footnotes.getCount(), 1) + + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "PAGEUP"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + type_text(xWriterEdit, "d") + + self.xUITest.executeCommand(".uno:InsertFootnote") + type_text(xWriterEdit, "def") + self.assertEqual(document.Footnotes[1].String, "def") + self.assertEqual(document.Footnotes.getCount(), 2) + + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "HOME"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "SHIFT+DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DELETE"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "PAGEUP"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DELETE"})) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests2/documentProperties.py b/sw/qa/uitest/writer_tests2/documentProperties.py new file mode 100644 index 000000000..5b1eeb583 --- /dev/null +++ b/sw/qa/uitest/writer_tests2/documentProperties.py @@ -0,0 +1,123 @@ +# -*- 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.uihelper.common import select_pos + +class documentProperties(UITestCase): + + def assert_custom_properties(self, dialog, bIsFirstItemVisible): + for i in range(6): + aExpected = 'false' + if bIsFirstItemVisible and i == 0: + aExpected = 'true' + xNameBox = dialog.getChild("namebox" + str(i + 1)) + xTypeBox = dialog.getChild("typebox" + str(i + 1)) + xValueEdit = dialog.getChild("valueedit" + str(i + 1)) + xRemoveBtn = dialog.getChild("remove" + str(i + 1)) + self.assertEqual(aExpected, get_state_as_dict(xNameBox)['ReallyVisible']) + self.assertEqual(aExpected, get_state_as_dict(xTypeBox)['ReallyVisible']) + self.assertEqual(aExpected, get_state_as_dict(xValueEdit)['ReallyVisible']) + self.assertEqual(aExpected, get_state_as_dict(xRemoveBtn)['ReallyVisible']) + + def test_open_documentProperties_writer(self): + with self.ui_test.create_doc_in_start_center("writer"): + with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") as xDialog: + 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") + + with self.ui_test.execute_blocking_action(xDigSignBtn.executeAction, args=('CLICK', ()), close_button="no"): + pass + + 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") + + with self.ui_test.execute_blocking_action(xProtectBtn.executeAction, args=('CLICK', ())) as dialog: + xPasswordText = dialog.getChild("pass1ed") + xPasswordText.executeAction("TYPE", mkPropertyValues({"TEXT":"password"})) + xConfirmText = dialog.getChild("confirm1ed") + xConfirmText.executeAction("TYPE", mkPropertyValues({"TEXT":"password"})) + + select_pos(xTabs, "2") #tab Custom properties + + self.assert_custom_properties(xDialog, False) + + xAddBtn = xDialog.getChild("add") + xAddBtn.executeAction("CLICK", tuple()) + + self.assert_custom_properties(xDialog, True) + + xRemoveBtn = xDialog.getChild("remove1") + xRemoveBtn.executeAction("CLICK", tuple()) + + self.assert_custom_properties(xDialog, False) + + select_pos(xTabs, "5") #tab Statistics + xUpdateBtn = xDialog.getChild("update") + xUpdateBtn.executeAction("CLICK", tuple()) + +#now open the dialog again and read the properties + with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties", close_button="cancel") as xDialog: + 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()) + + +# 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..f234dc3a2 --- /dev/null +++ b/sw/qa/uitest/writer_tests2/exchangeDatabase.py @@ -0,0 +1,45 @@ +# -*- 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.uihelper.common import get_state_as_dict + +class exchangeDB(UITestCase): + + def test_exchange_database(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + with self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField", close_button="close"): + pass + + + def test_exchange_database2(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + with self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField") as xExDBDlg: + 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 + + with self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField", close_button="close") as xExDBDlg: + xLabeldb = xExDBDlg.getChild("dbnameft") + self.assertEqual(get_state_as_dict(xLabeldb)["Text"], "Bibliography.biblio") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests2/fontworks.py b/sw/qa/uitest/writer_tests2/fontworks.py new file mode 100644 index 000000000..a70fc297b --- /dev/null +++ b/sw/qa/uitest/writer_tests2/fontworks.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 uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +#test FontWorks dialog +class fontWorksDialog(UITestCase): + + def test_fontwork_selector(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + with self.ui_test.execute_dialog_through_command(".uno:FontworkGalleryFloater", close_button="cancel") as xDialog: + FontWorkSelector = xDialog.getChild("ctlFavoriteswin") + # Select element with id (3) + element3 = FontWorkSelector.getChild("2") + element3.executeAction("SELECT", mkPropertyValues({})) + self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemPos"], "2") + self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemId"], "3") + self.assertEqual(get_state_as_dict(FontWorkSelector)["VisibleCount"], "36") + + # Select element with id (7) + element7 = FontWorkSelector.getChild("6") + element7.executeAction("SELECT", mkPropertyValues({})) + self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemPos"], "6") + self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemId"], "7") + + +# 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..4892dde49 --- /dev/null +++ b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py @@ -0,0 +1,270 @@ +# -*- 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.uihelper.common import get_state_as_dict + +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text +from uitest.uihelper.common import change_measurement_unit + +class formatBulletsNumbering(UITestCase): + + def test_bullets_and_numbering_dialog_tab_position(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + + change_measurement_unit(self, "Millimeter") + + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xalignedatmf = xDialog.getChild("alignedatmf") + xnum2alignlb = xDialog.getChild("num2alignlb") + xatmf = xDialog.getChild("atmf") + xindentatmf = xDialog.getChild("indentatmf") + + xalignedatmf.executeAction("UP", tuple()) + select_by_text(xnum2alignlb, "Centered") + xatmf.executeAction("UP", tuple()) + xindentatmf.executeAction("UP", tuple()) + + + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog: + 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") + + + + def test_bullets_and_numbering_dialog_tab_position2(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xnumfollowedbylb = xDialog.getChild("numfollowedbylb") + select_by_text(xnumfollowedbylb, "Space") + + + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xnumfollowedbylb = xDialog.getChild("numfollowedbylb") + self.assertEqual(get_state_as_dict(xnumfollowedbylb)["SelectEntryText"], "Space") + + + + def test_bullets_and_numbering_dialog_tab_customize(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog: + 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") + + select_by_text(xnumfmtlb, "A, B, C, ...") + xstartat.executeAction("UP", tuple()) + select_by_text(xcharstyle, "Bullets") + xprefix.executeAction("TYPE", mkPropertyValues({"TEXT":"o"})) + xsuffix.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xsuffix.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) + xallsame.executeAction("CLICK", tuple()) + + + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog: + 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") + + + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="user") as xDialog: + pass + + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog: + 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") + + + + def test_bullets_and_numbering_tab_move(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + change_measurement_unit(self, "Millimeter") + + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog: + 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] + + + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) #TAB to move indent right + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog: + 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) + + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog: + 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) + + + def test_bullets_and_numbering_button_move(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + + change_measurement_unit(self, "Millimeter") + + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog: + 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] + + + self.xUITest.executeCommand(".uno:DecrementSubLevels") + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog: + 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) + + self.xUITest.executeCommand(".uno:IncrementLevel") + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog: + 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) + + + def test_bullets_and_numbering_selection(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + + # Test Bullet Page + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog: + + # Select the BulletPage's Selector + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xBulletPage = xDialog.getChild("PickBulletPage") + xselector = xBulletPage.getChild("valueset") + self.assertEqual(get_state_as_dict(xselector)["ItemsCount"], "8") + # Select element num 3 + xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "3"})) + self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "2") + self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "3") + self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Solid diamond bullets") + # Select element num 7 + xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "7"})) + self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "6") + self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "7") + self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Cross mark bullets") + + + # Test other Pages + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog: + # Select the NumberingPage's Selector + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + xNumberingPage = xDialog.getChild("PickNumberingPage") + xselector = xNumberingPage.getChild("valueset") + self.assertEqual(get_state_as_dict(xselector)["ItemsCount"], "8") + # Select element num 5 + xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "5"})) + self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "4") + self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "5") + self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Uppercase letter A) B) C)") + # Select element num 8 + xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "8"})) + self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "7") + self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "8") + self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Lowercase Roman number i. ii. iii.") + + # Select the OutlinePage's Selector + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + xOutlinePage = xDialog.getChild("PickOutlinePage") + xselector = xOutlinePage.getChild("valueset") + self.assertEqual(get_state_as_dict(xselector)["ItemsCount"], "8") + # Select element num 1 + xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "1"})) + self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "0") + self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "1") + self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Numeric, numeric, lowercase letters, solid small circular bullet") + + # Select the GraphicPage's Selector + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "3") + xGraphicPage = xDialog.getChild("PickGraphicPage") + xselector = xGraphicPage.getChild("valueset") + self.assertEqual(get_state_as_dict(xselector)["ItemsCount"], "92") + # Select element num 22 + xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "22"})) + self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "21") + self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "22") + # Select element num 73 + xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "73"})) + self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "72") + self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "73") + + +# 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..196313368 --- /dev/null +++ b/sw/qa/uitest/writer_tests2/formatCharacter.py @@ -0,0 +1,246 @@ +# -*- 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.uihelper.common import get_state_as_dict + +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text + +class formatCharacter(UITestCase): + + def test_format_character_tab_font(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + + # xNoteBook = xDialog.getChild("nbWestern") //western notebook is always active + xSizeFont = xDialog.getChild("cbWestSize") + xLangFont = xDialog.getChild("cbWestLanguage") + xSizeFont.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSizeFont.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) + #set font size 18 + select_pos(xLangFont, "0") + + xNoteBook = xDialog.getChild("nbCJKCTL") + select_pos(xNoteBook, "0") + xSizeFontEast = xDialog.getChild("cbCJKSize") + xLangFontEast = xDialog.getChild("cbCJKLanguage") + xSizeFontEast.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSizeFontEast.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18 + select_pos(xLangFontEast, "0") + + select_pos(xNoteBook, "1") + xSizeFontCTL = xDialog.getChild("cbCTLSize") + xLangFontCTL = xDialog.getChild("cbCTLLanguage") + xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18 + select_pos(xLangFontCTL, "0") + + with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog: + xSizeFont = xDialog.getChild("cbWestSize") + self.assertEqual(get_state_as_dict(xSizeFont)["Text"], "18 pt") + xLangFont = xDialog.getChild("cbWestLanguage") + self.assertEqual(get_state_as_dict(xLangFont)["Text"], "[None]") + + xNoteBook = xDialog.getChild("nbCJKCTL") + select_pos(xNoteBook, "0") + xSizeFontEast = xDialog.getChild("cbCJKSize") + self.assertEqual(get_state_as_dict(xSizeFontEast)["Text"], "18 pt") + xLangFontEast = xDialog.getChild("cbCJKLanguage") + self.assertEqual(get_state_as_dict(xLangFontEast)["Text"], "[None]") + + select_pos(xNoteBook, "1") + xSizeFontCTL = xDialog.getChild("cbCTLSize") + self.assertEqual(get_state_as_dict(xSizeFontCTL)["Text"], "18 pt") + xLangFontCTL = xDialog.getChild("cbCTLLanguage") + self.assertEqual(get_state_as_dict(xLangFontCTL)["Text"], "[None]") + + + + def test_format_character_tab_font_effects(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog: + 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") + + + with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog: + 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") + + + + def test_format_character_tab_hyperlink(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog: + 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") + select_by_text(xVisited, "Bullets") + xUnVisited = xDialog.getChild("unvisitedlb") + select_by_text(xUnVisited, "Bullets") + + + self.xUITest.executeCommand(".uno:GoLeft") + self.assertEqual(document.Text.String[0:11], "LibreOffice") + + with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog: + 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") + + + def test_format_character_tab_asian_layout(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "3") + + xTwolines = xDialog.getChild("twolines") + xTwolines.executeAction("CLICK", tuple()) + + + with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "3") + xTwolines = xDialog.getChild("twolines") + + self.assertEqual(get_state_as_dict(xTwolines)["Selected"], "true") + + def test_format_character_tab_position(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog: + 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()) + + + with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog: + 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") + + + + def test_format_character_tab_position_scalewidthsb(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + + xScalewidth = xDialog.getChild("scalewidthsb") + xScalewidth.executeAction("UP", tuple()) + + + with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + xScalewidth = xDialog.getChild("scalewidthsb") + self.assertEqual(get_state_as_dict(xScalewidth)["Text"], "101%") + + + +# 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..14882dc6b --- /dev/null +++ b/sw/qa/uitest/writer_tests2/formatParagraph.py @@ -0,0 +1,541 @@ +# -*- 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.uihelper.common import get_state_as_dict + +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text +from uitest.uihelper.common import change_measurement_unit + +class formatParagraph(UITestCase): + + def test_format_paragraph_tab_indents_spacing(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog: + 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()) + select_by_text(xLineSpacing, "Double") + xActivate.executeAction("CLICK", tuple()) + + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog: + 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") + + + + def test_format_paragraph_tab_alignment(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog: + 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") + + select_by_text(xTextDirection, "Left-to-right (LTR)") + select_by_text(xAlignment, "Top") + xSnapToText.executeAction("CLICK", tuple()) + xJustified.executeAction("CLICK", tuple()) + select_by_text(xLastLine, "Justified") + xExpandChk.executeAction("CLICK", tuple()) + + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog: + 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") + + + + def test_format_paragraph_tab_text_flow(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog: + 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()) + select_by_text(xType, "Column") + select_by_text(xPosition, "After") + xspinOrphan.executeAction("UP", tuple()) + xspinWidow.executeAction("UP", tuple()) + xcheckWidow.executeAction("CLICK", tuple()) + xcheckOrphan.executeAction("CLICK", tuple()) + xcheckSplitPara.executeAction("CLICK", tuple()) + xcheckKeepPara.executeAction("CLICK", tuple()) + + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog: + 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") + + + + def test_format_paragraph_tab_asian_typography(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog: + 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()) + + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog: + 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") + + + + def test_format_paragraph_tab_outline_numbering(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog: + 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") + + select_by_text(xOutline, "Level 1") + select_by_text(xNumbering, "Bullet •") + xPara.executeAction("CLICK", tuple()) + xParaSpin.executeAction("UP", tuple()) + + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog: + 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") + + + + def test_format_paragraph_tab_tabs(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + + change_measurement_unit(self, "Centimeter") + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog: + 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()) + + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog: + 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") + + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog: + 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()) + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog: + 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") + + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog: + 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()) + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog: + 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") + + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog: + 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()) + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog: + 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") + + + + def test_format_paragraph_tab_drop_caps(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog: + 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"})) + select_by_text(xCharStyle, "Definition") + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog: + 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") + + + + def test_format_paragraph_tab_borders(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + + change_measurement_unit(self, "Centimeter") + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog: + 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") + + 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()) + + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog: + 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") + + + def test_format_paragraph_area(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog: + 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()) + + def test_format_paragraph_transparency(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog: + 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()) + + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog: + 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%") + + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog: + 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()) + select_by_text(xType, "Axial") + xAngle.executeAction("UP", tuple()) + xBorder.executeAction("UP", tuple()) + xStart.executeAction("UP", tuple()) + xEnd.executeAction("UP", tuple()) + + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog: + 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%") + + +# 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..cecd517f0 --- /dev/null +++ b/sw/qa/uitest/writer_tests2/horizontalLine.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 uitest.uihelper.common import get_state_as_dict, type_text + +class WriterInsertHorizontalLine(UITestCase): + + def test_insert_horizontal_line(self): + with 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 + + with self.ui_test.execute_dialog_through_command(".uno:EditStyle", close_button="cancel") as xDialog: + xStyleNametxt = xDialog.getChild("name") + self.assertEqual(get_state_as_dict(xStyleNametxt)["Text"], "Horizontal Line") #check style name + + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Redo") + + with self.ui_test.execute_dialog_through_command(".uno:EditStyle", close_button="cancel") as xDialog: + xStyleNametxt = xDialog.getChild("name") + self.assertEqual(get_state_as_dict(xStyleNametxt)["Text"], "Horizontal Line") #check style name + +# 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..176794684 --- /dev/null +++ b/sw/qa/uitest/writer_tests2/insertFootnote.py @@ -0,0 +1,36 @@ +# -*- 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.uihelper.common import type_text + +class insertFootnote(UITestCase): + + def test_insert_footnote(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + 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") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests2/pasteSpecial.py b/sw/qa/uitest/writer_tests2/pasteSpecial.py new file mode 100644 index 000000000..abbc067ef --- /dev/null +++ b/sw/qa/uitest/writer_tests2/pasteSpecial.py @@ -0,0 +1,39 @@ +# -*- 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.uihelper.common import type_text + +class PasteSpecial(UITestCase): + + def test_pasteSpecial(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + type_text(xWriterEdit, "test") + + for i in range(5): + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:Copy") + + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xDialog: + + xList = xDialog.getChild('list') + xChild = xList.getChild(str(i)) + + xChild.executeAction("SELECT", tuple()) + + + self.xUITest.executeCommand(".uno:Undo") + + self.assertEqual(document.Text.String, "test") + + +# 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..dca0e790a --- /dev/null +++ b/sw/qa/uitest/writer_tests2/tdf116474.py @@ -0,0 +1,47 @@ +# -*- 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_url_for_data_file + +#Bug 116474 - Undo/redo: The redo of adding caption to an image isn't working: no image + +class tdf116474(UITestCase): + + def test_tdf116474_insert_caption_undo(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + 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]) + + with self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") as xDialogCaption: + + xCapt = xDialogCaption.getChild("caption_edit") + xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption"})) + + + 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 + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests2/tdf146375.py b/sw/qa/uitest/writer_tests2/tdf146375.py new file mode 100644 index 000000000..e22e6c4d3 --- /dev/null +++ b/sw/qa/uitest/writer_tests2/tdf146375.py @@ -0,0 +1,76 @@ +# -*- 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.uihelper.common import get_state_as_dict, select_by_text +from libreoffice.uno.propertyvalue import mkPropertyValues +import random +import string + +class Tdf146375(UITestCase): + + def test_tdf146375(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + + count = 0 + # Use a random name + categoryName = ''.join(random.choice(string.ascii_lowercase) for i in range(15)) + renamedCategory = categoryName + "-renamed" + + with self.ui_test.execute_dialog_through_command(".uno:NewDoc", close_button="close") as xDialog: + xFilterFolder = xDialog.getChild("filter_folder") + self.assertEqual("All Categories", get_state_as_dict(xFilterFolder)["SelectEntryText"]) + count = int(get_state_as_dict(xFilterFolder)["EntryCount"]) + + xActionMenu = xDialog.getChild("action_menu") + + # Create a new category + with self.ui_test.execute_blocking_action( + xActionMenu.executeAction, args=('OPENFROMLIST', mkPropertyValues({"POS": "0"}))) as xNameDialog: + xEntry = xNameDialog.getChild("entry") + xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xEntry.executeAction("TYPE", mkPropertyValues({"TEXT": categoryName})) + + self.assertEqual(count + 1, int(get_state_as_dict(xFilterFolder)["EntryCount"])) + + select_by_text(xFilterFolder, categoryName) + self.assertEqual(categoryName, get_state_as_dict(xFilterFolder)["SelectEntryText"]) + + # Rename the category + with self.ui_test.execute_blocking_action( + xActionMenu.executeAction, args=('OPENFROMLIST', mkPropertyValues({"POS": "1"}))) as xNameDialog: + xEntry = xNameDialog.getChild("entry") + xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xEntry.executeAction("TYPE", mkPropertyValues({"TEXT": renamedCategory})) + + self.assertEqual(count + 1, int(get_state_as_dict(xFilterFolder)["EntryCount"])) + self.assertEqual(renamedCategory, get_state_as_dict(xFilterFolder)["SelectEntryText"]) + + with self.ui_test.execute_dialog_through_command(".uno:NewDoc", close_button="close") as xDialog: + xFilterFolder = xDialog.getChild("filter_folder") + self.assertEqual(count + 1, int(get_state_as_dict(xFilterFolder)["EntryCount"])) + + select_by_text(xFilterFolder, renamedCategory) + + # Without the fix in place, this test would have failed with + # AssertionError: 'zwpyzgwuwleanap-renamed' != 'All Categories' + self.assertEqual(renamedCategory, get_state_as_dict(xFilterFolder)["SelectEntryText"]) + + xActionMenu = xDialog.getChild("action_menu") + + # Delete the category + with self.ui_test.execute_blocking_action( + xActionMenu.executeAction, args=('OPENFROMLIST', mkPropertyValues({"POS": "2"})), close_button="yes") as xNameDialog: + pass + + self.assertEqual(count, int(get_state_as_dict(xFilterFolder)["EntryCount"])) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/autoredactDialog.py b/sw/qa/uitest/writer_tests3/autoredactDialog.py new file mode 100644 index 000000000..8acc33e46 --- /dev/null +++ b/sw/qa/uitest/writer_tests3/autoredactDialog.py @@ -0,0 +1,153 @@ +# -*- 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.uihelper.common import get_state_as_dict +from uitest.uihelper.common import type_text +from uitest.uihelper.common import select_pos +import re + +class AutoRedactDialog(UITestCase): + + add_target_counter = 0 + + def getText(self, xObj): + return get_state_as_dict(xObj)["Text"] + + def parseTargetContent(self, xObj): + return re.split(r'\t+', self.getText(xObj)) + + def clearTargetsbox(self, xDialog): + xTargetsListbox = xDialog.getChild("targets") + xDeleteBtn = xDialog.getChild("delete") + + child_count = len(xTargetsListbox.getChildren()) + + if child_count < 1: + return + + for i in range(0, child_count): + child = xTargetsListbox.getChild(0) + child.executeAction("SELECT", tuple()) + xDeleteBtn.executeAction("CLICK", tuple()) + + # Verify + self.assertEqual(len(xTargetsListbox.getChildren()), 0) + + def test_add_target(self): + with self.ui_test.create_doc_in_start_center("writer"): + with self.ui_test.execute_dialog_through_command(".uno:AutoRedactDoc", close_button="cancel") as xDialog: + xAddBtn = xDialog.getChild("add") + + # Make sure we are starting with an empty targets list + self.clearTargetsbox(xDialog) + + # Names need to be distinct + # ["target name", "target content"], + targets_list = [ + ["target1", "content1"], + ["target2", "content2"], + ["target3", "content3"], + ] + + for i in range(0, len(targets_list)): + self.add_target_counter = i + with self.ui_test.execute_blocking_action(xAddBtn.executeAction, args=('CLICK', ()), close_button="close") as dialog: + xNewNameTxt=dialog.getChild("name") + xNewContentTxt=dialog.getChild("content") + xTypeList = dialog.getChild("type") #0: Text, 1: Regex, 2: Predefined + + select_pos(xTypeList, "0") #Text + self.assertEqual(int(get_state_as_dict(xTypeList)["SelectEntryPos"]), 0) + + type_text(xNewNameTxt, targets_list[self.add_target_counter][0]) + type_text(xNewContentTxt, targets_list[self.add_target_counter][1]) + + # Make sure targets are added successfully + xTargetsListbox = xDialog.getChild("targets") + targets_box_state_dict = get_state_as_dict(xTargetsListbox) + self.assertEqual(int(targets_box_state_dict["Children"]), len(targets_list)) + + # Make sure targets are added with correct names and contents + for i in range(0, len(targets_list)): + child = xTargetsListbox.getChild(i) + child_text = self.parseTargetContent(child) + self.assertEqual(child_text[0], targets_list[i][0]) #name + self.assertEqual(child_text[2], targets_list[i][1]) #content + + # Now let's make sure the dialog remembers last state + with self.ui_test.execute_dialog_through_command(".uno:AutoRedactDoc", close_button="cancel") as xDialog: + xTargetsListbox = xDialog.getChild("targets") + targets_box_state_dict = get_state_as_dict(xTargetsListbox) + self.assertEqual(int(targets_box_state_dict["Children"]), len(targets_list)) + + # Make sure targets are remembered with correct names and contents + for i in range(0, len(targets_list)): + child = xTargetsListbox.getChild(i) + child_text = self.parseTargetContent(child) + self.assertEqual(child_text[0], targets_list[i][0]) #name + self.assertEqual(child_text[2], targets_list[i][1]) #content + + + + def test_edit_target(self): + with self.ui_test.create_doc_in_start_center("writer"): + with self.ui_test.execute_dialog_through_command(".uno:AutoRedactDoc", close_button="cancel") as xDialog: + xAddBtn = xDialog.getChild("add") + xEditBtn = xDialog.getChild("edit") + + # Make sure we are starting with an empty targets list + self.clearTargetsbox(xDialog) + + # We first need to add a target so that we can edit it + with self.ui_test.execute_blocking_action(xAddBtn.executeAction, args=('CLICK', ()), close_button="close") as dialog: + xNewNameTxt=dialog.getChild("name") + xNewContentTxt=dialog.getChild("content") + xTypeList = dialog.getChild("type") #0: Text, 1: Regex, 2: Predefined + + select_pos(xTypeList, "0") #Text + self.assertEqual(int(get_state_as_dict(xTypeList)["SelectEntryPos"]), 0) + + type_text(xNewNameTxt, "TestTarget") + type_text(xNewContentTxt, "TestContent") + + # Make sure target is added successfully + xTargetsListbox = xDialog.getChild("targets") + targets_box_state_dict = get_state_as_dict(xTargetsListbox) + self.assertEqual(int(targets_box_state_dict["Children"]), 1) + + # Select the added target + target_entry = xTargetsListbox.getChild(0) + target_entry.executeAction("SELECT", tuple()) + + # Now edit the target + with self.ui_test.execute_blocking_action(xEditBtn.executeAction, args=('CLICK', ()), close_button="close") as dialog: + xNameTxt=dialog.getChild("name") + xContentTxt=dialog.getChild("content") + + xNameTxt.executeAction("CLEAR", tuple()) + xContentTxt.executeAction("CLEAR", tuple()) + + type_text(xNameTxt, "TestTargetEdited") + type_text(xContentTxt, "TestContentEdited") + + # Make sure target is still there + xTargetsListbox = xDialog.getChild("targets") + targets_box_state_dict = get_state_as_dict(xTargetsListbox) + self.assertEqual(int(targets_box_state_dict["Children"]), 1) + + # Make sure target has the new values + target_entry = xTargetsListbox.getChild(0) + target_text = self.parseTargetContent(target_entry) + self.assertEqual(target_text[0], "TestTargetEdited") #name + self.assertEqual(target_text[2], "TestContentEdited") #content + + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/customizeDialog.py b/sw/qa/uitest/writer_tests3/customizeDialog.py new file mode 100644 index 000000000..982c1cef7 --- /dev/null +++ b/sw/qa/uitest/writer_tests3/customizeDialog.py @@ -0,0 +1,115 @@ +# -*- 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/. +# + +import time + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos + +class ConfigureDialog(UITestCase): + + def test_open_ConfigureDialog_writer(self): + + with self.ui_test.create_doc_in_start_center("writer"): + with self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog", close_button="cancel"): + pass + + + def test_search_filter(self): + with self.ui_test.create_doc_in_start_center("writer"): + with self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog", close_button="cancel") as xDialog: + + xfunc = xDialog.getChild("functions") + xSearch = xDialog.getChild("searchEntry") + + initialEntryCount = get_state_as_dict(xfunc)["Children"] + self.assertTrue(initialEntryCount != 0) + + xSearch.executeAction("TYPE", mkPropertyValues({"TEXT":"format"})) + + # Wait for the search/filter op to be completed + timeout = time.time() + 1 + while time.time() < timeout: + filteredEntryCount = get_state_as_dict(xfunc)["Children"] + if filteredEntryCount != initialEntryCount: + break + time.sleep(0.1) + + self.assertTrue(filteredEntryCount < initialEntryCount) + + xSearch.executeAction("CLEAR", tuple()) + + # Wait for the search/filter op to be completed + timeout = time.time() + 1 + while time.time() < timeout: + finalEntryCount = get_state_as_dict(xfunc)["Children"] + if finalEntryCount != filteredEntryCount: + break + time.sleep(0.1) + + self.assertEqual(initialEntryCount, finalEntryCount) + + + + + def test_category_listbox(self): + with self.ui_test.create_doc_in_start_center("writer"): + with self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog", close_button="cancel") as xDialog: + + xFunc = xDialog.getChild("functions") + xCategory = xDialog.getChild("commandcategorylist") + + initialEntryCount = get_state_as_dict(xFunc)["Children"] + self.assertTrue(initialEntryCount != 0) + + select_pos(xCategory, "1") + filteredEntryCount = get_state_as_dict(xFunc)["Children"] + self.assertTrue(filteredEntryCount < initialEntryCount) + + select_pos(xCategory, "0") + finalEntryCount = get_state_as_dict(xFunc)["Children"] + self.assertEqual(initialEntryCount, finalEntryCount) + + + + def test_tdf133862(self): + with self.ui_test.create_doc_in_start_center("writer"): + + self.xUITest.executeCommand(".uno:InsertObjectStarMath") + + # Without the fix in place, calling customize dialog after inserting + # a formula object would crash + with self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog", close_button="cancel"): + pass + + + def test_gear_button_menu(self): + with self.ui_test.create_doc_in_start_center("writer"): + + with self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog", close_button="cancel") as xDialog: + + # Open the New Menu Dialog with id = 0 + xmenugearbtn=xDialog.getChild("menugearbtn") + def show_dialog0(): + xmenugearbtn.executeAction("OPENFROMLIST", mkPropertyValues({"POS": "0" })) + with self.ui_test.execute_blocking_action( action=show_dialog0, close_button="cancel"): + pass + + # Open the Rename Menu Dialog with id = 2 + xmenugearbtn=xDialog.getChild("menugearbtn") + def show_dialog2(): + xmenugearbtn.executeAction("OPENFROMLIST", mkPropertyValues({"POS": "2"})) + with self.ui_test.execute_blocking_action( action=show_dialog2, close_button="cancel"): + pass + + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/goToPage.py b/sw/qa/uitest/writer_tests3/goToPage.py new file mode 100644 index 000000000..4b763eeca --- /dev/null +++ b/sw/qa/uitest/writer_tests3/goToPage.py @@ -0,0 +1,39 @@ +# -*- 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, get_url_for_data_file + +class GoToPage_dialog(UITestCase): + + def test_go_to_page(self): + with self.ui_test.load_file(get_url_for_data_file("3pages.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + with self.ui_test.execute_dialog_through_command(".uno:GotoPage") as xDialog: + xPageText = xDialog.getChild("page") + xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) + + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") + + with self.ui_test.execute_dialog_through_command(".uno:GotoPage") as xDialog: + xPageText = xDialog.getChild("page") + xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"3a"})) + + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3") + + # check cancel button + with self.ui_test.execute_dialog_through_command(".uno:GotoPage", close_button="cancel"): + pass + + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3") + +# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file diff --git a/sw/qa/uitest/writer_tests3/hyperlinkdialog.py b/sw/qa/uitest/writer_tests3/hyperlinkdialog.py new file mode 100644 index 000000000..c737f33ad --- /dev/null +++ b/sw/qa/uitest/writer_tests3/hyperlinkdialog.py @@ -0,0 +1,124 @@ +# -*- 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 os +import re +from uitest.uihelper.common import get_state_as_dict, select_pos +from libreoffice.uno.propertyvalue import mkPropertyValues + +#test Hyperlink dialog +class HyperlinkDialog(UITestCase): + + def test_hyperlink_dialog_vertical_tab(self): + + with self.ui_test.create_doc_in_start_center("writer"): + MainWindow = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog", close_button="cancel") as xDialog: + + # Test the vertical tab + xtab=xDialog.getChild("tabcontrol") + self.assertEqual(get_state_as_dict(xtab)["PageCount"], "4") + + select_pos(xtab, "0") + self.assertEqual(get_state_as_dict(xtab)["CurrPageTitel"], "~Internet") + self.assertEqual(get_state_as_dict(xtab)["CurrPagePos"], "0") + + select_pos(xtab, "1") + self.assertEqual(get_state_as_dict(xtab)["CurrPageTitel"], "~Mail") + self.assertEqual(get_state_as_dict(xtab)["CurrPagePos"], "1") + + select_pos(xtab, "2") + self.assertEqual(get_state_as_dict(xtab)["CurrPageTitel"], "~Document") + self.assertEqual(get_state_as_dict(xtab)["CurrPagePos"], "2") + + select_pos(xtab, "3") + self.assertEqual(get_state_as_dict(xtab)["CurrPageTitel"], "~New Document") + self.assertEqual(get_state_as_dict(xtab)["CurrPagePos"], "3") + + + + def test_insert_hyperlink(self): + + with self.ui_test.create_doc_in_start_center("writer"): + xMainWindow = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog") as xDialog: + + # insert link + xtab=xDialog.getChild("tabcontrol") + select_pos(xtab, "0") + + xtarget = xDialog.getChild("target") + xtarget.executeAction("TYPE", mkPropertyValues({"TEXT": "http://www.libreoffice.org/"})) + self.assertEqual(get_state_as_dict(xtarget)["Text"], "http://www.libreoffice.org/") + + xindication = xDialog.getChild("indication") + xindication.executeAction("TYPE", mkPropertyValues({"TEXT": "link"})) + self.assertEqual(get_state_as_dict(xindication)["Text"], "link") + + + # Check that the link is added + xMainWindow = self.xUITest.getTopFocusWindow() + xedit = xMainWindow.getChild("writer_edit") + xedit.executeAction("SELECT", mkPropertyValues({"START_POS": "0", "END_POS": "4"})) + self.assertEqual(get_state_as_dict(xedit)["SelectedText"], "link") + + + def test_insert_hyperlink_without_scheme(self): + + with self.ui_test.create_doc_in_start_center("writer"): + xMainWindow = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog") as xDialog: + + # insert link + xtab=xDialog.getChild("tabcontrol") + select_pos(xtab, "0") + + xtarget = xDialog.getChild("target") + xtarget.executeAction("TYPE", mkPropertyValues({"TEXT": "www.libreoffice.org:80"})) + + # Check that the link is added with http scheme + xMainWindow = self.xUITest.getTopFocusWindow() + xedit = xMainWindow.getChild("writer_edit") + xedit.executeAction("SELECT", mkPropertyValues({"START_POS": "0", "END_POS": "29"})) + self.assertEqual(get_state_as_dict(xedit)["SelectedText"], "http://www.libreoffice.org:80") + + + def test_tdf141166(self): + # Skip this test for --with-help=html and --with-help=online, as that would fail with a + # DialogNotExecutedException("did not execute a dialog for a blocking action") thrown from + # the below execute_blocking_action call (and would leave behind the relevant HTML page + # opened in the user's default browser): + if os.getenv('ENABLE_HTMLHELP') == 'TRUE': + return + # Skip this test for --enable-xmlhelp, as that would fail with a + # "uno.com.sun.star.uno.RuntimeException: Could not find child with id: cancel" thrown from + # the below execute_blocking_action call, as it would open the "LibreOffice Help" window + # instead of the apparently expected "LibreOffice Help Not Installed" dialog that has a + # "Cancel" button: + if re.compile(r'XMLHELP\b').search(os.getenv('BUILD_TYPE')): + return + + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + with self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog", close_button="") as xDialog: + xHelp = xDialog.getChild("help") + xHelp.executeAction('FOCUS', tuple()) + + # Without the fix in place, this test would have crashed here + with self.ui_test.execute_blocking_action(xHelp.executeAction, + args=("CLICK", tuple()), close_button="cancel"): + pass + +# 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..46226499d --- /dev/null +++ b/sw/qa/uitest/writer_tests3/insertEndnote.py @@ -0,0 +1,36 @@ +# -*- 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.uihelper.common import type_text + +class insertEndnote(UITestCase): + + def test_insert_endnote(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + 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") + +# 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..0a91780a1 --- /dev/null +++ b/sw/qa/uitest/writer_tests3/insertEnvelope.py @@ -0,0 +1,39 @@ +# -*- 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 + +#envaddresspage.ui + +class WriterInsertEnvelope(UITestCase): + + def test_insert_envelope(self): + with self.ui_test.create_doc_in_start_center("writer"): + with self.ui_test.execute_dialog_through_command(".uno:InsertEnvelope", close_button="user") as xDialog: + 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"})) + + with self.ui_test.execute_dialog_through_command(".uno:InsertEnvelope", close_button="cancel") as xDialog: + 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") + +# 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..f2fbc3559 --- /dev/null +++ b/sw/qa/uitest/writer_tests3/insertFootEndnote.py @@ -0,0 +1,63 @@ +# -*- 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 + +class insertFootEndnote(UITestCase): + + def test_insert_foot_endnote(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + +#Automatic - Footnote + with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog"): + pass + + self.assertEqual(document.Footnotes.getCount(), 1) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Footnotes.getCount(), 0) +#Automatic - Endnote + with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") as xDialog: + xEndnote = xDialog.getChild("endnote") + xEndnote.executeAction("CLICK", tuple()) + + self.assertEqual(document.Endnotes.getCount(), 1) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Endnotes.getCount(), 0) +#Character - Footnote + with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") as xDialog: + xChar = xDialog.getChild("character") + xChar.executeAction("CLICK", tuple()) + xCharentry = xDialog.getChild("characterentry") + xCharentry.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) + + self.assertEqual(document.Footnotes.getCount(), 1) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Footnotes.getCount(), 0) + +#Character - Endnote + with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") as xDialog: + 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()) + + self.assertEqual(document.Endnotes.getCount(), 1) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Endnotes.getCount(), 0) + +#Cancel button + with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog", close_button="cancel"): + pass + +# 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..3a5c6a13e --- /dev/null +++ b/sw/qa/uitest/writer_tests3/insertPageFooter.py @@ -0,0 +1,64 @@ +# -*- 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 + +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) + + with self.ui_test.execute_dialog_through_command( + ".uno:InsertPageFooter?PageStyle:string=Default%20Page%20Style&On:bool=false", close_button="yes"): + pass + + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FooterIsOn, False) + + def test_footer(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + + self.insert_footer() + + self.delete_footer() + + + def test_tdf107427(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + + self.insert_footer() + + with self.ui_test.execute_dialog_through_command(".uno:InsertTable"): + pass + + + 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() + +# 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..5895211af --- /dev/null +++ b/sw/qa/uitest/writer_tests3/insertQrCodeGen.py @@ -0,0 +1,37 @@ +# -*- 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.uihelper.common import type_text + +class insertQrCode(UITestCase): + + def test_insert_qr_code(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") as xDialog: + + # 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_margin") + + type_text(xURL, "www.libreoffice.org") #set the QR code + xECC_Low.executeAction("CLICK", tuple()) + xBorder.executeAction("UP", tuple()) + xBorder.executeAction("DOWN", tuple()) + + # check the QR code in the document + element = document.DrawPage.getByIndex(0) + self.assertEqual(element.BarCodeProperties.Payload, "www.libreoffice.org") + self.assertEqual(element.BarCodeProperties.ErrorCorrection, 1) + self.assertEqual(element.BarCodeProperties.Border, 1) + +# 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..0082891da --- /dev/null +++ b/sw/qa/uitest/writer_tests3/insertSignatureLine.py @@ -0,0 +1,44 @@ +# -*- 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 + +class insertSignatureLine(UITestCase): + + def test_insert_signature_line(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + + # set the signature line + with self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine") as xDialog: + + 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"})) + + #check the signature Line in the document + element = document.DrawPage.getByIndex(0) + self.assertEqual(element.SignatureLineSuggestedSignerName, "Name") + self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title") + self.assertEqual(element.SignatureLineSuggestedSignerEmail, "Email") + self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title") + self.assertEqual(element.SignatureLineCanAddComment, False) + self.assertEqual(element.SignatureLineShowSignDate, True) + self.assertEqual(element.SignatureLineSigningInstructions, "Instructions") + +# 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..ddcd0a583 --- /dev/null +++ b/sw/qa/uitest/writer_tests3/lineNumbering.py @@ -0,0 +1,89 @@ +# -*- 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 select_by_text +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import change_measurement_unit + +class WriterLineNumbering(UITestCase): + + def test_line_numbering_dialog(self): + with self.ui_test.create_doc_in_start_center("writer"): + + change_measurement_unit(self, "Centimeter") + + with self.ui_test.execute_dialog_through_command(".uno:LineNumberingDialog") as xDialog: + 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()) + select_by_text(xstyledropdown, "Bullets") + select_by_text(xformatdropdown, "A, B, C, ...") + select_by_text(xpositiondropdown, "Right") + 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()) + + with self.ui_test.execute_dialog_through_command(".uno:LineNumberingDialog", close_button="cancel") as xDialog: + 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") + + def test_tdf86185(self): + with self.ui_test.create_doc_in_start_center("writer"): + + with self.ui_test.execute_dialog_through_command(".uno:LineNumberingDialog", close_button="cancel") as xDialog: + 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): + select_by_text(xformatdropdown, itemFormat[i]) + self.assertEqual(get_state_as_dict(xformatdropdown)["SelectEntryText"], itemFormat[i]) +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/pageDialog.py b/sw/qa/uitest/writer_tests3/pageDialog.py new file mode 100644 index 000000000..18bc1c999 --- /dev/null +++ b/sw/qa/uitest/writer_tests3/pageDialog.py @@ -0,0 +1,216 @@ +# -*- 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.uihelper.common import select_pos, get_state_as_dict +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 + + +class WriterPageDialog(UITestCase): + + def click_button(self, dialog, button): + xButton = dialog.getChild(button) + xButton.executeAction("CLICK", tuple()) + + def check_default_area(self, btn): + document = self.ui_test.get_component() + if btn == 'btnnone': + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.BackColor, -1) + elif btn == 'btncolor': + self.assertEqual( + hex(document.StyleFamilies.PageStyles.Standard.BackColor), '0x729fcf') + self.assertEqual( + hex(document.StyleFamilies.PageStyles.Standard.FillColor), '0x729fcf') + self.assertEqual( + hex(document.StyleFamilies.PageStyles.Standard.FillColor), '0x729fcf') + elif btn == 'btngradient': + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillGradient.Style, LINEAR) + self.assertEqual( + hex(document.StyleFamilies.PageStyles.Standard.FillGradient.StartColor), '0xdde8cb') + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillGradient.Angle, 300) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillGradient.Border, 0) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillGradient.XOffset, 0) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillGradient.YOffset, 0) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillGradient.StartIntensity, 100) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillGradient.EndIntensity, 100) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillGradientName, 'Pastel Bouquet') + elif btn == 'btnhatch': + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillHatch.Style, SINGLE ) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillHatch.Color, 0) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillHatch.Distance, 102) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillHatch.Angle, 0) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillHatchName, 'Black 0 Degrees') + elif btn == 'btnbitmap': + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillBitmapMode, REPEAT) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillBitmapPositionOffsetX, 0) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillBitmapPositionOffsetY, 0) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillBitmapRectanglePoint, MIDDLE_MIDDLE) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillBitmapStretch, False) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillBitmapTile, True) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillBitmapOffsetX, 0) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillBitmapOffsetY, 0) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillBitmapLogicalSize, True) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillBitmapSizeX, 0) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillBitmapSizeY, 0) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillBitmapName, 'Painted White') + elif btn == 'btnpattern': + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillBitmapMode, REPEAT) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillBitmapPositionOffsetX, 0) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillBitmapPositionOffsetY, 0) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillBitmapRectanglePoint, MIDDLE_MIDDLE) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillBitmapStretch, False) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillBitmapTile, True) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillBitmapOffsetX, 0) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillBitmapOffsetY, 0) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillBitmapLogicalSize, True) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillBitmapSizeX, 0) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillBitmapSizeY, 0) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.FillBitmapName, '5 Percent') + + def test_area_tab(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + buttons = ['btnbitmap', 'btncolor', 'btngradient', 'btnhatch', 'btnpattern'] + for index, button in enumerate(buttons): + + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "2") + self.click_button(xDialog, button) + + self.check_default_area(button) + + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "2") + + self.click_button(xDialog, 'btnnone') + + self.check_default_area('btnnone') + + + def test_paper_format(self): + + lPaperFormat = ["A6", "A5", "A4", "A3", "B6 (ISO)", "B5 (ISO)", "B4 (ISO)", "Letter", + "Legal", "Long Bond", "Tabloid", "B6 (JIS)", "B5 (JIS)", "B4 (JIS)", "16 Kai", + "32 Kai", "Big 32 Kai", "User", "DL Envelope", "C6 Envelope", "C6/5 Envelope", + "C5 Envelope", "C4 Envelope", "#6¾ Envelope", "#7¾ (Monarch) Envelope", + "#9 Envelope", "#10 Envelope", "#11 Envelope", "#12 Envelope", "Japanese Postcard"] + + with self.ui_test.create_doc_in_start_center("writer"): + + for i in range(30): + with self.subTest(i=i): + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + xFormatList = xDialog.getChild("comboPageFormat") + select_pos(xFormatList, str(i)) + + self.assertEqual( + get_state_as_dict(xFormatList)["SelectEntryText"], lPaperFormat[i]) + + + def test_orientation(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.IsLandscape, False) + + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + self.click_button(xDialog, 'radiobuttonLandscape') + + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.IsLandscape, True) + + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + self.click_button(xDialog, 'radiobuttonPortrait') + + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.IsLandscape, False) + + + def test_text_direction(self): + + lTextDirection = ['Left-to-right (horizontal)', 'Right-to-left (horizontal)', + 'Right-to-left (vertical)', 'Left-to-right (vertical)'] + + with self.ui_test.create_doc_in_start_center("writer") as document: + + for i in range(4): + with self.subTest(i=i): + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + xTextDirectionList = xDialog.getChild("comboTextFlowBox") + select_pos(xTextDirectionList, str(i)) + + self.assertEqual( + get_state_as_dict(xTextDirectionList)["SelectEntryText"], lTextDirection[i]) + + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.WritingMode, i) + + + def test_cancel_button_page_dialog(self): + with self.ui_test.create_doc_in_start_center("writer"): + + with self.ui_test.execute_dialog_through_command(".uno:PageDialog", close_button="cancel") as xDialog: + pass + + +# 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..aafe7a00c --- /dev/null +++ b/sw/qa/uitest/writer_tests3/sort.py @@ -0,0 +1,61 @@ +# -*- 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 select_by_text +from uitest.uihelper.common import type_text + +class WriterSort(UITestCase): + + def test_sort(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + 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") + + self.xUITest.executeCommand(".uno:SelectAll") #select whole text + #Tools - Sort + with self.ui_test.execute_dialog_through_command(".uno:SortDialog") as xDialog: + xDown = xDialog.getChild("down1") + xDown.executeAction("CLICK", tuple()) + #check + self.assertEqual(document.Text.String[0:1], "v") + + + def test_sort_numerical(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + 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") + + self.xUITest.executeCommand(".uno:SelectAll") #select whole text + #Tools - Sort + with self.ui_test.execute_dialog_through_command(".uno:SortDialog") as xDialog: + xDown = xDialog.getChild("down1") + xcolsb1 = xDialog.getChild("colsb1") + xtypelb1 = xDialog.getChild("typelb1") + xcharacter = xDialog.getChild("character") + xseparator = xDialog.getChild("separator") + xDown.executeAction("CLICK", tuple()) + select_by_text(xtypelb1, "Numerical") + xcharacter.executeAction("CLICK", tuple()) + xseparator.executeAction("TYPE", mkPropertyValues({"TEXT":";"})) + #check + self.assertEqual(document.Text.String[0:5], "2;8;3") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/specialCharacter.py b/sw/qa/uitest/writer_tests3/specialCharacter.py new file mode 100644 index 000000000..c9e4299f2 --- /dev/null +++ b/sw/qa/uitest/writer_tests3/specialCharacter.py @@ -0,0 +1,100 @@ +# -*- 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.uihelper.common import select_pos + +# specialcharacters.ui +class specialCharacter(UITestCase): + + def test_tdf56363(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + + # Insert a font including a font feature into the font name combobox + xFontName = xWriterDoc.getChild("fontnamecombobox") + fontName = get_state_as_dict(xFontName)["Text"] + xFontName.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"})) + xFontName.executeAction("TYPE", mkPropertyValues({"TEXT": fontName + ":smcp"})) + xFontName.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + + # Open special character dialog and check selected font name + with self.ui_test.execute_dialog_through_command(".uno:InsertSymbol", close_button="cancel") as xDialog: + xComboFont = xDialog.getChild("fontlb") + # Without the fix in place, no font would be selected + self.assertEqual(get_state_as_dict(xComboFont)["Text"], fontName) + + def test_special_character(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + + xWriterDoc = self.xUITest.getTopFocusWindow() + + + with self.ui_test.execute_dialog_through_command(".uno:InsertSymbol", close_button="cancel") as xDialog: + 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") + + + with self.ui_test.execute_dialog_through_command(".uno:InsertSymbol", close_button="cancel") as xDialog: + + 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 + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/tdf79236.py b/sw/qa/uitest/writer_tests3/tdf79236.py new file mode 100644 index 000000000..c8e857188 --- /dev/null +++ b/sw/qa/uitest/writer_tests3/tdf79236.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 uitest.uihelper.common import type_text + +class tdf79236(UITestCase): + + def test_paragraph(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + type_text(xWriterEdit, "Test for tdf79236") + + + self.xUITest.executeCommand(".uno:SelectAll") + + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 0) + + self.assertEqual(document.CurrentSelection.getByIndex(0).String, "Test for tdf79236") + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xParagraphDlg: + + + + xLeftSpnBtn = xParagraphDlg.getChild("spinED_LEFTINDENT") + for _ in range(0,20): + xLeftSpnBtn.executeAction("UP", tuple()) + + xRightSpnBtn = xParagraphDlg.getChild("spinED_RIGHTINDENT") + for _ in range(0,20): + xRightSpnBtn.executeAction("UP", tuple()) + + + xLineSpnBtn = xParagraphDlg.getChild("spinED_FLINEINDENT") + for _ in range(0,20): + xLineSpnBtn.executeAction("UP", tuple()) + + + xBottomSpnBtn = xParagraphDlg.getChild("spinED_BOTTOMDIST") + for _ in range(0,20): + xBottomSpnBtn.executeAction("UP", tuple()) + + xTopSpnBtn = xParagraphDlg.getChild("spinED_TOPDIST") + for _ in range(0,20): + xTopSpnBtn.executeAction("UP", tuple()) + + + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 3704) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 3704) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 5503) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 5503) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 3704) + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xParagraphDlg: + + + xLeftSpnBtn = xParagraphDlg.getChild("spinED_LEFTINDENT") + for _ in range(0,20): + xLeftSpnBtn.executeAction("DOWN", tuple()) + + xRightSpnBtn = xParagraphDlg.getChild("spinED_RIGHTINDENT") + for _ in range(0,20): + xRightSpnBtn.executeAction("DOWN", tuple()) + + + xLineSpnBtn = xParagraphDlg.getChild("spinED_FLINEINDENT") + for _ in range(0,20): + xLineSpnBtn.executeAction("DOWN", tuple()) + + xBottomSpnBtn = xParagraphDlg.getChild("spinED_BOTTOMDIST") + for _ in range(0,20): + xBottomSpnBtn.executeAction("DOWN", tuple()) + + xTopSpnBtn = xParagraphDlg.getChild("spinED_TOPDIST") + for _ in range(0,20): + xTopSpnBtn.executeAction("DOWN", tuple()) + + + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 0) + + self.xUITest.executeCommand(".uno:Undo") + + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 3704) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 3704) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 5503) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 5503) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 3704) + + self.xUITest.executeCommand(".uno:Undo") + + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 0) + + self.assertEqual(document.CurrentSelection.getByIndex(0).String, "Test for tdf79236") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/exportToPDF.py b/sw/qa/uitest/writer_tests4/exportToPDF.py new file mode 100644 index 000000000..e88255948 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/exportToPDF.py @@ -0,0 +1,76 @@ +# -*- 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.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import type_text +from libreoffice.uno.propertyvalue import mkPropertyValues +from org.libreoffice.unotest import systemPathToFileUrl +from tempfile import TemporaryDirectory +import os.path + +class exportToPDF(UITestCase): + + def test_checkDefaultValues(self): + + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, 'exportToPDFFromWriter-tmp.pdf') + + with self.ui_test.create_doc_in_start_center("writer"): + + xMainWindow = self.xUITest.getTopFocusWindow() + xEdit = xMainWindow.getChild("writer_edit") + + type_text(xEdit, "Hello World") + + # Export as PDF + with self.ui_test.execute_dialog_through_command('.uno:ExportToPDF', close_button="") as xDialog: + + selectedChildren = ['bookmarks', 'display', 'effects', 'enablea11y', 'enablecopy', 'exporturl', 'forms', 'reduceresolution'] + + for child in selectedChildren: + self.assertEqual("true", get_state_as_dict(xDialog.getChild(child))['Selected']) + + nonSelectedChildren = ['allowdups', 'center', 'comments', 'convert', 'embed', 'emptypages', 'export', 'exportplaceholders', + 'firstonleft', 'hiddenpages', 'menubar', 'notes', 'onlynotes', 'open', 'pdfa', 'pdfua', 'resize', 'singlepagesheets', + 'tagged', 'toolbar', 'usereferencexobject', 'viewpdf', 'watermark', 'window'] + + for child in nonSelectedChildren: + self.assertEqual("false", get_state_as_dict(xDialog.getChild(child))['Selected']) + + checkedChildren = ['all', 'allbookmarks', 'changeany', 'default', 'defaultlayout', 'fitdefault', 'jpegcompress', 'pageonly', 'printhigh'] + + for child in checkedChildren: + self.assertEqual("true", get_state_as_dict(xDialog.getChild(child))['Checked']) + + nonCheckedChildren = ['changecomment', 'changeform', 'changeinsdel', 'changenone', 'contfacinglayout', 'contlayout', 'fitvis', + 'fitwidth', 'fitwin', 'fitzoom', 'losslesscompress', 'openinternet', 'openpdf', 'outline', 'printlow', 'printnone', 'range', + 'selection', 'singlelayout', 'thumbs', 'visiblebookmark'] + + for child in nonCheckedChildren: + self.assertEqual("false", get_state_as_dict(xDialog.getChild(child))['Checked']) + + self.assertEqual("300 DPI", get_state_as_dict(xDialog.getChild("resolution"))['Text']) + self.assertEqual("90", get_state_as_dict(xDialog.getChild("quality"))['Value']) + self.assertEqual("FDF", get_state_as_dict(xDialog.getChild("format"))['DisplayText']) + + xOk = xDialog.getChild("ok") + with self.ui_test.execute_dialog_through_action(xOk, "CLICK", close_button="open") as xSaveDialog: + xFileName = xSaveDialog.getChild('file_name') + xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'CTRL+A'})) + xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'})) + xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath})) + + self.ui_test.wait_until_file_is_available(xFilePath) + + with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document: + + self.assertEqual("Hello World", document.DrawPages[0].getByIndex(0).String) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/insertBreakDialog.py b/sw/qa/uitest/writer_tests4/insertBreakDialog.py new file mode 100644 index 000000000..9299d46aa --- /dev/null +++ b/sw/qa/uitest/writer_tests4/insertBreakDialog.py @@ -0,0 +1,70 @@ +# -*- 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 select_pos + +class WriterInsertBreakDialog(UITestCase): + + def getPages(self, total): + document = self.ui_test.get_component() + + self.assertEqual(document.CurrentController.PageCount, total) + + def test_insert_line_break(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + with self.ui_test.execute_dialog_through_command(".uno:InsertBreak") as xDialog: + xOption = xDialog.getChild("linerb") + xOption.executeAction("CLICK", tuple()) + + self.getPages(1) + + + def test_insert_column_break(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + with self.ui_test.execute_dialog_through_command(".uno:InsertBreak") as xDialog: + xOption = xDialog.getChild("columnrb") + xOption.executeAction("CLICK", tuple()) + + self.getPages(1) + + + def test_insert_page_break(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + for i in range(9): + with self.subTest(i=i): + with self.ui_test.execute_dialog_through_command(".uno:InsertBreak") as xDialog: + + xOption = xDialog.getChild("pagerb") + xOption.executeAction("CLICK", tuple()) + + xStyleList = xDialog.getChild("stylelb") + select_pos(xStyleList, str(i)) + + self.getPages(i + 2) + + + def test_cancel_button_insert_line_break_dialog(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + with self.ui_test.execute_dialog_through_command(".uno:InsertBreak", close_button="cancel"): + pass + + self.getPages(1) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/insertPageHeader.py b/sw/qa/uitest/writer_tests4/insertPageHeader.py new file mode 100644 index 000000000..9da58db9a --- /dev/null +++ b/sw/qa/uitest/writer_tests4/insertPageHeader.py @@ -0,0 +1,78 @@ +# -*- 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.uihelper.common import get_url_for_data_file + +class WriterInsertPageHeader(UITestCase): + + def insert_header(self): + document = self.ui_test.get_component() + + 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) + + def delete_header(self): + document = self.ui_test.get_component() + + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.HeaderIsOn, True) + + with self.ui_test.execute_dialog_through_command( + ".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=false", close_button="yes"): + pass + + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.HeaderIsOn, False) + + def test_header(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + + self.insert_header() + + self.delete_header() + + + def test_tdf107427(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + + self.insert_header() + + with self.ui_test.execute_dialog_through_command(".uno:InsertTable"): + pass + + + tables = document.getTextTables() + self.assertEqual(len(tables[0].getRows()), 2) + self.assertEqual(len(tables[0].getColumns()), 2) + + self.xUITest.executeCommand(".uno:SelectAll") + + self.delete_header() + + def test_tdf146248(self): + with self.ui_test.load_file(get_url_for_data_file("tdf146248.docx")): + + self.delete_header() + + # crashed before + self.xUITest.executeCommand(".uno:Undo") + + document = self.ui_test.get_component() + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.HeaderIsOn, True) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/spellDialog.py b/sw/qa/uitest/writer_tests4/spellDialog.py new file mode 100644 index 000000000..4d2b4b622 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/spellDialog.py @@ -0,0 +1,141 @@ +# -*- 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/. +# + +import re +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +from libreoffice.linguistic.linguservice import get_spellchecker +from com.sun.star.lang import Locale + +class SpellingAndGrammarDialog(UITestCase): + + def is_supported_locale(self, language, country): + xSpellChecker = get_spellchecker(self.ui_test._xContext) + locales = xSpellChecker.getLocales() + for locale in locales: + if language != None: + if locale.Language != language: + continue + + if country != None: + if locale.Country != country: + continue + + # we found the correct combination + return True + + TDF46852_INPUT = """\ +dogg +dogg +catt dogg +frogg frogg +frogg catt dogg +dogg catt +frog, dogg, catt""" + + TDF46852_REGEX = """\ +([a-z]+) +\\1 +([a-z]+) \\1 +([a-z]+) \\3 +\\3 \\2 \\1 +\\1 \\2 +\\3, \\1, \\2""" + + def test_tdf46852(self): + supported_locale = self.is_supported_locale("en", "US") + if not supported_locale: + self.skipTest("no dictionary support for en_US available") + # This automates the steps described in the bug report tdf#46852 + + # Step 1: Create a document with repetitious misspelled words + with self.ui_test.create_doc_in_start_center("writer") as document: + cursor = document.getCurrentController().getViewCursor() + # Inserted text must be en_US, so make sure to set language in current location + cursor.CharLocale = Locale("en", "US", "") + input_text = self.TDF46852_INPUT.replace('\n', '\r') # \r = para break + document.Text.insertString(cursor, input_text, False) + + # Step 2: Place cursor on 4th line after second "frogg" + cursor.goUp(2, False) + cursor.goLeft(1, False) + + # Step 3: Initiate spellchecking, and make sure "Check grammar" is + # unchecked + with self.ui_test.execute_modeless_dialog_through_command(".uno:SpellingAndGrammarDialog", close_button="") as xDialog: + checkgrammar = xDialog.getChild('checkgrammar') + if get_state_as_dict(checkgrammar)['Selected'] == 'true': + checkgrammar.executeAction('CLICK', ()) + self.assertTrue(get_state_as_dict(checkgrammar)['Selected'] == 'false') + + # Step 4: Repetitively click on "Correct all" for each misspelling + # prompt until end of document is reached. + changeall = xDialog.getChild('changeall') + changeall.executeAction("CLICK", ()) + changeall.executeAction("CLICK", ()) + # The third time we click on changeall, the click action is going to + # block while two message boxes are shown, so we need to do this third + # click specially + # Use empty close_button to open consecutive dialogs + with self.ui_test.execute_blocking_action( + changeall.executeAction, args=('CLICK', ()), close_button="") as dialog: + # Step 5: Confirm to "Continue check at beginning of document" + xYesBtn = dialog.getChild("yes") + + with self.ui_test.execute_blocking_action( + xYesBtn.executeAction, args=('CLICK', ())): + pass + + output_text = document.Text.getString().replace('\r\n', '\n') + self.assertTrue(re.match(self.TDF46852_REGEX, output_text)) + + def test_tdf136855(self): + supported_locale = self.is_supported_locale("en", "US") + if not supported_locale: + self.skipTest("no dictionary support for en_US available") + + with self.ui_test.load_file(get_url_for_data_file("tdf136855.odt")) as writer_doc: + + with self.ui_test.execute_modeless_dialog_through_command(".uno:SpellingAndGrammarDialog", close_button="close") as xDialog: + + xChangeBtn = xDialog.getChild('change') + for i in range(6): + # Without the fix in place, this test would have crashed here + xChangeBtn.executeAction("CLICK", ()) + + output_text = writer_doc.Text.getString().replace('\n', '').replace('\r', '') + self.assertTrue(output_text.startswith("xx xx xx xxxxxxxxxxix xxxxxxxxxxxxxxviii")) + + def test_tdf66043(self): + supported_locale = self.is_supported_locale("en", "US") + if not supported_locale: + self.skipTest("no dictionary support for en_US available") + with self.ui_test.load_file(get_url_for_data_file("tdf66043.fodt")) as writer_doc: + # Step 1: Initiate spellchecking, and make sure "Check grammar" is + # unchecked + with self.ui_test.execute_modeless_dialog_through_command(".uno:SpellingAndGrammarDialog", close_button="close") as xDialog: + checkgrammar = xDialog.getChild('checkgrammar') + if get_state_as_dict(checkgrammar)['Selected'] == 'true': + checkgrammar.executeAction('CLICK', ()) + self.assertTrue(get_state_as_dict(checkgrammar)['Selected'] == 'false') + + # Step 2: Click on "Correct all" for each misspelling + # prompt until end of document is reached. + changeall = xDialog.getChild('changeall') + changeall.executeAction("CLICK", ()) + + output_text = writer_doc.Text.getString().replace('\r\n', '\n') + # This was "gooodgood baaad eeend" ("goood" is a deletion, + # "good" is an insertion by fixing the first misspelling), + # but now "goood" is not a misspelling because it is accepted + # correctly without the redline containing a deleted "o" + self.assertEqual(output_text, 'goood baaadbaaed eeend') + +# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file diff --git a/sw/qa/uitest/writer_tests4/start.py b/sw/qa/uitest/writer_tests4/start.py new file mode 100644 index 000000000..64d41ff02 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/start.py @@ -0,0 +1,49 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict + +class SimpleWriterTest(UITestCase): + + def test_start_writer(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + xWriterDoc = self.xUITest.getTopFocusWindow() + + xWriterEdit = xWriterDoc.getChild("writer_edit") + + xWriterEdit.executeAction("SET", mkPropertyValues({"ZOOM": "200"})) + + self.assertEqual(get_state_as_dict(xWriterEdit)["Zoom"], "200") + + + def test_goto_first_page(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + state = get_state_as_dict(xWriterEdit) + while state["CurrentPage"] == "1": + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + state = get_state_as_dict(xWriterEdit) + + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") + + xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "1"})) + + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1") + + +# 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..4278d2536 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf113252.py @@ -0,0 +1,37 @@ +# -*- 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.uihelper.common import get_state_as_dict +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): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + #Start LibreOffice. Go to Tools > Macros > Organize Macros > Basic + with self.ui_test.execute_dialog_through_command(".uno:MacroDialog", close_button="close") as xDialog: + + #Click Button Organizer + xorganize = xDialog.getChild("organize") + with self.ui_test.execute_blocking_action(xorganize.executeAction, args=('CLICK', ()), close_button="close") as dialog: + xTabs = dialog.getChild("tabcontrol") + select_pos(xTabs, "0") + select_pos(xTabs, "1") + select_pos(xTabs, "2") + #Click button Close in the next dialog -> crash. + + + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/tdf113284.py b/sw/qa/uitest/writer_tests4/tdf113284.py new file mode 100644 index 000000000..3f04b3ff6 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf113284.py @@ -0,0 +1,40 @@ +# -*- 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, get_url_for_data_file + +class tdf113284(UITestCase): + + def test_tdf113284(self): + with self.ui_test.load_file(get_url_for_data_file("tdf113284.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.processEventsToIdle() + + xPageCount = writer_doc.CurrentController.PageCount + with self.ui_test.execute_dialog_through_command(".uno:GotoPage") as xDialog: + xPageText = xDialog.getChild("page") + xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":str(xPageCount)})) # goto last page + + xToolkit.processEventsToIdle() + + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], str(xPageCount)) + with self.ui_test.execute_dialog_through_command(".uno:EditCurIndex", close_button="cancel"): + pass + + #page count is not constant + #self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "66") #page 66 start of the Index + #pagecount unchanged + self.assertEqual(writer_doc.CurrentController.PageCount, xPageCount) + +# 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..4c4f91e75 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf122449.py @@ -0,0 +1,43 @@ +# -*- 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, get_url_for_data_file + +#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): + with self.ui_test.load_file(get_url_for_data_file("tdf122449.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + #search word Autocorrect (second find) .uno:SearchDialog + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + + 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") + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "HOME"})) + # invoke Index dialog Index entry .uno:IndexEntryDialog + with self.ui_test.execute_dialog_through_command(".uno:IndexEntryDialog", close_button="close"): + pass + # close + # Go to page 2 + with self.ui_test.execute_dialog_through_command(".uno:GotoPage") as xDialog: + xPageText = xDialog.getChild("page") + xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) + # verify + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/tdf134439.py b/sw/qa/uitest/writer_tests4/tdf134439.py new file mode 100644 index 000000000..7348049d1 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf134439.py @@ -0,0 +1,54 @@ +# -*- 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.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_by_text +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf134439(UITestCase): + + def test_tdf134439(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf134439.odt")) as document: + + self.assertEqual(document.CurrentController.PageCount, 3) + + xCursor = document.CurrentController.ViewCursor + self.assertEqual("Chap 1", xCursor.PageStyleName) + + xPageBreak = self.ui_test.wait_until_child_is_available('PageBreak') + with self.ui_test.execute_dialog_through_action(xPageBreak, "EDIT") as xDialog: + + + self.assertEqual("Page", get_state_as_dict(xDialog.getChild("comboBreakType"))["SelectEntryText"]) + self.assertEqual("Before", get_state_as_dict(xDialog.getChild("comboBreakPosition"))["SelectEntryText"]) + + xPageStyle = xDialog.getChild("comboPageStyle") + self.assertEqual("Chap 2", get_state_as_dict(xPageStyle)["SelectEntryText"]) + + select_by_text(xPageStyle, "Chap 3") + + self.assertEqual("Chap 3", get_state_as_dict(xPageStyle)["SelectEntryText"]) + + # tdf#116070: Without the fix in place, this test would have crashed here + + # Without the fix in place, this test would have failed with + # AssertionError: 'Chap 1' != 'Chap 3' + self.assertEqual("Chap 1", xCursor.PageStyleName) + + self.assertEqual(document.CurrentController.PageCount, 3) + + xCursor.jumpToNextPage() + self.assertEqual("Chap 3", xCursor.PageStyleName) + + self.xUITest.executeCommand(".uno:Undo") + + self.assertEqual("Chap 2", xCursor.PageStyleName) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/tdf135636.py b/sw/qa/uitest/writer_tests4/tdf135636.py new file mode 100644 index 000000000..0fd3aec66 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf135636.py @@ -0,0 +1,40 @@ +# -*- 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.uihelper.common import get_state_as_dict, get_url_for_data_file + +class tdf135636(UITestCase): + + def test_tdf135636(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf135636.odt")) as document: + + self.assertEqual(document.CurrentController.PageCount, 2) + + xPageBreak = self.ui_test.wait_until_child_is_available('PageBreak') + with self.ui_test.execute_dialog_through_action(xPageBreak, "EDIT") as xDialog: + + + xBreak = xDialog.getChild("break") + self.assertEqual("true", get_state_as_dict(xBreak)["Selected"]) + + xBreak.executeAction("CLICK", tuple()) + + self.assertEqual("false", get_state_as_dict(xBreak)["Selected"]) + + + # Without the fix in place, this test would have failed with + # AssertionError: 2 != 1 + self.assertEqual(document.CurrentController.PageCount, 1) + + self.xUITest.executeCommand(".uno:Undo") + + self.assertEqual(document.CurrentController.PageCount, 2) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/tdf136578.py b/sw/qa/uitest/writer_tests4/tdf136578.py new file mode 100644 index 000000000..13dc063a3 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf136578.py @@ -0,0 +1,31 @@ +# -*- 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.uihelper.common import get_url_for_data_file + +class tdf136578(UITestCase): + + def test_tdf136578(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf136578.odt")) as document: + + self.assertEqual(document.CurrentController.PageCount, 2) + + xPageBreak = self.ui_test.wait_until_child_is_available('PageBreak') + xPageBreak.executeAction("DELETE", tuple()) + + # Without the fix in place, this test would have failed with + # AssertionError: 1 != 2 + self.assertEqual(document.CurrentController.PageCount, 1) + + self.xUITest.executeCommand(".uno:Undo") + + self.assertEqual(document.CurrentController.PageCount, 2) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/tdf138546.py b/sw/qa/uitest/writer_tests4/tdf138546.py new file mode 100644 index 000000000..89abcf7da --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf138546.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 uitest.uihelper.common import change_measurement_unit +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.common import get_url_for_data_file + +class tdf138546(UITestCase): + def test_tdf138546(self): + with self.ui_test.load_file(get_url_for_data_file("tdf138546.odt")): + xWriterDoc = self.xUITest.getTopFocusWindow() + + change_measurement_unit(self, "Centimeter") + + #dialog Columns + with self.ui_test.execute_dialog_through_command(".uno:FormatColumns", close_button="cancel") as xDialog: + + colsnf = xDialog.getChild("colsnf") + width1mf = xDialog.getChild("width1mf") + self.assertEqual(get_state_as_dict(colsnf)["Text"], "2") + self.assertEqual((get_state_as_dict(width1mf)["Text"])[0:3], "2.0") #2.00 cm + + with self.ui_test.execute_dialog_through_command(".uno:PageDialog", close_button="cancel") as xDialog: + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "7") #Columns + colsnf = xDialog.getChild("colsnf") + width1mf = xDialog.getChild("width1mf") + self.assertEqual(get_state_as_dict(colsnf)["Text"], "2") + self.assertEqual((get_state_as_dict(width1mf)["Text"])[0:3], "2.0") #2.00 cm + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/tdf148395.py b/sw/qa/uitest/writer_tests4/tdf148395.py new file mode 100644 index 000000000..312733525 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf148395.py @@ -0,0 +1,47 @@ +# -*- 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.uihelper.common import select_pos + +class Tdf148395(UITestCase): + + def test_tdf148395(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + + with self.ui_test.execute_dialog_through_command(".uno:InsertObject") as xDialog: + xTypes = xDialog.getChild("types") + xCreateNew = xDialog.getChild("createnew") + + self.assertEqual('true', get_state_as_dict(xCreateNew)['Checked']) + + xSelectedEntry = get_state_as_dict(xTypes)['SelectEntryText'] + self.assertTrue('Spreadsheet' in xSelectedEntry ) + + for i in range(10): + xTypes.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + xSelectedEntry = get_state_as_dict(xTypes)['SelectEntryText'] + if 'Chart' in xSelectedEntry: + break + + self.assertEqual(1, document.EmbeddedObjects.Count) + self.assertEqual("SwXTextEmbeddedObject", document.CurrentSelection.getImplementationName()) + + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/Page=") + + # Without the fix in place, this test would have crashed here + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) as xDialog: + pass + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/tdf92611.py b/sw/qa/uitest/writer_tests4/tdf92611.py new file mode 100644 index 000000000..a0feb2f6b --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf92611.py @@ -0,0 +1,23 @@ +# -*- 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 + +class tdf92611(UITestCase): + + def test_launch_and_close_bibliography(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + self.xUITest.executeCommand(".uno:BibliographyComponent") + + self.xUITest.executeCommand(".uno:CloseWin") + + +# 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..9eb36eefb --- /dev/null +++ b/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py @@ -0,0 +1,133 @@ +# -*- 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.uihelper.common import get_state_as_dict, get_url_for_data_file + +class dateFormFieldDialog(UITestCase): + + def test_setting_date_format(self): + # open a file with a date form field + with self.ui_test.load_file(get_url_for_data_file("date_form_field.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + + # open the dialog (cursor is at the field) + with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog: + + 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") + + + # open the dialog again + with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog: + itemsList = xDialog.getChild("date_formats_treeview") + self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31") + + + def test_date_field_with_custom_format(self): + # open a file with a date form field + with self.ui_test.load_file(get_url_for_data_file("date_form_field_custom_format.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + + # open the dialog (cursor is at the field) + with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog: + + itemsList = xDialog.getChild("date_formats_treeview") + + # check whether we have the right format selected + # This is awkward though because checking for a fixed number of + # entries if the selected default format happens to equal a + # standard system format the entry gets duplicated with + # "[System]" appended. So this may be either 20 or 21 ... and + # in that case it is the selected format and the + # SelectEntryText doesn't match the sample string, so all this + # is rather fragile depending on actual locale data. + self.assertEqual(get_state_as_dict(itemsList)["Children"], "21") + self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "1999. december 31., péntek[System]") + + + def test_date_reformat(self): + # open a file with a date form field + with self.ui_test.load_file(get_url_for_data_file("date_form_field.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + self.assertEqual(writer_doc.getText().getString(), "07/17/19") + + # open the dialog (cursor is at the field) + with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog: + + 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") + + + # after applying the new format, the field content should be updated + self.assertEqual(writer_doc.getText().getString(), "07-17") + + def test_date_field_with_placeholder(self): + # open a file with a date form field + with self.ui_test.load_file(get_url_for_data_file("date_form_field_with_placeholder.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + self.assertEqual(writer_doc.getText().getString(), "[select date]") + + # open the dialog (cursor is at the field) + with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog: + + 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") + + + # a placeholder text is not changed by format change + self.assertEqual(writer_doc.getText().getString(), "[select date]") + + 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 + with self.ui_test.load_file(get_url_for_data_file("date_form_field_without_current_date.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + self.assertEqual(writer_doc.getText().getString(), "07/17/19") + + # open the dialog (cursor is at the field) + with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog: + + 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") + + + # a placeholder text is not changed by format change + self.assertEqual(writer_doc.getText().getString(), "Jul 17, 2019") + +# 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..e64e32b02 --- /dev/null +++ b/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py @@ -0,0 +1,238 @@ +# -*- 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.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues + +class dropDownFormFieldDialog(UITestCase): + + def test_add_new_items(self): + + # open a file with an empty form field + with self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + + # open the dialog (cursor is at the field) + with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog: + + 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") + + + # check whether items are the same after reopening + with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog: + + 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") + + + def test_remove_items(self): + + # open a file with an empty form field + with self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + + # open the dialog (cursor is at the field) + with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog: + + 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") + + + # check whether items are the same after reopening + with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog: + + 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") + + + def test_move_items(self): + + # open a file with an empty form field + with self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + + # open the dialog (cursor is at the field) + with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog: + + 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") + + + # check whether items are the same after reopening + with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog: + + 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") + + + 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 + with self.ui_test.load_file(get_url_for_data_file(file)) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + + # open the dialog (cursor is at the field) + with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog: + + 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") + + +# 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..980eca989 --- /dev/null +++ b/sw/qa/uitest/writer_tests5/about_test.py @@ -0,0 +1,22 @@ +# -*- 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 + +class AboutDlgTest(UITestCase): + + def test_about_dlg(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + with self.ui_test.execute_dialog_through_command(".uno:About", close_button="btnClose"): + pass + + +# 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..a1305018e --- /dev/null +++ b/sw/qa/uitest/writer_tests5/autocorrectOptions.py @@ -0,0 +1,98 @@ +# -*- 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.uihelper.common import select_pos + +class autocorrectOptions(UITestCase): + + def test_autocorrect_options_writer(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg", close_button="cancel") as xDialog: + 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"] + + self.assertTrue(int(nrRows) > 0) + + #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)["VisibleCount"] + + self.assertTrue(int(nrRowsAbb) > 0) + + 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)["VisibleCount"] + nrRowsAbbDiff = int(nrRowsAbbNew) - int(nrRowsAbb) + self.assertEqual(nrRowsAbbDiff, 1) #we have +1 rule + delabbrev.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(abbrevlist)["VisibleCount"], 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)["VisibleCount"] + + self.assertTrue(int(nrRowsDouble) > 0) + + 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)["VisibleCount"] + 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)["VisibleCount"], nrRowsDouble) #we have default nr of rules + + + +# 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..a70f31143 --- /dev/null +++ b/sw/qa/uitest/writer_tests5/columns.py @@ -0,0 +1,48 @@ +# -*- 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.uihelper.common import get_state_as_dict +from uitest.uihelper.common import change_measurement_unit +from libreoffice.uno.propertyvalue import mkPropertyValues +#uitest sw / Columns dialog + +class columns(UITestCase): + def test_columns(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + + change_measurement_unit(self, "Centimeter") + + #dialog Columns + with self.ui_test.execute_dialog_through_command(".uno:FormatColumns") as xDialog: + + 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()) + #verify + with self.ui_test.execute_dialog_through_command(".uno:FormatColumns", close_button="cancel") as xDialog: + 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") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/tdf106899.py b/sw/qa/uitest/writer_tests5/tdf106899.py new file mode 100644 index 000000000..bd77c2945 --- /dev/null +++ b/sw/qa/uitest/writer_tests5/tdf106899.py @@ -0,0 +1,43 @@ +# -*- 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/. +# + +import org.libreoffice.unotest +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file + +class tdf106899(UITestCase): + + def test_tdf106899_alphabetical_index_utf8(self): + # Copy concordance file containing an utf8 index entry + org.libreoffice.unotest.makeCopyFromTDOC("tdf106899.sdi") + with self.ui_test.load_file(get_url_for_data_file("tdf106899.odt")) as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + + # Update the alphabetical index and check if it contains the utf8 index entry + xDocumentIndexes = document.DocumentIndexes + self.assertEqual(xDocumentIndexes.getCount(), 1) + self.assertEqual(xDocumentIndexes.hasByName("Alphabetical Index1"), True) + xDocumentIndex = xDocumentIndexes.getByName("Alphabetical Index1") + xIndexAnchor = xDocumentIndex.getAnchor() + self.assertEqual("Nguyễn Khánh" in xIndexAnchor.getString(), False) + + # TODO Bug Report - Refresh of the index does only work using .uno:UpdateAllIndexes + # It does not work with xDocumentIndex.refresh() nor with xDocumentIndex.update() + self.xUITest.executeCommand(".uno:UpdateAllIndexes") + + # TODO Bug Report - Retrieving the text of the updated index only works using the cursor + # It does not work with xIndexAnchor.getString() + xCursor = document.getText().createTextCursor() + xCursor.gotoRange(xDocumentIndex.getAnchor().getEnd(), False) + xCursor.gotoStartOfParagraph(True) + + # Without the fix in place the index does not contain the utf8 index entry + self.assertEqual("Nguyễn Khánh" in xCursor.getString(), True) + +# 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..a08885308 --- /dev/null +++ b/sw/qa/uitest/writer_tests5/tdf117039.py @@ -0,0 +1,26 @@ +# -*- 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.uihelper.common import get_url_for_data_file + +#Bug 117039 - Print Preview crashes on signed document + +class tdf117039(UITestCase): + def test_tdf117039_preview_signed_document(self): + with self.ui_test.load_file(get_url_for_data_file("tdf117039.odt")) as writer_doc: + 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(writer_doc.Text.String[0:22], "Test digital signature") + +# 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..e33cad63b --- /dev/null +++ b/sw/qa/uitest/writer_tests5/tdf118540.py @@ -0,0 +1,28 @@ +# -*- 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.uihelper.common import get_url_for_data_file + +#Bug 118540 - LO6.1b2: DOCX crashes when properties are opened in print preview mode + +class tdf118540(UITestCase): + def test_tdf118540_preview_document_properties(self): + with self.ui_test.load_file(get_url_for_data_file("tdf118540.docx")) as writer_doc: + self.xUITest.executeCommand(".uno:PrintPreview") #open print preview + with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties"): + pass + self.xUITest.executeCommand(".uno:ClosePreview") # close print preview + + self.xUITest.getTopFocusWindow() #Get focus after closing preview + + #verify + self.assertEqual(writer_doc.Text.String[0:4], "Test") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/tdf122045.py b/sw/qa/uitest/writer_tests5/tdf122045.py new file mode 100644 index 000000000..6e938e093 --- /dev/null +++ b/sw/qa/uitest/writer_tests5/tdf122045.py @@ -0,0 +1,39 @@ +# -*- 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.uihelper.common import select_pos + +class tdf122045(UITestCase): + + def test_tdf122045(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:PageDialog", close_button="cancel") as xDialog: + + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + + btncolor = xDialog.getChild("btncolor") + btncolor.executeAction("CLICK", tuple()) + + xApplyBtn = xDialog.getChild("apply") + xApplyBtn.executeAction("CLICK", tuple()) + + self.assertTrue(document.isModified()) + self.assertEqual("0x729fcf", hex(document.StyleFamilies.PageStyles.Standard.BackColor)) + + + self.assertTrue(document.isModified()) + self.assertEqual("0x729fcf", hex(document.StyleFamilies.PageStyles.Standard.BackColor)) + + +# 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..ebbbd18db --- /dev/null +++ b/sw/qa/uitest/writer_tests5/tdf122722.py @@ -0,0 +1,67 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +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): + with self.ui_test.create_doc_in_start_center("writer") as document: + 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 + with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog: + 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()) + + #un-hidden + with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog: + 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()) + + + self.assertEqual(document.Text.String[0:11], "LibreOffice") + +# 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..b0b35d266 --- /dev/null +++ b/sw/qa/uitest/writer_tests5/tdf123378.py @@ -0,0 +1,28 @@ +# -*- 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 + +#Bug 123378 - Printing always sets "document modified" status + +class tdf123378(UITestCase): + def test_tdf123378_print_sets_modified(self): + # FIXME unstable test + return + with self.ui_test.create_doc_in_start_center("writer") as document: + 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) + +# 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..53f8208f8 --- /dev/null +++ b/sw/qa/uitest/writer_tests5/tdf123446.py @@ -0,0 +1,42 @@ +# -*- 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.uihelper.common import type_text +#Bug 123446 - Writer crashes after undoing + redoing ToC insertion in middle of word + +class tdf123446(UITestCase): + + def test_tdf123446_undo_redo_ToC_crash(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + 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") + + with self.ui_test.execute_dialog_through_command(".uno:InsertMultiIndex"): + pass + #- 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") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/tdf138531.py b/sw/qa/uitest/writer_tests5/tdf138531.py new file mode 100644 index 000000000..328a8250b --- /dev/null +++ b/sw/qa/uitest/writer_tests5/tdf138531.py @@ -0,0 +1,67 @@ +# -*- 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.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.calc import enter_text_to_cell + +class Tdf138531(UITestCase): + + def test_tdf138531(self): + + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #enter data + enter_text_to_cell(gridwin, "A1", "First") + enter_text_to_cell(gridwin, "A2", "Second") + + #select A1:A2 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + + self.xUITest.executeCommand(".uno:Copy") + + # Work with both documents at the same time + with self.ui_test.load_empty_file("writer") as writer_doc: + + # Paste as DDE + formatProperty = mkPropertyValues({"SelectedFormat": 59}) + self.xUITest.executeCommandWithParameters(".uno:ClipboardFormatItems", formatProperty) + + self.assertEqual(1, writer_doc.TextTables.getCount()) + table = writer_doc.getTextTables()[0] + self.assertEqual("First", table.getCellByName("A1").getString()) + self.assertEqual("Second", table.getCellByName("A2").getString()) + + frames = self.ui_test.get_frames() + # switch view to the calc document + frames[0].activate() + enter_text_to_cell(gridwin, "A1", "Second") + enter_text_to_cell(gridwin, "A2", "First") + + # switch view back to the writer document + frames[1].activate() + + with self.ui_test.execute_dialog_through_command(".uno:LinkDialog", close_button="close") as xDialog: + xLinks = xDialog.getChild("TB_LINKS") + self.assertEqual(1, len(xLinks.getChildren())) + + xFileName = xDialog.getChild("FULL_FILE_NAME") + self.assertEqual("Untitled 1", get_state_as_dict(xFileName)["Text"]) + + xUpdate = xDialog.getChild("UPDATE_NOW") + xUpdate.executeAction("CLICK", tuple()) + + # Without the fix in place, this test would have failed with + # AssertionError: 'Second' != 'First' + self.assertEqual("Second", table.getCellByName("A1").getString()) + self.assertEqual("First", table.getCellByName("A2").getString()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/tdf142847.py b/sw/qa/uitest/writer_tests5/tdf142847.py new file mode 100644 index 000000000..845b7eb7a --- /dev/null +++ b/sw/qa/uitest/writer_tests5/tdf142847.py @@ -0,0 +1,49 @@ +# -*- 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 org.libreoffice.unotest +from uitest.uihelper.common import get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf142847(UITestCase): + def test_tdf142847(self): + # load the sample file + with self.ui_test.load_file(get_url_for_data_file("tdf142847.fodt")): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + document = self.ui_test.get_component() + + # get the shape + shape = document.DrawPage.getByIndex(0) + + # get the textbox + frame = shape.getText() + + oldFramePos = frame.getPropertyValue("HoriOrientPosition") + oldShapePos = shape.getPropertyValue("LeftMargin") + oldDiff = oldFramePos - oldShapePos + + # select the shape. + self.xUITest.executeCommand(".uno:JumpToNextFrame") + self.ui_test.wait_until_child_is_available('metricfield') + + # set the wrap spacing of the shape + with self.ui_test.execute_dialog_through_command(".uno:TextWrap") as wrap_dialog: + wrap_dialog.getChild('left').executeAction("UP", tuple()) + + newDiff = frame.getPropertyValue("HoriOrientPosition") - shape.getPropertyValue("LeftMargin") + + # without the fix, this will fail. + # the textbox has fallen apart. + self.assertEqual(oldDiff, newDiff) + + self.assertGreater(frame.getPropertyValue("HoriOrientPosition"), oldFramePos) + self.assertGreater(shape.getPropertyValue("LeftMargin"), oldShapePos) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/tdf145326.py b/sw/qa/uitest/writer_tests5/tdf145326.py new file mode 100644 index 000000000..d063e6388 --- /dev/null +++ b/sw/qa/uitest/writer_tests5/tdf145326.py @@ -0,0 +1,86 @@ +# -*- 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.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues +from org.libreoffice.unotest import systemPathToFileUrl +from tempfile import TemporaryDirectory +import os.path + +class Tdf145326(UITestCase): + + def test_tdf145326(self): + + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, "tdf145326-temp.odt") + + with self.ui_test.execute_dialog_through_command(".uno:Open", close_button="") as xOpenDialog: + + xFileName = xOpenDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf145326.odt")})) + + xOpenBtn = xOpenDialog.getChild("open") + # Update all links dialog + with self.ui_test.wait_until_component_loaded(): + with self.ui_test.execute_blocking_action(xOpenBtn.executeAction, args=('CLICK', ()), close_button="yes"): + pass + + with self.ui_test.execute_dialog_through_command(".uno:LinkDialog", close_button="close") as xDialog: + + sLinks = "TB_LINKS" + xLinks = xDialog.getChild(sLinks) + self.assertEqual(1, len(xLinks.getChildren())) + + sFileName = "FULL_FILE_NAME" + xFileName = xDialog.getChild(sFileName) + self.assertTrue(get_state_as_dict(xFileName)["Text"].endswith("SAmple odp.ods")) + + sBreakLink = "BREAK_LINK" + xBreakLink = xDialog.getChild(sBreakLink) + + with self.ui_test.execute_blocking_action(xBreakLink.executeAction, + args=("CLICK", tuple()), close_button="yes"): + pass + + # Save Copy as + with self.ui_test.execute_dialog_through_command('.uno:SaveAs', close_button="open") as xDialog: + xFileName = xDialog.getChild('file_name') + xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'CTRL+A'})) + xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'})) + xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath})) + + self.ui_test.close_doc() + + self.ui_test.wait_until_file_is_available(xFilePath) + + with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as doc2: + + self.xUITest.executeCommand(".uno:LinkDialog") + + # Since the image is no longer linked, the link dialog is not open. + # Without the fix in place, this dialog would have been opened + xMainWin = self.xUITest.getTopFocusWindow() + self.assertTrue(sLinks not in xMainWin.getChildren()) + self.assertTrue(sFileName not in xMainWin.getChildren()) + self.assertTrue(sBreakLink not in xMainWin.getChildren()) + self.assertTrue("writer_edit" in xMainWin.getChildren()) + + self.assertEqual(doc2.TextTables.getCount(), 1) + table = doc2.getTextTables()[0] + + self.assertEqual(len(table.getRows()), 7) + self.assertEqual("10,000", table.getCellByName("D2").getString()) + self.assertEqual("20,000", table.getCellByName("D3").getString()) + self.assertEqual("5,000", table.getCellByName("D4").getString()) + self.assertEqual("7,000", table.getCellByName("D5").getString()) + self.assertEqual("5,000", table.getCellByName("D6").getString()) + self.assertEqual("7,000", table.getCellByName("D7").getString()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/tdf147935.py b/sw/qa/uitest/writer_tests5/tdf147935.py new file mode 100644 index 000000000..fa0e773a9 --- /dev/null +++ b/sw/qa/uitest/writer_tests5/tdf147935.py @@ -0,0 +1,43 @@ +# -*- 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.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.calc import enter_text_to_cell + +class Tdf147935(UITestCase): + + def test_tdf147935(self): + + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #enter data + enter_text_to_cell(gridwin, "A1", "DDE") + + #select A1 + gridwin.executeAction("SELECT", mkPropertyValues({"Cell": "A1"})) + + self.xUITest.executeCommand(".uno:Copy") + + with self.ui_test.load_empty_file("writer") as writer_doc: + + # Paste as DDE + formatProperty = mkPropertyValues({"SelectedFormat": 59}) + self.xUITest.executeCommandWithParameters(".uno:ClipboardFormatItems", formatProperty) + + # Without the fix in place, this test would have failed because the warning message + # "A table with no rows or no cells cannot be inserted" would have been displayed + + self.assertEqual(1, writer_doc.TextTables.getCount()) + table = writer_doc.getTextTables()[0] + self.assertEqual("DDE", table.getCellByName("A1").getString()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/tdf148920.py b/sw/qa/uitest/writer_tests5/tdf148920.py new file mode 100644 index 000000000..c8bde7769 --- /dev/null +++ b/sw/qa/uitest/writer_tests5/tdf148920.py @@ -0,0 +1,33 @@ +# -*- 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.uihelper.common import get_state_as_dict + +class tdf148920(UITestCase): + + def test_tdf148920(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + + self.xUITest.executeCommand(".uno:StyleApply?Style:string=Text%20body&FamilyName:string=ParagraphStyles") + + with self.ui_test.execute_dialog_through_command(".uno:EditStyle", close_button="cancel") as xDialog: + xFilter = xDialog.getChild("filter") + + # Without the fix in place, this test would have failed with + # AssertionError: 'true' != 'false' + self.assertEqual("true", get_state_as_dict(xFilter)["Enabled"]) + + # tdf#91035: Without the fix in place, this test would have failed with + # AssertionError: 'All Styles' != 'Hidden Styles' + self.assertEqual("All Styles", get_state_as_dict(xFilter)["SelectEntryText"]) + + +# 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..e2b774492 --- /dev/null +++ b/sw/qa/uitest/writer_tests5/titlePage.py @@ -0,0 +1,31 @@ +# -*- 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 +#uitest sw / Title Page dialog + +class titlePage(UITestCase): + def test_title_page(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + #dialog Title Page + with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") as xDialog: + #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()) + self.assertEqual(document.CurrentController.PageCount, 3) + + # check cancel button + with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog", close_button="cancel"): + pass + self.assertEqual(document.CurrentController.PageCount, 3) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/titlePageWizard.py b/sw/qa/uitest/writer_tests5/titlePageWizard.py new file mode 100644 index 000000000..4146dab22 --- /dev/null +++ b/sw/qa/uitest/writer_tests5/titlePageWizard.py @@ -0,0 +1,195 @@ +# -*- 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.uihelper.common import get_url_for_data_file + +# This tests the Format->Title Page wizard, specifically the reset page number portion, +# replacing some pages with title pages, +# inserting pages in the middle of the document, +# and inserting at the very end of the document. +class tdf138907(UITestCase): + def test_tdf138907(self): + with self.ui_test.load_file(get_url_for_data_file("tdf138907_titlePageDialog.odt")) as document: + + # Confirm the starting state. Just a page break, without a valid restart page number on page 2 + self.assertEqual(document.CurrentController.PageCount, 5) + Paragraphs = document.Text.createEnumeration() + Para1 = Paragraphs.nextElement() + self.assertEqual(Para1.String, "6") + self.assertEqual(Para1.PageDescName, "First Page") + Para2 = Paragraphs.nextElement() + self.assertEqual(Para2.String, "7") + self.assertEqual(Para2.PageDescName, None) + Para3 = Paragraphs.nextElement() + self.assertEqual(Para3.String, "8") + self.assertEqual(Para3.PageDescName, None) + Para4 = Paragraphs.nextElement() + self.assertEqual(Para4.String, "9") + self.assertEqual(Para4.PageDescName, None) + Para5 = Paragraphs.nextElement() + self.assertEqual(Para5.String, "10") + self.assertEqual(Para5.PageDescName, None) + + + #dialog Title Page + with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") as xDialog: + #set restart page number to 2. With this doc, it defaults to resetting to 1. + xRestartNumbering = xDialog.getChild("NF_RESTART_NUMBERING") + xRestartNumbering.executeAction("UP", tuple()) # restart numbering at 2 + + Paragraphs = document.Text.createEnumeration() + Para1 = Paragraphs.nextElement() + self.assertEqual(Para1.String, "6") + self.assertEqual(Para1.PageDescName, "First Page") + self.assertEqual(Para2.String, "2") + Para2 = Paragraphs.nextElement() + # Without this fix, there was no PageDescName specified, just Landscape as default. + self.assertEqual(Para2.PageDescName, "Landscape") + + #re-run dialog Title Page + with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog"): + pass + + # Without this fix, re-running the wizard was failing with the title page restarting at page 2. + Paragraphs = document.Text.createEnumeration() + Para1 = Paragraphs.nextElement() + self.assertEqual(Para1.String, "6") + self.assertEqual(Para1.PageDescName, "First Page") + Para2 = Paragraphs.nextElement() + self.assertEqual(Para2.String, "2") + self.assertEqual(Para2.PageDescName, "Landscape") + + #Note: 6 virtual pages, including blank, even page seen in book view + self.assertEqual(document.CurrentController.PageCount, 6) + + #Now test replacing several pages with title and index styles + + #dialog Title Page + with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") as xDialog: + #Convert three pages to title/index pages starting at page two. + xPageCount = xDialog.getChild("NF_PAGE_COUNT") + for _ in range(0,2): + xPageCount.executeAction("UP", tuple()) + xUseStartingPage = xDialog.getChild("RB_PAGE_START") + xUseStartingPage.executeAction("CLICK", tuple()) + xStartingPage = xDialog.getChild("NF_PAGE_START") + xStartingPage.executeAction("UP", tuple()) #Start at page 2. + + + Paragraphs = document.Text.createEnumeration() + Para1 = Paragraphs.nextElement() + self.assertEqual(Para1.String, "6") + self.assertEqual(Para1.PageDescName, "First Page") + # Without the fix, the following results are all off by one. + Para2 = Paragraphs.nextElement() + self.assertEqual(Para2.String, "6") + self.assertEqual(Para2.PageDescName, "First Page") + Para3 = Paragraphs.nextElement() + self.assertEqual(Para3.String, "7") + self.assertEqual(Para3.PageDescName, "Index") + Para4 = Paragraphs.nextElement() + self.assertEqual(Para4.String, "8") + self.assertEqual(Para4.PageDescName, "Index") + Para5 = Paragraphs.nextElement() + self.assertEqual(Para5.String, "2") + self.assertEqual(Para5.PageDescName, "Landscape") + + #Now test inserting at the end of the document + + #dialog Title Page + with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") as xDialog: + #Insert three title/index pages at the end of the document (plus a content page). + newPages = xDialog.getChild("RB_INSERT_NEW_PAGES") + newPages.executeAction("CLICK", tuple()) + xPageCount = xDialog.getChild("NF_PAGE_COUNT") + for _ in range(0,2): + xPageCount.executeAction("UP", tuple()) + xUseStartingPage = xDialog.getChild("RB_PAGE_START") + xUseStartingPage.executeAction("CLICK", tuple()) + xStartingPage = xDialog.getChild("NF_PAGE_START") + for _ in range(0,18): + xStartingPage.executeAction("UP", tuple()) #Start at mythical page 20. + + + # Without the fix, the pages were being inserted before the last page. + text = document.Text.String.replace('\r\n', '\n') + self.assertEqual(text[0:1], "6") + self.assertEqual(text[2:3], "6") + self.assertEqual(text[4:5], "7") + self.assertEqual(text[6:7], "8") + # Without the fix, the new pages were inserted before the last page. + self.assertFalse("\n" in text[8:9]) + #Note: 13 total virtual pages, including four blanks, as seen in book view + self.assertEqual(document.CurrentController.PageCount, 13) + + #Now test inserting in the middle of the document + + #dialog Title Page + with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") as xDialog: + #Insert three title/index pages starting at page 2. + newPages = xDialog.getChild("RB_INSERT_NEW_PAGES") + newPages.executeAction("CLICK", tuple()) + xPageCount = xDialog.getChild("NF_PAGE_COUNT") + for _ in range(0,2): + xPageCount.executeAction("UP", tuple()) + xUseStartingPage = xDialog.getChild("RB_PAGE_START") + xUseStartingPage.executeAction("CLICK", tuple()) + xStartingPage = xDialog.getChild("NF_PAGE_START") + for _ in range(0,10): + xStartingPage.executeAction("DOWN", tuple()) #Reset to page 1 + xStartingPage.executeAction("UP", tuple()) #Start at page 2. + + + # Without first re-calculating the layout, the styles were applied to the wrong pages. + Paragraphs = document.Text.createEnumeration() + Para1 = Paragraphs.nextElement() + self.assertEqual(Para1.String, "6") + self.assertEqual(Para1.PageDescName, "First Page") + # The next three pages are the ones that were just inserted. + Para2 = Paragraphs.nextElement() + self.assertEqual(Para2.String, "") + self.assertEqual(Para2.PageDescName, "First Page") + Para3 = Paragraphs.nextElement() + self.assertEqual(Para3.String, "") + self.assertEqual(Para3.PageDescName, "Index") + Para4 = Paragraphs.nextElement() + self.assertEqual(Para4.String, "") + self.assertEqual(Para4.PageDescName, "Index") + # A bit of a quirk is that the style of the first page after the + # title page is still First Page - so that is used as the Normal page style. + # OK - this is a bit of a strange workflow, so just accept that. + Para5 = Paragraphs.nextElement() + self.assertEqual(Para5.String, "6") + self.assertEqual(Para5.PageDescName, "First Page") + Para6 = Paragraphs.nextElement() + self.assertEqual(Para6.String, "7") + self.assertEqual(Para6.PageDescName, "Index") + Para7 = Paragraphs.nextElement() + self.assertEqual(Para7.String, "8") + self.assertEqual(Para7.PageDescName, "Index") + Para8 = Paragraphs.nextElement() + self.assertEqual(Para8.String, "2") + self.assertEqual(Para8.PageDescName, "Landscape") + Para9 = Paragraphs.nextElement() + self.assertEqual(Para9.String, "") + self.assertEqual(Para9.PageDescName, "First Page") + Para10 = Paragraphs.nextElement() + self.assertEqual(Para10.String, "") + self.assertEqual(Para10.PageDescName, "Index") + Para11 = Paragraphs.nextElement() + self.assertEqual(Para11.String, "") + self.assertEqual(Para11.PageDescName, "Index") + # The quirk resets this extra content page to the "style after First page == First Page" + Para12 = Paragraphs.nextElement() + self.assertEqual(Para12.String, "") + self.assertEqual(Para12.PageDescName, "First Page") + #Note: 17 total virtual pages, including five blanks, as seen in book view + self.assertEqual(document.CurrentController.PageCount, 17) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/titlePageWizard2.py b/sw/qa/uitest/writer_tests5/titlePageWizard2.py new file mode 100644 index 000000000..4f3473530 --- /dev/null +++ b/sw/qa/uitest/writer_tests5/titlePageWizard2.py @@ -0,0 +1,124 @@ +# -*- 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.uihelper.common import get_url_for_data_file + +# This tests both an edge cases, and some more realistic situations. +class tdf138907(UITestCase): + def test_tdf138907(self): + with self.ui_test.load_file(get_url_for_data_file("tdf138907_titlePageDialog.odt")) as document: + + # Test an undefined situation - try to modify pages beyond the end of the document. + + #dialog Title Page + with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") as xDialog: + #set restart page number to 2. With this doc, it defaults to resetting to 1. + xRestartNumbering = xDialog.getChild("NF_RESTART_NUMBERING") + xRestartNumbering.executeAction("UP", tuple()) # restart numbering at 2 + + #Convert three pages to title/index pages starting at non-existing page twenty. + xPageCount = xDialog.getChild("NF_PAGE_COUNT") + for _ in range(0,2): + xPageCount.executeAction("UP", tuple()) + xUseStartingPage = xDialog.getChild("RB_PAGE_START") + xUseStartingPage.executeAction("CLICK", tuple()) + xStartingPage = xDialog.getChild("NF_PAGE_START") + for _ in range(0,19): + xStartingPage.executeAction("UP", tuple()) #Start at mythical page 20. + + + # Nothing should happen when modifying pages that don't exist. + # Just a page break, without a valid restart page number on page 2 + self.assertEqual(document.CurrentController.PageCount, 5) + Paragraphs = document.Text.createEnumeration() + Para1 = Paragraphs.nextElement() + self.assertEqual(Para1.String, "6") + self.assertEqual(Para1.PageDescName, "First Page") + Para2 = Paragraphs.nextElement() + self.assertEqual(Para2.String, "7") + self.assertEqual(Para2.PageDescName, None) + Para3 = Paragraphs.nextElement() + self.assertEqual(Para3.String, "8") + self.assertEqual(Para3.PageDescName, None) + Para4 = Paragraphs.nextElement() + self.assertEqual(Para4.String, "9") + self.assertEqual(Para4.PageDescName, None) + Para5 = Paragraphs.nextElement() + self.assertEqual(Para5.String, "10") + self.assertEqual(Para5.PageDescName, None) + + + #dialog Title Page + with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") as xDialog: + #set restart page number to 1 - which is the default. + #set restart title page to 1 - the current value for this document is 6. + xRestartNumbering = xDialog.getChild("NF_SET_PAGE_NUMBER") + for _ in range(0,5): + xRestartNumbering.executeAction("DOWN", tuple()) # restart title numbering at 1 + #Insert two title/index pages at beginning of the document. + newPages = xDialog.getChild("RB_INSERT_NEW_PAGES") + newPages.executeAction("CLICK", tuple()) + xPageCount = xDialog.getChild("NF_PAGE_COUNT") + for _ in range(0,1): + xPageCount.executeAction("UP", tuple()) + + + Paragraphs = document.Text.createEnumeration() + Para1 = Paragraphs.nextElement() + self.assertEqual(Para1.String, "") + self.assertEqual(Para1.PageDescName, "First Page") + Para2 = Paragraphs.nextElement() + self.assertEqual(Para2.String, "") + self.assertEqual(Para2.PageDescName, "Index") + Para3 = Paragraphs.nextElement() + self.assertEqual(Para3.String, "1") + self.assertEqual(Para3.PageDescName, "Landscape") + Para4 = Paragraphs.nextElement() + self.assertEqual(Para4.String, "2") + Para5 = Paragraphs.nextElement() + self.assertEqual(Para5.String, "3") + Para6 = Paragraphs.nextElement() + self.assertEqual(Para6.String, "4") + Para7 = Paragraphs.nextElement() + self.assertEqual(Para7.String, "5") + + #Now test replacing several pages with title and index styles + + #dialog Title Page + with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") as xDialog: + #Convert four pages to title/index pages starting at page one. + xPageCount = xDialog.getChild("NF_PAGE_COUNT") + for _ in range(0,3): + xPageCount.executeAction("DOWN", tuple()) #reset to 1 first + for _ in range(0,3): + xPageCount.executeAction("UP", tuple()) + + + Paragraphs = document.Text.createEnumeration() + Para1 = Paragraphs.nextElement() + self.assertEqual(Para1.String, "") + self.assertEqual(Para1.PageDescName, "First Page") + Para2 = Paragraphs.nextElement() + self.assertEqual(Para2.String, "") + self.assertEqual(Para2.PageDescName, "Index") + Para3 = Paragraphs.nextElement() + self.assertEqual(Para3.String, "3") + self.assertEqual(Para3.PageDescName, "Index") + Para4 = Paragraphs.nextElement() + self.assertEqual(Para4.String, "4") + self.assertEqual(Para4.PageDescName, "Index") + Para5 = Paragraphs.nextElement() + self.assertEqual(Para5.String, "1") + self.assertEqual(Para5.PageDescName, "Landscape") + Para6 = Paragraphs.nextElement() + self.assertEqual(Para6.String, "2") + Para7 = Paragraphs.nextElement() + self.assertEqual(Para7.String, "3") + +# 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..d7a0f885f --- /dev/null +++ b/sw/qa/uitest/writer_tests5/xwindow.py @@ -0,0 +1,176 @@ +# -*- 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 unohelper +from com.sun.star.awt import XMouseListener +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 + + with self.ui_test.create_doc_in_start_center("writer") as xDoc: + + # 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 + + +# 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..cb6d0ebad --- /dev/null +++ b/sw/qa/uitest/writer_tests5/zoom.py @@ -0,0 +1,86 @@ +# -*- 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.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +#uitest sw / View-Zoom + +class writerZoom(UITestCase): + def test_zoom_writer(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + #dialog View-Zoom-Zoom + with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog: + + #select Optimal & Automatic - OK - open and verify + optimal = xDialog.getChild("optimal") + optimal.executeAction("CLICK", tuple()) + automatic = xDialog.getChild("automatic") + automatic.executeAction("CLICK", tuple()) + + with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog: + 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()) + + with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog: + 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"})) + + with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog: + 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()) + + with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog: + 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"})) + + with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog: + 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%") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/edit_file_properties_before_saving.py b/sw/qa/uitest/writer_tests6/edit_file_properties_before_saving.py new file mode 100644 index 000000000..d8d30d0af --- /dev/null +++ b/sw/qa/uitest/writer_tests6/edit_file_properties_before_saving.py @@ -0,0 +1,106 @@ +# -*- 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.uihelper.common import get_state_as_dict +from uitest.uihelper.common import type_text +from libreoffice.uno.propertyvalue import mkPropertyValues +from org.libreoffice.unotest import systemPathToFileUrl +from tempfile import TemporaryDirectory +import os.path + +class edit_file_properties_before_saving(UITestCase): + + def change_doc_info_setting(self, enabled): + with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog: + xPages = xDialog.getChild("pages") + xLoadSaveEntry = xPages.getChild('1') + xLoadSaveEntry.executeAction("EXPAND", tuple()) + xGeneralEntry = xLoadSaveEntry.getChild('0') + xGeneralEntry.executeAction("SELECT", tuple()) + + xDocInfo = xDialog.getChild("docinfo") + if get_state_as_dict(xDocInfo)['Selected'] != enabled: + xDocInfo.executeAction("CLICK", tuple()) + self.assertEqual(enabled, get_state_as_dict(xDocInfo)['Selected']) + + def test_tdf117895(self): + + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, "tdf117895-temp.odt") + + try: + self.change_doc_info_setting("true") + + with self.ui_test.create_doc_in_start_center("writer"): + + # Save Copy as + with self.ui_test.execute_dialog_through_command('.uno:SaveAs', close_button="") as xDialog: + xFileName = xDialog.getChild('file_name') + xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'CTRL+A'})) + xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'})) + xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath})) + + xOpen = xDialog.getChild("open") + with self.ui_test.execute_dialog_through_action(xOpen, "CLICK") as xPropertiesDialog: + xReadOnly = xPropertiesDialog.getChild("readonly") + xReadOnly.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(xReadOnly)['Selected']) + + self.ui_test.wait_until_file_is_available(xFilePath) + + with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as doc2: + # Without the fix in place, this test would have failed here + self.assertTrue(doc2.isReadonly()) + + finally: + # Put this setting back to false, otherwise it might affect other tests + self.change_doc_info_setting("false") + + def test_tdf119206(self): + + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, "tdf119206-temp.odt") + + try: + self.change_doc_info_setting("true") + + with self.ui_test.create_doc_in_start_center("writer"): + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + type_text(xWriterEdit, "XXXX") + + # Close document and save + with self.ui_test.execute_dialog_through_command('.uno:CloseDoc', close_button="") as xConfirmationDialog: + xSave = xConfirmationDialog.getChild("save") + + with self.ui_test.execute_dialog_through_action(xSave, "CLICK", close_button="") as xDialog: + xFileName = xDialog.getChild('file_name') + xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'CTRL+A'})) + xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'})) + xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath})) + + xOpen = xDialog.getChild("open") + with self.ui_test.execute_dialog_through_action(xOpen, "CLICK") as xPropertiesDialog: + # Without the fix in place, this test would have crashed here + xReadOnly = xPropertiesDialog.getChild("readonly") + xReadOnly.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(xReadOnly)['Selected']) + + self.ui_test.wait_until_file_is_available(xFilePath) + + with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as doc2: + self.assertTrue(doc2.isReadonly()) + + finally: + # Put this setting back to false, otherwise it might affect other tests + self.change_doc_info_setting("false") + +# 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..cb525fc9b --- /dev/null +++ b/sw/qa/uitest/writer_tests6/infobar.py @@ -0,0 +1,61 @@ +# -*- 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 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): + with self.ui_test.create_doc_in_start_center("writer") as document: + controller = document.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) + + def test_infobar_update(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + controller = document.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): + with self.ui_test.create_doc_in_start_center("writer") as document: + controller = document.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/save_readonly_with_password.py b/sw/qa/uitest/writer_tests6/save_readonly_with_password.py new file mode 100644 index 000000000..5593e852d --- /dev/null +++ b/sw/qa/uitest/writer_tests6/save_readonly_with_password.py @@ -0,0 +1,105 @@ +# -*- 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 org.libreoffice.unotest import systemPathToFileUrl +from uitest.uihelper.common import select_by_text +from uitest.uihelper.common import get_state_as_dict +from tempfile import TemporaryDirectory +import os.path + + +class save_readonly_with_password(UITestCase): + + #Bug 144374 - Writer: FILESAVE to DOCX as read-only with additional password protection for editing not working + def test_save_to_docx(self): + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, "tdf144374-tmp.docx") + + with self.ui_test.create_doc_in_start_center("writer"): + # Save the document + with self.ui_test.execute_dialog_through_command(".uno:Save", close_button="") as xSaveDialog: + xFileName = xSaveDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath})) + xFileTypeCombo = xSaveDialog.getChild("file_type") + select_by_text(xFileTypeCombo, "Office Open XML Text (Transitional) (.docx)") + xPasswordCheckButton = xSaveDialog.getChild("password") + xPasswordCheckButton.executeAction("CLICK", tuple()) + xOpen = xSaveDialog.getChild("open") + + with self.ui_test.execute_dialog_through_action(xOpen, "CLICK", close_button="") as xPasswordDialog: + xReadonly = xPasswordDialog.getChild("readonly") + xReadonly.executeAction("CLICK", tuple()) + xNewPassword = xPasswordDialog.getChild("newpassroEntry") + xNewPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + xConfirmPassword = xPasswordDialog.getChild("confirmropassEntry") + xConfirmPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + + xOk = xPasswordDialog.getChild("ok") + # DOCX confirmation dialog is displayed + with self.ui_test.execute_dialog_through_action(xOk, "CLICK", close_button="save"): + pass + + win = self.xUITest.getTopFocusWindow() + print(get_state_as_dict(win)) + print(win.getChildren()) + self.ui_test.wait_until_file_is_available(xFilePath) + + with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document: + + self.assertTrue(document.isReadonly()) + + #Without the fix in place, this dialog wouldn't have been displayed + with self.ui_test.execute_dialog_through_command(".uno:EditDoc") as xDialog: + xPassword = xDialog.getChild("newpassEntry") + xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + + self.assertFalse(document.isReadonly()) + + def test_save_to_odt(self): + + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, "readonly_with_password_tmp.odt") + + with self.ui_test.create_doc_in_start_center("writer"): + # Save the document + with self.ui_test.execute_dialog_through_command(".uno:Save", close_button="") as xSaveDialog: + xFileName = xSaveDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath})) + xPasswordCheckButton = xSaveDialog.getChild("password") + xPasswordCheckButton.executeAction("CLICK", tuple()) + xOpen = xSaveDialog.getChild("open") + + with self.ui_test.execute_dialog_through_action(xOpen, "CLICK") as xPasswordDialog: + xReadonly = xPasswordDialog.getChild("readonly") + xReadonly.executeAction("CLICK", tuple()) + xNewPassword = xPasswordDialog.getChild("newpassroEntry") + xNewPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + xConfirmPassword = xPasswordDialog.getChild("confirmropassEntry") + xConfirmPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + + self.ui_test.wait_until_file_is_available(xFilePath) + + with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document: + + xWriterEdit = self.xUITest.getTopFocusWindow().getChild("writer_edit") + + self.assertTrue(document.isReadonly()) + + with self.ui_test.execute_dialog_through_command(".uno:EditDoc") as xDialog: + xPassword = xDialog.getChild("newpassEntry") + xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + + self.assertFalse(document.isReadonly()) + +# 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..98fd794a4 --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf107847.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 uitest.uihelper.common import select_pos +#Bug 107847 - CRASH Opening macro tab of properties dialog (images, frames) causes crash + +class tdf107847(UITestCase): + + def test_tdf_107847_macro_tab_crash(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:InsertFrame") as xDialog: + 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 + + self.assertEqual(document.TextFrames.getCount(), 1) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextFrames.getCount(), 0) +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/tdf118883.py b/sw/qa/uitest/writer_tests6/tdf118883.py new file mode 100644 index 000000000..20e58c32d --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf118883.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 + +class Tdf118883(UITestCase): + + def test_tdf118883(self): + with self.ui_test.create_doc_in_start_center("writer") as writer_document: + + # Insert shape with Ctrl key + xArgs = mkPropertyValues({"KeyModifier": 8192}) + self.xUITest.executeCommandWithParameters(".uno:BasicShapes.rectangle", xArgs) + + self.assertEqual(1, writer_document.DrawPage.getCount()) + + self.xUITest.executeCommand(".uno:Copy") + + with self.ui_test.load_empty_file("calc") as calc_document: + + self.xUITest.executeCommand(".uno:Paste") + + # Without the fix in place, this test would have failed with + # AssertionError: 1 != 0 + self.assertEqual(1, calc_document.DrawPages[0].getCount()) + +# 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..d503fbd6d --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf120731.py @@ -0,0 +1,23 @@ +# -*- 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.uihelper.common import get_url_for_data_file + +#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): + with self.ui_test.load_file(get_url_for_data_file("tdf120731.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.xUITest.executeCommand(".uno:SelectAll") + with self.ui_test.execute_dialog_through_command(".uno:FontDialog"): + pass + self.assertEqual(writer_doc.Text.String[0:5], "Lorem") +# 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..27d7867e9 --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf124586.py @@ -0,0 +1,30 @@ +# -*- 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.uihelper.common import select_by_text +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +#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): + with self.ui_test.load_file(get_url_for_data_file("tdf124586.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + + #Goto Tools > Chapter Numbering. + with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog: + xstyle = xDialog.getChild("style") + select_by_text(xstyle, "MyHeading") + + self.assertEqual(writer_doc.Text.String[0:8], "Schritte") + + with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog: + xstyle = xDialog.getChild("style") + self.assertEqual(get_state_as_dict(xstyle)["SelectEntryText"], "MyHeading") +# 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..40eb2987e --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf124675.py @@ -0,0 +1,36 @@ +# -*- 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, get_url_for_data_file + +#Bug 124675 - CRASH: after moving the content down and undoing + +class tdf124675(UITestCase): + def test_tdf124675_crash_moving_SwTextFrame_previous_page(self): + with self.ui_test.load_file(get_url_for_data_file("tdf124675.docx")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.assertEqual(writer_doc.CurrentController.PageCount, 2) + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1") + + for i in range(52): + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + + self.assertEqual(writer_doc.CurrentController.PageCount, 4) + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") + + for i in range(52): + self.xUITest.executeCommand(".uno:Undo") + + self.assertEqual(writer_doc.CurrentController.PageCount, 2) + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1") + +# 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..63dbda6a2 --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf125104.py @@ -0,0 +1,63 @@ +# -*- 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.uihelper.common import select_pos, get_state_as_dict +from uitest.uihelper.common import select_by_text +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf125104(UITestCase): + + def set_combo_layout_format(self, dialog, format): + tabcontrol = dialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + comboLayoutFormat = dialog.getChild("comboLayoutFormat") + select_by_text(comboLayoutFormat, format) + + def test_tdf125104_pageFormat_numbering(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + + # 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 + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: + self.set_combo_layout_format(xDialog, "1st, 2nd, 3rd, ...") + + text = document.Text.String.replace('\r\n', '\n') + self.assertEqual(text[0:3], "1st") + self.assertEqual(text[4:7], "2nd") + + with self.ui_test.execute_dialog_through_command(".uno:PageDialog", close_button="cancel") as xDialog: + comboLayoutFormat = xDialog.getChild("comboLayoutFormat") + self.assertEqual(get_state_as_dict(comboLayoutFormat)["SelectEntryText"], "1st, 2nd, 3rd, ...") + + # change to devanagari alphabet format + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: + self.set_combo_layout_format(xDialog, "क, ख, ग, ...") + + text = document.Text.String.replace('\r\n', '\n') + self.assertEqual(text[0:1], "क") + self.assertEqual(text[2:3], "ख") + + # change to devanagari number format + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: + self.set_combo_layout_format(xDialog, "१, २, ३, ...") + + text = document.Text.String.replace('\r\n', '\n') + self.assertEqual(text[0:1], "१") + self.assertEqual(text[2:3], "२") + + +# 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..a57a25305 --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf126017.py @@ -0,0 +1,42 @@ +# -*- 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_url_for_data_file + +#Bug 126017 - Crash swlo!SwNode::EndOfSectionIndex + +class tdf126017(UITestCase): + def test_tdf126017_crash_after_undo(self): + with self.ui_test.load_file(get_url_for_data_file("tdf126017.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + + #go to TOC + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"aasasas"})) + xsearch = xDialog.getChild("search") + xsearch.executeAction("CLICK", tuple()) + #edit index + with self.ui_test.execute_dialog_through_command(".uno:EditCurIndex") as xDiagIndex: + title = xDiagIndex.getChild("title") + title.executeAction("TYPE", mkPropertyValues({"TEXT":"aaaa"})) + + self.xUITest.executeCommand(".uno:Undo") + + with self.ui_test.execute_dialog_through_command(".uno:EditCurIndex") as xDiagIndex: + title = xDiagIndex.getChild("title") + title.executeAction("TYPE", mkPropertyValues({"TEXT":"aaaa"})) + + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") + + self.assertEqual(writer_doc.Text.String.replace('\r\n', '\n')[1:7], "CRASHY") + +# 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..2415351db --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf126168.py @@ -0,0 +1,44 @@ +# -*- 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 +#Bug 126168 - Crash in: rtl_uString_acquire: frame style undo redo + +class tdf126168(UITestCase): + + def test_tdf126168_frame_undo_redo_crash(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + #2) Menu > Insert > Frame > Frame + #3) Press OK in Frame dialog + with self.ui_test.execute_dialog_through_command(".uno:InsertFrame"): + pass + self.assertEqual(document.TextFrames.getCount(), 1) + #New Style from Selection [uno:StyleNewByExample] + with self.ui_test.execute_dialog_through_command(".uno:StyleNewByExample") as xDialog: + #5) Enter a name in the Create Style dialog and press OK + stylename = xDialog.getChild("stylename") + stylename.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) + #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) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/tdf126226.py b/sw/qa/uitest/writer_tests6/tdf126226.py new file mode 100644 index 000000000..65da8b6d6 --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf126226.py @@ -0,0 +1,28 @@ +# -*- 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.uihelper.common import get_state_as_dict, get_url_for_data_file + +class Tdf126226(UITestCase): + + def test_tdf126226(self): + with self.ui_test.load_file(get_url_for_data_file("tdf126226.odt")) as writer_doc: + + self.xUITest.executeCommand(".uno:SelectAll") + + # Without the fix in place, this test would have crashed here + with self.ui_test.execute_dialog_through_command(".uno:CommentChangeTracking") as xDialog: + + + self.assertEqual("Hello\n", get_state_as_dict(xDialog.getChild("edit"))["Text"]) + self.assertEqual("Autor desconocido, 07/04/2019 13:43:52", + get_state_as_dict(xDialog.getChild("lastedit"))["Text"]) + +# 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..ee8941d4b --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf128431.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 uitest.uihelper.common import select_pos, get_state_as_dict +from uitest.uihelper.common import change_measurement_unit +#Bug 128431 - Synchronize padding in header borders it is not working + +class tdf128431(UITestCase): + + def test_tdf128431_pageFormat_sync_padding(self): + with self.ui_test.create_doc_in_start_center("writer"): + + change_measurement_unit(self, "Centimeter") + + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: + 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") + + + +# 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..1de344888 --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf131041.py @@ -0,0 +1,44 @@ +# -*- 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.uihelper.common import select_pos, get_state_as_dict + +class tdf131041(UITestCase): + + def test_run(self): + with self.ui_test.create_doc_in_start_center("writer"): + + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: + 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") + + with self.ui_test.execute_dialog_through_action(xMoreBtn, "CLICK") as xBorderDlg: + + + #modify any property + bottomft = xBorderDlg.getChild("bottommf") + bottomft.executeAction("UP", tuple()) + + #it would crash here + + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/tdf141957.py b/sw/qa/uitest/writer_tests6/tdf141957.py new file mode 100644 index 000000000..66795099f --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf141957.py @@ -0,0 +1,37 @@ +# -*- 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.uihelper.common import get_state_as_dict, get_url_for_data_file + +class tdf141957(UITestCase): + + def test_tdf_141957(self): + with self.ui_test.load_file(get_url_for_data_file("tdf141957.odt")): + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: + tabcontrol = xDialog.getChild("tabcontrol") + + xLandscape = xDialog.getChild('radiobuttonLandscape') + self.assertEqual("true", get_state_as_dict(xLandscape)['Checked']) + + xTextDirectionList = xDialog.getChild("comboTextFlowBox") + self.assertEqual("Right-to-left (vertical)", get_state_as_dict(xTextDirectionList)['SelectEntryText']) + + xHeaderOn = xDialog.getChild("checkHeaderOn") + self.assertEqual(get_state_as_dict(xHeaderOn)["Selected"], "true") + + xCharsPerLine = xDialog.getChild("spinNF_CHARSPERLINE") + xLinesPerLine = xDialog.getChild("spinNF_LINESPERPAGE") + + # Without the fix in place, this test would have failed with + # AssertionError: '21' != '24' + self.assertEqual("21", get_state_as_dict(xCharsPerLine)['Text']) + self.assertEqual("20", get_state_as_dict(xLinesPerLine)['Text']) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/tdf144691.py b/sw/qa/uitest/writer_tests6/tdf144691.py new file mode 100644 index 000000000..f2f980a59 --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf144691.py @@ -0,0 +1,46 @@ +# -*- 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.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_by_text + +class tdf144691(UITestCase): + + def test_tdf144691(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog: + xPages = xDialog.getChild("pages") + xLanguageEntry = xPages.getChild('2') + xLanguageEntry.executeAction("EXPAND", tuple()) + xxLanguageEntryGeneralEntry = xLanguageEntry.getChild('0') + xxLanguageEntryGeneralEntry.executeAction("SELECT", tuple()) + + xWesternLanguage = xDialog.getChild("westernlanguage") + + defaultLanguage = get_state_as_dict(xWesternLanguage)['SelectEntryText'] + + # Select another language + select_by_text(xWesternLanguage, "Tajik") + self.assertEqual("Tajik", get_state_as_dict(xWesternLanguage)['SelectEntryText']) + + xApply = xDialog.getChild("apply") + xApply.executeAction("CLICK", tuple()) + + # Without the fix in place, this test would have failed with + # AssertionError: 'Tajik' != 'English (USA)' + self.assertEqual("Tajik", get_state_as_dict(xWesternLanguage)['SelectEntryText']) + + # Select the default language + select_by_text(xWesternLanguage, defaultLanguage) + self.assertEqual(defaultLanguage, get_state_as_dict(xWesternLanguage)['SelectEntryText']) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/tdf89383.py b/sw/qa/uitest/writer_tests6/tdf89383.py new file mode 100644 index 000000000..40a7e74c5 --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf89383.py @@ -0,0 +1,30 @@ +# -*- 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.uihelper.common import get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues + +#Bug 89383 - Read-only passwords on OOXML files are not working + +class tdf89383(UITestCase): + def test_tdf89383_DOCX(self): + with self.ui_test.load_file(get_url_for_data_file("writeprotection.docx")): + document = self.ui_test.get_component() + + # Without the fix in place, this test would have failed with + # AssertionError: False is not true + self.assertTrue(document.isReadonly()) + + with self.ui_test.execute_dialog_through_command(".uno:EditDoc") as xDialog: + xPassword = xDialog.getChild("newpassEntry") + xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "a"})) + + self.assertFalse(document.isReadonly()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/apply_line_cap.py b/sw/qa/uitest/writer_tests7/apply_line_cap.py new file mode 100644 index 000000000..cd4fc8222 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/apply_line_cap.py @@ -0,0 +1,93 @@ +# -*- 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.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_pos + +class apply_line_cap(UITestCase): + + def test_apply_line_cap(self): + with self.ui_test.load_file(get_url_for_data_file("tdf127166_prstDash_Word97.docx")) as writer_doc: + + # check FLAT -> ROUND cap style change by selecting the new 'Rounded' preset line styles + + # select second line shape (dashDot) + writer_doc.getCurrentController().select(writer_doc.getDrawPage()[1]) + + # wait for available line style setting + self.ui_test.wait_until_child_is_available('metricfield') + + # line setting dialog window + with self.ui_test.execute_dialog_through_command(".uno:FormatLine") as xFormatLineDlg: + + # get cap style combo box + xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE") + cap_style = get_state_as_dict(xCapStyle)['SelectEntryText'] + + # get line style combo box + xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE") + + # select 'Dot (Rounded)', but store the previous value + style = get_state_as_dict(xLineStyle)['SelectEntryText'] + select_pos(xLineStyle, "3") + + + self.assertEqual(cap_style, 'Flat') + self.assertEqual(style, 'Long Dash Dot') + + # check round cap setting, opening the line style dialog again + writer_doc.getCurrentController().select(writer_doc.getDrawPage()[1]) + + # wait for available line style setting + self.ui_test.wait_until_child_is_available('metricfield') + + # line setting dialog window + with self.ui_test.execute_dialog_through_command(".uno:FormatLine") as xFormatLineDlg: + + # get cap style combo box + xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE") + cap_style = get_state_as_dict(xCapStyle)['SelectEntryText'] + + # get line style combo box + xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE") + + # select 'Dot', but store the previous value + style = get_state_as_dict(xLineStyle)['SelectEntryText'] + select_pos(xLineStyle, "2") + + + # This was 'Flat' (set only dash style of the line style before) + self.assertEqual(cap_style, 'Round') + self.assertEqual(style, 'Dot (Rounded)') + + # 2. check ROUND -> FLAT cap style change + writer_doc.getCurrentController().select(writer_doc.getDrawPage()[1]) + + # wait for available line style setting + self.ui_test.wait_until_child_is_available('metricfield') + + # line setting dialog window + with self.ui_test.execute_dialog_through_command(".uno:FormatLine") as xFormatLineDlg: + + # get cap style combo box + xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE") + cap_style = get_state_as_dict(xCapStyle)['SelectEntryText'] + + # get line style combo box + xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE") + + style = get_state_as_dict(xLineStyle)['SelectEntryText'] + + + # This was 'Flat' (set only dash style of the line style before) + self.assertEqual(cap_style, 'Flat') + self.assertEqual(style, 'Dot') + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/forms.py b/sw/qa/uitest/writer_tests7/forms.py new file mode 100644 index 000000000..2e44dbea6 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/forms.py @@ -0,0 +1,205 @@ +# -*- 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.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import change_measurement_unit +from uitest.uihelper.common import select_by_text +from libreoffice.uno.propertyvalue import mkPropertyValues + +class Forms(UITestCase): + + def test_tdf140486(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf140486.odt")): + + self.xUITest.executeCommand(".uno:JumpToNextFrame") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties", close_button=""): + xChild = self.ui_test.wait_until_child_is_available('listbox-Empty string is NULL') + + # Without the fix in place, this test would have failed with + # AssertionError: 'Yes' != 'No' + self.assertEqual("Yes", get_state_as_dict(xChild)['SelectEntryText']) + + def test_tdf140198(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf140198.odt")): + + self.xUITest.executeCommand(".uno:JumpToNextFrame") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties", close_button=""): + xChild = self.ui_test.wait_until_child_is_available('listbox-Text type') + + # Without the fix in place, this test would have failed with + # AssertionError: 'Multi-line' != 'Single-line' + self.assertEqual("Multi-line", get_state_as_dict(xChild)['SelectEntryText']) + + def test_tdf141084(self): + + # Reuse document from tdf#140239 + with self.ui_test.load_file(get_url_for_data_file("tdf140239.odt")): + + with self.ui_test.execute_modeless_dialog_through_command(".uno:FormProperties", close_button=""): + xURL = self.ui_test.wait_until_child_is_available('urlcontrol-URL') + + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "1"})) + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "2"})) + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "3"})) + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "4"})) + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "5"})) + + # Without the fix in place, this test would have failed with + # AssertionError: '12345' != 'file:///tmp/tmp/5file:///tmp/tmp/4file://[40 chars]mp/1' + self.assertEqual("12345", get_state_as_dict(xURL)['Text']) + + def test_tdf140239(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf140239.odt")): + + self.xUITest.executeCommand(".uno:JumpToNextFrame") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties", close_button=""): + xAction = self.ui_test.wait_until_child_is_available('listbox-Action') + xURL = self.ui_test.wait_until_child_is_available('urlcontrol-URL') + xEntry = self.ui_test.wait_until_child_is_available('entry') + + self.assertEqual("None", get_state_as_dict(xAction)['SelectEntryText']) + self.assertEqual("false", get_state_as_dict(xURL)['Enabled']) + + select_by_text(xAction, "Open document/web page") + + self.assertEqual("Open document/web page", get_state_as_dict(xAction)['SelectEntryText']) + + self.ui_test.wait_until_property_is_updated(xURL, "Enabled", "true") + self.assertEqual("true", get_state_as_dict(xURL)['Enabled']) + + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "1"})) + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "2"})) + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "3"})) + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "4"})) + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "5"})) + + # Without the fix in place, this test would have failed with + # AssertionError: '12345' != '54321' + self.assertEqual("12345", get_state_as_dict(xURL)['Text']) + + xEntry.executeAction("FOCUS", tuple()) + self.assertEqual("Push Button", get_state_as_dict(xEntry)['Text']) + + xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xEntry.executeAction("TYPE", mkPropertyValues({"TEXT": "Push"})) + + # Move the focus to another element so the changes done before will take effect + xAction.executeAction("FOCUS", tuple()) + + # tdf#131522: Without the fix in place, this test would have failed with + # AssertionError: 'Push' != 'Push Button' + self.assertEqual("Push", get_state_as_dict(xEntry)['Text']) + + def test_tdf138701(self): + + # Reuse file from another test + with self.ui_test.load_file(get_url_for_data_file("tdf140198.odt")): + + self.xUITest.executeCommand(".uno:JumpToNextFrame") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties", close_button=""): + xChild = self.ui_test.wait_until_child_is_available('combobox-Data field') + + xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "1"})) + xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "2"})) + xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "3"})) + xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "4"})) + xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "5"})) + + # Without the fix in place, this test would have failed with + # AssertionError: '12345' != '54321' + self.assertEqual("12345", get_state_as_dict(xChild)['Text']) + + def test_tdf139486(self): + + # Reuse file from another test + with self.ui_test.load_file(get_url_for_data_file("tdf140198.odt")) as document: + + change_measurement_unit(self, "Centimeter") + + self.xUITest.executeCommand(".uno:JumpToNextFrame") + + drawPage = document.getDrawPages().getByIndex(0) + shape = drawPage.getByIndex(0) + self.assertEqual(13996, shape.getSize().Width) + self.assertEqual(2408, shape.getSize().Height) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties", close_button=""): + xWidth = self.ui_test.wait_until_child_is_available('numericfield-Width') + xHeight = self.ui_test.wait_until_child_is_available('numericfield-Height') + + self.assertEqual("14.00 cm", get_state_as_dict(xWidth)['Text']) + self.assertEqual("2.41 cm", get_state_as_dict(xHeight)['Text']) + + xWidth.executeAction("FOCUS", tuple()) + xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xWidth.executeAction("TYPE", mkPropertyValues({"TEXT":"20 cm"})) + + self.assertEqual("20 cm", get_state_as_dict(xWidth)['Text']) + + xHeight.executeAction("FOCUS", tuple()) + xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xHeight.executeAction("TYPE", mkPropertyValues({"TEXT":"5 cm"})) + + self.assertEqual("5 cm", get_state_as_dict(xHeight)['Text']) + + # Move the focus to another element so the changes done before take effect on the document + xDialog = self.xUITest.getTopFocusWindow() + xDialog.getChild('numericfield-PositionY').executeAction("FOCUS", tuple()) + + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.processEventsToIdle() + + # Without the fix in place, the size of the form wouldn't have changed + self.assertEqual(20001, shape.getSize().Width) + self.assertEqual(5001, shape.getSize().Height) + + def test_tdf138271(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf138271.odt")): + + self.xUITest.executeCommand(".uno:JumpToNextFrame") + + aOldValue = ["-1000000.00", "1000000.00"] + aNewValue = ["-100.00", "100.00"] + + for i, name in enumerate(['formattedcontrol-Value min.', 'formattedcontrol-Value max.']): + + with self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties", close_button=""): + xChild = self.ui_test.wait_until_child_is_available(name) + + self.assertEqual(aOldValue[i], get_state_as_dict(xChild)['Text']) + + xChild.executeAction("FOCUS", tuple()) + xChild.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xChild.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xChild.executeAction("TYPE", mkPropertyValues({"TEXT": aNewValue[i]})) + + #Close the dialog and open it again + self.xUITest.executeCommand(".uno:ControlProperties") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties", close_button=""): + xChild = self.ui_test.wait_until_child_is_available(name) + + # Without the fix in place, this test would have failed here because + # the values wouldn't have changed + self.assertEqual(aNewValue[i], get_state_as_dict(xChild)['Text']) + + self.xUITest.executeCommand(".uno:ControlProperties") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf104795.py b/sw/qa/uitest/writer_tests7/tdf104795.py new file mode 100644 index 000000000..98be1cf36 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf104795.py @@ -0,0 +1,26 @@ +# -*- 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.uihelper.common import get_state_as_dict, get_url_for_data_file + +class tdf104795(UITestCase): + + def test_tdf104795(self): + with self.ui_test.load_file(get_url_for_data_file("tdf104795.odt")) as writer_doc: + with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") as xDialog: + + sShowSignedText = get_state_as_dict(xDialog.getChild('showsigned'))['Text'] + + + # Without the fix in place, this test would have failed with + # AssertionError: '12/19/2016, 23:06:31, timur.davletshin' != '12/19/2016, 00:00:00, !!br0ken!!' + self.assertEqual("12/19/2016, 23:06:31, timur.davletshin", sShowSignedText.split('@')[0]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf115853.py b/sw/qa/uitest/writer_tests7/tdf115853.py new file mode 100644 index 000000000..a1e9d2a7d --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf115853.py @@ -0,0 +1,40 @@ +# -*- 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.uihelper.common import select_pos + +class tdf115853(UITestCase): + + def test_tdf115853(self): + with self.ui_test.create_doc_in_start_center("writer"): + with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") as xDialog: + + xTabs = xDialog.getChild("tabcontrol") + + select_pos(xTabs, "2") + + xAddBtn = xDialog.getChild("add") + xAddBtn.executeAction("CLICK", tuple()) + + xNameBox1 = xDialog.getChild("namebox1") + xNameBox1.executeAction("TYPE", mkPropertyValues({"TEXT":"Text"})) + + xAddBtn = xDialog.getChild("add") + xAddBtn.executeAction("CLICK", tuple()) + + # Without the fix in place, this test would have failed with + # AssertionError: 'Text' != '' + self.assertEqual("Text", get_state_as_dict(xNameBox1)['Text']) + + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf119661.py b/sw/qa/uitest/writer_tests7/tdf119661.py new file mode 100644 index 000000000..689410f64 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf119661.py @@ -0,0 +1,81 @@ +# -*- 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, get_url_for_data_file +from org.libreoffice.unotest import systemPathToFileUrl +from tempfile import TemporaryDirectory +import os.path + +class tdf119661(UITestCase): + + def test_tdf119661(self): + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, "tdf119661-tmp.odt") + + with self.ui_test.create_doc_in_start_center("writer"): + + with self.ui_test.execute_dialog_through_command(".uno:InsertGraphic", close_button="") as xOpenDialog: + xFileName = xOpenDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("LibreOffice.jpg")})) + + xLink = xOpenDialog.getChild("link") + self.assertEqual("false", get_state_as_dict(xLink)['Selected']) + + xLink.executeAction("CLICK", tuple()) + + xOpenBtn = xOpenDialog.getChild("open") + + #Confirmation dialog is displayed + with self.ui_test.execute_dialog_through_action(xOpenBtn, 'CLICK'): + pass + + with self.ui_test.execute_dialog_through_command(".uno:LinkDialog", close_button="close") as xDialog: + + + sLinks = "TB_LINKS" + xLinks = xDialog.getChild(sLinks) + self.assertEqual(1, len(xLinks.getChildren())) + + sFileName = "FULL_FILE_NAME" + xFileName = xDialog.getChild(sFileName) + self.assertTrue(get_state_as_dict(xFileName)["Text"].endswith("/LibreOffice.jpg")) + + sBreakLink = "BREAK_LINK" + xBreakLink = xDialog.getChild(sBreakLink) + + with self.ui_test.execute_blocking_action(xBreakLink.executeAction, + args=("CLICK", tuple()), close_button="yes"): + pass + + + + # Save Copy as + with self.ui_test.execute_dialog_through_command(".uno:SaveAs", close_button="open") as xDialog: + + xFileName = xDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath})) + + self.ui_test.wait_until_file_is_available(xFilePath) + + with self.ui_test.load_file(systemPathToFileUrl(xFilePath)): + + self.xUITest.executeCommand(".uno:LinkDialog") + + # Since the image is no longer linked, the link dialog is not open. + # Without the fix in place, this dialog would have been opened + xMainWin = self.xUITest.getTopFocusWindow() + self.assertTrue(sLinks not in xMainWin.getChildren()) + self.assertTrue(sFileName not in xMainWin.getChildren()) + self.assertTrue(sBreakLink not in xMainWin.getChildren()) + self.assertTrue("writer_edit" in xMainWin.getChildren()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf122780.py b/sw/qa/uitest/writer_tests7/tdf122780.py new file mode 100644 index 000000000..957ef31df --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf122780.py @@ -0,0 +1,23 @@ +# -*- 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.uihelper.common import get_state_as_dict, get_url_for_data_file + +class tdf122780(UITestCase): + + def test_tdf122780(self): + with self.ui_test.load_file(get_url_for_data_file("tdf122780.docx")) as writer_doc: + with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") as xDialog: + + # Without the fix in place, this test would have hung here + self.assertEqual("Normal_x005F", get_state_as_dict(xDialog.getChild('showtemplate'))['Text'][:12]) + self.assertEqual(32767, len(get_state_as_dict(xDialog.getChild('showtemplate'))['Text'])) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf128744.py b/sw/qa/uitest/writer_tests7/tdf128744.py new file mode 100644 index 000000000..34201e858 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf128744.py @@ -0,0 +1,71 @@ +# -*- 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.uihelper.common import select_pos +from uitest.uihelper.common import get_url_for_data_file + +class tdf128744(UITestCase): + + def test_tdf128744(self): + # load the sample file + with self.ui_test.load_file(get_url_for_data_file("tdf128744.docx")): + + # first try to unprotect Record Changes with an invalid password + + with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") as xDialog: + xRecordChangesCheckbox = xDialog.getChild("recordchanges") + self.assertEqual(get_state_as_dict(xRecordChangesCheckbox)["Selected"], "true") + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "3") #tab Security + xProtectBtn = xDialog.getChild("protect") + + # No close_button: click on the "Ok" inside to check the "Invalid password" infobox + with self.ui_test.execute_blocking_action(xProtectBtn.executeAction, args=('CLICK', ()), close_button="") as xPasswordDialog: + self.assertEqual(get_state_as_dict(xPasswordDialog)["DisplayText"], "Enter Password") + xPassword = xPasswordDialog.getChild("pass1ed") + xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "bad password"})) + print(xPasswordDialog.getChildren()) + xOkBtn = xPasswordDialog.getChild("ok") + with self.ui_test.execute_blocking_action(xOkBtn.executeAction, args=('CLICK', ())) as xInfoBox: + # "Invalid password" infobox + self.assertEqual(get_state_as_dict(xInfoBox)["DisplayText"], 'Information') + + # now open the dialog again and read the properties, Record Changes checkbox is still enabled + with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties", close_button="cancel") as xDialog: + xRecordChangesCheckbox = xDialog.getChild("recordchanges") + self.assertEqual(get_state_as_dict(xRecordChangesCheckbox)["Selected"], "true") + xResetBtn = xDialog.getChild("reset") + xResetBtn.executeAction("CLICK", tuple()) + + # unprotect Record Changes with the valid password "test" + + with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") as xDialog: + xRecordChangesCheckbox = xDialog.getChild("recordchanges") + self.assertEqual(get_state_as_dict(xRecordChangesCheckbox)["Selected"], "true") + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "3") #tab Security + xProtectBtn = xDialog.getChild("protect") + + with self.ui_test.execute_blocking_action(xProtectBtn.executeAction, args=('CLICK', ())) as xPasswordDialog: + self.assertEqual(get_state_as_dict(xPasswordDialog)["DisplayText"], "Enter Password") + xPassword = xPasswordDialog.getChild("pass1ed") + # give the correct password + xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "test"})) + + # now open the dialog again and read the properties, Record Changes checkbox is disabled now + with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties", close_button="cancel") as xDialog: + xRecordChangesCheckbox = xDialog.getChild("recordchanges") + self.assertEqual(get_state_as_dict(xRecordChangesCheckbox)["Selected"], "false") + xResetBtn = xDialog.getChild("reset") + xResetBtn.executeAction("CLICK", tuple()) + +# 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..c7403bf2c --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf131936.py @@ -0,0 +1,24 @@ +# -*- 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.uihelper.common import get_state_as_dict, get_url_for_data_file + +class tdf131936(UITestCase): + + def test_tdf131936_saveas_docx_version(self): + with self.ui_test.load_file(get_url_for_data_file("tdf131936.docx")): + + with self.ui_test.execute_dialog_through_command(".uno:SaveAs", close_button="cancel") as xDialog: + xFileTypeCombo = xDialog.getChild("file_type") + state = get_state_as_dict(xFileTypeCombo) + self.assertEqual(state["SelectEntryText"], "Office Open XML Text (Transitional) (.docx)") + + +# 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..b2704b341 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf132169.py @@ -0,0 +1,43 @@ +# -*- 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.uihelper.common import get_state_as_dict, get_url_for_data_file, type_text +from uitest.uihelper.common import change_measurement_unit + +class tdf132169(UITestCase): + def test_tdf132169(self): + + with self.ui_test.load_file(get_url_for_data_file("shape.odt")) as writer_doc: + + #set measurement to points + change_measurement_unit(self, "Point") + + self.xUITest.executeCommand(".uno:JumpToNextFrame") + + #wait until the toolbar is available + xLineMetric = self.ui_test.wait_until_child_is_available('metricfield') + self.assertEqual(get_state_as_dict(xLineMetric)["Text"], "0.0 pt") + + #Check changing value from dialog also works + with self.ui_test.execute_dialog_through_command(".uno:FormatLine") as xFormatLineDlg: + xWidth = xFormatLineDlg.getChild('MTR_FLD_LINE_WIDTH') + type_text(xWidth, "4.0") + + 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()) + + drawPage = writer_doc.getDrawPages().getByIndex(0) + shape = drawPage.getByIndex(0) + + #Without the fix in place, it would have been 310 + self.assertEqual(shape.LineWidth, 176) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf132714.py b/sw/qa/uitest/writer_tests7/tdf132714.py new file mode 100644 index 000000000..971db5f97 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf132714.py @@ -0,0 +1,23 @@ +# -*- 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.uihelper.common import get_url_for_data_file + +class tdf132714(UITestCase): + def test_tdf132714(self): + with self.ui_test.load_file(get_url_for_data_file("tdf132714.odt")) as document: + + # delete second row (first data row) in the associated text table of the chart + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoDown") + # Without the fix in place, at this point crash occurs. + self.xUITest.executeCommand(".uno:DeleteRows") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf133348.py b/sw/qa/uitest/writer_tests7/tdf133348.py new file mode 100644 index 000000000..8f8ff94cf --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf133348.py @@ -0,0 +1,58 @@ +# -*- 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 + +class tdf133348(UITestCase): + def test_tdf133348(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + + self.xUITest.executeCommand(".uno:SelectAll") + xArgs = mkPropertyValues({"Text": "C1"}) + self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) + + with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialogOpt: + xPages = xDialogOpt.getChild("pages") + xEntry = xPages.getChild('0') + xEntry.executeAction("EXPAND", tuple()) + xGeneralEntry = xEntry.getChild('0') + xGeneralEntry.executeAction("SELECT", tuple()) + xFirstName = xDialogOpt.getChild("firstname") + props = {"TEXT": "Known Author"} + actionProps = mkPropertyValues(props) + xFirstName.executeAction("TYPE", actionProps) + + xWriterDoc = self.xUITest.getTopFocusWindow() + xArgs = mkPropertyValues({"Text": "C2"}) + self.xUITest.executeCommandWithParameters(".uno:ReplyComment", xArgs) + + # Wait for async events to be processed + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.processEventsToIdle() + + xEnum = document.TextFields.createEnumeration() + self.assertEqual(xEnum.nextElement().Author.strip(), 'Unknown Author') + self.assertEqual(xEnum.nextElement().Author.strip(), 'Known Author') + + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") + + # Without the fix in place, it would have crashed here + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") + + # all comments have been deleted + self.assertFalse(document.TextFields.createEnumeration().hasMoreElements()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf134243.py b/sw/qa/uitest/writer_tests7/tdf134243.py new file mode 100644 index 000000000..9200a4ba8 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf134243.py @@ -0,0 +1,21 @@ +# -*- 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.uihelper.common import get_url_for_data_file + +class tdf134243(UITestCase): + + def test_tdf134243(self): + with self.ui_test.load_file(get_url_for_data_file("tdf134243.odt")) as writer_doc: + + # Without the fix in place, it would hung launching the mailmerge wizard + with self.ui_test.execute_dialog_through_command(".uno:MailMergeWizard", close_button="cancel"): + pass + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf134452.py b/sw/qa/uitest/writer_tests7/tdf134452.py new file mode 100644 index 000000000..28dbc6f12 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf134452.py @@ -0,0 +1,51 @@ +# -*- 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.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import select_pos + +# Bug 134452 - Applying a table style caused the loss of break/pagedesc props of the table + + +class tdf134452(UITestCase): + def test_tdf134452(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + with self.ui_test.execute_dialog_through_command(".uno:InsertTable") as xDialog: + formatlbinstable = xDialog.getChild("formatlbinstable") + entry = formatlbinstable.getChild("1") + entry.executeAction("SELECT", tuple()) + #setting the break and pageDesc properties + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + xbreak = xDialog.getChild("break") + xbreak.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(xbreak)["Selected"]) + xpagestyle = xDialog.getChild("pagestyle") + xpagestyle.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(xpagestyle)["Selected"]) + + #applying table style on the table + #without the fix, break and pageDesc properties would be overridden and lost + document = self.ui_test.get_component() + tables = document.getTextTables() + tables[0].setPropertyValue("TableTemplateName", "Box List Red") + + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + xbreak = xDialog.getChild("break") + self.assertEqual("true", get_state_as_dict(xbreak)["Selected"]) + xpagestyle = xDialog.getChild("pagestyle") + self.assertEqual("true", get_state_as_dict(xpagestyle)["Selected"]) +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf135413.py b/sw/qa/uitest/writer_tests7/tdf135413.py new file mode 100644 index 000000000..22c088eb2 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf135413.py @@ -0,0 +1,25 @@ +# -*- 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.uihelper.common import get_state_as_dict, get_url_for_data_file + +class tdf135413(UITestCase): + + def test_tdf135413(self): + + # Without the fix in place, this test would have crashed opening the document + # It seems the issue is only reproducible when the UI is displayed, + # thus, test it with a UItest + with self.ui_test.load_file(get_url_for_data_file("tdf135413.docx")): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + self.assertEqual("16", get_state_as_dict(xWriterEdit)["Pages"]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf135938.py b/sw/qa/uitest/writer_tests7/tdf135938.py new file mode 100755 index 000000000..00a72bec2 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf135938.py @@ -0,0 +1,51 @@ +# -*- 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.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf135938(UITestCase): + + def test_tdf135938_cross_reference_update(self): + with self.ui_test.create_doc_in_start_center("writer"): + with self.ui_test.execute_modeless_dialog_through_command(".uno:InsertReferenceField", close_button="cancel") as xDialog: + # Select set reference type + xTreelistType = xDialog.getChild("type-ref") + xTreeEntry = xTreelistType.getChild('0') + self.assertEqual(get_state_as_dict(xTreeEntry)["Text"], "Set Reference") + xTreeEntry.executeAction("SELECT", tuple()) + + # Insert cross references + xName = xDialog.getChild("name-ref") + xName.executeAction("TYPE", mkPropertyValues({"TEXT": "ABC"})) + xInsert = xDialog.getChild("ok") + xInsert.executeAction("CLICK", tuple()) + xName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xName.executeAction("TYPE", mkPropertyValues({"TEXT": "DEF"})) + xInsert.executeAction("CLICK", tuple()) + + # Search for insert reference type + xFilter = None + for childIx in range(len(xTreelistType.getChildren())): + xTreeEntry = xTreelistType.getChild(childIx) + if get_state_as_dict(xTreeEntry)["Text"] == "Insert Reference": + xTreeEntry.executeAction("SELECT", tuple()) + # Filter the cross references + xFilter = xDialog.getChild("filter") + xFilter.executeAction("TYPE", mkPropertyValues({"TEXT": "A"})) + # Without the fix in place, this test would have failed with + # AssertionError: 'ABC' != 'DEF', i.e., the text of the name field did not change + self.assertEqual(get_state_as_dict(xName)["Text"], "ABC") + break + + # Check if insert reference entry was found + self.assertFalse(xFilter is None) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf137802.py b/sw/qa/uitest/writer_tests7/tdf137802.py new file mode 100644 index 000000000..8616e5255 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf137802.py @@ -0,0 +1,77 @@ +# -*- 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.uihelper.common import get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues +from com.sun.star.text.TextContentAnchorType import AT_PAGE, AT_PARAGRAPH + +class tdf137802(UITestCase): + + def test_tdf137802(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf137802.odt")) as document: + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.assertEqual(document.DrawPage.getCount(), 2) + self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType) + + self.xUITest.executeCommand(".uno:JumpToNextFrame") + + self.ui_test.wait_until_child_is_available('metricfield') + + with self.ui_test.execute_dialog_through_command(".uno:TransformDialog") as xDialog: + + + xDialog.getChild('topage').executeAction("CLICK", tuple()) + + + self.assertEqual(AT_PAGE, document.DrawPage.getByIndex(0).AnchorType) + + self.assertEqual(document.DrawPage.getCount(), 2) + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + # When shape 1 is selected, esc key doesn't put the focus back to the document + # because the shape has a textbox. Move the focus to another shape with tab key + # and then use escape + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ESC"})) + + # Wait until the shape is deselected and the cursor is on the document + self.ui_test.wait_until_child_is_available('FontNameBox') + + # Delete the second paragraph. Shape 2 is anchored to this paragraph + # so it should be deleted + # tdf#137587 fly is no longer deleted by backspace so explicitly select + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "SHIFT+LEFT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) + + self.assertEqual(document.DrawPage.getCount(), 1) + + self.xUITest.executeCommand(".uno:JumpToNextFrame") + self.xUITest.executeCommand(".uno:Delete") + + self.assertEqual(document.DrawPage.getCount(), 0) + + self.xUITest.executeCommand(".uno:Undo") + + self.assertEqual(document.DrawPage.getCount(), 1) + + self.xUITest.executeCommand(".uno:Undo") + + self.assertEqual(document.DrawPage.getCount(), 2) + + self.xUITest.executeCommand(".uno:Undo") + + self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf137803.py b/sw/qa/uitest/writer_tests7/tdf137803.py new file mode 100644 index 000000000..3954caca1 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf137803.py @@ -0,0 +1,49 @@ +# -*- 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.uihelper.common import get_url_for_data_file + + +class tdf137803(UITestCase): + def test_tdf137803(self): + # load the sample file + with self.ui_test.load_file(get_url_for_data_file("tdf137803.odt")) as document: + + # select the shape + self.xUITest.executeCommand(".uno:JumpToNextFrame") + self.ui_test.wait_until_child_is_available('metricfield') + + # open textattrs dialog + with self.ui_test.execute_dialog_through_command(".uno:TextAttributes") as TextDialog: + + # check autosize on + TSB_AUTOGROW_SIZE = TextDialog.getChild('TSB_AUTOGROW_SIZE') + TSB_AUTOGROW_SIZE.executeAction("CLICK",tuple()) + + # get the shape + drawPage = document.getDrawPages().getByIndex(0) + shape = drawPage.getByIndex(0) + + # and the textbox + frame = shape.getText() + + # get the positions + shapeYPos = shape.getPropertyValue("VertOrientPosition") + frameYPos = frame.getPropertyValue("VertOrientPosition") + shpsize = shape.getSize().Height + + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.processEventsToIdle() + + # without the fix, at this point the textbox falls apart so this won't be passed + self.assertLess(frameYPos, shapeYPos + shpsize) + + # close the doc + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf139301.py b/sw/qa/uitest/writer_tests7/tdf139301.py new file mode 100644 index 000000000..242d638e6 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf139301.py @@ -0,0 +1,60 @@ +# -*- 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.uihelper.common import get_state_as_dict, get_url_for_data_file + +class tdf139301(UITestCase): + + styles = ('Long Dash', 'Long Dash Dot', 'Long Dot', 'Double Dash', 'Double Dash Dot', 'Double Dash Dot Dot', 'Dash', 'Dash Dot', 'Dash Dot Dot', 'Dot') + + def test_tdf139301(self): + with self.ui_test.load_file(get_url_for_data_file("tdf127166_prstDash_Word97.docx")) as writer_doc: + + for i in range(len(self.styles)): + # select next line shape + writer_doc.getCurrentController().select(writer_doc.getDrawPage()[i]) + + # wait for available line style setting + self.ui_test.wait_until_child_is_available('metricfield') + + # line setting dialog window + with self.ui_test.execute_dialog_through_command(".uno:FormatLine") as xFormatLineDlg: + # get line style combo box + xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE") + + # check preset line style + style = get_state_as_dict(xLineStyle)['SelectEntryText'] + + + self.assertEqual(style, self.styles[i]) + + def test_round_cap(self): + with self.ui_test.load_file(get_url_for_data_file("tdf127166_prstDash_round_cap.docx")) as writer_doc: + + style_name_extension = ' (Rounded)' + + for i in range(len(self.styles)): + # select next line shape + writer_doc.getCurrentController().select(writer_doc.getDrawPage()[i]) + + # wait for available line style setting + self.ui_test.wait_until_child_is_available('metricfield') + + # line setting dialog window + with self.ui_test.execute_dialog_through_command(".uno:FormatLine") as xFormatLineDlg: + # get line style combo box + xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE") + + # check preset line style + style = get_state_as_dict(xLineStyle)['SelectEntryText'] + + + self.assertEqual(style, self.styles[i] + style_name_extension) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf140117.py b/sw/qa/uitest/writer_tests7/tdf140117.py new file mode 100644 index 000000000..42b8b04fa --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf140117.py @@ -0,0 +1,59 @@ +# -*- 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 select_pos +from uitest.uihelper.common import type_text +from uitest.uihelper.common import get_url_for_data_file + +class tdf140117(UITestCase): + def test_tdf140117(self): + # load the sample file + with self.ui_test.load_file(get_url_for_data_file("tdf140117.fodt")) as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + for i in range(3): + xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"})) + + self.xUITest.executeCommand(".uno:JumpToHeader") + + xPageSytle = document.getStyleFamilies().getByIndex(2) + xHeaderText = xPageSytle.getByIndex(0).HeaderText.String + xHeaderFirstText = xPageSytle.getByIndex(0).HeaderTextFirst.String + xHeaderLeftText = xPageSytle.getByIndex(0).HeaderTextLeft.String + xHeaderRightText = xPageSytle.getByIndex(0).HeaderTextRight.String + + # Option "same content on left and right pages" is false, + # insert text "XXXX" before actual header text "left" on page 2 + if i == 0: + type_text(xWriterEdit, "XXXX") + + # Option "same content on left and right pages" is true, + # header of page 2 contains the same text as page 1 + elif i == 1: + self.assertEqual("right", xHeaderText) + self.assertEqual("right", xHeaderRightText) + + # Option "same content on left and right pages" is false again. + # This was "right" instead of keeping the header content disabled + # temporarily for the second interaction of the loop. + elif i == 2: + self.assertEqual("XXXXleft", xHeaderLeftText) + + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as PageDialog: + + xTabs = PageDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + + # Change option "same content on left and right pages" for the next iteration + Button = xTabs.getChild('checkSameLR') + Button.executeAction("CLICK", tuple()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf140863.py b/sw/qa/uitest/writer_tests7/tdf140863.py new file mode 100644 index 000000000..edac0e451 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf140863.py @@ -0,0 +1,60 @@ +# -*- 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 + +class tdf140863(UITestCase): + + def test_tdf140863(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + + # Insert one section + with self.ui_test.execute_dialog_through_command(".uno:InsertSection"): + pass + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + # Insert a page break in the section + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + self.xUITest.executeCommand(".uno:InsertPagebreak") + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") + + self.assertEqual(1, len(document.TextSections)) + self.assertTrue(document.TextSections.Section1.IsVisible) + + + with self.ui_test.execute_dialog_through_command(".uno:EditRegion") as xDialog: + xHide = xDialog.getChild('hide') + self.assertEqual('false', get_state_as_dict(xHide)['Selected']) + + xHide.executeAction('CLICK', tuple()) + + + self.assertEqual(1, len(document.TextSections)) + self.assertFalse(document.TextSections.Section1.IsVisible) + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1") + + with self.ui_test.execute_dialog_through_command(".uno:EditRegion") as xDialog: + xHide = xDialog.getChild('hide') + self.assertEqual('true', get_state_as_dict(xHide)['Selected']) + + xHide.executeAction('CLICK', tuple()) + + self.assertEqual(1, len(document.TextSections)) + self.assertTrue(document.TextSections.Section1.IsVisible) + + # Without the fix in place, this test would have failed with + # AssertionError: '1' != '2' + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf141158.py b/sw/qa/uitest/writer_tests7/tdf141158.py new file mode 100644 index 000000000..6cdf178da --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf141158.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.uihelper.common import select_pos +from uitest.uihelper.common import get_url_for_data_file + +class TestTdf141158(UITestCase): + def test_tdf141158(self): + # load the desired bugdoc + with self.ui_test.load_file(get_url_for_data_file("TestHiddenHeadersFooters.docx")) as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + # open the page styles dialog and select the headers tab + with self.ui_test.execute_dialog_through_command(".uno:PageStyleName") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + # make the same left right page header state to off and apply the setting + checkSameLR = xDialog.getChild("checkSameLR") + checkSameLR.executeAction("CLICK",tuple()) + + # go to the left header + xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"})) + self.xUITest.executeCommand(".uno:JumpToHeader") + # get the text of the header + xPageSytle = document.getStyleFamilies().getByIndex(2) + xHeaderText = xPageSytle.getByIndex(0).HeaderText.String + xHeaderLeftText = xPageSytle.getByIndex(0).HeaderTextLeft.String + # without the fix in place it was "Right Header" (lost hidden left header), + # with the fix it should pass... + self.assertEqual("Left Header", xHeaderLeftText) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf141557.py b/sw/qa/uitest/writer_tests7/tdf141557.py new file mode 100644 index 000000000..355a9f366 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf141557.py @@ -0,0 +1,37 @@ +# -*- 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 com.sun.star.text.TextContentAnchorType import AS_CHARACTER, AT_PARAGRAPH +import org.libreoffice.unotest +from uitest.uihelper.common import get_url_for_data_file + +class tdf141557(UITestCase): + def test_tdf141557(self): + # load the sample file + with self.ui_test.load_file(get_url_for_data_file("tdf141557.docx")): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + document = self.ui_test.get_component() + + self.assertEqual(AS_CHARACTER, document.DrawPage.getByIndex(0).AnchorType) + + self.xUITest.executeCommand(".uno:JumpToNextFrame") + + self.ui_test.wait_until_child_is_available('metricfield') + + with self.ui_test.execute_dialog_through_command(".uno:TransformDialog") as xDialog: + + + xDialog.getChild('topara').executeAction("CLICK", tuple()) + + + # Without the fix in place, at this point crash occurs. + self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf143574.py b/sw/qa/uitest/writer_tests7/tdf143574.py new file mode 100644 index 000000000..0fc5dc66d --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf143574.py @@ -0,0 +1,40 @@ +# -*- 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 org.libreoffice.unotest +from uitest.uihelper.common import get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf143574(UITestCase): + def test_tdf143574(self): + # load the sample file + with self.ui_test.load_file(get_url_for_data_file("tdf143574.odt")): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + document = self.ui_test.get_component() + + # check the shape type. + self.assertEqual("com.sun.star.drawing.GroupShape", document.DrawPage.getByIndex(0).ShapeType) + + # select the shape. + self.xUITest.executeCommand(".uno:JumpToNextFrame") + self.ui_test.wait_until_child_is_available('metricfield') + + # go inside the group + self.xUITest.executeCommand(".uno:EnterGroup"); + + # select a shape in the group + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + + # At this point the Writer crashed here before the fix. + self.xUITest.executeCommand(".uno:AddTextBox"); + + self.assertEqual(True, document.DrawPage.getByIndex(0).getByIndex(2).TextBox) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf143785.py b/sw/qa/uitest/writer_tests7/tdf143785.py new file mode 100644 index 000000000..0e069b558 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf143785.py @@ -0,0 +1,43 @@ +# -*- 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.uihelper.common import get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues +from com.sun.star.text.TextContentAnchorType import AT_PAGE, AT_PARAGRAPH + +class tdf143785(UITestCase): + + def test_tdf143785(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf137802.odt")) as document: + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:JumpToNextFrame") + + self.ui_test.wait_until_child_is_available('metricfield') + + self.assertEqual(False, document.isModified()) + + with self.ui_test.execute_dialog_through_command(".uno:TransformDialog", close_button="cancel") as xDialog: + pass + + # Without the fix in place, this test would have failed with + # AssertionError: False != True + self.assertEqual(False, document.isModified()) + + with self.ui_test.execute_dialog_through_command(".uno:FormatArea", close_button="cancel") as xDialog: + pass + + # tdf#143778: Without the fix in place, this test would have failed with + # AssertionError: False != True + self.assertEqual(False, document.isModified()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf144439.py b/sw/qa/uitest/writer_tests7/tdf144439.py new file mode 100644 index 000000000..34911ee4c --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf144439.py @@ -0,0 +1,94 @@ +# -*- 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.uihelper.common import type_text, select_by_text, select_pos, get_state_as_dict + +class tdf144439(UITestCase): + + def test_tdf144439_list(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + # Enter some text + type_text(xWriterEdit, "List item") + # Apply numbering + self.xUITest.executeCommand(".uno:DefaultNumbering") + # Increase level up to 2 + self.xUITest.executeCommand(".uno:IncrementIndent") + + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog: + # Select custom tab + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + + # Select numbering + xNumFmt = xDialog.getChild("numfmtlb") + select_by_text(xNumFmt, "1, 2, 3, ...") + + # Increase number of sublevels to show + xSubLevels = xDialog.getChild("sublevels") + xSubLevels.executeAction("UP", tuple()) + + Paragraphs = document.Text.createEnumeration() + Para1 = Paragraphs.nextElement() + self.assertEqual(Para1.String, "List item") + self.assertEqual(Para1.getPropertyValue("ListLabelString"), "1.1.") + + def test_tdf144439_outline(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + # Enter some text + type_text(xWriterEdit, "Outline2") + # Apply outline level 2 (as a style) + self.xUITest.executeCommand(".uno:StyleApply?Style:string=Heading%202&FamilyName:string=ParagraphStyles") + + with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog: + # Select level "2" + xLevel = xDialog.getChild("level") + xLevel2 = xLevel.getChild("1") + xLevel2.executeAction("SELECT", tuple()) + self.assertEqual("2", get_state_as_dict(xLevel)['SelectEntryText']) + + # Select custom tab + xTab = xDialog.getChild("tabcontrol") + select_pos(xTab, "0") + + # Select numbering + xNumFmt = xDialog.getChild("numbering") + select_by_text(xNumFmt, "1, 2, 3, ...") + + # Increase number of sublevels to show + xSubLevels = xDialog.getChild("sublevelsnf") + xSubLevels.executeAction("UP", tuple()) + + Paragraphs = document.Text.createEnumeration() + Para1 = Paragraphs.nextElement() + self.assertEqual(Para1.String, "Outline2") + self.assertEqual(Para1.getPropertyValue("ListLabelString"), "1") + + with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog: + # Select level "1" + xLevel = xDialog.getChild("level") + xLevel2 = xLevel.getChild("0") + xLevel2.executeAction("SELECT", tuple()) + self.assertEqual("1", get_state_as_dict(xLevel)['SelectEntryText']) + + # Select custom tab + xTab = xDialog.getChild("tabcontrol") + select_pos(xTab, "0") + + # Select numbering + xNumFmt = xDialog.getChild("numbering") + select_by_text(xNumFmt, "1, 2, 3, ...") + + self.assertEqual(Para1.String, "Outline2") + self.assertEqual(Para1.getPropertyValue("ListLabelString"), "1.1") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf144578.py b/sw/qa/uitest/writer_tests7/tdf144578.py new file mode 100644 index 000000000..f92034edc --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf144578.py @@ -0,0 +1,68 @@ +# -*- 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.uihelper.common import get_state_as_dict, get_url_for_data_file + +import time + +class tdf144578(UITestCase): + + def test_tdf144578(self): + with self.ui_test.load_file(get_url_for_data_file("tdf144578.odt")) as writer_doc: + with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog: + # Select level "1" + xLevelsTree = xDialog.getChild("level") + xLevel = xLevelsTree.getChild("0") + xLevel.executeAction("SELECT", tuple()) + # Check value for show upper levels + xSubLevels = xDialog.getChild("sublevelsnf") + self.assertEqual(get_state_as_dict(xSubLevels)["Text"], "1") + + # Select level "2" + xLevel = xLevelsTree.getChild("1") + xLevel.executeAction("SELECT", tuple()) + # Check value for show upper levels + xSubLevels = xDialog.getChild("sublevelsnf") + self.assertEqual(get_state_as_dict(xSubLevels)["Text"], "2") + + # Select level "3" + xLevel = xLevelsTree.getChild("2") + xLevel.executeAction("SELECT", tuple()) + # Check value for show upper levels + xSubLevels = xDialog.getChild("sublevelsnf") + self.assertEqual(get_state_as_dict(xSubLevels)["Text"], "3") + + # Select level "3" + xLevel = xLevelsTree.getChild("3") + xLevel.executeAction("SELECT", tuple()) + # Check value for show upper levels + xSubLevels = xDialog.getChild("sublevelsnf") + self.assertEqual(get_state_as_dict(xSubLevels)["Text"], "1") + + # And also verify label strings in outlines + Paragraphs = [] + ParagraphEnum = writer_doc.Text.createEnumeration() + while ParagraphEnum.hasMoreElements(): + Para = ParagraphEnum.nextElement() + Paragraphs.append(Para) + + self.assertEqual(Paragraphs[0].getPropertyValue("ListLabelString"), "I.") + self.assertEqual(Paragraphs[2].getPropertyValue("ListLabelString"), "II.") + self.assertEqual(Paragraphs[4].getPropertyValue("ListLabelString"), "II.A.") + self.assertEqual(Paragraphs[6].getPropertyValue("ListLabelString"), "II.B.") + self.assertEqual(Paragraphs[8].getPropertyValue("ListLabelString"), "III.") + self.assertEqual(Paragraphs[10].getPropertyValue("ListLabelString"), "III.A.") + self.assertEqual(Paragraphs[11].getPropertyValue("ListLabelString"), "III.A.1.") + self.assertEqual(Paragraphs[13].getPropertyValue("ListLabelString"), "III.A.2.") + self.assertEqual(Paragraphs[15].getPropertyValue("ListLabelString"), "III.B.") + self.assertEqual(Paragraphs[17].getPropertyValue("ListLabelString"), "III.C.") + self.assertEqual(Paragraphs[19].getPropertyValue("ListLabelString"), "III.C.1.") + self.assertEqual(Paragraphs[21].getPropertyValue("ListLabelString"), "III.C.2.") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf145093.py b/sw/qa/uitest/writer_tests7/tdf145093.py new file mode 100644 index 000000000..b02fa4cbb --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf145093.py @@ -0,0 +1,36 @@ +# -*- 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 select_pos +from uitest.uihelper.common import type_text +from uitest.uihelper.common import get_url_for_data_file + +class tdf145093(UITestCase): + def test_tdf145093(self): + # load the sample file + with self.ui_test.load_file(get_url_for_data_file("tdf39721.fodt")) as document: + + # redlining should be on + self.xUITest.executeCommand(".uno:TrackChanges") + + # Move Up/Down a list item over a tracked paragraph insertion resulted a crash + # (Note: not only at the end of the document, but check the original + # bug report temporarily, where the problem is triggered by an other problem). + + self.xUITest.executeCommand(".uno:MoveDown") + self.xUITest.executeCommand(".uno:MoveDown") + # Note: Move list item from the end of the document creates an extra insertion. + # TODO: fix this other problem, and improve the test with an extra paragraph insertion + self.xUITest.executeCommand(".uno:MoveUp") + + # This was a crash (using invalid pointer) both in Show Changes and Hide Changes modes + self.xUITest.executeCommand(".uno:MoveDown") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf145158.py b/sw/qa/uitest/writer_tests7/tdf145158.py new file mode 100644 index 000000000..50ef8575d --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf145158.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.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_by_text + +class tdf145158(UITestCase): + + def test_tdf145158(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + xMainWindow = self.xUITest.getTopFocusWindow() + xWriterEdit = xMainWindow.getChild("writer_edit") + + xFontsize = xMainWindow.getChild("fontsizecombobox") + + self.assertEqual("12 pt", get_state_as_dict(xFontsize)['Text']) + + select_by_text(xFontsize, "10.5 pt") + + xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Test"})) + + with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog: + xSizeFont = xDialog.getChild("cbWestSize") + + # Without the fix in place, this test would have failed with + # AssertionError: '10.5 pt' != '11 pt' + self.assertEqual("10.5 pt", get_state_as_dict(xSizeFont)['Text']) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf145178.py b/sw/qa/uitest/writer_tests7/tdf145178.py new file mode 100644 index 000000000..f535fad2a --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf145178.py @@ -0,0 +1,79 @@ +# -*- 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, select_pos +from uitest.uihelper.common import get_url_for_data_file + +class tdf145178(UITestCase): + + def test_tdf145178(self): + + with self.ui_test.load_file(get_url_for_data_file('tdf145178.fodt')): + + with self.ui_test.execute_dialog_through_command(".uno:EditRegion") as xDialog: + xTree = xDialog.getChild("tree") + self.assertEqual("1", get_state_as_dict(xTree)['Children']) + self.assertEqual("Section1", get_state_as_dict(xTree.getChild('0'))['Text']) + self.assertEqual("Section1", get_state_as_dict(xDialog.getChild('curname'))['Text']) + + xOptions = xDialog.getChild("options") + with self.ui_test.execute_blocking_action( + xOptions.executeAction, args=('CLICK', ())) as xOptDialog: + xTabs = xOptDialog.getChild("tabcontrol") + select_pos(xTabs, "3") + + xFtnExt = xOptDialog.getChild("ftnntattextend") + xFtnNum = xOptDialog.getChild("ftnntnum") + xFtnFrm = xOptDialog.getChild("ftnntnumfmt") + xFtnPre = xOptDialog.getChild("ftnprefix") + xFtnSuf = xOptDialog.getChild("ftnsuffix") + xFtnView = xOptDialog.getChild("ftnnumviewbox") + xFtnOffset = xOptDialog.getChild("ftnoffset") + + self.assertEqual("true", get_state_as_dict(xFtnExt)["Enabled"]) + self.assertEqual("true", get_state_as_dict(xFtnNum)["Enabled"]) + self.assertEqual("true", get_state_as_dict(xFtnFrm)["Enabled"]) + self.assertEqual("true", get_state_as_dict(xFtnPre)["Enabled"]) + self.assertEqual("true", get_state_as_dict(xFtnSuf)["Enabled"]) + self.assertEqual("true", get_state_as_dict(xFtnView)["Enabled"]) + self.assertEqual("true", get_state_as_dict(xFtnOffset)["Enabled"]) + + self.assertEqual("1, 2, 3, ...", get_state_as_dict(xFtnView)["DisplayText"]) + self.assertEqual("(", get_state_as_dict(xFtnPre)["Text"]) + + # Without the fix in place, this test would have failed with + # AssertionError: ')' != '' + self.assertEqual(")", get_state_as_dict(xFtnSuf)["Text"]) + + self.assertEqual("3", get_state_as_dict(xFtnOffset)["Text"]) + + xEndExt = xOptDialog.getChild("endntattextend") + xEndNum = xOptDialog.getChild("endntnum") + xEndFrm = xOptDialog.getChild("endntnumfmt") + xEndPre = xOptDialog.getChild("endprefix") + xEndSuf = xOptDialog.getChild("endsuffix") + xEndView = xOptDialog.getChild("endnumviewbox") + xEndOffset = xOptDialog.getChild("endoffset") + + self.assertEqual("true", get_state_as_dict(xEndExt)["Enabled"]) + self.assertEqual("true", get_state_as_dict(xEndNum)["Enabled"]) + self.assertEqual("true", get_state_as_dict(xEndFrm)["Enabled"]) + self.assertEqual("true", get_state_as_dict(xEndPre)["Enabled"]) + self.assertEqual("true", get_state_as_dict(xEndSuf)["Enabled"]) + self.assertEqual("true", get_state_as_dict(xEndView)["Enabled"]) + self.assertEqual("true", get_state_as_dict(xEndOffset)["Enabled"]) + + self.assertEqual("i, ii, iii, ...", get_state_as_dict(xEndView)["DisplayText"]) + self.assertEqual("[", get_state_as_dict(xEndPre)["Text"]) + self.assertEqual("]", get_state_as_dict(xEndSuf)["Text"]) + + self.assertEqual("2", get_state_as_dict(xEndOffset)["Text"]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf146605.py b/sw/qa/uitest/writer_tests7/tdf146605.py new file mode 100644 index 000000000..c63ae0bc9 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf146605.py @@ -0,0 +1,63 @@ +# -*- 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, get_url_for_data_file +from uitest.uihelper.common import select_pos + +class tdf146605(UITestCase): + + def test_tdf146605(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf146605.odt")) as document: + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.assertEqual(1, len(document.TextSections)) + self.assertTrue(document.TextSections.Section1.IsVisible) + self.assertFalse(document.TextSections.Section1.FootnoteIsCollectAtTextEnd) + self.assertFalse(document.TextSections.Section1.EndnoteIsCollectAtTextEnd) + self.assertEqual("2", get_state_as_dict(xWriterEdit)["Pages"]) + + with self.ui_test.execute_dialog_through_command(".uno:EditRegion") as xDialog: + xTree = xDialog.getChild("tree") + self.assertEqual("1", get_state_as_dict(xTree)['Children']) + self.assertEqual("Section1", get_state_as_dict(xTree.getChild('0'))['Text']) + self.assertEqual("Section1", get_state_as_dict(xDialog.getChild('curname'))['Text']) + + xOptions = xDialog.getChild("options") + with self.ui_test.execute_blocking_action( + xOptions.executeAction, args=('CLICK', ())) as xOptDialog: + xTabs = xOptDialog.getChild("tabcontrol") + select_pos(xTabs, "3") + + xTextEnd = xOptDialog.getChild("endntattextend") + xNum = xOptDialog.getChild("endntnum") + + self.assertEqual("true", get_state_as_dict(xTextEnd)['Enabled']) + self.assertEqual("false", get_state_as_dict(xTextEnd)['Selected']) + self.assertEqual("false", get_state_as_dict(xNum)['Enabled']) + + xTextEnd.executeAction('CLICK', tuple()) + + self.assertEqual("true", get_state_as_dict(xTextEnd)['Enabled']) + self.assertEqual("true", get_state_as_dict(xTextEnd)['Selected']) + self.assertEqual("true", get_state_as_dict(xNum)['Enabled']) + + self.assertEqual(1, len(document.TextSections)) + self.assertTrue(document.TextSections.Section1.IsVisible) + self.assertFalse(document.TextSections.Section1.FootnoteIsCollectAtTextEnd) + self.assertTrue(document.TextSections.Section1.EndnoteIsCollectAtTextEnd) + + # Without the fix in place, this test would have failed with + # AssertionError: '1' != '2' + self.assertEqual("1", get_state_as_dict(xWriterEdit)["Pages"]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf150443.py b/sw/qa/uitest/writer_tests7/tdf150443.py new file mode 100644 index 000000000..8cca7c78e --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf150443.py @@ -0,0 +1,46 @@ +# -*- 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.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf150443(UITestCase): + + def test_tdf150443(self): + with self.ui_test.load_file(get_url_for_data_file("tdf150443.docx")) as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + + # search term "Jump here!" + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Jump here!"})) + xsearch = xDialog.getChild("search") + xsearch.executeAction("CLICK", tuple()) #first search + xToolkit.processEventsToIdle() + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "4") + + # reject the tracked table row in Manage Changes dialog window + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg: + changesList = xTrackDlg.getChild("writerchanges") + + items = len(changesList.getChildren()) + + # select tree parent of the actual tracked row deletion in tree list + changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) + xToolkit.processEventsToIdle() + + # Without the fix in place, it would have crashed here + xAccBtn = xTrackDlg.getChild("reject") + xAccBtn.executeAction("CLICK", tuple()) + self.assertEqual(items - 1, len(changesList.getChildren())) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf152964.py b/sw/qa/uitest/writer_tests7/tdf152964.py new file mode 100644 index 000000000..abbf25434 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf152964.py @@ -0,0 +1,50 @@ +# -*- 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.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import select_pos + +# Bug 152964 - Undo of tracked deletion of an empty table row crashed Writer + + +class tdf152964(UITestCase): + def test_tdf152964(self): + with self.ui_test.create_doc_in_start_center("writer"): + + # redlining should be on + self.xUITest.executeCommand(".uno:TrackChanges") + # hide changes + self.xUITest.executeCommand(".uno:ShowTrackedChanges") + + # insert a table + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + with self.ui_test.execute_dialog_through_command(".uno:InsertTable") as xDialog: + formatlbinstable = xDialog.getChild("formatlbinstable") + entry = formatlbinstable.getChild("1") + entry.executeAction("SELECT", tuple()) + + # delete its second and first rows + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:DeleteRows") + self.xUITest.executeCommand(".uno:DeleteRows") + + # This crashed Writer + self.xUITest.executeCommand(".uno:Undo") + + # test other Undos and Redos + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Redo") + self.xUITest.executeCommand(".uno:Redo") + self.xUITest.executeCommand(".uno:Redo") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf46561.py b/sw/qa/uitest/writer_tests7/tdf46561.py new file mode 100644 index 000000000..575053a4f --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf46561.py @@ -0,0 +1,97 @@ +# -*- 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 select_pos +from uitest.uihelper.common import type_text +from uitest.uihelper.common import get_url_for_data_file + +class tdf46561(UITestCase): + def check_header_texts(self, master="", first="", left="", right=""): + # Get the current header style and its text contents + xPageStyle = self.document.getStyleFamilies().getByIndex(2) + xHeaderText = xPageStyle.getByIndex(0).HeaderText.String + xHeaderTextFirst = xPageStyle.getByIndex(0).HeaderTextFirst.String + xHeaderTextLeft = xPageStyle.getByIndex(0).HeaderTextLeft.String + xHeaderTextRight = xPageStyle.getByIndex(0).HeaderTextRight.String + + # Check the current values + self.assertEqual(master, xHeaderText) + self.assertEqual(first, xHeaderTextFirst) + self.assertEqual(left, xHeaderTextLeft) + self.assertEqual(right, xHeaderTextRight) + + def test_tdf46561(self): + with self.ui_test.load_file(get_url_for_data_file("tdf46561.odt")): + self.document = self.ui_test.get_component() + self.check_header_texts(master="right", first="1st", left="left", right="right") + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"})) + self.xUITest.executeCommand(".uno:JumpToHeader") + + # Switch "same left and right page headers" on and off a few times + for _ in range(4): + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as PageDialog: + + xTabs = PageDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + + Button = xTabs.getChild('checkSameLR') + Button.executeAction("CLICK",tuple()) + + # We should be back to the starting state after 2*k on/off changes + self.check_header_texts(master="right", first="1st", left="left", right="right") + + # Enter some additional text in the left page header + type_text(xWriterEdit, "XXXX") + self.check_header_texts(master="right", first="1st", left="XXXXleft", right="right") + + # Now go back one change (before entering "XXXX") + self.xUITest.executeCommand(".uno:Undo") + self.check_header_texts(master="right", first="1st", left="left", right="right") + + # Undo the fourth change + self.xUITest.executeCommand(".uno:Undo") + self.check_header_texts(master="right", first="1st", left="right", right="right") + + # Undo the third change + self.xUITest.executeCommand(".uno:Undo") + self.check_header_texts(master="right", first="1st", left="left", right="right") + + # Undo the second change + self.xUITest.executeCommand(".uno:Undo") + self.check_header_texts(master="right", first="1st", left="right", right="right") + + # Undo the first change + self.xUITest.executeCommand(".uno:Undo") + self.check_header_texts(master="right", first="1st", left="left", right="right") + + # Redo the first change + self.xUITest.executeCommand(".uno:Redo") + self.check_header_texts(master="right", first="1st", left="right", right="right") + + # Redo the second change + self.xUITest.executeCommand(".uno:Redo") + self.check_header_texts(master="right", first="1st", left="left", right="right") + + # Redo the third change + self.xUITest.executeCommand(".uno:Redo") + self.check_header_texts(master="right", first="1st", left="right", right="right") + + # Redo the fourth change + self.xUITest.executeCommand(".uno:Redo") + self.check_header_texts(master="right", first="1st", left="left", right="right") + + # Redo the final change + self.xUITest.executeCommand(".uno:Redo") + self.check_header_texts(master="right", first="1st", left="XXXXleft", right="right") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf90401.py b/sw/qa/uitest/writer_tests7/tdf90401.py new file mode 100644 index 000000000..b08c1f882 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf90401.py @@ -0,0 +1,165 @@ +# -*- 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.uihelper.common import type_text +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import get_url_for_data_file +from uitest.uihelper.common import select_pos +from libreoffice.uno.propertyvalue import mkPropertyValues +from org.libreoffice.unotest import systemPathToFileUrl +from tempfile import TemporaryDirectory +import os.path +#Bug 90401 - remove personal info on redlines and annotations + +class tdf90401(UITestCase): + + def test_tdf90401_remove_personal_info(self): + + # load a test document with a tracked change, and add a comment + + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, 'tdf90401-tmp.fodt') + + with self.ui_test.load_file(get_url_for_data_file('redline-autocorrect.fodt')) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild('writer_edit') + + self.xUITest.executeCommand('.uno:SelectAll') + self.xUITest.executeCommand('.uno:InsertAnnotation') + + # enable remove personal info security option + + with self.ui_test.execute_dialog_through_command('.uno:OptionsTreeDialog') as xDialog: + xPages = xDialog.getChild('pages') + xGenEntry = xPages.getChild('0') + xSecurityPage = xGenEntry.getChild('6') + xSecurityPage.executeAction('SELECT', tuple()) + # Click Button Options... + xOptions = xDialog.getChild('options') + + with self.ui_test.execute_blocking_action(xOptions.executeAction, args=('CLICK', ()), close_button="") as dialog: + xRemovePersonal = dialog.getChild('removepersonal') + if get_state_as_dict(xRemovePersonal)['Selected'] == "false": + xRemovePersonal.executeAction('CLICK', tuple()) + self.ui_test.wait_until_property_is_updated(xRemovePersonal, "Selected", "true") + self.assertEqual(get_state_as_dict(xRemovePersonal)["Selected"], "true") + + xOkBtn = dialog.getChild('ok') + # FIXME: we can't use close_dialog_through_button here, the dialog doesn't emit the + # event DialogClosed after closing + xOkBtn.executeAction('CLICK', tuple()) + + # Save Copy as + with self.ui_test.execute_dialog_through_command('.uno:SaveAs', close_button="open") as xDialog: + xFileName = xDialog.getChild('file_name') + xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'CTRL+A'})) + xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'})) + xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath})) + + self.ui_test.wait_until_file_is_available(xFilePath) + + with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as writer_doc2: + + # check removed personal info on comments + + textfields = writer_doc2.getTextFields() + author = "" + year = -1 + for textfield in textfields: + if textfield.supportsService("com.sun.star.text.TextField.Annotation"): + author = textfield.Author + year = textfield.Date.Year + # This was 'Unknown Author' + self.assertEqual(author, 'Author2') + # This was 2021 + self.assertEqual(year, 0) + + # check removed personal info on tracked changes + with self.ui_test.execute_modeless_dialog_through_command('.uno:AcceptTrackedChanges', close_button="close") as xTrackDlg: + xTreeList = xTrackDlg.getChild('writerchanges') + state = get_state_as_dict(xTreeList) + # This was 'NL\t11/03/2020 19:19:05\t', containing personal info + self.assertEqual(state['SelectEntryText'], 'Author1\t01/01/1970 00:00:00\t') + + def test_tdf142902_remove_personal_info_in_DOCX(self): + + # load a test document with a tracked change, and add a comment + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, 'redline-para-join-tmp.docx') + + with self.ui_test.load_file(get_url_for_data_file('redline-para-join.docx')) as writer_doc: + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild('writer_edit') + + self.xUITest.executeCommand('.uno:SelectAll') + self.xUITest.executeCommand('.uno:InsertAnnotation') + + # enable remove personal info security option + + with self.ui_test.execute_dialog_through_command('.uno:OptionsTreeDialog') as xDialog: + xPages = xDialog.getChild('pages') + xGenEntry = xPages.getChild('0') + xSecurityPage = xGenEntry.getChild('6') + xSecurityPage.executeAction('SELECT', tuple()) + # Click Button Options... + xOptions = xDialog.getChild('options') + + with self.ui_test.execute_blocking_action(xOptions.executeAction, args=('CLICK', ()), close_button="") as dialog: + xRemovePersonal = dialog.getChild('removepersonal') + if get_state_as_dict(xRemovePersonal)['Selected'] == "false": + xRemovePersonal.executeAction('CLICK', tuple()) + self.ui_test.wait_until_property_is_updated(xRemovePersonal, "Selected", "true") + self.assertEqual(get_state_as_dict(xRemovePersonal)["Selected"], "true") + + xOkBtn = dialog.getChild('ok') + # FIXME: we can't use close_dialog_through_button here, the dialog doesn't emit the + # event DialogClosed after closing + xOkBtn.executeAction('CLICK', tuple()) + + # Save Copy as + with self.ui_test.execute_dialog_through_command('.uno:SaveAs', close_button="") as xDialog: + xFileName = xDialog.getChild('file_name') + xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'CTRL+A'})) + xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'})) + xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath})) + + xOpen = xDialog.getChild("open") + # DOCX confirmation dialog is displayed + with self.ui_test.execute_dialog_through_action(xOpen, "CLICK", close_button="save"): + pass + + self.ui_test.wait_until_file_is_available(xFilePath) + + with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as writer_doc2: + + # check removed personal info on comments + + textfields = writer_doc2.getTextFields() + author = "" + year = -1 + for textfield in textfields: + if textfield.supportsService("com.sun.star.text.TextField.Annotation"): + author = textfield.Author + year = textfield.Date.Year + # This was 'Unknown Author' + self.assertEqual(author, 'Author2') + # This was 2021 + self.assertEqual(year, 0) + + # check removed personal info on tracked changes + + with self.ui_test.execute_modeless_dialog_through_command('.uno:AcceptTrackedChanges', close_button="close") as xTrackDlg: + xTreeList = xTrackDlg.getChild('writerchanges') + state = get_state_as_dict(xTreeList) + # This was 'NL\t11/03/2020 19:19:05\t', containing personal info + self.assertEqual(state['SelectEntryText'], 'Author1\t01/01/1970 00:00:00\t') + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |