|
import resources.Script3Helper;
import com.rational.test.ft.*;
import com.rational.test.ft.object.interfaces.*;
import com.rational.test.ft.object.interfaces.siebel.*;
import com.rational.test.ft.script.*;
import com.rational.test.ft.value.*;
import com.rational.test.ft.vp.*;
import java.io.*;
import javax.swing.Timer;
import java.awt.*;
/**
* Description : Functional Test Script
* @author Administrator
*/
public class Script3 extends Script3Helper
{
/**
* Script Name : <b>Script3</b>
* Generated : <b>2006-11-7 13:30:46</b>
* Description : Functional Test Script
* Original Host : WinNT Version 5.2 Build 3790 (S)
*
* @since 2006/11/07
* @author Administrator
*/
private final static int SCREENWIDTH = getScreen().getScreenRectangle().width;
private final static int SCREENHEIGHT = getScreen().getScreenRectangle().height;
private final int BROWSERWIDTH = browser_htmlBrowser().getScreenRectangle().width;
private final int BROWSERHEIGHT = browser_htmlBrowser().getScreenRectangle().height;
private int direction;
private int x;
private int y;
private final int STEP = 5;
private final static int NE = 1;
private final static int EN = 2;
private final static int WN = 3;
private final static int NW = 4;
private final static int WS = 5;
private final static int SW = 6;
private final static int SE = 7;
private final static int ES = 8;
public void testMain(Object[] args) throws Exception
{
x = 0;
y = 0;
move(x, y);
direction = NE;
while(true)
{
switch(direction)
{
case NE:
moveNE();
break;
case EN:
moveEN();
break;
case WN:
moveWN();
break;
case NW:
moveNW();
break;
case WS:
moveWS();
break;
case SW:
moveSW();
break;
case SE:
moveSE();
break;
case ES:
moveES();
break;
default:
break;
}
//sleep(0.001);
}
}
public void move(int x, int y)
{
browser_htmlBrowser().move(atPoint(x, y));
}
private void moveNE()
{
while(true)
{
x = x + STEP;
y = y + STEP;
if(x + BROWSERWIDTH >= SCREENWIDTH)
{
direction = ES;
break;
}
else if(y + BROWSERHEIGHT >= SCREENHEIGHT)
{
direction = SE;
break;
}
move(x, y);
}
}
private void moveES()
{
while(true)
{
x = x - STEP;
y = y + STEP;
if(x <= 0)
{
direction = WS;
break;
}
else if(y + BROWSERHEIGHT >= SCREENHEIGHT)
{
direction = SW;
break;
}
move(x, y);
}
}
private void moveSW()
{
while(true)
{
x = x - STEP;
y = y - STEP;
if(x <= 0)
{
direction = WN;
break;
}
else if(y <= 0)
{
direction = NW;
break;
}
move(x, y);
}
}
private void moveWN()
{
while(true)
{
x = x + STEP;
y = y - STEP;
if(y <= 0)
{
direction = NE;
break;
}
else if(x + BROWSERWIDTH >= SCREENWIDTH)
{
direction = EN;
break;
}
move(x, y);
}
}
private void moveEN()
{
while(true)
{
x = x - STEP;
y = y - STEP;
if(y <= 0)
{
direction = NW;
break;
}
else if(x <= 0)
{
direction = WN;
break;
}
move(x, y);
}
}
public void moveNW()
{
while(true)
{
x = x - STEP;
y = y + STEP;
if(x <= 0)
{
direction = WS;
break;
}
else if(y + BROWSERHEIGHT >= SCREENHEIGHT)
{
direction = SW;
break;
}
move(x, y);
}
}
public void moveWS()
{
while(true)
{
x = x + STEP;
y = y + STEP;
if(y + BROWSERHEIGHT >= SCREENHEIGHT)
{
direction = SE;
break;
}
else if(x + BROWSERWIDTH >= SCREENWIDTH)
{
direction = ES;
break;
}
move(x, y);
}
}
public void moveSE()
{
while(true)
{
x = x + STEP;
y = y - STEP;
if(x + BROWSERWIDTH >= SCREENWIDTH)
{
direction = EN;
break;
}
else if(y <= 0)
{
direction = NE;
break;
}
move(x, y);
}
}
} |
|