Emberveil source

tests/OwnerBankSmoke.java

import java.net.InetAddress;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
import java.io.File;
/** Synthetic bonds account on the loopback-only isolated test world. */
public final class OwnerBankSmoke extends OnlineSmoke {
 boolean opened,withdrew,deposited;
 void click(int widget,int slot,int item){stream.createFrame(145);stream.method432(widget);stream.method432(slot);stream.method432(item);}
 @Override public void processGameLoop(){
  super.processGameLoop();if(!loggedIn||loadingStage!=2)return;
  if(ticks==50){stream.createFrame(103);stream.writeWordBigEndian(5);stream.writeString("bank");}
  if(openInterfaceID==5292 && RSInterface.interfaceCache[5382].inv.length==1000)opened=true;
  if(ticks==120){if(!opened)throw new AssertionError("Expanded bank failed to open");click(5382,999,385);}
  if(ticks==200){withdrew=RSInterface.interfaceCache[5382].invStackSizes[999]==2;click(5064,0,385);}
  if(ticks==300){deposited=RSInterface.interfaceCache[5382].invStackSizes[999]==3;RSInterface scroll=RSInterface.interfaceCache[5385];scroll.scrollPosition=scroll.scrollMax-scroll.height;needDrawTabArea=true;}
  if(ticks==400){
   try{BufferedImage shot=new BufferedImage(512,334,BufferedImage.TYPE_INT_RGB);shot.setRGB(0,0,512,334,aRSImageProducer_1165.anIntArray315,0,512);ImageIO.write(shot,"png",new File("runtime/owner-bank-expanded.png"));}catch(Exception e){throw new RuntimeException(e);}
   boolean pass=opened&&withdrew&&deposited;System.out.println((pass?"PASS":"FAIL")+" expanded bank opened="+opened+" withdraw="+withdrew+" deposit="+deposited+" slots="+RSInterface.interfaceCache[5382].inv.length);System.exit(pass?0:1);
  }
 }
 public static void main(String[] args)throws Exception {
  host="127.0.0.1";username=peer="bonds";targetTicks=6000;
  ClientSettings.SERVER_IP=host;ClientSettings.SERVER_WORLD=1;ClientSettings.CHECK_CRC=false;ClientSettings.SHOW_NAVBAR=false;
  Game.nodeID=10;Game.portOff=0;Game.setHighMem();Game.isMembers=true;Signlink.storeid=32;Signlink.startpriv(InetAddress.getLocalHost());
  OwnerBankSmoke client=new OwnerBankSmoke();client.testWalking=client.testChat=false;client.createClientFrame(503,765);client.gameFrame.setVisible(false);
 }
}