JDK-8283493 : Create an automated regression test for RFE 4231298
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 8,11,17,18,19
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2022-03-22
  • Updated: 2022-08-01
  • Resolved: 2022-03-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 17 JDK 19 JDK 8
11.0.17-oracleFixed 17.0.5-oracleFixed 19 b16Fixed 8u351Fixed
Related Reports
Relates :  
Relates :  
Description
Create a regression test for JDK-4231298
Issue:
When a JComboBox first drops down, the renderer is called for
every element in the list, even those elements that will not
actually be drawn on the screen. 

Fix:
Introduced new API to JComboBox: get/setPrototypeDisplayValue(). This API allows the UI to calculate the display size using this prototype value rather than iterated over a large list of items. See RFE 4289100 which also addresses this problem.

Testing:
1. Tested in Mach5, 10 times per platform(macos,linux and windows) and got all pass.

2. Tested in JDK 1.3.0 and JDK 1.4.0 and the results are given below.
Java 1.3.0 -> Test Failed.
$ jdk1.3/bin/java JComboBoxPrototypeTest
getListCellRendererComponent index = -1, isSelected = false, cellHasFocus = false
Value of the Counter is 1
....
getListCellRendererComponent index = -1, isSelected = false, cellHasFocus = false
Value of the Counter is 101
Test Failed
java.lang.RuntimeException: Custom Renderer got called 101 times, expected is maximum 6 times
        at JComboBoxPrototypeTestOld.main(JComboBoxPrototypeTest.java:107)

Java 1.4.0(added a call to setPrototypeDisplayValue()) -> Test Passed.
$ j2sdk1.4.0/bin/java JComboBoxPrototypeTest
getListCellRendererComponent index = -1, isSelected = false, cellHasFocus = false
Value of the Counter is 1
getListCellRendererComponent index = -1, isSelected = false, cellHasFocus = false
Value of the Counter is 2
getListCellRendererComponent index = -1, isSelected = false, cellHasFocus = false
Value of the Counter is 3
Test Passed
Comments
Fix request [11u,17u] I backport this for parity with 11.0.17,17.0.5-oracle. No risk, only a test change. Clean backport. Test passes. SAP nightly testing passed.
01-08-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk11u-dev/pull/1287 Date: 2022-07-29 16:13:33 +0000
29-07-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk17u-dev/pull/610 Date: 2022-07-29 16:11:40 +0000
29-07-2022

Changeset: 6917c39e Author: Manukumar V S <mvs@openjdk.org> Committer: Phil Race <prr@openjdk.org> Date: 2022-03-23 23:42:39 +0000 URL: https://git.openjdk.java.net/jdk/commit/6917c39e450e0564b8db7c96be132881a6b0a112
23-03-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk/pull/7905 Date: 2022-03-22 15:30:09 +0000
22-03-2022