RFR: 8360498: [TEST_BUG] Some Mixing test continue to fail [v5]

Khalid Boulanouare duke at openjdk.org
Tue Aug 12 16:37:18 UTC 2025


On Tue, 12 Aug 2025 16:02:28 GMT, Khalid Boulanouare <duke at openjdk.org> wrote:

>> 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;
> 
>     }

I updated the method implementation as suggested.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26625#discussion_r2270513357


More information about the client-libs-dev mailing list