test_lib_agw_foldpanelbar.py 2.25 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
import unittest
from unittests import wtc
import wx

import wx.lib.agw.foldpanelbar as FPB

#---------------------------------------------------------------------------

class lib_agw_foldpanelbar_Tests(wtc.WidgetTestCase):

    def test_lib_agw_foldpanelbarCtor(self):
        panel_bar = FPB.FoldPanelBar(self.frame, -1, agwStyle=FPB.FPB_VERTICAL)

        fold_panel = panel_bar.AddFoldPanel("Thing")
        thing = wx.TextCtrl(fold_panel, -1, size=(400, -1), style=wx.TE_MULTILINE)

        panel_bar.AddFoldPanelWindow(fold_panel, thing)

    def test_lib_agw_foldpanelbarMethods(self):
        panel_bar = FPB.FoldPanelBar(self.frame, -1, agwStyle=FPB.FPB_VERTICAL)

        fold_panel = panel_bar.AddFoldPanel("Thing")
        thing = wx.TextCtrl(fold_panel, -1, size=(400, -1), style=wx.TE_MULTILINE)

        panel_bar.AddFoldPanelWindow(fold_panel, thing)

        # Some methods tests...
        self.assertTrue(panel_bar.IsVertical())
        self.assertEqual(panel_bar.GetCount(), 1)

        # Separators do not count as they are not "real" windows
        panel_bar.AddFoldPanelSeparator(fold_panel)
        self.assertEqual(panel_bar.GetCount(), 1)

        foldpanel = panel_bar.GetFoldPanel(0)
        self.assertTrue(foldpanel.IsExpanded())

        panel_bar.Collapse(foldpanel)
        self.assertTrue(not foldpanel.IsExpanded())


    def test_lib_agw_foldpanelbarConstantsExist(self):
        FPB.CAPTIONBAR_FILLED_RECTANGLE
        FPB.CAPTIONBAR_GRADIENT_H
        FPB.CAPTIONBAR_GRADIENT_V
        FPB.CAPTIONBAR_NOSTYLE
        FPB.CAPTIONBAR_RECTANGLE
        FPB.CAPTIONBAR_SINGLE
        FPB.FPB_ALIGN_LEFT
        FPB.FPB_ALIGN_WIDTH
        FPB.FPB_BMP_RIGHTSPACE
        FPB.FPB_COLLAPSE_TO_BOTTOM
        FPB.FPB_DEFAULT_LEFTLINESPACING
        FPB.FPB_DEFAULT_LEFTSPACING
        FPB.FPB_DEFAULT_RIGHTLINESPACING
        FPB.FPB_DEFAULT_RIGHTSPACING
        FPB.FPB_DEFAULT_SPACING
        FPB.FPB_EXCLUSIVE_FOLD
        FPB.FPB_EXTRA_X
        FPB.FPB_EXTRA_Y
        FPB.FPB_HORIZONTAL
        FPB.FPB_SINGLE_FOLD
        FPB.FPB_VERTICAL

    def test_lib_agw_foldpanelbarEvents(self):
        FPB.EVT_CAPTIONBAR
        FPB.wxEVT_CAPTIONBAR

#---------------------------------------------------------------------------

if __name__ == '__main__':
    unittest.main()