Kaydet (Commit) c94a1fdc authored tarafından Laurent Godard's avatar Laurent Godard Kaydeden (comit) Miklos Vajna

sideber uno api test less dependant to panels order

Change-Id: I3a4ef006becbce70897505a6f3367c4b004e13b0
Reviewed-on: https://gerrit.libreoffice.org/18239Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 043cd5a5
...@@ -96,7 +96,7 @@ class CheckSidebar(unittest.TestCase): ...@@ -96,7 +96,7 @@ class CheckSidebar(unittest.TestCase):
panelsCount = xPanels.getCount() panelsCount = xPanels.getCount()
self.assertEqual ( panelsCount, 5 ) self.assertEqual ( panelsCount, 5 )
firstPanelName = "StylesPropertyPanel" firstPanelName = self.getFirstPanel(xPanels)
panelElementNames = xPanels.getElementNames() panelElementNames = xPanels.getElementNames()
assert ( firstPanelName in panelElementNames ) assert ( firstPanelName in panelElementNames )
...@@ -110,10 +110,7 @@ class CheckSidebar(unittest.TestCase): ...@@ -110,10 +110,7 @@ class CheckSidebar(unittest.TestCase):
xPanel.setTitle(newTitle) xPanel.setTitle(newTitle)
assert ( xPanel.getTitle() == newTitle ) assert ( xPanel.getTitle() == newTitle )
xPanel.moveFirst()
initialIndex = xPanel.getOrderIndex() initialIndex = xPanel.getOrderIndex()
assert ( initialIndex == 100 )
xPanel.moveLast() xPanel.moveLast()
assert ( xPanel.getOrderIndex() > initialIndex ) assert ( xPanel.getOrderIndex() > initialIndex )
...@@ -132,7 +129,9 @@ class CheckSidebar(unittest.TestCase): ...@@ -132,7 +129,9 @@ class CheckSidebar(unittest.TestCase):
xPanel.collapse() xPanel.collapse()
assert( not xPanel.isExpanded() ) assert( not xPanel.isExpanded() )
otherPanel = xPanels.getByName("NumberFormatPropertyPanel") lastPanelName = self.getLastPanel(xPanels)
otherPanel = xPanels.getByName(lastPanelName)
otherPanel.expand(False) otherPanel.expand(False)
assert( otherPanel.isExpanded() ) assert( otherPanel.isExpanded() )
...@@ -143,6 +142,30 @@ class CheckSidebar(unittest.TestCase): ...@@ -143,6 +142,30 @@ class CheckSidebar(unittest.TestCase):
# close the document # close the document
xDoc.dispose() xDoc.dispose()
def getFirstPanel(self, xPanels):
panelName = ""
curIndex = 10000
for panel in xPanels:
if panel.getOrderIndex() < curIndex:
panelName = panel.getId()
curIndex = panel.getOrderIndex()
return panelName
def getLastPanel(self, xPanels):
panelName = ""
curIndex = 0
for panel in xPanels:
if panel.getOrderIndex() > curIndex:
panelName = panel.getId()
curIndex = panel.getOrderIndex()
return panelName
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment