RFR: 8352997: Open source several Swing JTabbedPane tests
Phil Race
prr at openjdk.org
Thu Apr 3 20:55:49 UTC 2025
On Thu, 3 Apr 2025 20:25:37 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:
>> open sourcing some Swing JTabbedPane tests
>
> test/jdk/javax/swing/JTabbedPane/bug4273320.java line 57:
>
>> 55:
>> 56: TabbedPaneUI ui = tabs.getUI();
>> 57: Rectangle origSize = ui.getTabBounds(tabs, 0);
>
> On EDT ?
I don't think it is needed here because the UI is stable and so access should be safe.
> test/jdk/javax/swing/JTabbedPane/bug4287268.java line 59:
>
>> 57: Point point = jtp.getLocationOnScreen();
>> 58: int width = jtp.getWidth();
>> 59: int height = jtp.getHeight();
>
> Might be good to wrap it in EDT.
>
> It was the following `getComponentBounds()` method that @azvegint suggested we move to Util (since we use it across multiple tests), but it does create a dependency on Util class.
>
>
> Rectangle jtpLoc = Util.invokeOnEDT(() ->
> getComponentBounds(jtp));
>
> private static Rectangle getComponentBounds(Component component) {
> Point locationOnScreen = component.getLocationOnScreen();
> Dimension size = component.getSize();
> return new Rectangle(locationOnScreen, size);
> }
As I said when it was discussed, I like to avoid dependencies just for the sake of a few lines of code.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24370#discussion_r2027726025
PR Review Comment: https://git.openjdk.org/jdk/pull/24370#discussion_r2027724096
More information about the client-libs-dev
mailing list