RFR: 8283623: Create an automated regression test for JDK-4525475

Manukumar V S mvs at openjdk.java.net
Wed Mar 30 10:32:40 UTC 2022


On Tue, 29 Mar 2022 22:08:01 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> Write a regression test for [JDK-4525475](https://bugs.openjdk.java.net/browse/JDK-4525475)
>> 
>> Issue:
>> JFileChooser allows modification to the file-system by way of the "New Folder"
>> button, and the ability to rename file/folder names. There is no method on
>> JFileChooser which indicates that this type of modification should not be
>> allowed within the given JFileChooser.
>> 
>> Testing:
>> 1. Tested using Mach5(20 times per platform) in macos,linux and windows and got all pass.
>> 2. Tested in original failed Java version and the fixed version;
>> Java 1.4.0 -> Test Failed.
>> $ j2sdk1.4.0/bin/java Bug4525475
>> LookAndFeel: com.sun.java.swing.plaf.windows.WindowsLookAndFeel
>> Name = Go Up, readOnly = true
>> Name = New Folder, readOnly = true
>> Its a Read Only JFileChooser and has a New Folder Button. So Test Failed.
>> Name = Go Up, readOnly = false
>> Name = New Folder, readOnly = false
>> Failed
>> 
>> Java 1.5.0 -> Test Passed.
>> $ jdk1.5.0/bin/java Bug4525475
>> LookAndFeel: com.sun.java.swing.plaf.windows.WindowsLookAndFeel
>> Name = Go Up, readOnly = true
>> Name = Go Up, readOnly = false
>> Name = New Folder, readOnly = false
>> Passed
>
> test/jdk/javax/swing/JFileChooser/4525475/JFileChooserReadOnlyTest.java line 73:
> 
>> 71: 
>> 72:             // Test2, Read/Write JFileChooser
>> 73:             if (!(laf.contains("Motif") || laf.contains("Aqua"))) {
> 
> Can we update the test to find the correct buttons for these L&Fs as well?

For Motif L&F, the 'New Folder' button is not shown anywhere irrespective of what we set in UI defaults, for any platform. But Aqua L&F behaves similar to the native FileChooser, like for 'Open' dialog it will not show 'New Folder' button, but it will show 'New Folder' button for 'Save' dialog.

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

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



More information about the client-libs-dev mailing list