RFR: 8217472: Add attenuation for PointLight [v5]
Kevin Rushforth
kcr at openjdk.java.net
Tue Sep 1 11:44:46 UTC 2020
On Tue, 1 Sep 2020 10:54:50 GMT, Nir Lisker <nlisker at openjdk.org> wrote:
>> The performance tests need a standard GPLv2+classpath copyright header. I haven't tested them yet, but will do that
>> next week.
>
> I've written a simple draft for the automated test:
>
> PointLight light = new PointLight(Color.BLUE);
> light.setTranslateZ(-50);
> var box = new Box(100, 100, 1);
> var root = new Group(light, box);
> var scene = new Scene(root);
> var image = box.snapshot(null, null);
> var nonAttenColor = image.getPixelReader().getColor(1, 1);
> light.setLinearAttenuation(2);
> image = box.snapshot(null, null);
> var attenColor = image.getPixelReader().getColor(1, 1);
> assertTrue("Attenuation color should be less than non-attenuated", nonAttenColor.getBlue() > attenColor.getBlue());
>
> However, I'm getting the error:
>
> java.lang.UnsupportedOperationException
> at javafx.graphics/test.com.sun.javafx.pgstub.StubToolkit.renderToImage(StubToolkit.java:719)
> at javafx.graphics/javafx.scene.Scene.doSnapshotTile(Scene.java:1383)
> at javafx.graphics/javafx.scene.Scene.doSnapshot(Scene.java:1319)
> at javafx.graphics/javafx.scene.Node.doSnapshot(Node.java:2136)
> at javafx.graphics/javafx.scene.Node.snapshot(Node.java:2214)
> Where is the test that takes the snapshot? I am missing something in my setup.
I guess you are trying a unit test in the `javafx.graphics` project? That won't work. It needs to be a system test in
`tests/system/...`
-------------
PR: https://git.openjdk.java.net/jfx/pull/43
More information about the openjfx-dev
mailing list