diff options
Diffstat (limited to 'sw/qa/uitest/chapterNumbering')
-rw-r--r-- | sw/qa/uitest/chapterNumbering/chapterNumbering.py | 85 | ||||
-rw-r--r-- | sw/qa/uitest/chapterNumbering/tdf123547.py | 27 | ||||
-rw-r--r-- | sw/qa/uitest/chapterNumbering/tdf140528.py | 51 | ||||
-rw-r--r-- | sw/qa/uitest/chapterNumbering/tdf145215.py | 37 |
4 files changed, 200 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: |