JavaFX 26 introduced a headless glass platform that enables running JavaFX rendering tests in CI environments without a display. This post walks through how the Lottie4J project used this feature to enable a previously disabled GitHub Actions test that compares JavaFX animation output against JavaScript reference screenshots. The solution uses a Maven profile that upgrades JavaFX to version 26 and Java to 25 only for the test run, while keeping the library itself on Java 21/JavaFX 21. Key JVM flags needed are -Dglass.platform=headless and --enable-native-access=javafx.graphics. The approach eliminates the need for Xvfb or Docker display tricks, and enables pixel-level regression testing of Lottie animation rendering on every CI push.

7m read timeFrom webtechie.be
Post cover image
Table of contents
The Test, and Why It MatteredWhat Changed in JavaFX 26The Catch: JavaFX 26 Requires Java 24The GitHub Actions SideWhat This Actually TestsWould I Recommend This Pattern?

Sort: