RFR: 8283493: Create an automated regression test for RFE 4231298 [v2]

Manukumar V S mvs at openjdk.java.net
Tue Mar 22 15:41:19 UTC 2022


> Create a regression test for [JDK-4231298](https://bugs.openjdk.java.net/browse/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

Manukumar V S has updated the pull request incrementally with one additional commit since the last revision:

  Removed unwanted comment text

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/7905/files
  - new: https://git.openjdk.java.net/jdk/pull/7905/files/2d5c9fb8..ce0e62e9

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=7905&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=7905&range=00-01

  Stats: 17 lines in 1 file changed: 0 ins; 17 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/7905.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/7905/head:pull/7905

PR: https://git.openjdk.java.net/jdk/pull/7905



More information about the client-libs-dev mailing list