Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jdk17u
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
einsteinathome
openjdk
jdk17u
Commits
a2363898
Commit
a2363898
authored
7 months ago
by
Goetz Lindenmaier
Browse files
Options
Downloads
Patches
Plain Diff
8328402: Implement pausing functionality for the PassFailJFrame
Backport-of: 581b1e29aebd425bade14d2ee46704a16187df5b
parent
24e2c8a9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/jdk/java/awt/regtesthelpers/PassFailJFrame.java
+45
-12
45 additions, 12 deletions
test/jdk/java/awt/regtesthelpers/PassFailJFrame.java
with
45 additions
and
12 deletions
test/jdk/java/awt/regtesthelpers/PassFailJFrame.java
+
45
−
12
View file @
a2363898
...
...
@@ -24,6 +24,7 @@
import
java.awt.AWTException
;
import
java.awt.BorderLayout
;
import
java.awt.Dimension
;
import
java.awt.Font
;
import
java.awt.GraphicsConfiguration
;
import
java.awt.GraphicsDevice
;
import
java.awt.GraphicsEnvironment
;
...
...
@@ -186,7 +187,7 @@ public final class PassFailJFrame {
private
static
final
CountDownLatch
latch
=
new
CountDownLatch
(
1
);
private
static
TimeoutHandler
timeoutHandler
;
private
static
TimeoutHandler
Panel
timeoutHandler
Panel
;
/**
* The description of why the test fails.
...
...
@@ -423,10 +424,8 @@ public final class PassFailJFrame {
int
rows
,
int
columns
,
boolean
enableScreenCapture
)
{
JPanel
main
=
new
JPanel
(
new
BorderLayout
());
JLabel
testTimeoutLabel
=
new
JLabel
(
""
,
JLabel
.
CENTER
);
timeoutHandler
=
new
TimeoutHandler
(
testTimeoutLabel
,
testTimeOut
);
main
.
add
(
testTimeoutLabel
,
BorderLayout
.
NORTH
);
timeoutHandlerPanel
=
new
TimeoutHandlerPanel
(
testTimeOut
);
main
.
add
(
timeoutHandlerPanel
,
BorderLayout
.
NORTH
);
JTextComponent
text
=
instructions
.
startsWith
(
"<html>"
)
?
configureHTML
(
instructions
,
rows
,
columns
)
...
...
@@ -438,13 +437,13 @@ public final class PassFailJFrame {
JButton
btnPass
=
new
JButton
(
"Pass"
);
btnPass
.
addActionListener
((
e
)
->
{
latch
.
countDown
();
timeoutHandler
.
stop
();
timeoutHandler
Panel
.
stop
();
});
JButton
btnFail
=
new
JButton
(
"Fail"
);
btnFail
.
addActionListener
((
e
)
->
{
requestFailureReason
();
timeoutHandler
.
stop
();
timeoutHandler
Panel
.
stop
();
});
JPanel
buttonsPanel
=
new
JPanel
();
...
...
@@ -602,17 +601,35 @@ public final class PassFailJFrame {
}
private
static
final
class
TimeoutHandler
implements
ActionListener
{
private
final
long
endTime
;
private
static
final
class
TimeoutHandlerPanel
extends
JPanel
implements
ActionListener
{
private
static
final
String
PAUSE_BUTTON_LABEL
=
"Pause"
;
private
static
final
String
RESUME_BUTTON_LABEL
=
"Resume"
;
private
long
endTime
;
private
long
pauseTimeLeft
;
private
final
Timer
timer
;
private
final
JLabel
label
;
private
final
JButton
button
;
public
TimeoutHandler
(
final
JLabel
label
,
final
long
testTimeOut
)
{
endTime
=
System
.
currentTimeMillis
()
+
TimeUnit
.
MINUTES
.
toMillis
(
testTimeOut
);
public
TimeoutHandlerPanel
(
final
long
testTimeOut
)
{
endTime
=
System
.
currentTimeMillis
()
+
TimeUnit
.
MINUTES
.
toMillis
(
testTimeOut
);
this
.
label
=
label
;
label
=
new
JLabel
(
""
,
JLabel
.
CENTER
);
button
=
new
JButton
(
PAUSE_BUTTON_LABEL
);
button
.
setFocusPainted
(
false
);
button
.
setFont
(
new
Font
(
Font
.
DIALOG
,
Font
.
BOLD
,
10
));
button
.
addActionListener
(
e
->
pauseToggle
());
setLayout
(
new
BorderLayout
());
add
(
label
,
BorderLayout
.
CENTER
);
add
(
button
,
BorderLayout
.
EAST
);
timer
=
new
Timer
(
1000
,
this
);
timer
.
start
();
...
...
@@ -643,6 +660,22 @@ public final class PassFailJFrame {
hours
,
minutes
,
seconds
));
}
private
void
pauseToggle
()
{
if
(
timer
.
isRunning
())
{
pauseTimeLeft
=
endTime
-
System
.
currentTimeMillis
();
timer
.
stop
();
label
.
setEnabled
(
false
);
button
.
setText
(
RESUME_BUTTON_LABEL
);
}
else
{
endTime
=
System
.
currentTimeMillis
()
+
pauseTimeLeft
;
updateTime
(
pauseTimeLeft
);
timer
.
start
();
label
.
setEnabled
(
true
);
button
.
setText
(
PAUSE_BUTTON_LABEL
);
}
}
public
void
stop
()
{
timer
.
stop
();
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment