| 1 |
"Test zoomheight, coverage 66%." |
| 2 |
# Some code is system dependent. |
| 3 |
|
| 4 |
from idlelib import zoomheight |
| 5 |
import unittest |
| 6 |
from test.support import requires |
| 7 |
from tkinter import Tk |
| 8 |
from idlelib.editor import EditorWindow |
| 9 |
|
| 10 |
|
| 11 |
class Test(unittest.TestCase): |
| 12 |
|
| 13 |
@classmethod |
| 14 |
def setUpClass(cls): |
| 15 |
requires('gui') |
| 16 |
cls.root = Tk() |
| 17 |
cls.root.withdraw() |
| 18 |
cls.editwin = EditorWindow(root=cls.root) |
| 19 |
|
| 20 |
@classmethod |
| 21 |
def tearDownClass(cls): |
| 22 |
cls.editwin._close() |
| 23 |
cls.root.update_idletasks() |
| 24 |
for id in cls.root.tk.call('after', 'info'): |
| 25 |
cls.root.after_cancel(id) # Need for EditorWindow. |
| 26 |
cls.root.destroy() |
| 27 |
del cls.root |
| 28 |
|
| 29 |
def test_init(self): |
| 30 |
zoom = zoomheight.ZoomHeight(self.editwin) |
| 31 |
self.assertIs(zoom.editwin, self.editwin) |
| 32 |
|
| 33 |
def test_zoom_height_event(self): |
| 34 |
zoom = zoomheight.ZoomHeight(self.editwin) |
| 35 |
zoom.zoom_height_event() |
| 36 |
|
| 37 |
|
| 38 |
if __name__ == '__main__': |
| 39 |
unittest.main(verbosity=2) |