Git Product home page Git Product logo

monocle's Introduction

OpenJFX Monocle

NOTE

This is not the official OpenJFX Monocle repository. This repository is used to build Monocle for use with TestFX. The official OpenJFX Monocle repository is located at https://github.com/openjdk/jfx.

Summary

Monocle is the implementation of the Glass windowing component of JavaFX for embedded systems [1]. It is part of the Java Platform since version 8u20 (released in August 2014), but not included in builds for desktop platforms (Windows, Linux, Mac) [2].

This repository provides pre-packaged builds of Monocle taken from the OpenJFX project. The builds include components to run in headless environments. They do not include native libraries for low-level access.

Gradle

testCompile 'org.testfx:openjfx-monocle:21.0.2' // For OpenJFX 21
testCompile 'org.testfx:openjfx-monocle:17.0.10' // For OpenJFX 17
testCompile 'org.testfx:openjfx-monocle:11.0.2' // For OpenJFX 11
testCompile 'org.testfx:openjfx-monocle:jdk-8.0.372' // For Java 8

Maven

<dependency>
    <groupId>org.testfx</groupId>
    <artifactId>openjfx-monocle</artifactId>
    <version>21.0.2</version> <!-- 17.0.10 For OpenJFX 17, 11.0.2 For OpenJFX 11, jdk-8.0.372 for Java 8 -->
    <scope>test</scope>
</dependency>

Build (under Windows)

There are branches for each of the LTS releases of OpenJFX. Currently, we are supporting four branches, until the support for each LTS release ends.

  • jdk-21: OpenJFX 21
  • jdk-17: OpenJFX 17
  • jdk-11: OpenJFX 11
  • jdk-8: OpenJFX 8u-dev

To build Monocle for a specific JDK version, clone the repository and checkout the tag.

C:\> git clone https://github.com/TestFX/Monocle
C:\> cd Monocle
C:\> git checkout jdk-21

Choose the JDK version and build the jars.

C:\> set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_20
C:\> gradlew clean jar
C:\> dir build\libs

Updating Monocle

To update the build to newer versions of Monocle just copy source code files from [src/main/java/com/sun/glass/ui/monocle][10] into the directory src/main/java and resource files from [src/main/resources/com/sun/glass/ui/monocle][11] into the directory src/main/resources. Use the links bz2, zip or gz to export the files as archive.

Automatic Update (beta)

The sync.sh Bash script attempts to automate the process of updating to a newer version of Monocle from the OpenJFX repository. The script will look for the highest build number (such as b00, b01, etc.) for each version (such as 8u45, 8u60, etc.) and if there is no corresponding tag in this repository for that version/build number combination it will offer to open a pull-request with the changeset from the upstream OpenJFX repository. The PR is opened using the hub tool (which is automatically downloaded if you do not have it installed). This script should work on any flavor of Linux (including the Windows Subsystem for Linux) and macOS. Improvements to it are very welcome!

Issuing a Release

After you have either manually or automatically updated to the latest Monocle version you can issue a release by doing the following:

Upgraded Monocle Version is First Build (YY) for New Major Java Version (XX)

  • Add the gradle dependency info to README.md under Gradle header:
testCompile "org.testfx:openjfx-monocle:[openjdk.version]" // For OpenJFX XX
testCompile 'org.testfx:openjfx-monocle:21.0.2' // For OpenJFX 21
testCompile 'org.testfx:openjfx-monocle:17.0.10' // For OpenJFX 17
testCompile 'org.testfx:openjfx-monocle:11.0.2' // For OpenJFX 11
testCompile 'org.testfx:openjfx-monocle:jdk-8.0.372' // For Java 8
  • Change the Maven dependency info in README.md under the Maven header:
<dependency>
    <groupId>org.testfx</groupId>
    <artifactId>openjfx-monocle</artifactId>
    <version>[openjdk.version]</version> <!-- 17.0.10 For OpenJFX 17, 11.0.2 For OpenJFX 11, jdk-8.0.372 for Java 8 -->
    <scope>test</scope>
</dependency>
  • Bump the project version in gradle.properties to the new version:
group = org.testfx
version = [openjdk.version]

Make the Release

  • Commit the above changes with the commit message (release) Monocle [openjdk.version]. to upstream (either by creating a PR or pushing the commit directly).

  • Tag the new commit (note the v prefix character so that the branch name does not conflict with the tag name):

git tag -a v[openjdk.version]

  • Push the tag to upstream:

git push upstream v[openjdk.version]

License

OpenJDK and OpenJFX are licensed under the GNU General Public License, version 2, with the Classpath Exception.

monocle's People

Contributors

brcolow avatar hastebrot avatar mvsoder avatar svenruppert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

monocle's Issues

Easy way to Turn of Not Supported Exception

Our application tests in UI mode click some buttons that open file chooser. In headless mode, our tests use monocle, and showing file choosers are not supported by monocle, of which is unsupported by monocle i.e. java.lang.UnsupportedOperationException ( at com.sun.glass.ui.monocle.MonocleApplication.staticCommonDialogs_showFileChooser(MonocleApplication.java:293))

We want to just suppress just this error message in headless mode. Is there an easy and simple way to do this? We would like not to have to change our application code (i.e. catch this error specifically) in all places that we try to open dialogs. One thought is to override this method to just not return an exception in headless mode? Not sure how to do this properly - or maybe a mocking library out there would allow to stub the filechooser method somehow?

Thanks.

Monocle with JavaFX 14

Hi,

Have you planned a version of monocle for JavaFX 14?

I use AdoptOpenJDK 11 + JavaFX 14.0.2.1

I did some tests by modifying the pom file of the jdk-12.0.1+2 version to adapt them to JavaFX 14.0.2.1 :

