File: test_ribbon_gallery.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 (88 lines) | stat: -rw-r--r-- 2,556 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
78
79
80
81
82
83
84
85
86
87
88
import unittest
from unittests import wtc
import wx.ribbon

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

class ribbon_gallery_Tests(wtc.WidgetTestCase):

    def test_ribbon_gallery1(self):
        wx.ribbon.RIBBON_GALLERY_BUTTON_NORMAL
        wx.ribbon.RIBBON_GALLERY_BUTTON_HOVERED
        wx.ribbon.RIBBON_GALLERY_BUTTON_ACTIVE
        wx.ribbon.RIBBON_GALLERY_BUTTON_DISABLED

        wx.ribbon.wxEVT_RIBBONGALLERY_HOVER_CHANGED
        wx.ribbon.wxEVT_RIBBONGALLERY_SELECTED
        wx.ribbon.wxEVT_RIBBONGALLERY_CLICKED

        wx.ribbon.EVT_RIBBONGALLERY_HOVER_CHANGED
        wx.ribbon.EVT_RIBBONGALLERY_SELECTED
        wx.ribbon.EVT_RIBBONGALLERY_CLICKED


    def test_ribbon_gallery2(self):
        evt = wx.ribbon.RibbonGalleryEvent()


    def test_ribbon_gallery3(self):
        ribbon = wx.ribbon.RibbonBar(self.frame)
        g = wx.ribbon.RibbonGallery()
        g.Create(ribbon)


    def test_ribbon_gallery4(self):
        ribbon = wx.ribbon.RibbonBar(self.frame)
        g = wx.ribbon.RibbonGallery(ribbon)
        item = g.Append(wx.Bitmap(16,16), 101)
        assert isinstance(item, wx.ribbon.RibbonGalleryItem)


    def test_ribbon_gallery5(self):
        ribbon = wx.ribbon.RibbonBar(self.frame)
        g = wx.ribbon.RibbonGallery(ribbon)

        with self.assertRaises(AttributeError):
            g.SetItemClientObject

        with self.assertRaises(AttributeError):
            g.GetItemClientObject


    def test_ribbon_gallery6(self):
        ribbon = wx.ribbon.RibbonBar(self.frame)
        g = wx.ribbon.RibbonGallery(ribbon)

        class _Data(object):
            def __init__(self, **kw):
                self.__dict__.update(kw)

        data = _Data(a=1, b=2, c=3)
        item = g.Append(wx.Bitmap(16,16), 102)
        g.SetItemClientData(item, data)
        data_out = g.GetItemClientData(item)
        self.assertEqual(data.a, data_out.a)
        self.assertTrue(data_out is data)


    def test_ribbon_gallery7(self):
        ribbon = wx.ribbon.RibbonBar(self.frame)
        g = wx.ribbon.RibbonGallery(ribbon)

        class _Data(object):
            def __init__(self, **kw):
                self.__dict__.update(kw)

        data = _Data(a=1, b=2, c=3)
        item = g.Append(wx.Bitmap(16,16), 102, data)
        data_out = g.GetItemClientData(item)
        self.assertEqual(data.a, data_out.a)
        self.assertTrue(data_out is data)




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

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