File: test_brush.py

package info (click to toggle)
wxpython4.0 4.2.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 221,752 kB
  • sloc: cpp: 962,555; python: 230,573; ansic: 170,731; makefile: 51,756; sh: 9,342; perl: 1,564; javascript: 584; php: 326; xml: 200
file content (77 lines) | stat: -rw-r--r-- 2,187 bytes parent folder | download | duplicates (4)
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
73
74
75
76
77
import unittest
from unittests import wtc
import wx
import os

pngFile = os.path.join(os.path.dirname(__file__), 'toucan.png')

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

class BrushTests(wtc.WidgetTestCase):

    def test_BrushCtors(self):
        b = wx.Brush()
        b = wx.Brush(wx.Colour(1,2,3), wx.BRUSHSTYLE_SOLID)
        bmp = wx.Bitmap(pngFile)
        b = wx.Brush(bmp)
        copy = wx.Brush(b)


    def test_BrushOperators(self):
        b1 = wx.Brush(wx.Colour(1,2,3), wx.BRUSHSTYLE_SOLID)
        b2 = wx.Brush(wx.Colour(1,2,3), wx.BRUSHSTYLE_SOLID)
        b3 = wx.Brush(wx.Colour(4,5,6), wx.BRUSHSTYLE_SOLID)

        self.assertTrue(b1 == b2)
        self.assertTrue(b2 != b3)
        self.assertFalse(b1 != b2)
        self.assertFalse(b2 == b3)


    def test_nonzero(self):
        b = wx.Brush(wx.Colour(1,2,3), wx.BRUSHSTYLE_SOLID)
        if not b:
            self.fail("__nonzero__ should have avoided this branch")
        if wx.NullBrush:
            self.fail("__nonzero__ should have avoided this branch")


    def test_StockBrushesExist(self):
        wx.BLUE_BRUSH
        wx.GREEN_BRUSH
        wx.YELLOW_BRUSH
        wx.WHITE_BRUSH
        wx.BLACK_BRUSH
        wx.GREY_BRUSH
        wx.MEDIUM_GREY_BRUSH
        wx.LIGHT_GREY_BRUSH
        wx.TRANSPARENT_BRUSH
        wx.CYAN_BRUSH
        wx.RED_BRUSH
        wx.NullBrush


    def test_StockBrushesInitialized(self):
        self.assertTrue(wx.BLUE_BRUSH.IsOk())
        self.assertTrue(wx.GREEN_BRUSH.IsOk())
        self.assertTrue(wx.YELLOW_BRUSH.IsOk())
        self.assertTrue(wx.WHITE_BRUSH.IsOk())
        self.assertTrue(wx.BLACK_BRUSH.IsOk())
        self.assertTrue(wx.GREY_BRUSH.IsOk())
        self.assertTrue(wx.MEDIUM_GREY_BRUSH.IsOk())
        self.assertTrue(wx.LIGHT_GREY_BRUSH.IsOk())
        self.assertTrue(wx.TRANSPARENT_BRUSH.IsOk())
        self.assertTrue(wx.CYAN_BRUSH.IsOk())
        self.assertTrue(wx.RED_BRUSH.IsOk())


    def test_brushOldStyleNames(self):
        b = wx.Brush(wx.RED, wx.SOLID)



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


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