RFR: 8316627: JViewport Test headless failure [v3]
Phil Race
prr at openjdk.org
Wed Sep 20 22:03:26 UTC 2023
On Wed, 20 Sep 2023 21:53:09 GMT, Phil Race <prr at openjdk.org> wrote:
>> test/jdk/javax/swing/JViewport/bug4546474.java line 51:
>>
>>> 49: if (!viewChanged) {
>>> 50: viewChanged = true;
>>> 51: }
>>
>> What purpose does viewChanged have ?
>> Its set but never read.
>
> The adjustmentListener therefore seems irrelevant too.
Seems to me the test reduces to
import javax.swing.JPanel;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
public class bug4546474 {
public static void main(String[] args) {
JPanel panel = new JPanel();
JScrollPane scrollpane = new JScrollPane(panel,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
JScrollBar sbar = scrollpane.getVerticalScrollBar();
scrollpane.setViewportView(null);
if (sbar.getVisibleAmount() > 0) {
throw new RuntimeException("Vertical scrollbar is not " +
"updated when viewport is replaced");
}
}
}
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15847#discussion_r1332223256
More information about the client-libs-dev
mailing list