look for java, javac and javadoc with the .exe suffix on windows
[LibreOffice.git] / sfx2 / qa / python / check_sidebar_registry.py
blobbc247006ccc075d316407a491df9c7b6bc815719
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 import unittest
11 from org.libreoffice.unotest import UnoInProcess
12 import uno
14 class CheckSidebarRegistry(unittest.TestCase):
16 @classmethod
17 def setUpClass(cls):
18 cls._uno = UnoInProcess()
19 cls._uno.setUp()
21 @classmethod
22 def tearDownClass(cls):
23 cls._uno.tearDown()
25 def test_sidebar_registry(self):
27 # assert(result) after whole processing to list defective nodes at once
28 result = True
30 #open registry node in Sidebar.xcu
31 config_provider = self.createUnoService("com.sun.star.configuration.ConfigurationProvider")
33 param = uno.createUnoStruct('com.sun.star.beans.PropertyValue')
34 param.Name = "nodepath"
37 # Deck names consistency
39 param.Value = "org.openoffice.Office.UI.Sidebar/Content/DeckList"
41 sidebar_decks_settings = config_provider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess",
42 (param, ))
43 for nodeName in sidebar_decks_settings:
45 node = sidebar_decks_settings[nodeName]
47 if (node.Id != nodeName):
48 print("\nNon-consistent sidebar.xcu Deck registry names", nodeName, node.Id)
49 result = False
51 # panel names consistency
53 param.Value = "org.openoffice.Office.UI.Sidebar/Content/PanelList"
55 sidebar_panels_settings = config_provider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess",
56 (param, ))
57 for nodeName in sidebar_panels_settings:
59 node = sidebar_panels_settings[nodeName]
61 if (node.Id != nodeName):
62 print("\nNon-consistent sidebar.xcu Panel registry names", nodeName, node.Id)
63 result = False
65 # is panel bound to an existing Deck ?
66 FoundDeckId = False
67 for deckNodeName in sidebar_decks_settings:
68 deck_node = sidebar_decks_settings[deckNodeName]
69 if (node.DeckId == deck_node.Id):
70 FoundDeckId = True
71 if not FoundDeckId:
72 print("\nNon existing DeckId for the panel ",node.Id)
73 result = False
75 # trigger the overall result. details of each error have already be printed
76 assert(result)
79 def createUnoService(self, serviceName):
81 sm = uno.getComponentContext().ServiceManager
82 return sm.createInstanceWithContext(serviceName, uno.getComponentContext())
84 if __name__ == "__main__":
85 unittest.main()
87 # vim: set shiftwidth=4 softtabstop=4 expandtab: