RFR: 8217472: Add attenuation for PointLight [v5]

Nir Lisker nlisker at openjdk.java.net
Wed Sep 2 16:59:44 UTC 2020

On Tue, 1 Sep 2020 23:09:39 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>>> gradle -PFULL_TEST=true -PUSE_ROBOT=true :systemTests:test --tests MyTest
>> What format is `MyTest`? Is it some relative path?
> It can either be a fully qualified class name (with `.` as separator) or the unqualified name of the test class. The
> class name must end with exactly `Test`. So for example, try it with `Snapshot1Test`.

I wrote the following test:

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;

import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Group;
import javafx.scene.PointLight;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.shape.Box;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;

public class PointLightAttenuationTest {

    private static CountDownLatch startupLatch;
    private static Stage stage;
    private static PointLight light = new PointLight(Color.BLUE);
    private static Box box = new Box(100, 100, 1);

    public static void initFX() throws Exception {
        startupLatch = new CountDownLatch(1);
        new Thread(() -> Application.launch(TestApp.class, (String[])null)).start();
        assertTrue("Timeout waiting for FX runtime to start", startupLatch.await(15, TimeUnit.SECONDS));

    public class TestApp extends Application {

        public void start(Stage mainStage) {
            stage = mainStage;
            var root = new Group(light, box);
            var scene = new Scene(root);
            stage.addEventHandler(WindowEvent.WINDOW_SHOWN, e -> Platform.runLater(startupLatch::countDown));
    public void testAttenuation() {
        var image = box.snapshot(null, null);
        var nonAttenColor = image.getPixelReader().getColor(1, 1);

        image = box.snapshot(null, null);
        var attenColor = image.getPixelReader().getColor(1, 1);

        if (nonAttenColor.getBlue() > attenColor.getBlue()) {
            throw new AssertionError("Attenuation color should be less than non-attenuated");

    public static void teardown() {
        Platform.runLater(() -> {
But when executing it with

    ./gradlew -PFULL_TEST=true -PUSE_ROBOT=true :systemTests:test --tests PointLightAttenuationTest

I get the error

test.javafx.scene.lighting3D.PointLightAttenuationTest > classMethod FAILED
    java.lang.AssertionError: Timeout waiting for FX runtime to start
        at org.junit.Assert.fail(Assert.java:91)
        at org.junit.Assert.assertTrue(Assert.java:43)
        at test.javafx.scene.lighting3D.PointLightAttenuationTest.initFX(PointLightAttenuationTest.java:59)

So for some reason the Application doesn't start, it seems. I ran `ShapeViewOrderLeakTest` and `RestoreSceneSizeTest`
which look the same, and those work. Any idea?


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

More information about the openjfx-dev mailing list