8340466: Add description for PassFailJFrame constructors
Reviewed-by: prr, honkar
This commit is contained in:
parent
e2626db2f0
commit
3762ec3978
@ -213,90 +213,172 @@ public final class PassFailJFrame {
|
|||||||
|
|
||||||
public enum Position {HORIZONTAL, VERTICAL, TOP_LEFT_CORNER}
|
public enum Position {HORIZONTAL, VERTICAL, TOP_LEFT_CORNER}
|
||||||
|
|
||||||
public PassFailJFrame(String instructions) throws InterruptedException,
|
/**
|
||||||
InvocationTargetException {
|
* Constructs a frame which displays test instructions and
|
||||||
|
* the <i>Pass</i> / <i>Fail</i> buttons with the given instructions, and
|
||||||
|
* the default timeout of {@value #TEST_TIMEOUT} minutes,
|
||||||
|
* the default title of {@value #TITLE} and
|
||||||
|
* the default values of {@value #ROWS} and {@value #COLUMNS}
|
||||||
|
* for rows and columns.
|
||||||
|
* <p>
|
||||||
|
* See {@link #PassFailJFrame(String,String,long,int,int,boolean)} for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* @param instructions the instructions for the tester
|
||||||
|
*
|
||||||
|
* @throws InterruptedException if the current thread is interrupted
|
||||||
|
* while waiting for EDT to finish creating UI components
|
||||||
|
* @throws InvocationTargetException if an exception is thrown while
|
||||||
|
* creating UI components on EDT
|
||||||
|
*/
|
||||||
|
public PassFailJFrame(String instructions)
|
||||||
|
throws InterruptedException, InvocationTargetException {
|
||||||
this(instructions, TEST_TIMEOUT);
|
this(instructions, TEST_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PassFailJFrame(String instructions, long testTimeOut) throws
|
/**
|
||||||
InterruptedException, InvocationTargetException {
|
* Constructs a frame which displays test instructions and
|
||||||
|
* the <i>Pass</i> / <i>Fail</i> buttons
|
||||||
|
* with the given instructions and timeout as well as
|
||||||
|
* the default title of {@value #TITLE}
|
||||||
|
* and the default values of {@value #ROWS} and {@value #COLUMNS}
|
||||||
|
* for rows and columns.
|
||||||
|
* <p>
|
||||||
|
* See {@link #PassFailJFrame(String,String,long,int,int,boolean)} for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* @param instructions the instructions for the tester
|
||||||
|
* @param testTimeOut the test timeout in minutes
|
||||||
|
*
|
||||||
|
* @throws InterruptedException if the current thread is interrupted
|
||||||
|
* while waiting for EDT to finish creating UI components
|
||||||
|
* @throws InvocationTargetException if an exception is thrown while
|
||||||
|
* creating UI components on EDT
|
||||||
|
*/
|
||||||
|
public PassFailJFrame(String instructions, long testTimeOut)
|
||||||
|
throws InterruptedException, InvocationTargetException {
|
||||||
this(TITLE, instructions, testTimeOut);
|
this(TITLE, instructions, testTimeOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a frame which displays test instructions and
|
||||||
|
* the <i>Pass</i> / <i>Fail</i> buttons
|
||||||
|
* with the given title, instructions and timeout as well as
|
||||||
|
* the default values of {@value #ROWS} and {@value #COLUMNS}
|
||||||
|
* for rows and columns.
|
||||||
|
* The screenshot feature is not enabled, if you use this constructor.
|
||||||
|
* <p>
|
||||||
|
* See {@link #PassFailJFrame(String,String,long,int,int,boolean)} for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* @param title the title of the instruction frame
|
||||||
|
* @param instructions the instructions for the tester
|
||||||
|
* @param testTimeOut the test timeout in minutes
|
||||||
|
*
|
||||||
|
* @throws InterruptedException if the current thread is interrupted
|
||||||
|
* while waiting for EDT to finish creating UI components
|
||||||
|
* @throws InvocationTargetException if an exception is thrown while
|
||||||
|
* creating UI components on EDT
|
||||||
|
*/
|
||||||
public PassFailJFrame(String title, String instructions,
|
public PassFailJFrame(String title, String instructions,
|
||||||
long testTimeOut) throws InterruptedException,
|
long testTimeOut)
|
||||||
InvocationTargetException {
|
throws InterruptedException, InvocationTargetException {
|
||||||
this(title, instructions, testTimeOut, ROWS, COLUMNS);
|
this(title, instructions, testTimeOut, ROWS, COLUMNS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a JFrame with a given title & serves as test instructional
|
* Constructs a frame which displays test instructions and
|
||||||
* frame where the user follows the specified test instruction in order
|
* the <i>Pass</i> / <i>Fail</i> buttons
|
||||||
* to test the test case & mark the test pass or fail. If the expected
|
* with the given title, instructions, timeout, number of rows and columns.
|
||||||
* result is seen then the user click on the 'Pass' button else click
|
* The screenshot feature is not enabled, if you use this constructor.
|
||||||
* on the 'Fail' button and the reason for the failure should be
|
* <p>
|
||||||
* specified in the JDialog JTextArea.
|
* See {@link #PassFailJFrame(String,String,long,int,int,boolean)} for
|
||||||
|
* more details.
|
||||||
*
|
*
|
||||||
* @param title title of the Frame.
|
* @param title the title of the instruction frame
|
||||||
* @param instructions the instruction for the tester on how to test
|
* @param instructions the instructions for the tester
|
||||||
* and what is expected (pass) and what is not
|
* @param testTimeOut the test timeout in minutes
|
||||||
* expected (fail).
|
* @param rows the number of rows for the text component
|
||||||
* @param testTimeOut test timeout where time is specified in minutes.
|
* which displays test instructions
|
||||||
* @param rows number of visible rows of the JTextArea where the
|
* @param columns the number of columns for the text component
|
||||||
* instruction is show.
|
* which displays test instructions
|
||||||
* @param columns Number of columns of the instructional
|
*
|
||||||
* JTextArea
|
* @throws InterruptedException if the current thread is interrupted
|
||||||
* @throws InterruptedException exception thrown when thread is
|
* while waiting for EDT to finish creating UI components
|
||||||
* interrupted
|
|
||||||
* @throws InvocationTargetException if an exception is thrown while
|
* @throws InvocationTargetException if an exception is thrown while
|
||||||
* creating the test instruction frame on
|
* creating UI components on EDT
|
||||||
* EDT
|
|
||||||
*/
|
*/
|
||||||
public PassFailJFrame(String title, String instructions, long testTimeOut,
|
public PassFailJFrame(String title, String instructions,
|
||||||
int rows, int columns) throws InterruptedException,
|
long testTimeOut,
|
||||||
InvocationTargetException {
|
int rows, int columns)
|
||||||
|
throws InterruptedException, InvocationTargetException {
|
||||||
this(title, instructions, testTimeOut, rows, columns, false);
|
this(title, instructions, testTimeOut, rows, columns, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a JFrame with a given title & serves as test instructional
|
* Constructs a frame which displays test instructions and
|
||||||
* frame where the user follows the specified test instruction in order
|
* the <i>Pass</i> / <i>Fail</i> buttons
|
||||||
* to test the test case & mark the test pass or fail. If the expected
|
* as well as supporting UI components with the given title, instructions,
|
||||||
* result is seen then the user click on the 'Pass' button else click
|
* timeout, number of rows and columns,
|
||||||
* on the 'Fail' button and the reason for the failure should be
|
* and screen capture functionality.
|
||||||
* specified in the JDialog JTextArea.
|
* All the UI components are created on the EDT, so it is safe to call
|
||||||
|
* the constructor on the main thread.
|
||||||
* <p>
|
* <p>
|
||||||
* The test instruction frame also provides a way for the tester to take
|
* After you create a test UI window, register the window using
|
||||||
* a screenshot (full screen or individual frame) if this feature
|
* {@link #addTestWindow(Window) addTestWindow} for disposal, and
|
||||||
* is enabled by passing {@code true} as {@code enableScreenCapture}
|
* position it close to the instruction frame using
|
||||||
* parameter.
|
* {@link #positionTestWindow(Window, Position) positionTestWindow}.
|
||||||
|
* As the last step, make your test UI window visible.
|
||||||
|
* <p>
|
||||||
|
* Call the {@link #awaitAndCheck() awaitAndCheck} method on the instance
|
||||||
|
* of {@code PassFailJFrame} when you set up the testing environment.
|
||||||
|
* <p>
|
||||||
|
* If the tester clicks the <i>Fail</i> button, a dialog prompting for
|
||||||
|
* a description of the problem is displayed, and then an exception
|
||||||
|
* is thrown which fails the test.
|
||||||
|
* If the tester clicks the <i>Pass</i> button, the test completes
|
||||||
|
* successfully.
|
||||||
|
* If the timeout occurs or the instruction frame is closed,
|
||||||
|
* the test fails.
|
||||||
|
* <p>
|
||||||
|
* The {@code rows} and {@code columns} parameters control
|
||||||
|
* the size of a text component which displays the instructions.
|
||||||
|
* The preferred size of the instructions is calculated by
|
||||||
|
* creating {@code new JTextArea(rows, columns)}.
|
||||||
|
* <p>
|
||||||
|
* If you enable screenshots by setting the {@code screenCapture}
|
||||||
|
* parameter to {@code true}, a <i>Screenshot</i> button is added.
|
||||||
|
* Clicking the <i>Screenshot</i> button takes screenshots of
|
||||||
|
* all the monitors or all the windows registered with
|
||||||
|
* {@code PassFailJFrame}.
|
||||||
*
|
*
|
||||||
* @param title title of the Frame.
|
* @param title the title of the instruction frame
|
||||||
* @param instructions the instruction for the tester on how to test
|
* @param instructions the instructions for the tester
|
||||||
* and what is expected (pass) and what is not
|
* @param testTimeOut the test timeout in minutes
|
||||||
* expected (fail).
|
* @param rows the number of rows for the text component
|
||||||
* @param testTimeOut test timeout where time is specified in minutes.
|
* which displays test instructions
|
||||||
* @param rows number of visible rows of the JTextArea where the
|
* @param columns the number of columns for the text component
|
||||||
* instruction is show.
|
* which displays test instructions
|
||||||
* @param columns Number of columns of the instructional
|
* @param screenCapture if set to {@code true}, enables screen capture
|
||||||
* JTextArea
|
* functionality
|
||||||
* @param enableScreenCapture if set to true, 'Capture Screen' button & its
|
*
|
||||||
* associated UIs are added to test instruction
|
* @throws InterruptedException if the current thread is interrupted
|
||||||
* frame
|
* while waiting for EDT to finish creating UI components
|
||||||
* @throws InterruptedException exception thrown when thread is
|
|
||||||
* interrupted
|
|
||||||
* @throws InvocationTargetException if an exception is thrown while
|
* @throws InvocationTargetException if an exception is thrown while
|
||||||
* creating the test instruction frame on
|
* creating UI components on EDT
|
||||||
* EDT
|
*
|
||||||
|
* @see JTextArea#JTextArea(int,int) JTextArea(int rows, int columns)
|
||||||
|
* @see Builder Builder
|
||||||
*/
|
*/
|
||||||
public PassFailJFrame(String title, String instructions, long testTimeOut,
|
public PassFailJFrame(String title, String instructions,
|
||||||
|
long testTimeOut,
|
||||||
int rows, int columns,
|
int rows, int columns,
|
||||||
boolean enableScreenCapture)
|
boolean screenCapture)
|
||||||
throws InterruptedException, InvocationTargetException {
|
throws InterruptedException, InvocationTargetException {
|
||||||
invokeOnEDT(() -> createUI(title, instructions,
|
invokeOnEDT(() -> createUI(title, instructions,
|
||||||
testTimeOut,
|
testTimeOut,
|
||||||
rows, columns,
|
rows, columns,
|
||||||
enableScreenCapture));
|
screenCapture));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user