RFR: 8360498: [TEST_BUG] Some Mixing test continue to fail [v5]
Khalid Boulanouare
duke at openjdk.org
Tue Aug 12 16:05:17 UTC 2025
On Tue, 12 Aug 2025 14:50:08 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>> Khalid Boulanouare has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Updates copyright years
>
> test/jdk/java/awt/Mixing/AWT_Mixing/MixingPanelsResizing.java line 313:
>
>> 311: return true;
>> 312: } else {
>> 313: return Math.abs(color.getRed() - refColor.getRed()) <
>
> The indentation of the first `if` is wrong.
>
> Essentially, this `if` condition can be simplified to
>
>
> return color.equals(refColor)
> || (Math.abs(color.getRed() - refColor.getRed())
> < COLOR_TOLERANCE_MACOSX
> && Math.abs(color.getGreen() - refColor.getGreen())
> < COLOR_TOLERANCE_MACOSX
> && Math.abs(color.getBlue() - refColor.getBlue())
> < COLOR_TOLERANCE_MACOSX;
>
> There may be a utility method available for colour tolerance which seems quite common for macOS.
I have copied the same method logic in test java.awt.Graphics2D.DrawPrimitivesTest.java
private static boolean isAlmostEqual(Color c1, Color c2) {
return Math.abs(c1.getRed() - c2.getRed()) < COLOR_TOLERANCE &&
Math.abs(c1.getGreen() - c2.getGreen()) < COLOR_TOLERANCE &&
Math.abs(c1.getBlue() - c2.getBlue()) < COLOR_TOLERANCE;
}
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26625#discussion_r2270430458
More information about the client-libs-dev
mailing list