<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <groupId>org.testfx</groupId> <artifactId>openjfx-monocle</artifactId> <version>jfx-14.0.2.1</version> <dependencies> <dependency> <groupId>org.openjfx</groupId> <artifactId>javafx-base</artifactId> <version>14.0.2.1</version> <scope>runtime</scope> </dependency> <dependency> <groupId>org.openjfx</groupId> <artifactId>javafx-controls</artifactId> <version>14.0.2.1</version> <scope>runtime</scope> </dependency> <dependency> <groupId>org.openjfx</groupId> <artifactId>javafx-graphics</artifactId> <version>14.0.2.1</version> <scope>runtime</scope> </dependency> </dependencies> <description>Headless graphics driver for JavaFX.</description> <name>openjfx-monocle</name> <url>https://github.com/TestFX/Monocle</url> <licenses> <license> <name>GNU General Public License, version 2, with the Classpath Exception</name> <url>https://github.com/TestFX/Monocle/blob/master/LICENSE</url> <distribution>repo</distribution> </license> </licenses> <developers> <developer> <name>The OpenJDK Community</name> </developer> </developers> <scm> <url>https://github.com/TestFX/Monocle</url> </scm> </project>

But unfortunately it doesn't work and here is the error I get on Jenkins as a result of a unit test using TestFX :

java.lang.AbstractMethodError: Receiver class com.sun.glass.ui.monocle.MonocleTimer does not define or inherit an implementation of the resolved method 'abstract void _pause(long)' of abstract class com.sun.glass.ui.Timer. at com.sun.glass.ui.Timer.pause(Timer.java:143) at com.sun.javafx.tk.quantum.QuantumToolkit.pauseTimer(QuantumToolkit.java:502) at com.sun.javafx.tk.quantum.QuantumToolkit.postPulse(QuantumToolkit.java:489) at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$12(QuantumToolkit.java:345) at com.sun.glass.ui.monocle.MonocleTimer$1.run(MonocleTimer.java:58) at java.base/java.util.TimerThread.mainLoop(Timer.java:556) at java.base/java.util.TimerThread.run(Timer.java:506)

Thanks for your response

Monocle Framebuffer java.nio.BufferOverflowException

Hi,

I'm experiencing this error:

Exception in thread "JavaFX Application Thread" java.nio.BufferOverflowException at java.nio.IntBuffer.put(IntBuffer.java:769) at com.sun.glass.ui.monocle.Framebuffer.composePixels(Framebuffer.java:187) at com.sun.glass.ui.monocle.HeadlessScreen.uploadPixels(HeadlessScreen.java:118) at com.sun.glass.ui.monocle.MonocleView._uploadPixels(MonocleView.java:95) at com.sun.glass.ui.View.uploadPixels(View.java:771) at com.sun.prism.PresentableState.uploadPixels(PresentableState.java:295) at com.sun.javafx.tk.quantum.SceneState.access$001(SceneState.java:40) at com.sun.javafx.tk.quantum.SceneState.lambda$uploadPixels$307(SceneState.java:123) at com.sun.glass.ui.monocle.RunnableProcessor.runLoop(RunnableProcessor.java:92) at com.sun.glass.ui.monocle.RunnableProcessor.run(RunnableProcessor.java:51) at java.lang.Thread.run(Thread.java:745) java.nio.BufferOverflowException at java.nio.DirectIntBufferU.put(DirectIntBufferU.java:363) at com.sun.javafx.tk.quantum.UploadingPainter.run(UploadingPainter.java:153) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125) at java.lang.Thread.run(Thread.java:745)

I can't be sure if its exactly the same, but its possibly related to this patch
https://gitlab.com/openjfxepd/jfxpatch/merge_requests/1

I'm using Java 8. Whats is the best way for me to try to incorporate this patch? Any help or recommendations are appreciated!

Thanks!

Confusing error message when drawing outside the screen

When using a stage that is too large and/or headless screen that is too small, BufferOverflowException is thrown without any details pointing to the root cause of the problem. This leads to bug reports like #56.

A clearer error message would be great.

No module name specified, and automatic module name is invalid

The monocle releases for 9 and 11 cannot be used in a project with a module-info.java file due to the JAR file names being automatically resolved to invalid names - openjfx.monocle.jdk.9.181 and openjfx.monocle.jdk.11.23, respectively - and because there is no module-info file or Automatic-Module-Name attribute in the manifest file.

The easiest solution would be to add this line to the JAR manifest attributes in the build.gradle file:

"Automatic-Module-Name": "org.testfx.monocle" // or whatever you want the module name to be

Compatibility with older Java version

Would it be possible to build the Monocle artifacts with / for older Java versions?
We for example use Java 17 as runtime, but with JavaFX 21.
But our component tests now using this cannot run on this combination as the Monocle artifacts are built with class file version of Java 21.
So we either have to test with the JavaFX 17 monocole artifacts or with Java 21, which both of course then do not match our target environment.

New releases?

Can we get new versions of Monocle or is there any reason not to provide them?

Can we port this to Android ?

Dear support.
I am an android developer, and I am struggling with one matter.
How to run headless webview on an android application.

as you know, android has webview support.
But once app gos to the background, android will pause all UI threads including the webview itself.

And we can not set UI thread in a service. To run in in the background. I need something like phantomjs, a browser not curl, wget.
Chrome does not support headless in the Android base, that what chromium group tells me.

I found that JavaFX has webview and it may support headless mode.
but I note monocle has not ported to the Android system yet, base on the doc.

https://wiki.openjdk.java.net/display/OpenJFX/Monocle

What's not done yet:
Android port
DirectFB port

I contact [email protected] asking for a piece of advice in this regards, they saide:

Thanks for contacting us,
Maybe you try with TestFX https://github.com/TestFX/TestFX, as that will let you launch headlessly a stage with a JavaFX WebView.

The version for Java 8 can also be ported to Android. But we haven't really tested what you want to accomplish, and we can't say for sure if the headless mode will work on Android (even with the app running on the foreground).

Best regards,
Jose
Gluon

Is there any update for Android?

