RFR: 8217472: Add attenuation for PointLight [v5]

Nir Lisker nlisker at openjdk.java.net
Tue Sep 1 13:52:12 UTC 2020


On Tue, 1 Sep 2020 11:42:30 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> 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/...`

I tried several approaches. When I put it under `tests/system` and run the tests task, I don't see it being run. I'm
not familiar with the way tests under `tests` are run in general.

-------------

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


More information about the openjfx-dev mailing list