On Wed, 4 Mar 2026 23:39:10 GMT, Damon Nguyen <[email protected]> wrote:

>> This test used to intermittently fail. Since then, the test has been 
>> converted from an `.html` test to a `.java` test. I have run the test in CI 
>> on 3 different runs with 100 repeats across all OS's. The test passes on all 
>> instances. So, I have removed the test from the ProblemList as well. The 
>> test updates are mostly minor nits.
>
> Damon Nguyen has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Revert run change

Changes requested by aivanov (Reviewer).

test/jdk/java/awt/TextComponent/CorrectTextComponentSelectionTest.java line 78:

> 76:         for (int i = 0; i < 50; i++) {
> 77:             sf = sf + " ";
> 78:         }

You could replace concatenation in a loop (that you shouldn't do) with

Suggestion:

String sf = " ".repeat(50);

test/jdk/java/awt/TextComponent/CorrectTextComponentSelectionTest.java line 125:

> 123:         EventQueue.invokeAndWait(() -> color_center =
> 124:                 r.getPixelColor(loc.x + tc.getWidth() / 2,
> 125:                         loc.y + tc.getHeight() / 2));

I suggest modifying the code so that it stores the center point into `loc` in 
one go, instead of wrapping `r.getPixelColor` into another `invokeAndWait`.


Point p = tc.getLocationOnScreen();
p.translate(tc.getWidth() / 2, tc.getHeight() / 2);
loc = p;

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

PR Review: https://git.openjdk.org/jdk/pull/30058#pullrequestreview-3898483676
PR Review Comment: https://git.openjdk.org/jdk/pull/30058#discussion_r2891387492
PR Review Comment: https://git.openjdk.org/jdk/pull/30058#discussion_r2891378213

Reply via email to