kindly may you advise me if there any way to embedded headless support in my apk... Or it is impossible...

Monocle on build servers (JDK 8)

Hello, I'm looking to build a javaFX app with headless unit testing with Monocle. I've been able to get headless testing to work locally with building the monocle jar myself and loading it into my /Extensions java folder as specified here: https://stackoverflow.com/questions/29116819/javafx-maven-testfx-monocle-dont-work-together. But I don't own the build servers so it will be difficult for me to install Monocle into the Java extensions folder.

I am using Maven and tried using the tag https://maven.apache.org/pom.html#Extensions to include monocle:

<extensions>
        <extension>
            <groupId>org.testfx</groupId>
            <artifactId>openjfx-monocle</artifactId>
            <version>8u76-b04</version>
        </extension>
</extensions>  

This doesn't work, even with a separate dependency in the tag. I also tried including the monocle jar in the source code and including it with the java.ext.dirs parameter:

<argLine>-Dtestfx.robot=glass -Dglass.platform=Monocle -Dmonocle.platform=Headless -Dprism.order=sw -Dheadless.geometry=1600x1200-32 -Djava.ext.dirs=:<path>/monocle-jars</argLine>

But this gives me this error:

java.lang.NoClassDefFoundError: javafx/application/Application

I think that changing to a custom java.ext.dirs value causes the javafx code to not be found. Is there any guidance on how to use this tool when one doesn't own the build servers and can't modify the java install on them?

Randomly appearing IndexOutOfBoundsException

We are using monocle for our ui tests and we currently we can't really rely on the results because some of them seem to fail 'randomly'. Reason is an IndexOutOfBoundsException (Stacktrace down below) which I can't get rid of (sometimes there are also other exceptions like ConcurrentModification or NullPointer but they appear rarely). I've been spending days to locate the error and to find out when and why it is happening - without any success so I hope you can help me. I tried to create a small test which causes the errors but turned out that it's not that easy because it's not reliably reproducible. I also tried to use the @RepeatedIfExceptionsTest Annotation but it seems like if the error repeats once it appears.

I know this is not much information but I thought maybe you already know about that issue or something... Let me know if you need any other details.

we are using:

  • monocle:jdk-12.0.1+2
  • junit:5.5.2
  • javafx:13 (also tried 12.0.2)
java.lang.RuntimeException: java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 3
	at org.testfx.util.WaitForAsyncUtils.---- Delayed Exception: (See Trace Below) ----(WaitForAsyncUtils.java:0)
Caused by: java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 3
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
	at java.base/java.util.Objects.checkIndex(Objects.java:372)
	at java.base/java.util.ArrayList.get(ArrayList.java:458)
	at com.sun.javafx.collections.ObservableListWrapper.get(ObservableListWrapper.java:89)
	at com.sun.javafx.collections.VetoableListDecorator.get(VetoableListDecorator.java:306)
	at javafx.scene.Parent.updateCachedBounds(Parent.java:1703)
	at javafx.scene.Parent.recomputeBounds(Parent.java:1647)
	at javafx.scene.Parent.doComputeGeomBounds(Parent.java:1500)
	at javafx.scene.Parent$1.doComputeGeomBounds(Parent.java:115)
	at com.sun.javafx.scene.ParentHelper.computeGeomBoundsImpl(ParentHelper.java:84)
	at com.sun.javafx.scene.layout.RegionHelper.superComputeGeomBoundsImpl(RegionHelper.java:78)
	at com.sun.javafx.scene.layout.RegionHelper.superComputeGeomBounds(RegionHelper.java:62)
	at javafx.scene.layout.Region.doComputeGeomBounds(Region.java:3289)
	at javafx.scene.layout.Region$1.doComputeGeomBounds(Region.java:168)
	at com.sun.javafx.scene.layout.RegionHelper.computeGeomBoundsImpl(RegionHelper.java:89)
	at com.sun.javafx.scene.NodeHelper.computeGeomBounds(NodeHelper.java:115)
	at javafx.scene.Node.updateGeomBounds(Node.java:3848)
	at javafx.scene.Node.getGeomBounds(Node.java:3810)
	at javafx.scene.Node.computeLocalBounds(Node.java:3864)
	at javafx.scene.Node.updateLocalBounds(Node.java:3894)
	at javafx.scene.Node.getLocalBounds(Node.java:3764)
	at javafx.scene.Node.updateTxBounds(Node.java:3912)
	at javafx.scene.Node.getTransformedBounds(Node.java:3704)
	at javafx.scene.Node.updateBounds(Node.java:766)
	at javafx.scene.Parent.updateBounds(Parent.java:1834)
	at javafx.scene.Parent.updateBounds(Parent.java:1832)
	at javafx.scene.Parent.updateBounds(Parent.java:1832)
	at javafx.scene.Parent.updateBounds(Parent.java:1832)
	at javafx.scene.Parent.updateBounds(Parent.java:1832)
	at javafx.scene.Parent.updateBounds(Parent.java:1832)
	at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2497)
	at com.sun.javafx.tk.Toolkit.lambda$runPulse$2(Toolkit.java:412)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:389)
	at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:411)
	at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:438)
	at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:562)
	at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:542)
	at com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:535)
	at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$11(QuantumToolkit.java:341)
	at com.sun.glass.ui.monocle.RunnableProcessor.runLoop(RunnableProcessor.java:92)
	at com.sun.glass.ui.monocle.RunnableProcessor.run(RunnableProcessor.java:51)
	at java.base/java.lang.Thread.run(Thread.java:835)

Java 11 - exception while calling MonocleRobot->getScreenCapture

jdk: OpenJDK11U-jdk_x64_windows_hotspot_11.0.10_9
javafx version: 11.0.2
monocle version: jdk-11+26

JVM parameters:
-Dtestfx.robot=glass
-Dglass.platform=Monocle
-Dmonocle.platform=Headless
-Dprism.order=sw
-Dprism.text=t2k

