Skip to content

Commit

Permalink
8243110: SVGTest.testSVGRenderingWithPattern fails intermittently
Browse files Browse the repository at this point in the history
Reviewed-by: kcr
  • Loading branch information
arun-joseph committed May 29, 2020
1 parent 168b7f7 commit 9edba9c
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions tests/system/src/test/java/test/javafx/scene/web/SVGTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import test.util.Util;

import static javafx.concurrent.Worker.State.SUCCEEDED;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
Expand Down Expand Up @@ -96,7 +96,6 @@ public void setupTestObjects() {
* @bug 8223298
* summary Checks if svg pattern is displayed properly
*/
@Ignore("JDK-8243110")
@Test public void testSVGRenderingWithPattern() {
final CountDownLatch webViewStateLatch = new CountDownLatch(1);
final String htmlSVGContent = "\n"
Expand All @@ -115,11 +114,25 @@ public void setupTestObjects() {

Util.runAndWait(() -> {
assertNotNull(webView);
webView.getEngine().getLoadWorker().stateProperty().
addListener((observable, oldValue, newValue) -> {
if (newValue == SUCCEEDED) {
webView.requestFocus();
}
});

webView.focusedProperty().
addListener((observable, oldValue, newValue) -> {
if (newValue) {
webViewStateLatch.countDown();
}
});

webView.getEngine().loadContent(htmlSVGContent);
webViewStateLatch.countDown();
});

assertTrue("Timeout when waiting for focus change ", Util.await(webViewStateLatch));
Util.sleep(1000);

Util.runAndWait(() -> {
WritableImage snapshot = svgTestApp.primaryStage.getScene().snapshot(null);
Expand Down

0 comments on commit 9edba9c

Please sign in to comment.