forked from diffpy/diffpy.pdfgui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_mainframe.py
69 lines (55 loc) · 1.86 KB
/
test_mainframe.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
#!/usr/bin/env python
##############################################################################
#
# diffpy.pdfgui Complex Modeling Initiative
# (c) 2019 Brookhaven Science Associates,
# Brookhaven National Laboratory.
# All rights reserved.
#
# File coded by: Pavol Juhas
#
# See AUTHORS.txt for a list of people who contributed.
# See LICENSE.txt for license information.
#
##############################################################################
"""
Unit tests for the MainFrame class.
"""
import unittest
import wx
from diffpy.pdfgui.gui.mainframe import MainFrame
from diffpy.pdfgui.tests.testutils import GUITestCase
# ----------------------------------------------------------------------------
class TestMainFrame(GUITestCase):
@classmethod
def setUpClass(cls):
GUITestCase.setUpClass()
cls.app = wx.App()
cls.frame = MainFrame(None, -1, "")
return
@classmethod
def tearDownClass(cls):
cls.frame.Close()
cls.app.Destroy()
GUITestCase.tearDownClass()
return
def test_onRightClick(self):
"check MainFrame.onRightClick method for context menu"
# just instantiate the context menu
# disable modal Frame.PopupMenu
self.frame.PopupMenu = lambda menu, pos: None
e = wx.MouseEvent(wx.EVT_RIGHT_DOWN.typeId)
try:
self.frame.treeCtrlMain.ProcessEvent(e)
finally:
del self.frame.PopupMenu
self.assertIsNotNone(self.frame.PopupMenu)
return
def test_disableMainMenuItems(self):
"cover MainFrame.disableMainMenuItems method."
self.frame.disableMainMenuItems()
return
# End of class TestMainFrame
# ----------------------------------------------------------------------------
if __name__ == "__main__":
unittest.main()