TestStylesheet.java revision 3658:7f3b6ce62ea7
1/*
2 * Copyright (c) 2005, 2016, 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      4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461 8154261 8162363
27 * @summary  Run tests on doclet stylesheet.
28 * @author   jamieh
29 * @library  ../lib
30 * @modules jdk.javadoc/jdk.javadoc.internal.tool
31 * @build    JavadocTester
32 * @run main TestStylesheet
33 */
34
35public class TestStylesheet extends JavadocTester {
36
37    public static void main(String... args) throws Exception {
38        TestStylesheet tester = new TestStylesheet();
39        tester.runTests();
40    }
41
42    @Test
43    void test() {
44        javadoc("-d", "out",
45                "-sourcepath", testSrc,
46                "pkg");
47        checkExit(Exit.OK);
48
49        // TODO: most of this test seems a bit silly, since javadoc is simply
50        // copying in the stylesheet from the source directory
51        checkOutput("stylesheet.css", true,
52                "/* Javadoc style sheet */",
53                "/*\n"
54                + "Overall document style\n"
55                + "*/",
56                "/*\n"
57                + "Heading styles\n"
58                + "*/",
59                "/*\n"
60                + "Navigation bar styles\n"
61                + "*/",
62                "body {\n"
63                + "    background-color:#ffffff;\n"
64                + "    color:#353833;\n"
65                + "    font-family:'DejaVu Sans', Arial, Helvetica, sans-serif;\n"
66                + "    font-size:14px;\n"
67                + "    margin:0;\n"
68                + "    padding:0;\n"
69                + "    height:100%;\n"
70                + "    width:100%;\n"
71                + "}",
72                "iframe {\n"
73                + "    margin:0;\n"
74                + "    padding:0;\n"
75                + "    height:100%;\n"
76                + "    width:100%;\n"
77                + "    overflow-y:scroll;\n"
78                + "    border:none;\n"
79                + "}",
80                "ul {\n"
81                + "    list-style-type:disc;\n"
82                + "}",
83                ".overviewSummary caption, .memberSummary caption, .typeSummary caption,\n"
84                + ".useSummary caption, .constantsSummary caption, .deprecatedSummary caption,\n"
85                + ".requiresSummary caption, .packagesSummary caption, .providesSummary caption, .usesSummary caption {\n"
86                + "    position:relative;\n"
87                + "    text-align:left;\n"
88                + "    background-repeat:no-repeat;\n"
89                + "    color:#253441;\n"
90                + "    font-weight:bold;\n"
91                + "    clear:none;\n"
92                + "    overflow:hidden;\n"
93                + "    padding:0px;\n"
94                + "    padding-top:10px;\n"
95                + "    padding-left:1px;\n"
96                + "    margin:0px;\n"
97                + "    white-space:pre;\n"
98                + "}",
99                ".overviewSummary caption span, .memberSummary caption span, .typeSummary caption span,\n"
100                + ".useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span,\n"
101                + ".requiresSummary caption span, .packagesSummary caption span, .providesSummary caption span,\n"
102                + ".usesSummary caption span {\n"
103                + "    white-space:nowrap;\n"
104                + "    padding-top:5px;\n"
105                + "    padding-left:12px;\n"
106                + "    padding-right:12px;\n"
107                + "    padding-bottom:7px;\n"
108                + "    display:inline-block;\n"
109                + "    float:left;\n"
110                + "    background-color:#F8981D;\n"
111                + "    border: none;\n"
112                + "    height:16px;\n"
113                + "}",
114                ".memberSummary caption span.activeTableTab span {\n"
115                + "    white-space:nowrap;\n"
116                + "    padding-top:5px;\n"
117                + "    padding-left:12px;\n"
118                + "    padding-right:12px;\n"
119                + "    margin-right:3px;\n"
120                + "    display:inline-block;\n"
121                + "    float:left;\n"
122                + "    background-color:#F8981D;\n"
123                + "    height:16px;\n"
124                + "}",
125                ".memberSummary caption span.tableTab span {\n"
126                + "    white-space:nowrap;\n"
127                + "    padding-top:5px;\n"
128                + "    padding-left:12px;\n"
129                + "    padding-right:12px;\n"
130                + "    margin-right:3px;\n"
131                + "    display:inline-block;\n"
132                + "    float:left;\n"
133                + "    background-color:#4D7A97;\n"
134                + "    height:16px;\n"
135                + "}",
136                // Test the formatting styles for proper content display in use and constant values pages.
137                ".overviewSummary td.colFirst, .overviewSummary th.colFirst,\n"
138                + ".requiresSummary td.colFirst, .requiresSummary th.colFirst,\n"
139                + ".packagesSummary td.colFirst, .packagesSummary td.colSecond, .packagesSummary th.colFirst, .packagesSummary th,\n"
140                + ".usesSummary td.colFirst, .usesSummary th.colFirst,\n"
141                + ".useSummary td.colFirst, .useSummary th.colFirst,\n"
142                + ".memberSummary td.colFirst, .memberSummary th.colFirst,\n"
143                + ".memberSummary td.colSecond, .memberSummary th.colSecond,\n"
144                + ".typeSummary td.colFirst{\n"
145                + "    width:25%;\n"
146                + "    vertical-align:top;\n"
147                + "}",
148                ".overviewSummary td, .memberSummary td, .typeSummary td,\n"
149                + ".useSummary td, .constantsSummary td, .deprecatedSummary td,\n"
150                + ".requiresSummary td, .packagesSummary td, .providesSummary td, .usesSummary td {\n"
151                + "    text-align:left;\n"
152                + "    padding:0px 0px 12px 10px;\n"
153                + "}",
154                ".memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab {\n"
155                + "    padding-top:0px;\n"
156                + "    padding-left:0px;\n"
157                + "    padding-right:0px;\n"
158                + "    background-image:none;\n"
159                + "    float:none;\n"
160                + "    display:inline;\n"
161                + "}",
162                "@import url('resources/fonts/dejavu.css');");
163
164        // Test whether a link to the stylesheet file is inserted properly
165        // in the class documentation.
166        checkOutput("pkg/A.html", true,
167                "<link rel=\"stylesheet\" type=\"text/css\" "
168                + "href=\"../stylesheet.css\" title=\"Style\">");
169
170        checkOutput("index.html", true,
171                "<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" title=\"Style\">");
172
173        checkOutput("stylesheet.css", false,
174                "* {\n"
175                + "    margin:0;\n"
176                + "    padding:0;\n"
177                + "}");
178    }
179}
180