|
| 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 | +} |
1 commit comments
openjdk-notifier[bot] commentedon Mar 22, 2024
Review
Issues