RFR: 8255337: [TestBug] Controls unit tests - ButtonTest and ComboBoxTest - log ClassCastException

Jeanette Winzenburg fastegal at openjdk.java.net
Fri Oct 23 15:50:37 UTC 2020


On Fri, 23 Oct 2020 11:35:50 GMT, Ajit Ghaisas <aghaisas at openjdk.org> wrote:

> This is a test fix.
> 
> Root cause:
> - For ButtonTest - Incorrect use of MouseEventFirer - which puts Button on to the stage and shows it before firing mouse event
> - For ComboBoxTest - adding ComboBox to a Stage, not showing the Stage but trying to show the ComboBox
> 
> 
> Fix :
> - For ButtonTest - Moved MouseEventFirer usage from test class to the 2 tests that need it
> - For ComboBoxTest - Started using StageLoader (which adds comboBox to the stage and shows it) instead of separate Scene and Stage creation.
> 
> 
> I have attached the logs captured before and after this fix to the JBS.

modules/javafx.controls/src/test/java/test/javafx/scene/control/ButtonTest.java line 425:

> 423: 
> 424:         mouse.dispose();
> 425:     }

just curious: do we have to dispose the mouseFirer? If so, that pattern isn't safe because it will not happen if the test fails.

modules/javafx.controls/src/test/java/test/javafx/scene/control/ComboBoxTest.java line 658:

> 656:         StageLoader sl = new StageLoader(comboBox);
> 657: 
> 658: 

good catch :) But wouldn't show the stage have the same effect? (It's just me having a personal dislike of stageloader :)

modules/javafx.controls/src/test/java/test/javafx/scene/control/ComboBoxTest.java line 679:

> 677: 
> 678:         sl.dispose();
> 679:     }

just for completeness: same as mouse.dispose above :)

-------------

PR: https://git.openjdk.java.net/jfx/pull/337


More information about the openjfx-dev mailing list