modules/graphics/src/test/java/javafx/scene/EventAnyTest.java
Print this page
rev 6167 : RT-35330 [Monocle] Remove StubToolkit and replace it with headless glass implementation
@@ -23,14 +23,17 @@
* questions.
*/
package javafx.scene;
+import com.sun.javafx.FXUnit;
import com.sun.javafx.stage.FocusUngrabEvent;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.concurrent.atomic.AtomicReference;
+
import javafx.event.ActionEvent;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.event.EventType;
import javafx.scene.input.ContextMenuEvent;
@@ -53,21 +56,27 @@
import javafx.scene.input.ZoomEvent;
import javafx.scene.shape.Rectangle;
import javafx.scene.transform.TransformChangedEvent;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;
+import org.junit.Rule;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
@RunWith(Parameterized.class)
public class EventAnyTest {
+
+ @Rule
+ public FXUnit fx = new FXUnit();
+
@Parameters
public static Collection getParams() {
- return Arrays.asList(new Object[][] {
+ AtomicReference<Collection> ref = new AtomicReference<>();
+ new FXUnit().invokeAndWait(() -> ref.set(Arrays.asList(new Object[][] {
{ ActionEvent.ANY, actionEvent(), true},
{ ActionEvent.ANY, focusUngrabEvent(), false},
{ FocusUngrabEvent.ANY, focusUngrabEvent(), true},
{ FocusUngrabEvent.ANY, actionEvent(), false},
{ ContextMenuEvent.ANY, contextMenuEvent(), true},
@@ -99,11 +108,12 @@
{ WindowEvent.ANY, actionEvent(), false },
{ GestureEvent.ANY, rotateEvent(), true },
{ GestureEvent.ANY, mouseEvent(), false },
{ InputEvent.ANY, mouseEvent(), true },
{ InputEvent.ANY, actionEvent(), false },
- });
+ })));
+ return ref.get();
}
private boolean delivered;
private EventType type;
private Event event;