tn5250j/scripts/Test test.py,NONE,1.1 testfields.py,NONE,1.1 testgetscreentext.py,NONE,1.1 testlooping.py,NONE,1.1 testsendkey.py,NONE,1.1 testsignon.py,NONE,1.1 testtillbottom.py,NONE,1.1 testwin.py,NONE,1.1
Nicola Ken Barozzi <[email protected]> Wed, 11 May 2005 07:31:53 +0000
| Newsgroups | gmane.comp.java.tn5250j.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/tn5250j/tn5250j/scripts/Test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26729/scripts/Test
Added Files:
test.py testfields.py testgetscreentext.py testlooping.py
testsendkey.py testsignon.py testtillbottom.py testwin.py
Log Message:
Move all tests in a test subfolder to increase clarity.
--- NEW FILE: testsendkey.py ---
print "--------------- tn5250j test send keys script start ------------"
print "--------------- session ------------"
print _session
screen = _session.getScreen()
print "--------------- screen ------------"
print screen
screen.sendKeys("[enter]")
print "---------------- tn5250j test send keys script end -------------"
--- NEW FILE: testtillbottom.py ---
# testtillbottom.py will page down the wrkactjob screen area until Bottom
# it will also print out the text for Subsystem/job to the screen on each page down
#
# August 22, 2002 version 0.1
# Author Kenneth J. Pouncey
import java
import time
# Fill a StringBuffer with an area from the screen
def fillWithSubArea(row,col,width,sb):
sPos = ((row - 1) * screen.getCols()) + (col - 1)
while width > 0:
c = screenChars[sPos]
sb.append(screenChars[sPos])
sPos += 1
width -= 1
# Get the screen object from _session object
screen = _session.getScreen()
screenChars = screen.getScreenAsChars()
# Check for advanced users
advanced = java.lang.StringBuffer()
advanced.setLength(0)
fillWithSubArea(22,2,2,advanced)
pfKeys = advanced.toString()
if pfKeys == "F3":
lines = 9
bottomLine = 19
else:
lines = 11
bottomLine = 21
# define bottom variable text
bottomText = "Bottom"
# Create some work variables to hold screen characters
bottom = java.lang.StringBuffer()
sj = java.lang.StringBuffer()
# Loop until we are asked to stop or literal is found on the screen
while not _session.isStopMacroRequested():
screenChars = screen.getScreenAsChars()
times = 0
#loop 9 times to read all the rows from 10 to 18
while times < lines:
sj.setLength(0)
# get the Subsystem/job information for each row
fillWithSubArea(10 + times,7,14,sj)
# print it out
print sj.toString()
times += 1
# check for bottom literal
bottom.setLength(0)
fillWithSubArea(bottomLine,74,len(bottomText),bottom)
whereAreWe = bottom.toString()
if whereAreWe == bottomText:
print 'we are at the bottom'
break
else:
# if bottom is not found yet then page down for the next page
screen.sendKeys("[pgdown]")
time.sleep(1)
--- NEW FILE: testfields.py ---
print "--------------- tn5250j test fields script start ------------"
screen = _session.getScreen()
screenfields = screen.getScreenFields()
fields = screenfields.getFields()
for x in fields:
print x.toString()
print x.getString()
print "number of fields %s " % screenfields.getSize()
print "---------------- tn5250j test fields script end -------------"
--- NEW FILE: test.py ---
print "--------------- tn5250j test script start ------------"
x = 3 + 6
print x
print " Is this not the coolest ever"
print "---------------- tn5250j test script end -------------"
--- NEW FILE: testwin.py ---
from javax import swing
import java.awt as awt
print "--------------- tn5250j test script start ------------"
win = swing.JFrame("tn5250j test window")
win.size = (300,400)
win.contentPane.background = awt.Color.white
label = swing.JLabel("Hello all you tn5250j'ers script writers")
label.foreground = awt.Color.red
win.contentPane.add(label)
win.show()
print "---------------- tn5250j test script end -------------"
--- NEW FILE: testgetscreentext.py ---
print "--------------- tn5250j test screen text script start ------------"
screen = _session.getScreen()
print screen.getScreenAsChars()
print "---------------- tn5250j test screen text script end -------------"
--- NEW FILE: testsignon.py ---
print "--------------- tn5250j test send keys script start ------------"
screen = _session.getScreen()
screen.sendKeys("userid[fldext]password[fldext][enter][enter][enter][enter]")
print "---------------- tn5250j test send keys script end -------------"
--- NEW FILE: testlooping.py ---
import time
print "--------------- tn5250j test looping script start ------------"
screen = _session.getScreen()
while not _session.isStopMacroRequested():
screen.sendKeys("[pf5]")
time.sleep(5)
print "---------------- tn5250j test looping script end -------------"
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click