-
Notifications
You must be signed in to change notification settings - Fork 16
/
test_bgui.py
executable file
·97 lines (72 loc) · 2.66 KB
/
test_bgui.py
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
#!/usr/bin/env python
import unittest
import gc
import bgui
class TestMemoryLeaks(unittest.TestCase):
def setUp(self):
self.system = bgui.System()
def test_memory_leak_widget(self):
w = bgui.Widget(self.system)
self.system = None
gc.collect()
self.assertListEqual(gc.garbage, [])
def test_memory_leak_frame(self):
w = bgui.Frame(self.system)
self.system = None
gc.collect()
self.assertListEqual(gc.garbage, [])
@unittest.skip("Fonts are causing a segfault")
def test_memory_leak_frame_button(self):
w = bgui.FrameButton(self.system)
self.system = None
gc.collect()
self.assertListEqual(gc.garbage, [])
@unittest.skip("Texture loading not working for testing (requires OpenGL)")
def test_memory_leak_image(self):
w = bgui.Image(self.system, "examples/simple/img.jpg")
self.system = None
gc.collect()
self.assertListEqual(gc.garbage, [])
def test_memory_leak_image_button(self):
w = bgui.ImageButton(self.system)
self.system = None
gc.collect()
self.assertListEqual(gc.garbage, [])
@unittest.skip("Fonts are causing a segfault")
def test_memory_leak_label(self):
w = bgui.Label(self.system)
self.system = None
gc.collect()
self.assertListEqual(gc.garbage, [])
@unittest.skip("Fonts are causing a segfault")
def test_memory_leak_list_box(self):
w = bgui.ListBox(self.system, items=[1, 2, 3])
self.system = None
gc.collect()
self.assertListEqual(gc.garbage, [])
def test_memory_leak_progress_bar(self):
w = bgui.ProgressBar(self.system)
self.system = None
gc.collect()
self.assertListEqual(gc.garbage, [])
@unittest.skip("Fonts are causing a segfault")
def test_memory_leak_text_block(self):
w = bgui.TextBlock(self.system, text="Testing string")
self.system = None
gc.collect()
self.assertListEqual(gc.garbage, [])
@unittest.skip("Fonts are causing a segfault")
def test_memory_leak_text_input(self):
w = bgui.TextInput(self.system, text="Testing string")
self.system = None
gc.collect()
self.assertListEqual(gc.garbage, [])
@unittest.skip("Texture loading not working for testing (requires OpenGL)")
def test_memory_leak_video(self):
# TODO find an actual video to load
w = bgui.Video(self.system, "examples/simple/img.jpg")
self.system = None
gc.collect()
self.assertListEqual(gc.garbage, [])
if __name__ == '__main__':
unittest.main(verbosity=2)