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/.
11 from org
.libreoffice
.unotest
import UnoInProcess
14 class CheckSidebarRegistry(unittest
.TestCase
):
18 cls
._uno
= UnoInProcess()
22 def tearDownClass(cls
):
25 def test_sidebar_registry(self
):
27 # assert(result) after whole processing to list defective nodes at once
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",
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
)
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",
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
)
65 # is panel bound to an existing Deck ?
67 for deckNodeName
in sidebar_decks_settings
:
68 deck_node
= sidebar_decks_settings
[deckNodeName
]
69 if (node
.DeckId
== deck_node
.Id
):
72 print("\nNon existing DeckId for the panel ",node
.Id
)
75 # trigger the overall result. details of each error have already be printed
79 def createUnoService(self
, serviceName
):
81 sm
= uno
.getComponentContext().ServiceManager
82 return sm
.createInstanceWithContext(serviceName
, uno
.getComponentContext())
84 if __name__
== "__main__":
87 # vim: set shiftwidth=4 softtabstop=4 expandtab: