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/.
13 from org
.libreoffice
.unotest
import UnoInProcess
16 class CheckSidebarRegistry(unittest
.TestCase
):
20 cls
._uno
= UnoInProcess()
24 def tearDownClass(cls
):
27 def test_sidebar_registry(self
):
29 # assert(result) after whole processing to list defective nodes at once
32 #open registry node in Sidebar.xcu
33 config_provider
= self
.createUnoService("com.sun.star.configuration.ConfigurationProvider")
35 param
= uno
.createUnoStruct('com.sun.star.beans.PropertyValue')
36 param
.Name
= "nodepath"
39 # Deck names consistency
41 param
.Value
= "org.openoffice.Office.UI.Sidebar/Content/DeckList"
43 sidebar_decks_settings
= config_provider
.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess",
45 for nodeName
in sidebar_decks_settings
:
47 node
= sidebar_decks_settings
[nodeName
]
49 if (node
.Id
!= nodeName
):
50 print("\nNon-consistent sidebar.xcu Deck registry names", nodeName
, node
.Id
)
53 # panel names consistency
55 param
.Value
= "org.openoffice.Office.UI.Sidebar/Content/PanelList"
57 sidebar_panels_settings
= config_provider
.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess",
59 for nodeName
in sidebar_panels_settings
:
61 node
= sidebar_panels_settings
[nodeName
]
63 if (node
.Id
!= nodeName
):
64 print("\nNon-consistent sidebar.xcu Panel registry names", nodeName
, node
.Id
)
67 # is panel bound to an existing Deck ?
69 for deckNodeName
in sidebar_decks_settings
:
70 deck_node
= sidebar_decks_settings
[deckNodeName
]
71 if (node
.DeckId
== deck_node
.Id
):
74 print("\nNon existing DeckId for the panel ",node
.Id
)
77 # trigger the overall result. details of each error have already be printed
81 def createUnoService(self
, serviceName
):
83 sm
= uno
.getComponentContext().ServiceManager
84 return sm
.createInstanceWithContext(serviceName
, uno
.getComponentContext())
86 if __name__
== "__main__":
89 # vim: set shiftwidth=4 softtabstop=4 expandtab: