mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-05 11:30:06 +01:00
Update unittests to work with wxWidgets 3.1.6
This commit is contained in:
committed by
Robin Dunn
parent
a785167b74
commit
54a07bc27f
@@ -219,7 +219,7 @@ def run():
|
||||
# force a copy, in case the _colorData is shared
|
||||
self.colour = wx.Colour(colour)
|
||||
bmp = self._makeBitmap()
|
||||
self.SetBitmapLabel(bmp)
|
||||
self.SetBitmapLabel(wx.BitmapBundle(bmp))
|
||||
|
||||
def GetColour(self):
|
||||
return self.colour
|
||||
|
||||
@@ -12,7 +12,7 @@ class bannerwindow_Tests(wtc.WidgetTestCase):
|
||||
|
||||
def test_bannerwindow1(self):
|
||||
banner = wx.adv.BannerWindow(self.frame, dir=wx.LEFT)
|
||||
banner.SetBitmap(wx.Bitmap(pngFile))
|
||||
banner.SetBitmap(wx.BitmapBundle(wx.Bitmap(pngFile)))
|
||||
|
||||
def test_bannerwindow2(self):
|
||||
banner = wx.adv.BannerWindow(self.frame, dir=wx.LEFT)
|
||||
|
||||
32
unittests/test_bmpbndl.py
Normal file
32
unittests/test_bmpbndl.py
Normal file
@@ -0,0 +1,32 @@
|
||||
import unittest
|
||||
from unittests import wtc
|
||||
import wx
|
||||
import os
|
||||
|
||||
icoFile = os.path.join(os.path.dirname(__file__), 'mondrian.ico')
|
||||
pngFile = os.path.join(os.path.dirname(__file__), 'pointy.png')
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class bmpbndl_Tests(wtc.WidgetTestCase):
|
||||
|
||||
def test_BitmapBundleCtor1(self):
|
||||
b1 = wx.BitmapBundle()
|
||||
self.assertTrue( not b1.IsOk() )
|
||||
|
||||
def test_BitmapBundleCtor2(self):
|
||||
b2 = wx.BitmapBundle(wx.Bitmap(5, 10, 32))
|
||||
self.assertTrue( b2.IsOk() )
|
||||
|
||||
def test_BitmapBundleCtor3(self):
|
||||
b3 = wx.BitmapBundle(wx.Icon(icoFile))
|
||||
self.assertTrue( b3.IsOk() )
|
||||
|
||||
def test_BitmapBundleCtor4(self):
|
||||
b4 = wx.BitmapBundle(wx.Image(pngFile))
|
||||
self.assertTrue( b4.IsOk() )
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -12,7 +12,7 @@ class ButtonTests(wtc.WidgetTestCase):
|
||||
def test_ButtonCtors(self):
|
||||
btn = wx.Button(self.frame, label='label')
|
||||
btn = wx.Button(self.frame, -1, 'label', (10,10), (100,-1), wx.BU_LEFT)
|
||||
bmp = wx.Bitmap(pngFile)
|
||||
bmp = wx.BitmapBundle(wx.Bitmap(pngFile))
|
||||
btn.SetBitmap(bmp)
|
||||
|
||||
def test_ButtonProperties(self):
|
||||
|
||||
@@ -87,7 +87,7 @@ class dataview_Tests(wtc.WidgetTestCase):
|
||||
|
||||
def test_dataviewIconText2(self):
|
||||
icon = wx.Icon(pngFile)
|
||||
dit = dv.DataViewIconText('Smile!', icon)
|
||||
dit = dv.DataViewIconText('Smile!', wx.BitmapBundle(icon))
|
||||
dit.Icon
|
||||
dit.Text
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@ class headercol_Tests(wtc.WidgetTestCase):
|
||||
|
||||
|
||||
def test_headercolCtor2(self):
|
||||
bmp = wx.Bitmap(pngFile)
|
||||
bmp = wx.BitmapBundle(wx.Bitmap(pngFile))
|
||||
hc = wx.HeaderColumnSimple(bmp, flags=wx.COL_RESIZABLE)
|
||||
hc.Bitmap
|
||||
hc.BitmapBundle
|
||||
|
||||
|
||||
def test_headercolProperties(self):
|
||||
|
||||
@@ -99,7 +99,7 @@ class lib_agw_speedmeter_Tests(wtc.WidgetTestCase):
|
||||
fgSizer.Add(panel1, 1, wx.EXPAND)
|
||||
|
||||
boxSizer = wx.BoxSizer()
|
||||
panel.SetSizer(boxSizer)
|
||||
panel1.SetSizer(boxSizer)
|
||||
spW = SM.SpeedMeter(panel1,
|
||||
agwStyle=SM.SM_DRAW_HAND |
|
||||
SM.SM_DRAW_SECTORS |
|
||||
|
||||
@@ -22,8 +22,8 @@ class preferences_Tests(wtc.WidgetTestCase):
|
||||
class MyPrefsPage(wx.PreferencesPage):
|
||||
def GetName(self):
|
||||
return 'MyPrefsPage'
|
||||
def GetLargeIcon(self):
|
||||
return wx.ArtProvider.GetBitmap(wx.ART_HELP, wx.ART_TOOLBAR, (32,32))
|
||||
def GetIcon(self):
|
||||
return wx.ArtProvider.GetBitmapBundle(wx.ART_HELP, wx.ART_TOOLBAR)
|
||||
def CreateWindow(self, parent):
|
||||
return MyPrefsPanel(parent)
|
||||
|
||||
|
||||
@@ -238,7 +238,13 @@ class richtextbuffer_Tests(wtc.WidgetTestCase):
|
||||
o1 = wx.richtext.RichTextLine(None)
|
||||
|
||||
def test_richtextbuffer26(self):
|
||||
o1 = wx.richtext.RichTextLineList()
|
||||
para = wx.richtext.RichTextParagraph()
|
||||
para.AllocateLine(0)
|
||||
para.AllocateLine(1)
|
||||
lines = para.GetLines()
|
||||
self.assertEqual(len(lines), 2)
|
||||
for l in lines:
|
||||
self.assertTrue(isinstance(l, wx.richtext.RichTextLine))
|
||||
|
||||
def test_richtextbuffer27(self):
|
||||
o1 = wx.richtext.RichTextParagraph()
|
||||
|
||||
@@ -12,7 +12,7 @@ class taskbar_Tests(wtc.WidgetTestCase):
|
||||
|
||||
def test_taskbar1(self):
|
||||
icon = wx.adv.TaskBarIcon(wx.adv.TBI_DOCK)
|
||||
icon.SetIcon(wx.Icon(icoFile), "The tip string")
|
||||
icon.SetIcon(wx.BitmapBundle(wx.Icon(icoFile)), "The tip string")
|
||||
self.assertTrue(icon.IsOk())
|
||||
icon.Destroy()
|
||||
self.myYield()
|
||||
|
||||
@@ -12,7 +12,7 @@ class tglbtn_Tests(wtc.WidgetTestCase):
|
||||
def test_tglbtnCtors(self):
|
||||
btn = wx.ToggleButton(self.frame, label='label')
|
||||
btn = wx.ToggleButton(self.frame, -1, 'label', (10,10), (100,-1), wx.BU_LEFT)
|
||||
bmp = wx.Bitmap(pngFile)
|
||||
bmp = wx.BitmapBundle(wx.Bitmap(pngFile))
|
||||
btn.SetBitmap(bmp)
|
||||
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ class toolbar_Tests(wtc.WidgetTestCase):
|
||||
|
||||
tools = []
|
||||
for bmp in bmps:
|
||||
tool = tb.AddTool(-1, 'label', bmp)
|
||||
tool = tb.AddTool(-1, 'label', wx.BitmapBundle(bmp))
|
||||
self.assertTrue(isinstance(tool, wx.ToolBarToolBase))
|
||||
tools.append(tool)
|
||||
tb.Realize()
|
||||
|
||||
@@ -34,7 +34,7 @@ class wizard_Tests(wtc.WidgetTestCase):
|
||||
|
||||
def test_wizard2(self):
|
||||
# Create the wizard
|
||||
bmp = wx.Bitmap(pngFile)
|
||||
bmp = wx.BitmapBundle(wx.Bitmap(pngFile))
|
||||
wiz = wx.adv.Wizard(self.frame, title="Test Wizard 2", bitmap=bmp)
|
||||
|
||||
# create the pages
|
||||
@@ -54,7 +54,7 @@ class wizard_Tests(wtc.WidgetTestCase):
|
||||
|
||||
def test_wizard3(self):
|
||||
# Same as above but use the Chain function to connect the pages
|
||||
bmp = wx.Bitmap(pngFile)
|
||||
bmp = wx.BitmapBundle(wx.Bitmap(pngFile))
|
||||
wiz = wx.adv.Wizard(self.frame, title="Test Wizard 2", bitmap=bmp)
|
||||
|
||||
pages = []
|
||||
@@ -74,7 +74,7 @@ class wizard_Tests(wtc.WidgetTestCase):
|
||||
|
||||
def test_wizard4(self):
|
||||
# Create the wizard
|
||||
bmp = wx.Bitmap(pngFile)
|
||||
bmp = wx.BitmapBundle(wx.Bitmap(pngFile))
|
||||
wiz = wx.adv.Wizard(self.frame, title="Test Wizard 2", bitmap=bmp)
|
||||
|
||||
# create the pages
|
||||
|
||||
@@ -158,7 +158,7 @@ class datetime_Tests(wtc.WidgetTestCase):
|
||||
def test_datetimeParseDate3(self):
|
||||
d = wx.DateTime()
|
||||
val = d.ParseDate('10/25/2015 non-date text')
|
||||
self.assertEqual(val, 13)
|
||||
self.assertEqual(val, 10)
|
||||
|
||||
|
||||
def test_datetimeParseDateTime1(self):
|
||||
|
||||
@@ -381,8 +381,8 @@ class InfoBar(wx.Control):
|
||||
self._button = wx.BitmapButton(self, wx.ID_ANY, bmp, style=wx.BORDER_NONE)
|
||||
|
||||
if wx.Platform != '__WXGTK__':
|
||||
self._button.SetBitmapPressed(GetCloseButtonBitmap(self, sizeBmp, colBg, wx.CONTROL_PRESSED))
|
||||
self._button.SetBitmapCurrent(GetCloseButtonBitmap(self, sizeBmp, colBg, wx.CONTROL_CURRENT))
|
||||
self._button.SetBitmapPressed(wx.BitmapBundle(GetCloseButtonBitmap(self, sizeBmp, colBg, wx.CONTROL_PRESSED)))
|
||||
self._button.SetBitmapCurrent(wx.BitmapBundle(GetCloseButtonBitmap(self, sizeBmp, colBg, wx.CONTROL_CURRENT)))
|
||||
|
||||
self._button.SetBackgroundColour(colBg)
|
||||
self._button.SetToolTip(_("Hide this notification message."))
|
||||
|
||||
@@ -119,7 +119,8 @@ class NavCanvas(wx.Panel):
|
||||
self.ModesDict = {}
|
||||
for Mode in Modes:
|
||||
tool = tb.AddTool(wx.ID_ANY, label=Mode[0],
|
||||
shortHelp=Mode[0], bitmap=Mode[2],
|
||||
shortHelp=Mode[0],
|
||||
bitmap=wx.BitmapBundle(Mode[2]),
|
||||
kind=wx.ITEM_RADIO)
|
||||
self.Bind(wx.EVT_TOOL, self.SetMode, tool)
|
||||
self.ModesDict[tool.GetId()]=Mode[1]
|
||||
|
||||
@@ -208,15 +208,15 @@ class InspectionFrame(wx.Frame):
|
||||
tbar = self.CreateToolBar(wx.TB_HORIZONTAL | wx.TB_FLAT | wx.TB_TEXT | wx.NO_BORDER )
|
||||
tbar.SetToolBitmapSize((24,24))
|
||||
|
||||
refreshBmp = Refresh.GetBitmap()
|
||||
findWidgetBmp = Find.GetBitmap()
|
||||
showSizersBmp = ShowSizers.GetBitmap()
|
||||
expandTreeBmp = ExpandTree.GetBitmap()
|
||||
collapseTreeBmp = CollapseTree.GetBitmap()
|
||||
highlightItemBmp = HighlightItem.GetBitmap()
|
||||
evtWatcherBmp = EvtWatcher.GetBitmap()
|
||||
refreshBmp = wx.BitmapBundle(Refresh.GetBitmap())
|
||||
findWidgetBmp = wx.BitmapBundle(Find.GetBitmap())
|
||||
showSizersBmp = wx.BitmapBundle(ShowSizers.GetBitmap())
|
||||
expandTreeBmp = wx.BitmapBundle(ExpandTree.GetBitmap())
|
||||
collapseTreeBmp = wx.BitmapBundle(CollapseTree.GetBitmap())
|
||||
highlightItemBmp = wx.BitmapBundle(HighlightItem.GetBitmap())
|
||||
evtWatcherBmp = wx.BitmapBundle(EvtWatcher.GetBitmap())
|
||||
|
||||
toggleFillingBmp = ShowFilling.GetBitmap()
|
||||
toggleFillingBmp = wx.BitmapBundle(ShowFilling.GetBitmap())
|
||||
|
||||
refreshTool = tbar.AddTool(-1, 'Refresh', refreshBmp,
|
||||
shortHelp = 'Refresh widget tree (F1)')
|
||||
|
||||
Reference in New Issue
Block a user