forked from wxWidgets/Phoenix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_filehistory.py
44 lines (34 loc) · 1.28 KB
/
test_filehistory.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
import unittest
from unittests import wtc
import wx
#---------------------------------------------------------------------------
class filehistory_Tests(wtc.WidgetTestCase):
def test_filehistory1(self):
fh = wx.FileHistory()
for fn in "one two three four".split():
fh.AddFileToHistory(fn)
self.assertEqual(fh.GetCount(), 4)
self.assertEqual(fh.Count, 4)
self.assertEqual(fh.GetHistoryFile(1), 'three') # they are in LIFO order
m = wx.Menu()
fh.AddFilesToMenu(m)
def test_filehistory2(self):
fh = wx.FileHistory()
for fn in "one two three four".split():
fh.AddFileToHistory(fn)
menu1 = wx.Menu()
menu2 = wx.Menu()
fh.UseMenu(menu1)
fh.UseMenu(menu2)
fh.AddFilesToMenu()
lst = fh.GetMenus()
self.assertTrue(isinstance(lst, wx.FileHistoryMenuList))
self.assertTrue(len(lst) == 2)
self.assertTrue(len(list(lst)) == 2)
self.assertTrue(isinstance(lst[0], wx.Menu))
self.assertTrue(isinstance(lst[1], wx.Menu))
self.assertTrue(lst[0] is menu1)
self.assertTrue(lst[1] is menu2)
#---------------------------------------------------------------------------
if __name__ == '__main__':
unittest.main()