code:

  public static WritableImage takeScreenshot(final GlassRobot robot) {
        final Rectangle2D bounds = Screen.getPrimary().getVisualBounds();
        final int width = (int) bounds.getWidth();
        final int height = (int) bounds.getHeight();
        final int x = (int) bounds.getMinX();
        final int y = (int) bounds.getMinY();

        return robot.getScreenCapture(null, x, y, width, height, false);
    }

Expected result: screenhsot captured
Actual result: java.lang.UnsupportedOperationException
at java.base/java.nio.IntBuffer.array(IntBuffer.java:1049)
at com.sun.glass.ui.monocle.MonocleRobot.getScreenCapture(MonocleRobot.java:209)
at com.sun.glass.ui.GlassRobot.getScreenCapture(GlassRobot.java:200)

Java 17

Using Java 17, JavaFX 17, Monocle jdk-12.0.1+2:

java.lang.RuntimeException: java.lang.IllegalAccessError: superclass access check failed: class com.sun.glass.ui.monocle.MonoclePlatformFactory (in unnamed module @0x2[38](https://github.com/sekassel-research/stp-22-client-demo/runs/6095564390?check_suite_focus=true#step:5:38)e0d81) cannot access class com.sun.glass.ui.PlatformFactory (in module javafx.graphics) because module javafx.graphics does not export com.sun.glass.ui to unnamed module @0x238e0d81
        at org.testfx.util.WaitForAsyncUtils.waitFor(WaitForAsyncUtils.java:302)
        at org.testfx.api.FxToolkit.registerPrimaryStage(FxToolkit.java:107)
        at org.testfx.framework.junit.ApplicationTest.internalBefore(ApplicationTest.java:85)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
        at org.junit.internal.runners.statements.RunBefores.invokeMethod(RunBefores.java:33)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
        at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
        at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110)
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38)
        at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
        at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
        at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
        at jdk.proxy2/jdk.proxy2.$Proxy5.processTestClass(Unknown Source)
        at org.gradle.api.internal.tasks.testing.worker.TestWorker$2.run(TestWorker.java:176)
        at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
        at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
        at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
        at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
        at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:133)
        at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:71)
        at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
        at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)

        Caused by:
        java.lang.IllegalAccessError: superclass access check failed: class com.sun.glass.ui.monocle.MonoclePlatformFactory (in unnamed module @0x238e0d81) cannot access class com.sun.glass.ui.PlatformFactory (in module javafx.graphics) because module javafx.graphics does not export com.sun.glass.ui to unnamed module @0x238e0d81
            at java.base/java.lang.ClassLoader.defineClass1(Native Method)
            at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1012)
            at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
            at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862)
            at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760)
            at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681)
            at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:6[39](https://github.com/sekassel-research/stp-22-client-demo/runs/6095564390?check_suite_focus=true#step:5:39))
            at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
            at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
            at java.base/java.lang.Class.forName0(Native Method)
            at java.base/java.lang.Class.forName(Class.java:375)
            at org.testfx.toolkit.impl.ApplicationLauncherImpl.assignMonoclePlatform(ApplicationLauncherImpl.java:54)
            at org.testfx.toolkit.impl.ApplicationLauncherImpl.initMonocleHeadless(ApplicationLauncherImpl.java:39)
            at org.testfx.toolkit.impl.ApplicationLauncherImpl.launch(ApplicationLauncherImpl.java:29)
            at org.testfx.toolkit.impl.ToolkitServiceImpl.lambda$setupPrimaryStage$0(ToolkitServiceImpl.java:57)
            at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
            at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
            at org.testfx.util.WaitForAsyncUtils$ASyncFXCallable.call(WaitForAsyncUtils.java:690)
            at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
            at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
            at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
            at java.base/java.lang.Thread.run(Thread.java:833)

    java.lang.IllegalStateException: Toolkit not initialized
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:437)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:432)
        at javafx.graphics/javafx.application.Platform.runLater(Platform.java:162)
        at org.testfx.util.WaitForAsyncUtils.runOnFxThread(WaitForAsyncUtils.java:538)
        at org.testfx.util.WaitForAsyncUtils.blockFxThreadWithSemaphore(WaitForAsyncUtils.java:553)
        at org.testfx.util.WaitForAsyncUtils.waitForFxEvents(WaitForAsyncUtils.java:372)
        at org.testfx.util.WaitForAsyncUtils.waitForFxEvents(WaitForAsyncUtils.java:360)
        at org.testfx.robot.impl.MouseRobotImpl.release(MouseRobotImpl.java:61)
        at org.testfx.api.FxRobot.release(FxRobot.java:570)
        at org.testfx.framework.junit.ApplicationTest.internalAfter(ApplicationTest.java:94)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
        at org.junit.internal.runners.statements.RunAfters.invokeMethod(RunAfters.java:46)
        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
        at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
        at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:[41](https://github.com/sekassel-research/stp-22-client-demo/runs/6095564390?check_suite_focus=true#step:5:41)3)
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110)
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38)
        at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
        at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:[43](https://github.com/sekassel-research/stp-22-client-demo/runs/6095564390?check_suite_focus=true#step:5:43))
        at java.base/java.lang.reflect.Method.invoke(Method.java:[56](https://github.com/sekassel-research/stp-22-client-demo/runs/6095564390?check_suite_focus=true#step:5:56)8)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
        at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
        at jdk.proxy2/jdk.proxy2.$Proxy5.processTestClass(Unknown Source)
        at org.gradle.api.internal.tasks.testing.worker.TestWorker$2.run(TestWorker.java:176)
        at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
        at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
        at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:[60](https://github.com/sekassel-research/stp-22-client-demo/runs/6095564390?check_suite_focus=true#step:5:60))
        at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
        at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:133)
        at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:71)
        at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:[69](https://github.com/sekassel-research/stp-22-client-demo/runs/6095564390?check_suite_focus=true#step:5:69))
        at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:[74](https://github.com/sekassel-research/stp-22-client-demo/runs/6095564390?check_suite_focus=true#step:5:74))

Version 1.8.0_212 doesn't work

The latest version, of Oracle Java doesn't work properly with the latest Java8 release.

I've created a fix in my own fork, because i require it for JPro: https://github.com/FlorianKirmaier/Monocle/tree/8_212

I've published it on my own repository, it can be used the following way in gradle:

    repositories {
        maven {
            url "http://sandec.bintray.com/repo"
        }
    }

    dependencies {
        compile "de.sandec:openjfx-monocle:8u212"
    }

monocle 21 jpms

I am using fx + monocle version 21.0.2
I put the libraries on the module path and use --add-modules=ALL-MODULE-PATH

I get an exception because monocle uses internal classes from javafx. Is this the expected behaviour and I should figure out the needed --add-exports myself? Its a bit odd that the documentation doesnt mention anything about this

Best regards,
Thorsten Goetzke
{code}
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.RuntimeException: java.lang.IllegalAccessError: superclass access check failed: class com.sun.glass.ui.monocle.MonoclePlatformFactory (in module org.testfx.monocle) cannot access class com.sun.glass.ui.PlatformFactory (in module javafx.graphics) because module javafx.graphics does not export com.sun.glass.ui to module org.testfx.monocle [in thread "main"]^M
at [email protected]/com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:300)^M
at [email protected]/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:292)^M
at [email protected]/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:162)^M
at [email protected]/javafx.embed.swing.JFXPanel.initFx(JFXPanel.java:247)^M
at [email protected]/javafx.embed.swing.JFXPanel.(JFXPanel.java:263)^M
at securiton.uls.utilities.lang.javafx.PlatformUtil.initJavaFx(PlatformUtil.java:38)^M
at securiton.uls.tools.configuration.launcher.IntTestApplicationImpl.(IntTestApplicationImpl.java:157)^M
... 105 more^M
{code}

Headless test failing with JavaFX 21 AbstractMethodError

Environment:

  • Java 17
  • JavaFX 21
  • headless mode

java.lang.AbstractMethodError: Receiver class com.sun.glass.ui.monocle.MonocleWindow does not define or inherit an implementation of the resolved method 'abstract void _updateViewSize(long)' of abstract class com.sun.glass.ui.Window. at com.sun.glass.ui.Window.setView(Window.java:377) at com.sun.javafx.tk.quantum.WindowStage.lambda$setScene$0(WindowStage.java:271) at com.sun.javafx.tk.quantum.QuantumToolkit.runWithRenderLock(QuantumToolkit.java:442) at com.sun.javafx.tk.quantum.WindowStage.setScene(WindowStage.java:270) at javafx.stage.Window$12.invalidated(Window.java:1162) at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:110) at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:145) at javafx.stage.Window.setShowing(Window.java:1239) at javafx.stage.Window.show(Window.java:1254) at javafx.stage.Stage.show(Stage.java:277)

