aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--tests/test-extensions/net/sourceforge/jnlp/awt/AWTHelper.java45
2 files changed, 42 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index f1b1d94..6555fb0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2013-05-02 Jana Fabrikova <[email protected]>
+
+ * tests/test-extensions/net/sourceforge/jnlp/awt/AWTHelper.java:
+ refactoring - removing initStrGiven variable - now it only
+ matters if the initStr is null or not. Modifying the following
+ two methods: (charReaded) - if initStr is null the run method
+ can not be started from charReaded and the presence of initStr
+ is not checked in stdout. Method (getInitStrAsRule) returns rule
+ that is always true if initStr is null.
+
2013-05-02 Jiri Vanek <[email protected]>
Renamed cz locales to be more general
diff --git a/tests/test-extensions/net/sourceforge/jnlp/awt/AWTHelper.java b/tests/test-extensions/net/sourceforge/jnlp/awt/AWTHelper.java
index e33d35c..91e1ad5 100644
--- a/tests/test-extensions/net/sourceforge/jnlp/awt/AWTHelper.java
+++ b/tests/test-extensions/net/sourceforge/jnlp/awt/AWTHelper.java
@@ -60,7 +60,7 @@ import net.sourceforge.jnlp.closinglisteners.RulesFolowingClosingListener;
public abstract class AWTHelper extends RulesFolowingClosingListener implements Runnable{
//attributes possibly set by user
- private String initStr = "";
+ private String initStr = null;
private Color appletColor;
private BufferedImage marker;
private Point markerPosition;
@@ -75,7 +75,6 @@ public abstract class AWTHelper extends RulesFolowingClosingListener implements
private BufferedImage screenshot;
private Robot robot;
private boolean appletFound = false;
- private boolean initStrGiven = false; //impossible to find in the output if not given
private boolean appletColorGiven = false; //impossible to search for color difference if not given
private boolean markerGiven = false; //impossible to find the applet if marker not given
private boolean appletDimensionGiven = false;
@@ -117,7 +116,6 @@ public abstract class AWTHelper extends RulesFolowingClosingListener implements
this();
this.initStr = initStr;
- this.initStrGiven = true;
}
/**
@@ -148,7 +146,6 @@ public abstract class AWTHelper extends RulesFolowingClosingListener implements
this(icon, iconPosition, appletWidth, appletHeight);
this.initStr = initString;
- this.initStrGiven = true;
}
/**
@@ -176,7 +173,6 @@ public abstract class AWTHelper extends RulesFolowingClosingListener implements
public AWTHelper(String initString, int appletWidth, int appletHeight){
this(appletWidth, appletHeight);
this.initStr = initString;
- this.initStrGiven = true;
}
/**
@@ -194,6 +190,8 @@ public abstract class AWTHelper extends RulesFolowingClosingListener implements
* override of method charReaded (from RulesFolowingClosingListener)
*
* waiting for the applet, when applet is ready run action thread
+ * (if initStr==null, do not check and do not call run)
+ *
* when all the wanted strings are in the stdout, applet can be closed
*
* @param ch
@@ -202,7 +200,8 @@ public abstract class AWTHelper extends RulesFolowingClosingListener implements
public void charReaded(char ch) {
sb.append(ch);
//is applet ready to start clicking?
- if (initStrGiven && !actionStarted && appletIsReady(sb.toString())) {
+ //check and run applet only if initStr is not null
+ if ((initStr != null) && !actionStarted && appletIsReady(sb.toString())) {
try{
actionStarted = true;
this.findAndActivateApplet();
@@ -241,22 +240,43 @@ public abstract class AWTHelper extends RulesFolowingClosingListener implements
* @return
*/
public Rule getInitStrAsRule(){
- return new ContainsRule(this.initStr);
+ if( initStr != null ){
+ return new ContainsRule(this.initStr);
+ }else{
+ return new Rule(){
+
+ @Override
+ public void setRule(Object rule) {
+ }
+
+ @Override
+ public boolean evaluate(Object upon) {
+ return true;
+ }
+
+ @Override
+ public String toPassingString() {
+ return "nothing to check, initStr is null";
+ }
+
+ @Override
+ public String toFailingString() {
+ return "nothing to check, initStr is null";
+ }
+
+ } ;
+ }
}
//boolean controls getters
protected boolean appletIsReady(String content) {
- return (content.contains(initStr));
+ return this.getInitStrAsRule().evaluate(content);
}
public boolean isActionStarted() {
return actionStarted;
}
- public boolean isInitStrGiven(){
- return initStrGiven;
- }
-
public boolean isAppletColorGiven(){
return appletColorGiven;
}
@@ -292,7 +312,6 @@ public abstract class AWTHelper extends RulesFolowingClosingListener implements
public void setInitStr(String initStr) {
this.initStr = initStr;
- this.initStrGiven = true;
}
public void setMarker(BufferedImage marker, Point markerPosition) {