[Libreoffice-commits] core.git: sfx2/qa

Laurent Godard lgodard.libre at laposte.net
Wed Sep 2 01:25:37 PDT 2015


 sfx2/qa/python/check_sidebar.py |   33 ++++++++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 5 deletions(-)

New commits:
commit c94a1fdc4443e11d19d12ac8888d8883f9b9494e
Author: Laurent Godard <lgodard.libre at laposte.net>
Date:   Tue Sep 1 15:28:39 2015 +0200

    sideber uno api test less dependant to panels order
    
    Change-Id: I3a4ef006becbce70897505a6f3367c4b004e13b0
    Reviewed-on: https://gerrit.libreoffice.org/18239
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sfx2/qa/python/check_sidebar.py b/sfx2/qa/python/check_sidebar.py
index 26a76bd..7599e4d 100644
--- a/sfx2/qa/python/check_sidebar.py
+++ b/sfx2/qa/python/check_sidebar.py
@@ -96,7 +96,7 @@ class CheckSidebar(unittest.TestCase):
         panelsCount = xPanels.getCount()
         self.assertEqual ( panelsCount, 5 )
 
-        firstPanelName = "StylesPropertyPanel"
+        firstPanelName = self.getFirstPanel(xPanels)
 
         panelElementNames = xPanels.getElementNames()
         assert ( firstPanelName in panelElementNames )
@@ -110,10 +110,7 @@ class CheckSidebar(unittest.TestCase):
         xPanel.setTitle(newTitle)
         assert ( xPanel.getTitle() == newTitle )
 
-        xPanel.moveFirst()
         initialIndex = xPanel.getOrderIndex()
-        assert ( initialIndex == 100 )
-
         xPanel.moveLast()
         assert ( xPanel.getOrderIndex() > initialIndex )
 
@@ -132,7 +129,9 @@ class CheckSidebar(unittest.TestCase):
         xPanel.collapse()
         assert( not xPanel.isExpanded() )
 
-        otherPanel = xPanels.getByName("NumberFormatPropertyPanel")
+        lastPanelName = self.getLastPanel(xPanels)
+
+        otherPanel = xPanels.getByName(lastPanelName)
         otherPanel.expand(False)
         assert( otherPanel.isExpanded() )
 
@@ -143,6 +142,30 @@ class CheckSidebar(unittest.TestCase):
     # close the document
         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__":
     unittest.main()
 


More information about the Libreoffice-commits mailing list