diff options
-rw-r--r-- | sw/Module_sw.mk | 1 | ||||
-rw-r--r-- | sw/UITest_sw_sidebar.mk | 16 | ||||
-rw-r--r-- | sw/qa/uitest/data/customStyles.odt | bin | 0 -> 8665 bytes | |||
-rw-r--r-- | sw/qa/uitest/sidebar/stylesSidebar.py | 78 | ||||
-rw-r--r-- | sw/qa/uitest/sidebar/tdf133189.py (renamed from sw/qa/uitest/writer_tests7/tdf133189.py) | 0 | ||||
-rw-r--r-- | sw/qa/uitest/sidebar/tdf99711.py (renamed from sw/qa/uitest/writer_tests7/tdf99711.py) | 0 | ||||
-rw-r--r-- | sw/qa/uitest/writer_dialogs/openDialogs.py | 3 |
7 files changed, 97 insertions, 1 deletions
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk index 85a0a7a23e13..4a56c8602d25 100644 --- a/sw/Module_sw.mk +++ b/sw/Module_sw.mk @@ -179,6 +179,7 @@ $(eval $(call gb_Module_add_uicheck_targets,sw,\ UITest_chapterNumbering \ UITest_sw_navigator \ UITest_sw_options \ + UITest_sw_sidebar \ UITest_sw_styleInspector \ UITest_sw_ui_fmtui \ UITest_classification \ diff --git a/sw/UITest_sw_sidebar.mk b/sw/UITest_sw_sidebar.mk new file mode 100644 index 000000000000..8a087e14fa43 --- /dev/null +++ b/sw/UITest_sw_sidebar.mk @@ -0,0 +1,16 @@ +# 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/. +# + +$(eval $(call gb_UITest_UITest,sw_sidebar)) + +$(eval $(call gb_UITest_add_modules,sw_sidebar,$(SRCDIR)/sw/qa/uitest,\ + sidebar/ \ +)) + +$(eval $(call gb_UITest_set_defs,sw_sidebar, \ + TDOC="$(SRCDIR)/sw/qa/uitest/data" \ +)) diff --git a/sw/qa/uitest/data/customStyles.odt b/sw/qa/uitest/data/customStyles.odt Binary files differnew file mode 100644 index 000000000000..2cf4bbbb1e98 --- /dev/null +++ b/sw/qa/uitest/data/customStyles.odt diff --git a/sw/qa/uitest/sidebar/stylesSidebar.py b/sw/qa/uitest/sidebar/stylesSidebar.py new file mode 100644 index 000000000000..db625be6f006 --- /dev/null +++ b/sw/qa/uitest/sidebar/stylesSidebar.py @@ -0,0 +1,78 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues + +class StylesSidebar(UITestCase): + + def test_load_styles_from_template(self): + self.ui_test.create_doc_in_start_center("writer") + + self.ui_test.execute_dialog_through_command(".uno:LoadStyles") + + xDialog = self.xUITest.getTopFocusWindow() + + 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") + xFileName.executeAction("CLICK", tuple()) + + xOpenDialog = self.xUITest.getTopFocusWindow() + xFileName = xOpenDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("customStyles.odt")})) + + xOpenBtn = xOpenDialog.getChild("open") + xOpenBtn.executeAction("CLICK", tuple()) + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:Sidebar") + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "StyleListPanel"})) + + xFilter = xWriterEdit.getChild('filter') + xFilter.executeAction("SELECT", mkPropertyValues({"TEXT": "Custom Styles"})) + + expectedResults = ["customParagraphStyle", "customCharacterStyle", "customFrameStyle", + "customPageStyle", "customNumberingStyle"] + + for i in range(5): + xLeft = xWriterEdit.getChild('left') + + #change to another style type + xLeft.executeAction("CLICK", mkPropertyValues({"POS": str( i + 1 )})) + + 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") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf133189.py b/sw/qa/uitest/sidebar/tdf133189.py index 30bd35d4c451..30bd35d4c451 100644 --- a/sw/qa/uitest/writer_tests7/tdf133189.py +++ b/sw/qa/uitest/sidebar/tdf133189.py diff --git a/sw/qa/uitest/writer_tests7/tdf99711.py b/sw/qa/uitest/sidebar/tdf99711.py index 776894431b92..776894431b92 100644 --- a/sw/qa/uitest/writer_tests7/tdf99711.py +++ b/sw/qa/uitest/sidebar/tdf99711.py diff --git a/sw/qa/uitest/writer_dialogs/openDialogs.py b/sw/qa/uitest/writer_dialogs/openDialogs.py index 07f127830404..6c8cb699a7a6 100644 --- a/sw/qa/uitest/writer_dialogs/openDialogs.py +++ b/sw/qa/uitest/writer_dialogs/openDialogs.py @@ -79,7 +79,8 @@ dialogs = [ # tested in sw/qa/uitest/writer_tests/watermark.py # {"command": ".uno:EditStyle", "closeButton": "cancel"}, # tested in sw/qa/uitest/writer_tests2/horizontalLine.py - {"command": ".uno:LoadStyles", "closeButton": "cancel"}, + #{"command": ".uno: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"}, |