Skip to content

Commit e120d5f

Browse files
committed
8328030: Convert javax/swing/text/GlyphView/4984669/bug4984669.java applet test to main
Backport-of: 7502dc99bf23109ef16fb99de25b09bab51e4978
1 parent eedad33 commit e120d5f

File tree

2 files changed

+38
-43
lines changed

2 files changed

+38
-43
lines changed

test/jdk/javax/swing/text/GlyphView/4984669/bug4984669.html

Lines changed: 0 additions & 30 deletions
This file was deleted.

test/jdk/javax/swing/text/GlyphView/4984669/bug4984669.java renamed to test/jdk/javax/swing/text/GlyphView/htmlUnderliningTest.java

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -21,24 +21,48 @@
2121
* questions.
2222
*/
2323

24+
import javax.swing.JEditorPane;
25+
import javax.swing.JPanel;
26+
import javax.swing.JScrollPane;
27+
import javax.swing.text.MutableAttributeSet;
28+
import javax.swing.text.SimpleAttributeSet;
29+
import javax.swing.text.StyleConstants;
30+
import javax.swing.text.StyledEditorKit;
31+
2432
/* @test
25-
@bug 4984669 8002148
26-
@summary Tests HTML underlining
27-
@author Peter Zhelezniakov
28-
@run applet/manual=yesno bug4984669.html
29-
*/
30-
import javax.swing.*;
31-
import javax.swing.text.*;
33+
* @bug 4984669 8002148
34+
* @summary Tests HTML underlining
35+
* @library /java/awt/regtesthelpers
36+
* @build PassFailJFrame
37+
* @run main/manual htmlUnderliningTest
38+
*/
39+
40+
public class htmlUnderliningTest {
41+
public static void main(String[] args) throws Exception {
42+
String testInstructions = """
43+
The four lines printed in a bold typeface should all be underlined.
44+
It is a bug if any of these lines is underlined only partially.
45+
The very first line should not be underlined at all.
46+
""";
47+
48+
PassFailJFrame.builder()
49+
.title("Test Instructions")
50+
.instructions(testInstructions)
51+
.rows(4)
52+
.columns(35)
53+
.splitUI(htmlUnderliningTest::initializeTest)
54+
.build()
55+
.awaitAndCheck();
56+
}
3257

33-
public class bug4984669 extends JApplet
34-
{
35-
public void init() {
58+
public static JPanel initializeTest() {
59+
JPanel panel = new JPanel();
3660
JEditorPane pane = new JEditorPane();
37-
this.getContentPane().add(new JScrollPane(pane));
61+
panel.add(new JScrollPane(pane));
3862
pane.setEditorKit(new StyledEditorKit());
3963

4064
try {
41-
pane.getDocument().insertString(0,"12 \n",null);
65+
pane.getDocument().insertString(0, "12 \n", null);
4266
MutableAttributeSet attrs = new SimpleAttributeSet();
4367

4468
StyleConstants.setFontSize(attrs, 36);
@@ -51,5 +75,6 @@ public void init() {
5175
} catch (Exception e) {
5276
throw new Error("Failed: Unexpected Exception", e);
5377
}
78+
return panel;
5479
}
5580
}

0 commit comments

Comments
 (0)