From 114a12ff12f526c1c8cb748939ccb197e532c5ea Mon Sep 17 00:00:00 2001 From: noah Date: Thu, 8 May 2003 01:21:43 +0000 Subject: This tests the new facility for set and get of child tty window size. git-svn-id: http://pexpect.svn.sourceforge.net/svnroot/pexpect/trunk@194 656d521f-e311-0410-88e0-e7920216d269 --- pexpect/tests/test_winsize.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 pexpect/tests/test_winsize.py diff --git a/pexpect/tests/test_winsize.py b/pexpect/tests/test_winsize.py new file mode 100755 index 0000000..672818b --- /dev/null +++ b/pexpect/tests/test_winsize.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +import pexpect +import unittest +import time + +class TestCaseWinsize(unittest.TestCase): + def test_winsize (self): + """ + This tests that the child process can set and get the windows size. + This makes use of an external script sigwinch_report.py. + """ + p1 = pexpect.spawn('python sigwinch_report.py') + time.sleep(1) + p1.setwinsize (11,22) + p1.expect ('SIGWINCH: \(([0-9]*), ([0-9]*)\)') + r = p1.match.group(1) + c = p1.match.group(2) + assert (r=="11" and c=="22") + time.sleep(1) + p1.setwinsize (24,80) + p1.expect ('SIGWINCH: \(([0-9]*), ([0-9]*)\)') + r = p1.match.group(1) + c = p1.match.group(2) + assert (r=="24" and c=="80") + +if __name__ == '__main__': + unittest.main() + +suite = unittest.makeSuite(TestCaseWinsize,'test') + -- cgit v1.2.1