On Thu, 20 Oct 2022 19:50:38 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:

> This automates the test added in #9327.
> 
> The test has a set of objects which store the size of the file and the 
> expected displayed size, the file name is generated automatically. The 
> pattern for the file names ensures the files are displayed in the expected 
> order up to and including gigabytes, 10 digits. I added more test cases that 
> the original test had to verify the displayed size is rounded up, an 
> automatic test can easily verify more rows than a human can.
> 
> The finds the **Details** button in the file chooser and clicks it, then it 
> finds the table, finds the row where the first file is displayed. The test 
> compares the size displayed in the table to the expected one. If it doesn't 
> match, an error is printed to `stderr`. All the file sizes are verified. The 
> first error message, if any, is thrown to fail the test.
> 
> The test passes with the fix for 
> [JDK-8288882](https://bugs.openjdk.org/browse/JDK-8288882) and fails without 
> it.

test/jdk/javax/swing/JFileChooser/FileSizeCheck.java line 51:

> 49:  * @bug 8288882
> 50:  * @key headful
> 51:  * @requires (os.family == "linux")

Why the linux platform only? I think it should be able to work on all platform 
if Metal is used?

test/jdk/javax/swing/JFileChooser/FileSizeCheck.java line 58:

> 56: public class FileSizeCheck {
> 57:     private enum FileSize {
> 58:         F0(    0, "0.0 KB"),

The text probably depends from the Locale? Do we need to set it explicitly?

test/jdk/javax/swing/JFileChooser/FileSizeCheck.java line 128:

> 126:     private static void createUI() {
> 127:         // Create temp files
> 128:         Path dir = Paths.get(".");

It is better to create a testFolder, and then open the chooser in it, otherwise 
other files in the current folder may break it(if the test executed standalone)

test/jdk/javax/swing/JFileChooser/FileSizeCheck.java line 158:

> 156:             robot.waitForIdle();
> 157:             robot.delay(500);
> 158:             SwingUtilities.invokeAndWait(FileSizeCheck::clickDetails);

Can we click that button programmatically w/o robot? That will make the test a 
little bit more stable.

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

PR: https://git.openjdk.org/jdk/pull/10802

Reply via email to