forked from diffpy/diffpy.pdfgui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_aboutdialog.py
69 lines (54 loc) · 1.99 KB
/
test_aboutdialog.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 class DialogAbout
"""
import unittest
import wx
from diffpy.pdfgui.gui import aboutdialog
from diffpy.pdfgui.tests.testutils import GUITestCase, overridewebbrowser
# ----------------------------------------------------------------------------
class TestDialogAbout(GUITestCase):
def setUp(self):
self.app = wx.App()
self.dialog = aboutdialog.DialogAbout(None)
return
def tearDown(self):
self.dialog.Close()
self.app.Destroy()
return
def _clickbutton(self, button):
e = wx.CommandEvent(wx.EVT_BUTTON.typeId, button.Id)
self.dialog.ProcessEvent(e)
return
def set_url(self, u):
setattr(self, "url", u)
def test_LogoClicks(self):
"Check handling of clicks on various logos"
d = self.dialog
with overridewebbrowser(self.set_url):
self._clickbutton(d.bitmap_button_nsf)
self.assertTrue(self.url.endswith("www.nsf.gov"))
self._clickbutton(d.bitmap_button_danse)
self.assertTrue(self.url.endswith("danse.us"))
self._clickbutton(d.bitmap_button_msu)
self.assertTrue(self.url.endswith("www.msu.edu"))
self._clickbutton(d.bitmap_button_columbia)
self.assertTrue(self.url.endswith("www.columbia.edu"))
return
# End of class TestDialogAbout
# ----------------------------------------------------------------------------
if __name__ == "__main__":
unittest.main()