tools/SharedTestUtilsOpen/src/test/javaclient/shared/TestBase.java

Print this page




 289 
 290         String resName = GoldenImageManager.getScreenshotPath(filename);
 291         String res2Name = GoldenImageManager.getScreenshotPath(filename + "-2");
 292 
 293         imageJemmy.save(resName);
 294 
 295         doRenderToImageAndWait(noda, null);
 296 
 297         // TAKE A SHOT USING JEMMY, save it (scene with ImageView with rendered image in it)
 298         //org.jemmy.image.Image sceneImageJemmy2 = scene.getScreenImage();
 299         //sceneImageJemmy2.save(ImagesManager.getInstance().getScreenshotPath(filename + "2"));
 300 
 301         String diffName = GoldenImageManager.getScreenshotPath(filename + "-diff");
 302         boolean scenesEqual = true;
 303         try {
 304             if (null == noda) {
 305                 getScene().waitImage(getScene().getEnvironment().getImageLoader().load(resName),
 306                         res2Name, diffName);
 307             } else {
 308                 Wrap<? extends Node> imViewWrap =
 309                         (new NodeDock(getScene().as(Parent.class, Node.class), "ViewOfNodeSnapshot")).wrap();

 310                 //Lookups.byID(scene, "ViewOfNodeSnapshot", ImageView.class);
 311 
 312                 imViewWrap.waitImage(getScene().getEnvironment().getImageLoader().load(resName),
 313                         res2Name, diffName);
 314             }
 315         } catch (org.jemmy.TimeoutExpiredException ex) {
 316             scenesEqual = false;
 317         } finally {
 318             restoreSceneRoot();
 319         }
 320 
 321         if (scenesEqual) {
 322             System.out.print("delete scene- and node- images.... ");
 323             new File(resName).delete();
 324             new File(res2Name).delete();
 325             System.out.println(" Completed.");
 326         } else {
 327             System.out.print("scene/node render to image failed.");
 328             throw new org.jemmy.TimeoutExpiredException("waitImage failed for file:" + resName);
 329         }




 289 
 290         String resName = GoldenImageManager.getScreenshotPath(filename);
 291         String res2Name = GoldenImageManager.getScreenshotPath(filename + "-2");
 292 
 293         imageJemmy.save(resName);
 294 
 295         doRenderToImageAndWait(noda, null);
 296 
 297         // TAKE A SHOT USING JEMMY, save it (scene with ImageView with rendered image in it)
 298         //org.jemmy.image.Image sceneImageJemmy2 = scene.getScreenImage();
 299         //sceneImageJemmy2.save(ImagesManager.getInstance().getScreenshotPath(filename + "2"));
 300 
 301         String diffName = GoldenImageManager.getScreenshotPath(filename + "-diff");
 302         boolean scenesEqual = true;
 303         try {
 304             if (null == noda) {
 305                 getScene().waitImage(getScene().getEnvironment().getImageLoader().load(resName),
 306                         res2Name, diffName);
 307             } else {
 308                 Wrap<? extends Node> imViewWrap =
 309                         //(new NodeDock(getScene().as(Parent.class, Node.class), "ViewOfNodeSnapshot")).wrap();
 310                         (new NodeDock((Parent<Node>)getScene().as(Parent.class, Node.class), "ViewOfNodeSnapshot")).wrap();
 311                 //Lookups.byID(scene, "ViewOfNodeSnapshot", ImageView.class);
 312 
 313                 imViewWrap.waitImage(getScene().getEnvironment().getImageLoader().load(resName),
 314                         res2Name, diffName);
 315             }
 316         } catch (org.jemmy.TimeoutExpiredException ex) {
 317             scenesEqual = false;
 318         } finally {
 319             restoreSceneRoot();
 320         }
 321 
 322         if (scenesEqual) {
 323             System.out.print("delete scene- and node- images.... ");
 324             new File(resName).delete();
 325             new File(res2Name).delete();
 326             System.out.println(" Completed.");
 327         } else {
 328             System.out.print("scene/node render to image failed.");
 329             throw new org.jemmy.TimeoutExpiredException("waitImage failed for file:" + resName);
 330         }