--- a/nashorn/test/script/jfx.js Tue Nov 05 09:13:41 2013 +0530
+++ b/nashorn/test/script/jfx.js Tue Nov 05 13:09:40 2013 +0400
@@ -37,13 +37,24 @@
var Scene = Java.type("javafx.scene.Scene");
var Stage = Java.type("javafx.stage.Stage");
var File = Java.type("java.io.File");
-var Timer = Java.type("java.util.Timer");
-var TimerTask = Java.type("java.util.TimerTask");
var OSInfo = Java.type("sun.awt.OSInfo");
var OSType = Java.type("sun.awt.OSInfo.OSType");
var StringBuffer = Java.type("java.lang.StringBuffer");
+var Paint = Java.type("javafx.scene.paint.Paint");
+var Color = Java.type("javafx.scene.paint.Color");
+var Image = Java.type("javafx.scene.image.Image");
+var Canvas = Java.type("javafx.scene.canvas.Canvas");
+var BorderPane = Java.type("javafx.scene.layout.BorderPane");
+var StackPane = Java.type("javafx.scene.layout.StackPane");
+var StrokeLineCap = Java.type("javafx.scene.shape.StrokeLineCap");
+var Platform = Java.type("javafx.application.Platform");
+var Runnable = Java.type("java.lang.Runnable");
+var RunnableExtend = Java.extend(Runnable);
+var AnimationTimer = Java.type("javafx.animation.AnimationTimer");
+var AnimationTimerExtend = Java.extend(AnimationTimer);
+var Timer = Java.type("java.util.Timer");
+var TimerTask = Java.type("java.util.TimerTask");
-var WAIT = 2000;
var TESTNAME = "test";
var fsep = System.getProperty("file.separator");
@@ -53,14 +64,16 @@
run: function run() {
var tmpdir = System.getProperty("java.io.tmpdir");
var timenow = (new Date()).getTime();
- makeScreenShot(tmpdir + fsep + "screenshot" + timenow +".png");
- var dupImg = isDuplicateImages(tmpdir + fsep + "screenshot" + timenow +".png", __DIR__ + "jfx" + fsep + TESTNAME + fsep + "golden");
- (new File(mpdir + fsep + "screenshot" + timenow +".png")).delete();
- if (!dupImg) System.err.println("ERROR: screenshot does not match golden image");
+ var scrShotTmp = tmpdir + fsep + "screenshot" + timenow +".png";
+ var goldenImageDir = __DIR__ + "jfx" + fsep + TESTNAME + fsep + "golden";
+ makeScreenShot(scrShotTmp);
+ var dupImg = isDuplicateImages(scrShotTmp, goldenImageDir);
+ (new File(scrShotTmp)).delete();
+ if (!dupImg) System.err.println("ERROR: screenshot does not match the golden image");
exit(0);
}
};
- raceTimer.schedule(timerTask, WAIT);
+ raceTimer.schedule(timerTask, 100);
}
function makeScreenShot(shootToImg) {
@@ -70,10 +83,10 @@
imageJemmy.save(shootToImg);
}
-function isDuplicateImages(file1, file2) {
- var f1 = new File(file1);
+function isDuplicateImages(screenShot, goldenDir) {
+ var f1 = new File(screenShot);
var f2;
- var sb = new StringBuffer(file2);
+ var sb = new StringBuffer(goldenDir);
if (OSInfo.getOSType() == OSType.WINDOWS) {
f2 = new File(sb.append(fsep + "windows.png").toString());
} else if (OSInfo.getOSType() == OSType.LINUX) {
@@ -81,8 +94,6 @@
} else if (OSInfo.getOSType() == OSType.MACOSX) {
f2 = new File(sb.append(fsep + "macosx.png").toString());
}
- print(f1.getAbsolutePath());
- print(f2.getAbsolutePath());
if (f1.exists() && f2.exists()) {
var image1 = new AWTImage(PNGDecoder.decode(f1.getAbsolutePath()));
var image2 = new AWTImage(PNGDecoder.decode(f2.getAbsolutePath()));