Search code examples
javafxjavafx-2javafx-8javafx-3dtestfx

TestFX How to understand the color of an item?


I am trying to get a rectangle's background color. I tried to find a way but i couldnt. Isnt there a method makes all this easy? Any help would be appriciated


Solution

  • This worked for me

        Rectangle rectangle = lookup("#rectangleId").queryAll().iterator().next();
        Paint color = rect.getFill();
        assertThat(color,is(color2));