diff options
author | Laurent Godard <lgodard.libre@laposte.net> | 2015-09-14 15:58:37 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2015-09-15 16:09:42 +0000 |
commit | d38e743e8eb3fa70faf194c25dea1893029c5460 (patch) | |
tree | aa8780763c8ed9f65d1c4961db544939ac1caa0f /sfx2 | |
parent | f74e120ed08fa557faf09a76363e774057163f76 (diff) |
Rename Sidebar.xcu node names to be meaningful
+ prefixe with Sd, Sw, Sc if only one application context, no prefix otherwise
+ uniformize implicit convention nodeName = Id
+ unit test
+ check nodeName/Id
+ panels are bound to existing deck
Change-Id: I4ccc39008ebf5b5820d09472abfd45d2813e8c96
Reviewed-on: https://gerrit.libreoffice.org/18570
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/PythonTest_sfx2_python.mk | 1 | ||||
-rw-r--r-- | sfx2/qa/python/check_sidebar_registry.py | 92 |
2 files changed, 93 insertions, 0 deletions
diff --git a/sfx2/PythonTest_sfx2_python.mk b/sfx2/PythonTest_sfx2_python.mk index 43001100eb0d..a3a80079dc8c 100644 --- a/sfx2/PythonTest_sfx2_python.mk +++ b/sfx2/PythonTest_sfx2_python.mk @@ -15,6 +15,7 @@ $(eval $(call gb_PythonTest_set_defs,sfx2_python,\ $(eval $(call gb_PythonTest_add_modules,sfx2_python,$(SRCDIR)/sfx2/qa/python,\ check_sidebar \ + check_sidebar_registry \ )) # vim: set noet sw=4 ts=4: diff --git a/sfx2/qa/python/check_sidebar_registry.py b/sfx2/qa/python/check_sidebar_registry.py new file mode 100644 index 000000000000..9635f27010d6 --- /dev/null +++ b/sfx2/qa/python/check_sidebar_registry.py @@ -0,0 +1,92 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# 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 unittest +import unohelper +import os +from org.libreoffice.unotest import UnoInProcess +import uno + +class CheckSidebarRegistry(unittest.TestCase): + _uno = None + _xDoc = None + + @classmethod + def setUpClass(cls): + cls._uno = UnoInProcess() + cls._uno.setUp() + cls._xDoc = cls._uno.openEmptyDoc( url = "private:factory/scalc", bHidden = False, bReadOnly = False) + + @classmethod + def tearDownClass(cls): + cls._uno.tearDown() + + def test_sidebar_registry(self): + + # assert(result) after whole processing to list defected nodes at once + result = True + + #open registry node in Sidebar.xcu + configProvider = self.createUnoService("com.sun.star.configuration.ConfigurationProvider") + + param = uno.createUnoStruct('com.sun.star.beans.PropertyValue') + param.Name = "nodepath" + + + # Deck names consitency + + param.Value = "org.openoffice.Office.UI.Sidebar/Content/DeckList" + + sidebarDecksSettings = configProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", + (param, )) + for nodeName in sidebarDecksSettings: + + node = sidebarDecksSettings.getByName(nodeName) + + if (node.Id != nodeName): + print("\nNon-consistent sidebar.xcu Deck registry names", nodeName, node.Id) + result = False + + # panel names consitency + + param.Value = "org.openoffice.Office.UI.Sidebar/Content/PanelList" + + sidebarPanelsSettings = configProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", + (param, )) + for nodeName in sidebarPanelsSettings: + + node = sidebarPanelsSettings.getByName(nodeName) + + if (node.Id != nodeName): + print("\nNon-consistent sidebar.xcu Panel registry names", nodeName, node.Id) + result = False + + # is panel bound to an existing Deck ? + FoundDeckId = False + for deckNodeName in sidebarDecksSettings: + deckNode = sidebarDecksSettings.getByName(deckNodeName) + if (node.DeckId == deckNode.Id): + FoundDeckId = True + if not FoundDeckId: + print("\nNon existing DeckId for the panel ",node.Id) + result = False + + # trigger the overall result. details of each error have already be printed + assert(result) + + + def createUnoService(self, serviceName): + + sm = uno.getComponentContext().ServiceManager + return sm.createInstanceWithContext(serviceName, uno.getComponentContext()) + +if __name__ == "__main__": + unittest.main() + +# vim: set noet sw=4 ts=4: |