Right click on TreeView, doesn't seems to work with Monocle

I have created a sample project that create a simple TreeView with a menu item.
When the user click on a tree cell, it display a menu item.

The app look like this:

saved

Code:

public class MyApp extends Application
{
    TreeItem<String> rootNode = new TreeItem<>("MyCompany Human Resources");

    public static void main(String[] args) {
        Application.launch(args);
    }

    TreeView<String> treeView = new TreeView<>(rootNode);

    @Override
    public void start(Stage stage)
    {

        // instantiate the root context menu
        ContextMenu rootContextMenu = ContextMenuBuilder.create()
                .items(
                        MenuItemBuilder.create()
                                .text("Menu Item")
                                .onAction(new EventHandler<ActionEvent>() {
                                            @Override
                                            public void handle(ActionEvent arg0)
                                            {
                                                System.out.println("Menu Item Clicked!");
                                            }
                                        }
                                )
                                .build()
                )
                .build();

        treeView.setContextMenu(rootContextMenu);

        stage.setTitle("Tree View Sample");
        VBox box = new VBox();
        final Scene scene = new Scene(box, 400, 300);
        scene.setFill(Color.LIGHTGRAY);


        box.getChildren().add(treeView);
        stage.setScene(scene);
        stage.show();
    }
}

And the unit test associated with that :

public class MyTreeCellTest extends FxRobot {

    private MyApp app;

    @BeforeClass
    public static void setupSpec() throws Exception {
        Stage primaryStage = registerPrimaryStage();
        setupStage(stage -> stage.show());
    }

    @Before
    public void setup() throws Exception {
        app = (MyApp) setupApplication(MyApp.class);
    }

    @Test
    public void clickMenuHumanResourcesTest() throws IOException {
        clickOn("MyCompany Human Resources", MouseButton.SECONDARY);
        clickOn("Menu Item");
    }
}

The test run fine on a desktop but not with in headless mode.

I have capture the screen just after the clickOn("MyCompany Human Resources", MouseButton.SECONDARY); line in headless mode.

saved2

We can see that the click never happen.

Stacktrace:

