Add some unit tests

This commit is contained in:
Robin Dunn
2016-06-24 20:00:37 -07:00
parent d0f79d62df
commit adda4aa8c2
4 changed files with 140 additions and 16 deletions

View File

@@ -1,15 +1,81 @@
import unittest import unittest
import wtc import wtc
import wx import wx.ribbon
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
class ribbon_bar_Tests(wtc.WidgetTestCase): class ribbon_bar_Tests(wtc.WidgetTestCase):
# TODO: Remove this test and add real ones.
def test_ribbon_bar1(self): def test_ribbon_bar1(self):
self.fail("Unit tests for ribbon_bar not implemented yet.") wx.ribbon.RIBBON_BAR_SHOW_PAGE_LABELS
wx.ribbon.RIBBON_BAR_SHOW_PAGE_ICONS
wx.ribbon.RIBBON_BAR_FLOW_HORIZONTAL
wx.ribbon.RIBBON_BAR_FLOW_VERTICAL
wx.ribbon.RIBBON_BAR_SHOW_PANEL_EXT_BUTTONS
wx.ribbon.RIBBON_BAR_SHOW_PANEL_MINIMISE_BUTTONS
wx.ribbon.RIBBON_BAR_ALWAYS_SHOW_TABS
wx.ribbon.RIBBON_BAR_SHOW_TOGGLE_BUTTON
wx.ribbon.RIBBON_BAR_SHOW_HELP_BUTTON
wx.ribbon.RIBBON_BAR_DEFAULT_STYLE
wx.ribbon.RIBBON_BAR_FOLDBAR_STYLE
wx.ribbon.RIBBON_BAR_PINNED
wx.ribbon.RIBBON_BAR_MINIMIZED
wx.ribbon.RIBBON_BAR_EXPANDED
wx.ribbon.wxEVT_RIBBONBAR_PAGE_CHANGED
wx.ribbon.wxEVT_RIBBONBAR_PAGE_CHANGING
wx.ribbon.wxEVT_RIBBONBAR_TAB_MIDDLE_DOWN
wx.ribbon.wxEVT_RIBBONBAR_TAB_MIDDLE_UP
wx.ribbon.wxEVT_RIBBONBAR_TAB_RIGHT_DOWN
wx.ribbon.wxEVT_RIBBONBAR_TAB_RIGHT_UP
wx.ribbon.wxEVT_RIBBONBAR_TAB_LEFT_DCLICK
wx.ribbon.wxEVT_RIBBONBAR_TOGGLED
wx.ribbon.wxEVT_RIBBONBAR_HELP_CLICK
wx.ribbon.EVT_RIBBONBAR_PAGE_CHANGED
wx.ribbon.EVT_RIBBONBAR_PAGE_CHANGING
wx.ribbon.EVT_RIBBONBAR_TAB_MIDDLE_DOWN
wx.ribbon.EVT_RIBBONBAR_TAB_MIDDLE_UP
wx.ribbon.EVT_RIBBONBAR_TAB_RIGHT_DOWN
wx.ribbon.EVT_RIBBONBAR_TAB_RIGHT_UP
wx.ribbon.EVT_RIBBONBAR_TAB_LEFT_DCLICK
wx.ribbon.EVT_RIBBONBAR_TOGGLED
wx.ribbon.EVT_RIBBONBAR_HELP_CLICK
def test_ribbon_bar2(self):
evt = wx.ribbon.RibbonBarEvent()
evt.GetPage()
evt.Page
def test_ribbon_bar3(self):
pti = wx.ribbon.RibbonPageTabInfo()
pti.rect
pti.page
pti.ideal_width
pti.small_begin_need_separator_width
pti.small_must_have_separator_width
pti.minimum_width
pti.active
pti.hovered
pti.highlight
pti.shown
def test_ribbon_bar4(self):
bar = wx.ribbon.RibbonBar()
bar.Create(self.frame)
def test_ribbon_bar5(self):
bar = wx.ribbon.RibbonBar(self.frame)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':

View File

@@ -1,15 +1,27 @@
import unittest import unittest
import wtc import wtc
import wx import wx.ribbon
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
class ribbon_control_Tests(wtc.WidgetTestCase): class ribbon_control_Tests(wtc.WidgetTestCase):
# TODO: Remove this test and add real ones.
def test_ribbon_control1(self): def test_ribbon_control1(self):
self.fail("Unit tests for ribbon_control not implemented yet.") ctrl = wx.ribbon.RibbonControl()
ctrl.Create(self.frame)
def test_ribbon_control2(self):
ctrl = wx.ribbon.RibbonControl(self.frame)
ctrl.GetArtProvider()
ctrl.IsSizingContinuous()
ctrl.GetNextSmallerSize(wx.VERTICAL)
ctrl.GetNextLargerSize(wx.HORIZONTAL)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':

View File

@@ -1,15 +1,27 @@
import unittest import unittest
import wtc import wtc
import wx import wx.ribbon
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
class ribbon_page_Tests(wtc.WidgetTestCase): class ribbon_page_Tests(wtc.WidgetTestCase):
# TODO: Remove this test and add real ones.
def test_ribbon_page1(self): def test_ribbon_page1(self):
self.fail("Unit tests for ribbon_page not implemented yet.") bar = wx.ribbon.RibbonBar(self.frame)
page = wx.ribbon.RibbonPage()
page.Create(bar)
def test_ribbon_page2(self):
bar = wx.ribbon.RibbonBar(self.frame)
page = wx.ribbon.RibbonPage(bar)
rect = wx.Rect(0,0,0,0)
page.AdjustRectToIncludeScrollButtons(rect)
page.GetIcon()
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':

View File

@@ -1,15 +1,49 @@
import unittest import unittest
import wtc import wtc
import wx import wx.ribbon
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
class ribbon_panel_Tests(wtc.WidgetTestCase): class ribbon_panel_Tests(wtc.WidgetTestCase):
# TODO: Remove this test and add real ones.
def test_ribbon_panel1(self): def test_ribbon_panel1(self):
self.fail("Unit tests for ribbon_panel not implemented yet.") wx.ribbon.RIBBON_PANEL_NO_AUTO_MINIMISE,
wx.ribbon.RIBBON_PANEL_EXT_BUTTON,
wx.ribbon.RIBBON_PANEL_MINIMISE_BUTTON,
wx.ribbon.RIBBON_PANEL_STRETCH,
wx.ribbon.RIBBON_PANEL_FLEXIBLE,
wx.ribbon.RIBBON_PANEL_DEFAULT_STYLE
wx.ribbon.wxEVT_RIBBONPANEL_EXTBUTTON_ACTIVATED
wx.ribbon.EVT_RIBBONPANEL_EXTBUTTON_ACTIVATED
def test_ribbon_panel2(self):
evt = wx.ribbon.RibbonPanelEvent()
self.assertTrue(evt.Panel is None)
def test_ribbon_panel3(self):
p = wx.ribbon.RibbonPanel()
p.Create(self.frame)
def test_ribbon_panel4(self):
p = wx.ribbon.RibbonPanel(self.frame)
p.GetMinimisedIcon()
p.HasExtButton()
p.IsMinimised()
p.IsHovered()
p.CanAutoMinimise()
p.ShowExpanded()
p.HideExpanded()
p.ExpandedDummy
p.ExpandedPanel
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':