Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java 8: Exception "Not on FX application thread" in TextInputControlsTest #41

Closed
hastebrot opened this issue Jan 13, 2014 · 7 comments
Closed
Assignees

Comments

@hastebrot
Copy link
Member

Ran all tests from IntelliJ IDEA 13 on Windows 7 (x64). Throws this exception with Java build 1.8.0-ea-b120 (x64), but runs without exception with Java build 1.7.0_45-b18 (x64).

java.lang.IllegalStateException: Not on FX application thread; currentThread = main
    at com.sun.javafx.tk.Toolkit.checkFxUserThread(Toolkit.java:210)
    at com.sun.javafx.tk.quantum.QuantumToolkit.checkFxUserThread(QuantumToolkit.java:393)
    at javafx.scene.Scene.addToDirtyList(Scene.java:521)
    at javafx.scene.Node.addToSceneDirtyList(Node.java:417)
    at javafx.scene.Node.impl_markDirty(Node.java:408)
    at javafx.scene.shape.Shape.impl_markDirty(Shape.java:930)
    at javafx.scene.Node.impl_geomChanged(Node.java:3758)
    at javafx.scene.text.Text.impl_geomChanged(Text.java:772)
    at javafx.scene.text.Text.needsTextLayout(Text.java:202)
    at javafx.scene.text.Text.needsFullTextLayout(Text.java:197)
    at javafx.scene.text.Text.access$400(Text.java:96)
    at javafx.scene.text.Text$4.invalidated(Text.java:396)
    at javafx.beans.property.StringPropertyBase.markInvalid(StringPropertyBase.java:109)
    at javafx.beans.property.StringPropertyBase.access$000(StringPropertyBase.java:49)
    at javafx.beans.property.StringPropertyBase$Listener.invalidated(StringPropertyBase.java:229)
    at com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:135)
    at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
    at javafx.beans.binding.StringBinding.invalidate(StringBinding.java:171)
    at com.sun.javafx.binding.BindingHelperObserver.invalidated(BindingHelperObserver.java:51)
    at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:339)
    at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
    at javafx.scene.control.TextInputControl$TextProperty.fireValueChangedEvent(TextInputControl.java:1116)
    at javafx.scene.control.TextInputControl$TextProperty.markInvalid(TextInputControl.java:1120)
    at javafx.scene.control.TextInputControl$TextProperty.invalidate(TextInputControl.java:1060)
    at javafx.scene.control.TextInputControl$TextProperty.access$200(TextInputControl.java:1032)
    at javafx.scene.control.TextInputControl$1.invalidated(TextInputControl.java:130)
    at com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:135)
    at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
    at javafx.scene.control.TextField$TextFieldContent.delete(TextField.java:91)
    at javafx.scene.control.TextInputControl$TextProperty.doSet(TextInputControl.java:1128)
    at javafx.scene.control.TextInputControl$TextProperty.set(TextInputControl.java:1055)
    at javafx.scene.control.TextInputControl.setText(TextInputControl.java:279)
    at javafx.scene.control.TextInputControl.clear(TextInputControl.java:925)
    at org.loadui.testfx.controls.TextInputControls.clearTextIn(TextInputControls.java:24)
    at org.loadui.testfx.TextInputControlsTest.shouldClearText(TextInputControlsTest.java:32)
@hastebrot
Copy link
Member Author

I also reported this issue to https://javafx-jira.kenai.com/browse/RT-35317.

@minisu
Copy link
Member

minisu commented Jan 13, 2014

I'm not sure that this is a JavaFX bug at all. What I am sure of however, is that my implementation of clearTextIn was obviously way too rushed.

TestFX is supposed to simulate user actions -- threads shouldn't matter. ´textField.clear()´ is not a user action. I'll rewrite it.

@Philipp91
Copy link
Contributor

Yes, this is clearly a TestFX bug, I already commented that to the JavaFX ticket.

@minisu minisu closed this as completed in 26c29d5 Jan 13, 2014
@minisu
Copy link
Member

minisu commented Jan 13, 2014

The fix really shows the clumsyness in the current implementation (having to instantiate a new GuiTest with a getRootNode that returns null)...

@RobzInadE
Copy link

Hi.

I just wanted to comment on this matter..
I'm using a Mac, and looking at the implementation of this function, it presses CTRL + A (Select all), which does not work on mac, since it is CMD + A for a select, meaning my tests fail when running them on a mac.
I hope this wasn't the wrong forum to post this in, just wanted to let you know, and please let me know if you're going to fix this in an upcoming release.

Regards

@hastebrot
Copy link
Member Author

Hi! Thanks for the report!

This is what I use on Windows:

click("#textfield").push(KeyCode.CONTROL, KeyCode.A);

Maybe you could try something like this on OS X:

click("#textfield").push(KeyCode.COMMAND, KeyCode.A);

@RobzInadE
Copy link

Hi @hastebrot thanks for the reply.
I am aware that it could be solved like this.
However our programmers use either linux or mac depending on their choice. We need the same code to run on both operating systems, hence the need for a smart "clearAllIn" function.

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants