Skip to content

Commit

Permalink
8255337: [TestBug] Controls unit tests - ButtonTest and ComboBoxTest …
Browse files Browse the repository at this point in the history
…- log ClassCastException

Reviewed-by: fastegal, kcr
  • Loading branch information
aghaisas committed Oct 28, 2020
1 parent 2c67555 commit 690d266
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 144 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

//import com.sun.javafx.test.MouseEventGenerator;

/**
* action (which can be bound, and can be null),
* and that action is called when the button is fired.
Expand All @@ -76,7 +74,8 @@ public class ButtonTest {
private Scene scene;
private Stage stage;
private StackPane root;
private MouseEventFirer mouse;
private MouseEventFirer mouse; //Note : It is created and used by individual tests that need it


@Before public void setup() {
btn = new Button();
Expand All @@ -85,12 +84,14 @@ public class ButtonTest {
scene = new Scene(root);
stage = new Stage();
stage.setScene(scene);
mouse = new MouseEventFirer(btn);
}

@After public void after() {
stage.hide();
mouse.dispose();

if (mouse != null) {
mouse.dispose();
}
}

/*********************************************************************
Expand Down Expand Up @@ -420,6 +421,8 @@ private void show() {
btn.fireEvent(new ActionEvent());
btn.fire();

mouse = new MouseEventFirer(btn);

mouse.fireMousePressed();
mouse.fireMouseReleased();
mouse.fireMouseClicked();
Expand All @@ -446,6 +449,8 @@ private void show() {

assertEquals(0, count);

mouse = new MouseEventFirer(btn);

/* Note that right-mouse press events don't force the popup open */
mouse.fireMousePressed(MouseButton.SECONDARY);
assertEquals(0, count);
Expand Down
Loading

0 comments on commit 690d266

Please sign in to comment.