Skip to content

Commit cd534f8

Browse files
committedMar 22, 2024
8328673: Convert closed text/html/CSS manual applet test to main
Reviewed-by: abhiscxk, aivanov
1 parent 38e3cda commit cd534f8

File tree

2 files changed

+161
-0
lines changed

2 files changed

+161
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/*
2+
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
/*
25+
* @test
26+
* @bug 4270889 4271058 4285098
27+
* @summary Tests that <table border>, <table align> and <td width> tags work
28+
* @library /java/awt/regtesthelpers
29+
* @build PassFailJFrame
30+
* @run main/manual bug4271058
31+
*/
32+
33+
import javax.swing.JEditorPane;
34+
import javax.swing.JFrame;
35+
36+
public class bug4271058 {
37+
38+
private static String INSTRUCTIONS = """
39+
What should be seen is three 2x2 tables.
40+
41+
The first table should have borders and lines distinguishing
42+
table cells. If they are not shown, test fails (bug 4271058).
43+
44+
In the second table, the first (left) column should be about
45+
four times as wide as the second (right) column.
46+
If this is not so, test fails (bug 4270889).
47+
48+
The third table should be right aligned, i.e. its right edge
49+
should be close to the right edge of the viewable area.
50+
Otherwise test fails (bug 4285098).
51+
""";
52+
53+
public static void main(String[] args) throws Exception {
54+
PassFailJFrame.builder()
55+
.title("CSS html tag verification Instructions")
56+
.instructions(INSTRUCTIONS)
57+
.rows(15)
58+
.columns(30)
59+
.testUI(bug4271058::createTestUI)
60+
.screenCapture()
61+
.build()
62+
.awaitAndCheck();
63+
}
64+
65+
private static JFrame createTestUI() {
66+
String htmlText =
67+
"<html><table border width=300 height=200>" +
68+
"<tr><th>col A</th><th>col B</th></tr>" +
69+
"<tr>" +
70+
"<td>aaaaaa</td>" +
71+
"<td>bbbbbbb</td>" +
72+
"</tr></table>" +
73+
"<table border width=300>" +
74+
"<tr><th>A</th><th>B</th></tr>" +
75+
"<tr>" +
76+
"<td width=\"80%\">a</td>" +
77+
"<td width=\"20%\">b</td>" +
78+
"</tr></table>" +
79+
"<table align=right border width=200>" +
80+
"<tr><th>col A</th><th>col B</th></tr>" +
81+
"<tr>" +
82+
"<td>aaaaaa</td>" +
83+
"<td>bbbbbbb</td>" +
84+
"</tr></table></html>";
85+
86+
JEditorPane lbl = new JEditorPane("text/html", htmlText);
87+
JFrame frame = new JFrame("bug4271058");
88+
frame.add(lbl);
89+
frame.pack();
90+
return frame;
91+
}
92+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
/*
25+
* @test
26+
* @bug 4286458
27+
* @summary Tests if cellpadding in tables is non-negative number
28+
* @library /java/awt/regtesthelpers
29+
* @build PassFailJFrame
30+
* @run main/manual bug4286458
31+
*/
32+
33+
import javax.swing.JEditorPane;
34+
import javax.swing.JFrame;
35+
import javax.swing.text.html.HTMLEditorKit;
36+
37+
public class bug4286458 {
38+
39+
private static String INSTRUCTIONS = """
40+
If you can clearly read the line of text in the appeared frame
41+
press PASS. Otherwise test fails.""";
42+
43+
public static void main(String[] args) throws Exception {
44+
PassFailJFrame.builder()
45+
.title("CSS tag Instructions")
46+
.instructions(INSTRUCTIONS)
47+
.rows(5)
48+
.columns(30)
49+
.testUI(bug4286458::createTestUI)
50+
.build()
51+
.awaitAndCheck();
52+
}
53+
54+
private static JFrame createTestUI() {
55+
56+
String text =
57+
"<html><body><table border=\"1\" cellpadding=\"-10\">" +
58+
"<tr><td>This line should be clearly readable</td></tr>" +
59+
"</table></body></html>";
60+
61+
JFrame f = new JFrame("bug4286458");
62+
JEditorPane jep = new JEditorPane("text/html", text);
63+
jep.setEditable(false);
64+
65+
f.add(jep);
66+
f.pack();
67+
return f;
68+
}
69+
}

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on Mar 22, 2024

@openjdk-notifier[bot]
Please sign in to comment.