mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-09-05 17:30:26 +02:00
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@69279 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
53 lines
1.7 KiB
Python
53 lines
1.7 KiB
Python
import imp_unittest, unittest
|
|
import wx
|
|
import wtc
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
class Colour(wtc.WidgetTestCase):
|
|
|
|
def test_default_ctor(self):
|
|
c = wx.Colour()
|
|
self.assertTrue(not c.IsOk())
|
|
self.assertTrue(c.Get() == (-1,-1,-1,255))
|
|
|
|
def test_rgb_ctor(self):
|
|
c = wx.Colour(1,2,3)
|
|
self.assertTrue(c.Get(False) == (1,2,3))
|
|
|
|
def test_rgba_ctor(self):
|
|
c = wx.Colour(1,2,3,4)
|
|
self.assertTrue(c.Get() == (1,2,3,4))
|
|
|
|
def test_copy_ctor(self):
|
|
c1 = wx.Colour(1,2,3,4)
|
|
c2 = wx.Colour(c1)
|
|
self.assertTrue(c1 == c2)
|
|
self.assertTrue(c1 is not c2)
|
|
self.assertTrue(c1.Get() == c2.Get())
|
|
|
|
|
|
if hasattr(wx, 'testColourTypeMap'):
|
|
def test_ColourTypemaps(self):
|
|
c = wx.testColourTypeMap('red')
|
|
self.assertTrue(c.Get() == (0xff, 0, 0, 0xff))
|
|
c = wx.testColourTypeMap('Blue:80')
|
|
self.assertTrue(c.Get() == (0, 0, 0xff, 0x80))
|
|
c = wx.testColourTypeMap('#112233')
|
|
self.assertTrue(c.Get() == (0x11, 0x22, 0x33, 0xff))
|
|
c = wx.testColourTypeMap('#11223344')
|
|
self.assertTrue(c.Get() == (0x11, 0x22, 0x33, 0x44))
|
|
c = wx.testColourTypeMap(None)
|
|
self.assertTrue(c.Get() == (-1, -1, -1, 0xff))
|
|
c = wx.testColourTypeMap( (1,2,3) )
|
|
self.assertTrue(c.Get() == (1, 2, 3, 0xff))
|
|
c = wx.testColourTypeMap( (1,2,3,4) )
|
|
self.assertTrue(c.Get() == (1, 2, 3, 4))
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|