11:28:59.321 [DEBUG] [TestEventLogger] MyTreeCellTest > clickMenuHumanResourcesTest STARTED
11:28:59.813 [QUIET] [system.out] 11:28:59.812 [INFO] [org.gradle.api.internal.tasks.testing.worker.TestWorker] Gradle Test Executor 1 finished executing tests.
11:28:59.843 [QUIET] [system.out] 11:28:59.817 [DEBUG] [org.gradle.process.internal.child.ActionExecutionWorker] Completed Gradle Test Executor 1.
11:28:59.860 [QUIET] [system.out] 11:28:59.859 [DEBUG] [org.gradle.process.internal.child.ActionExecutionWorker] Stopping client connection.
11:28:59.862 [DEBUG] [TestEventLogger]
11:28:59.873 [DEBUG] [TestEventLogger] MyTreeCellTest > clickMenuHumanResourcesTest FAILED
11:28:59.882 [DEBUG] [TestEventLogger]     org.testfx.api.FxRobotException: the query "Menu Item" returned no nodes.
11:28:59.890 [DEBUG] [TestEventLogger]         at org.testfx.api.FxRobot.queryVisibleNode(FxRobot.java:1169)
11:28:59.887 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: SUCCEEDED
11:28:59.895 [DEBUG] [TestEventLogger]         at org.testfx.api.FxRobot.pointOfVisibleNode(FxRobot.java:1138)
11:28:59.902 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Process 'Gradle Test Executor 1' finished with exit value 0 (state: SUCCEEDED)
11:28:59.907 [DEBUG] [TestEventLogger]         at org.testfx.api.FxRobot.clickOn(FxRobot.java:750)
11:28:59.920 [DEBUG] [TestEventLogger]         at MyTreeCellTest.clickMenuHumanResourcesTest(MyTreeCellTest.java:50)
11:28:59.926 [DEBUG] [TestEventLogger]         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
11:28:59.931 [DEBUG] [TestEventLogger]         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
11:28:59.936 [DEBUG] [TestEventLogger]         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
11:28:59.943 [DEBUG] [TestEventLogger]         at java.lang.reflect.Method.invoke(Method.java:498)
11:28:59.948 [DEBUG] [TestEventLogger]         at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
11:28:59.954 [DEBUG] [TestEventLogger]         at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
11:28:59.960 [DEBUG] [TestEventLogger]         at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
11:28:59.966 [DEBUG] [TestEventLogger]         at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
11:28:59.972 [DEBUG] [TestEventLogger]         at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
11:28:59.977 [DEBUG] [TestEventLogger]         at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
11:28:59.982 [DEBUG] [TestEventLogger]         at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
11:28:59.988 [DEBUG] [TestEventLogger]         at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
11:28:59.994 [DEBUG] [TestEventLogger]         at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
11:28:59.999 [DEBUG] [TestEventLogger]         at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
11:29:00.005 [DEBUG] [TestEventLogger]         at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
11:29:00.010 [DEBUG] [TestEventLogger]         at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
11:29:00.016 [DEBUG] [TestEventLogger]         at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
11:29:00.020 [DEBUG] [TestEventLogger]         at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
11:29:00.026 [DEBUG] [TestEventLogger]         at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
11:29:00.031 [DEBUG] [TestEventLogger]         at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:105)
11:29:00.038 [DEBUG] [TestEventLogger]         at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:56)
11:29:00.044 [DEBUG] [TestEventLogger]         at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:64)
11:29:00.051 [DEBUG] [TestEventLogger]         at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:50)
11:29:00.058 [DEBUG] [TestEventLogger]         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
11:29:00.063 [DEBUG] [TestEventLogger]         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
11:29:00.069 [DEBUG] [TestEventLogger]         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
11:29:00.075 [DEBUG] [TestEventLogger]         at java.lang.reflect.Method.invoke(Method.java:498)
11:29:00.080 [DEBUG] [TestEventLogger]         at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
11:29:00.086 [DEBUG] [TestEventLogger]         at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
11:29:00.092 [DEBUG] [TestEventLogger]         at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
11:29:00.098 [DEBUG] [TestEventLogger]         at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
11:29:00.105 [DEBUG] [TestEventLogger]         at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
11:29:00.110 [DEBUG] [TestEventLogger]         at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:106)
11:29:00.116 [DEBUG] [TestEventLogger]         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
11:29:00.122 [DEBUG] [TestEventLogger]         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
11:29:00.127 [DEBUG] [TestEventLogger]         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
11:29:00.133 [DEBUG] [TestEventLogger]         at java.lang.reflect.Method.invoke(Method.java:498)
11:29:00.138 [DEBUG] [TestEventLogger]         at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
11:29:00.144 [DEBUG] [TestEventLogger]         at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
11:29:00.151 [DEBUG] [TestEventLogger]         at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:360)
11:29:00.157 [DEBUG] [TestEventLogger]         at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
11:29:00.163 [DEBUG] [TestEventLogger]         at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
11:29:00.169 [DEBUG] [TestEventLogger]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
11:29:00.175 [DEBUG] [TestEventLogger]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
11:29:00.181 [DEBUG] [TestEventLogger]         at java.lang.Thread.run(Thread.java:745)
11:29:00.188 [DEBUG] [TestEventLogger]
11:29:00.193 [DEBUG] [TestEventLogger] MyTreeCellTest FAILED
11:29:00.201 [DEBUG] [TestEventLogger]
11:29:00.206 [DEBUG] [TestEventLogger] Gradle Test Executor 1 FAILED
11:29:00.214 [DEBUG] [TestEventLogger]
11:29:00.221 [DEBUG] [TestEventLogger] Gradle Test Run :test FAILED
11:29:00.229 [ERROR] [org.gradle.api.internal.tasks.testing.logging.TestCountLogger]
1 test completed, 1 failed

All code can be found on GitHub.

Java version: 1.8.0_91.b15 (64 bits)
OS: Windows and Linux

Is it a TestFX issue or more a Monocle issue that have to be reported on their local bugtracker ?

Thank in advance.

MonacleView needs to implement _getNativeFrameBuffer(long)

i'm guessing some kind of change was made to the latest version of the java 8 sdk

java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)

that is causing the current monacle library to break.

the current released version yield this exception w/ the fore mentioned jdk

java.lang.AbstractMethodError: com.sun.glass.ui.View._getNativeFrameBuffer(J)I
    at com.sun.glass.ui.View.getNativeFrameBuffer(View.java:755)
    at com.sun.prism.PresentableState.lock(PresentableState.java:273)
    at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:65)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
    at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
    at java.lang.Thread.run(Thread.java:745)

i tried recompiling the library, but i get this error

