-
Notifications
You must be signed in to change notification settings - Fork 36
/
test_ui_memgator.py
44 lines (36 loc) · 1.26 KB
/
test_ui_memgator.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
# Lack of relative imports prevents this from running from tests/
import wx
import sys
from bundledApps.WAIL import WAILGUIFrame_Basic as basic
from bundledApps import WAILConfig as config
class Test(wx.Frame):
def __init__(self, m_count, a_count):
wx.Frame.__init__(self, None)
panel = wx.Panel(self)
self.notebook = wx.Notebook(panel)
b = basic(self.notebook)
b.set_memento_count(m_count, a_count)
self.result = b.memento_status.GetLabel()
testCases = [
[0, 0, config.msg_no_mementos_available],
[0, 1, config.msg_no_mementos_available],
[1, 0, "1 memento available from 0 archives"],
[1, 1, "1 memento available from 1 archive"],
[2, 1, "2 mementos available from 1 archive"],
[1, 2, "1 memento available from 2 archives"],
[2, 2, "2 mementos available from 2 archives"],
[-1, 0, ValueError()],
[0, -1, ValueError()],
[-1, -1, ValueError()]
]
for case in testCases:
[m_count, a_count, expected_value] = case
app = wx.App()
try:
main_app_window = Test(m_count, a_count)
res = main_app_window.result
testPass = (res == expected_value)
assert testPass
except ValueError:
assert type(expected_value) is type(ValueError())
app.Destroy()