File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
scripts/device-runner-app/tests Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,24 @@ static boolean emitCurrentFormScreenshot(String testName) {
4343 }
4444 int width = Math .max (1 , current .getWidth ());
4545 int height = Math .max (1 , current .getHeight ());
46- Image screenshot = Image .createImage (width , height );
46+ Image [] img = new Image [1 ];
47+ Display .getInstance ().screenshot (screen -> img [0 ] = screen );
48+ long time = System .currentTimeMillis ();
49+ CN .invokAndBlock (() -> {
50+ while (img [0 ] == null ) {
51+ Util .sleep (50 );
52+ // timeout
53+ if (System .currentTimeMillis () - time > 2000 ) {
54+ return ;
55+ }
56+ }
57+ });
58+ if (img [0 ] == null ) {
59+ println ("CN1SS:ERR:test=" + safeName + " message=Screenshot process timed out" );
60+ println ("CN1SS:END:" + safeName );
61+ return false ;
62+ }
63+ Image screenshot = img [0 ];
4764 current .paintComponent (screenshot .getGraphics (), true );
4865 try {
4966 ImageIO io = ImageIO .getImageIO ();
You can’t perform that action at this time.
0 commit comments