/Users/jgangemi/projects/scriptkitty/git-clone/Monocle/src/main/java/com/sun/glass/ui/monocle/MonocleView.java:36: error: MonocleView is not abstract and does not override abstract method _getNativeFrameBuffer(long) in View
public final class MonocleView extends View {
             ^
Note: /Users/jgangemi/projects/scriptkitty/git-clone/Monocle/src/main/java/com/sun/glass/ui/monocle/linux/SysFS.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
:compileJava FAILED

it seems an implementation of _getNativeFrameBuffer(long) is needed but unfortunately i don't know what that should look like.

Alternating error in JDK11: ClassNotFound or module org.testfx.monocle

I am trying to execute this example. I am using JDK11 in Ubuntu (openjdk version "11.0.4" 2019-07-16 onUbuntu 18.04.3 LTS) and have OpenJFX installed and working. I am trying to run this via Scala using Mill.

EDIT: forgot to mention that I have tried with javafx 11.0.2 and 12.0.2.

This is my set-up:

val monocle = "/usr/share/openjfx/lib:/home/hmf/.cache/coursier/v1/https/repo1.maven.org/maven2/org/testfx/openjfx-monocle/jdk-11%2B26"
Seq(
  "-XX:+UnlockExperimentalVMOptions",
  "-XX:+EnableJVMCI",
  s"--module-path=$libPath::/usr/share/openjfx/lib:$monocle",
  s"--upgrade-module-path=$compiler",
  "--add-modules=org.testfx.monocle,javafx.graphics,javafx.controls,javafx.fxml,javafx.base,javafx.media,javafx.web,javafx.swing", // TODO: auto create
  // javafx Monocle
  s"--patch-module=javafx.graphics=${monocle}",
  "--add-exports=javafx.graphics/com.sun.glass.ui=org.testfx.monocle",
  //"--add-exports=javafx.graphics/com.sun.glass.ui=ALL-UNNAMED",
  "--add-reads=javafx.graphics=ALL-UNNAMED",
  "--add-opens=javafx.graphics/com.sun.glass.ui=ALL-UNNAMED",
  "--add-opens=javafx.controls/com.sun.javafx.charts=ALL-UNNAMED",
  "--add-opens=javafx.graphics/com.sun.javafx.iio=ALL-UNNAMED",
  "--add-opens=javafx.graphics/com.sun.javafx.iio.common=ALL-UNNAMED",
  "--add-opens=javafx.graphics/com.sun.javafx.css=ALL-UNNAMED",
  "--add-opens=javafx.base/com.sun.javafx.runtime=ALL-UNNAMED"
)

In this case I get:

Exception in thread "main" java.lang.IllegalStateException: Monocle headless platform not found
	at mdocs.JavaFXHtmlImageCapture.initMonocleHeadless(JavaFXHtmlImageCapture.java:151)
	at mdocs.JavaFXHtmlImageCapture.initialize(JavaFXHtmlImageCapture.java:37)
	at mdocs.TestHeadlessMonocle$.main(TestHeadlessMonocle.scala:72)
	at mdocs.TestHeadlessMonocle.main(TestHeadlessMonocle.scala)
Caused by: java.lang.ClassNotFoundException: com.sun.glass.ui.monocle.headless.HeadlessPlatform
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:315)
	at mdocs.JavaFXHtmlImageCapture.assignHeadlessPlatform(JavaFXHtmlImageCapture.java:171)
	at mdocs.JavaFXHtmlImageCapture.initMonocleHeadless(JavaFXHtmlImageCapture.java:149)

With "--add-exports=javafx.graphics/com.sun.glass.ui=ALL-UNNAMED" I also get the same result. But if if I now un-comment the line:

"--add-exports=javafx.graphics/com.sun.glass.ui=org.testfx.monocle",

I get:

Exception in thread "main" java.lang.IllegalAccessError: superclass access check failed: class com.sun.glass.ui.monocle.MonoclePlatformFactory (in module org.testfx.monocle) cannot access class com.sun.glass.ui.PlatformFactory (in module javafx.graphics) because module javafx.graphics does not export com.sun.glass.ui to module org.testfx.monocle
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1095)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:206)
	at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:761)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findClassInModuleOrNull(BuiltinClassLoader.java:682)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:607)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:315)
	at mdocs.JavaFXHtmlImageCapture.assignMonoclePlatform(JavaFXHtmlImageCapture.java:165)
	at mdocs.JavaFXHtmlImageCapture.initMonocleHeadless(JavaFXHtmlImageCapture.java:148)
	at mdocs.JavaFXHtmlImageCapture.initialize(JavaFXHtmlImageCapture.java:37)
	at mdocs.TestHeadlessMonocle$.main(TestHeadlessMonocle.scala:72)
	at mdocs.TestHeadlessMonocle.main(TestHeadlessMonocle.scala)

I have scoured the net and have tried the suggestions I have found. First I would like to confirm that I need only use Maven to install TestFX's Monocle.

Can anyone tell me what I can do do diagnose this further? Are their any example projects I can use to test my installation? Any suggeston greatly appreciated.

TIA.

Java9 support and usage

I recognized that monocle is now also available for Java9. I build it but unfortunately I could not get the classes to be loaded with Java9 (java.lang.ClassNotFoundException: com.sun.glass.ui.monocle.MonoclePlatformFactory)
Since java9 does not support the ext folder anymore, it would be fine if you could provide the steps necessary that the class loader recognizes the appropriate monocle classes.

Headless testing with version 8u76-b04 does not work on JDK 8u311. Throws java.lang.NoSuchMethodException: com.sun.glass.ui.Screen error

Im running gradle headless tests for javafx using the following versions of the testfx libraries and monocle library
testCompile 'org.testfx:testfx-core:4.0.16-alpha'
testCompile 'org.testfx:openjfx-monocle:8u76-b04'
testCompile 'org.testfx:testfx-junit:4.0.15-alpha'

It works on JDK 8u211 and earlier... On 8u311 the tests hang with the following error:

