File: test_lib_sized_controls.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 (124 lines) | stat: -rw-r--r-- 3,141 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
import unittest
from unittests import wtc
import wx
import os

import wx.lib.sized_controls as sc

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

class sizedFrame_Tests(wtc.WidgetTestCase):

    def test_frameStyles(self):
        wx.FRAME_NO_TASKBAR
        wx.FRAME_TOOL_WINDOW
        wx.FRAME_FLOAT_ON_PARENT
        wx.FRAME_SHAPED


    def test_frameCtors(self):
        f = sc.SizedFrame(None)
        f.Show()
        f.Close()
        f = sc.SizedFrame(self.frame, title="Title", pos=(50,50), size=(100,100))
        f.Show()
        f.Close()
        #f = sc.SizedFrame()
        #f.Create(None, title='2 phase')
        #f.Show()
        #f.Close()

    #def test_frameTopLevelTweaks(self):
    #    # test a couple tweaks added in wx.TopLevelWidnow
    #    f = sc.SizedFrame()
    #    f.MacSetMetalAppearance(True)
    #    f.Create(None)
    #    f.Show()
    #    f.MacGetTopLevelWindowRef()
    #    f.Close()


    def test_frameProperties(self):
        f = sc.SizedFrame(None)
        f.Show()

        f.DefaultItem
        f.Icon
        f.Title
        f.TmpDefaultItem
        f.OSXModified
        f.MacMetalAppearance

        f.Close()


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


class sizedDialog_Tests(wtc.WidgetTestCase):

    def runDialog(self, dlg):
        # Add some buttons
        ok = wx.Button(dlg.GetContentsPane(), wx.ID_OK, pos=(10,10))
        cancel = wx.Button(dlg.GetContentsPane(), wx.ID_CANCEL, pos=(100,10))

        wx.CallLater(250, dlg.EndModal, wx.ID_OK)
        val = dlg.ShowModal()
        dlg.Destroy()
        self.assertTrue(val == wx.ID_OK)
        self.myYield()


    #def test_dialogDefaultCtor(self):
    #    dlg = sc.SizedDialog()
    #    dlg.Create(None, title='dialog')
    #    self.runDialog(dlg)

    def test_dialog1(self):
        # with parent
        dlg = sc.SizedDialog(self.frame, title='Hello')
        self.runDialog(dlg)

    def test_dialog2(self):
        # without parent
        dlg = sc.SizedDialog(None, title='World')
        self.runDialog(dlg)

    def test_dialogTextSizer(self):
        dlg = sc.SizedDialog(self.frame, title='Hello')
        s = dlg.CreateTextSizer("This is a test.\nThis is only a test.\nHello World")
        self.assertTrue(isinstance(s, wx.Sizer))
        self.assertTrue(len(s.Children) == 3)
        self.runDialog(dlg)


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


class sizedPanel_Tests(wtc.WidgetTestCase):

    def test_panelCtor(self):
        p = sc.SizedPanel(self.frame)

    #def test_panelDefaultCtor(self):
    #    p = sc.SizedPanel()
    #    p.Create(self.frame)


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


class sizedScrolledPanel_Tests(wtc.WidgetTestCase):

    def test_panelCtor(self):
        p = sc.SizedScrolledPanel(self.frame)

    #def test_panelDefaultCtor(self):
    #    p = sc.SizedScrolledPanel()
    #    p.Create(self.frame)


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

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