Skip to content

Commit

Permalink
8316003: Update FileChooserSymLinkTest.java to HTML instructions
Browse files Browse the repository at this point in the history
Reviewed-by: prr
  • Loading branch information
aivanov-jdk committed Oct 25, 2023
1 parent 42b9ac8 commit c587211
Showing 1 changed file with 43 additions and 30 deletions.
73 changes: 43 additions & 30 deletions test/jdk/javax/swing/JFileChooser/FileChooserSymLinkTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -74,48 +74,61 @@ public void run() {
static void initialize() throws InterruptedException, InvocationTargetException {
//Initialize the components
final String INSTRUCTIONS = """
<html><body>
Instructions to Test:
1. Open an elevated Command Prompt.
2. Paste the following commands:
cd /d C:\\
<ol>
<li>Open an elevated <i>Command Prompt</i>.
<li>Paste the following commands:
<pre><code>cd /d C:\\
mkdir FileChooserTest
cd FileChooserTest
mkdir target
mklink /d link target
mklink /d link target</code></pre>
3. Navigate to C:\\FileChooserTest in the JFileChooser.
4. Use "Enable Multi-Selection" checkbox to enable/disable
MultiSelection Mode
5. Single-selection:
Click "link" directory, the absolute path of the symbolic
link should be displayed. If it's null, click FAIL.
Click "target" directory, its absolute path should be
displayed.
Enable multiple selection by clicking the checkbox.
Multi-selection:
Click "link", press Ctrl and then click "target".
Both should be selected and their absolute paths should be
displayed.
If "link" can't be selected or if its absolute path is null,
click FAIL.
If "link" can be selected in both single- and multi-selection modes,
click PASS.
6. When done with testing, paste the following commands to
remove the 'FileChooserTest' directory:
cd \\
rmdir /s /q C:\\FileChooserTest
<li>Navigate to <code>C:\\FileChooserTest</code> in
the <code>JFileChooser</code>.
<li>Perform testing in single- and multi-selection modes:
<ul style="margin-bottom: 0px">
<li><strong>Single-selection:</strong>
<ol>
<li>Ensure <b>Enable multi-selection</b> is cleared
(the default state).
<li>Click <code>link</code> directory,
the absolute path of the symbolic
link should be displayed.<br>
If it's <code>null</code>, click <b>Fail</b>.
<li>Click <code>target</code> directory,
its absolute path should be displayed.
</ol>
<li><strong>Multi-selection:</strong>
<ol>
<li>Select <b>Enable multi-selection</b>.
<li>Click <code>link</code>,
<li>Press <kbd>Ctrl</kbd> and
then click <code>target</code>.
<li>Both should be selected and
their absolute paths should be displayed.
<li>If <code>link</code> can't be selected or
if its absolute path is <code>null</code>,
click <b>Fail</b>.
</ol>
</ul>
<p>If <code>link</code> can be selected in both
single- and multi-selection modes, click <b>Pass</b>.</p>
<li>When done with testing, paste the following commands to
remove the <code>FileChooserTest</code> directory:
<pre><code>cd \\
rmdir /s /q C:\\FileChooserTest</code></pre>
or use File Explorer to clean it up.
</ol>
""";
frame = new JFrame("JFileChooser Symbolic Link test");
panel = new JPanel(new BorderLayout());
multiSelection = new JCheckBox("Enable Multi-Selection");
pathList = new JTextArea(10, 50);
jfc = new JFileChooser(new File("C:\\"));
passFailJFrame = new PassFailJFrame("Test Instructions", INSTRUCTIONS, 5L, 35, 40);
passFailJFrame = new PassFailJFrame("Test Instructions", INSTRUCTIONS, 5L, 35, 50);

PassFailJFrame.addTestWindow(frame);
PassFailJFrame.positionTestWindow(frame, PassFailJFrame.Position.HORIZONTAL);
Expand Down

1 comment on commit c587211

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.