18:21:13.325 [DEBUG] [TestEventLogger] java.lang.NoSuchMethodException: com.sun.glass.ui.Screen.<init>(long, int, int, int, int, int, int, int, int, int, int, int, float) 18:21:13.326 [DEBUG] [TestEventLogger] at java.lang.Class.getConstructor0(Class.java:3082) 18:21:13.326 [DEBUG] [TestEventLogger] at java.lang.Class.getDeclaredConstructor(Class.java:2178) 18:21:13.326 [DEBUG] [TestEventLogger] at com.sun.glass.ui.monocle.MonocleApplication$2.run(MonocleApplication.java:234) 18:21:13.326 [DEBUG] [TestEventLogger] at com.sun.glass.ui.monocle.MonocleApplication$2.run(MonocleApplication.java:230) 18:21:13.326 [DEBUG] [TestEventLogger] at java.security.AccessController.doPrivileged(Native Method) 18:21:13.326 [DEBUG] [TestEventLogger] at com.sun.glass.ui.monocle.MonocleApplication.staticScreen_getScreens(MonocleApplication.java:229) 18:21:13.326 [DEBUG] [TestEventLogger] at com.sun.glass.ui.Screen.initScreens(Screen.java:412) 18:21:13.327 [DEBUG] [TestEventLogger] at com.sun.glass.ui.Application.lambda$run$1(Application.java:155) 18:21:13.327 [DEBUG] [TestEventLogger] at com.sun.glass.ui.monocle.RunnableProcessor.runLoop(RunnableProcessor.java:77) 18:21:13.327 [DEBUG] [TestEventLogger] at com.sun.glass.ui.monocle.RunnableProcessor.run(RunnableProcessor.java:47) 18:21:13.327 [DEBUG] [TestEventLogger] at java.lang.Thread.run(Thread.java:748) 18:21:13.327 [DEBUG] [TestEventLogger] Exception in thread "JavaFX Application Thread" java.lang.NullPointerException 18:21:13.327 [DEBUG] [TestEventLogger] at com.sun.javafx.tk.quantum.QuantumToolkit.assignScreensAdapters(QuantumToolkit.java:729) 18:21:13.327 [DEBUG] [TestEventLogger] at com.sun.javafx.tk.quantum.QuantumToolkit.runToolkit(QuantumToolkit.java:334) 18:21:13.327 [DEBUG] [TestEventLogger] at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$startup$10(QuantumToolkit.java:279) 18:21:13.327 [DEBUG] [TestEventLogger] at com.sun.glass.ui.Application.lambda$run$1(Application.java:156) 18:21:13.328 [DEBUG] [TestEventLogger] at com.sun.glass.ui.monocle.RunnableProcessor.runLoop(RunnableProcessor.java:77) 18:21:13.328 [DEBUG] [TestEventLogger] at com.sun.glass.ui.monocle.RunnableProcessor.run(RunnableProcessor.java:47) 18:21:13.328 [DEBUG] [TestEventLogger] at java.lang.Thread.run(Thread.java:748) 18:21:15.316 [DEBUG] [org.gradle.launcher.daemon.server.Daemon] DaemonExpirationPeriodicCheck running 18:21:15.320 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry. 18:21:15.320 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired. 18:21:15.322 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry. 18:21:15.325 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry. 18:21:15.325 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired. 18:21:15.326 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.

Monocle support for JavaFX 13

Would it be possible to get a build of Monocle up from JDK 13? I'd like to use JavaFX 13, but I don't think I can run it against an older version of Monocle.

As an aside:

The readme suggests that the version of Monocle you use is tied to the version of Java you're using, but I don't think that's the case. Running JavaFX 13 on Java 11 is supported, but Monocle from OpenJDK 11 is missing methods required by JavaFX 13 (com.sun.prims.Graphics.setPerspectiveTransform(), for example). I think the readme should be updated to indicate that you want the version of Monocle and the version of JavaFX you're using to be in sync.

Monocole - HeadlessTest - java.nio.BufferOverflowException

Hello,

I'm trying to configure headless test with :

  • JDK : 1.8.0_71
  • TestFX 4.0.4
  • org.testfx:openjfx-monocle:1.8.0_20

All my test are working but there are very slow and they all produce this exception (many many many time) :

java.nio.BufferOverflowException
    at java.nio.DirectIntBufferU.put(DirectIntBufferU.java:363)
    at com.sun.javafx.tk.quantum.UploadingPainter.run(UploadingPainter.java:153)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
    at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
    at java.lang.Thread.run(Thread.java:745)

I configured TestFX/Monocle like that :

    @BeforeClass public static void setUpClass() throws Exception {

        if (Boolean.getBoolean("headless")) {
            System.setProperty("testfx.robot", "glass");
            System.setProperty("testfx.headless", "true");
            System.setProperty("prism.order", "sw");
            System.setProperty("prism.text", "t2k");
            System.setProperty("java.awt.headless", "true");
        }
     ...

Could somebody help me ?

Shift-Clicks don't work when multiselecting list entries

Testcases where multipe selections are made by clickOn(item1), then press(KeyCode.SHIFT) and then clickOn(item2) are failing with Monocle, while working normally under plain JavaFX. The generated screenshots show that only item2 is marked, meaning press(KeyCode.SHIFT) seems to have no effect in Monocle.

Monocle 21 builds available

Hi everyone,

I was checking Test/Monocle, and the latest build was for 12.
So, I'm not sure of the state of the monocle libraries, but I assumed the repository to be dead, and created own builds.
I also published them on Maven Central:
https://github.com/sandec/monocle
https://repo.maven.apache.org/maven2/one/jpro/openjfx-monocle/jfx-21/

It is a drop-in replacement.

<dependency>
  <groupId>one.jpro</groupId>
  <artifactId>openjfx-monocle</artifactId>
  <version>jfx-21</version>
</dependency>

Release u40 version

Hi, it would save a lot of people trouble if you built and released an u40 version of this repo.

Regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.