1/* 2 * Copyright (c) 2005, 2017, 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 8160196 8151743 8177417 27 * 8175218 8176452 28 * @summary Run tests on doclet stylesheet. 29 * @author jamieh 30 * @library ../lib 31 * @modules jdk.javadoc/jdk.javadoc.internal.tool 32 * @build JavadocTester 33 * @run main TestStylesheet 34 */ 35 36public class TestStylesheet extends JavadocTester { 37 38 public static void main(String... args) throws Exception { 39 TestStylesheet tester = new TestStylesheet(); 40 tester.runTests(); 41 } 42 43 @Test 44 void test() { 45 javadoc("-d", "out", 46 "-sourcepath", testSrc, 47 "pkg"); 48 checkExit(Exit.OK); 49 50 // TODO: most of this test seems a bit silly, since javadoc is simply 51 // copying in the stylesheet from the source directory 52 checkOutput("stylesheet.css", true, 53 "/* Javadoc style sheet */", 54 "/*\n" 55 + "Overall document style\n" 56 + "*/", 57 "/*\n" 58 + "Heading styles\n" 59 + "*/", 60 "/*\n" 61 + "Navigation bar styles\n" 62 + "*/", 63 "body {\n" 64 + " background-color:#ffffff;\n" 65 + " color:#353833;\n" 66 + " font-family:'DejaVu Sans', Arial, Helvetica, sans-serif;\n" 67 + " font-size:14px;\n" 68 + " margin:0;\n" 69 + " padding:0;\n" 70 + " height:100%;\n" 71 + " width:100%;\n" 72 + "}", 73 "iframe {\n" 74 + " margin:0;\n" 75 + " padding:0;\n" 76 + " height:100%;\n" 77 + " width:100%;\n" 78 + " overflow-y:scroll;\n" 79 + " border:none;\n" 80 + "}", 81 "ul {\n" 82 + " list-style-type:disc;\n" 83 + "}", 84 ".overviewSummary caption, .memberSummary caption, .typeSummary caption,\n" 85 + ".useSummary caption, .constantsSummary caption, .deprecatedSummary caption,\n" 86 + ".requiresSummary caption, .packagesSummary caption, .providesSummary caption, .usesSummary caption {\n" 87 + " position:relative;\n" 88 + " text-align:left;\n" 89 + " background-repeat:no-repeat;\n" 90 + " color:#253441;\n" 91 + " font-weight:bold;\n" 92 + " clear:none;\n" 93 + " overflow:hidden;\n" 94 + " padding:0px;\n" 95 + " padding-top:10px;\n" 96 + " padding-left:1px;\n" 97 + " margin:0px;\n" 98 + " white-space:pre;\n" 99 + "}", 100 ".overviewSummary caption span, .memberSummary caption span, .typeSummary caption span,\n" 101 + ".useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span,\n" 102 + ".requiresSummary caption span, .packagesSummary caption span, .providesSummary caption span,\n" 103 + ".usesSummary caption span {\n" 104 + " white-space:nowrap;\n" 105 + " padding-top:5px;\n" 106 + " padding-left:12px;\n" 107 + " padding-right:12px;\n" 108 + " padding-bottom:7px;\n" 109 + " display:inline-block;\n" 110 + " float:left;\n" 111 + " background-color:#F8981D;\n" 112 + " border: none;\n" 113 + " height:16px;\n" 114 + "}", 115 ".memberSummary caption span.activeTableTab span, .packagesSummary caption span.activeTableTab span {\n" 116 + " white-space:nowrap;\n" 117 + " padding-top:5px;\n" 118 + " padding-left:12px;\n" 119 + " padding-right:12px;\n" 120 + " margin-right:3px;\n" 121 + " display:inline-block;\n" 122 + " float:left;\n" 123 + " background-color:#F8981D;\n" 124 + " height:16px;\n" 125 + "}", 126 ".memberSummary caption span.tableTab span, .packagesSummary caption span.tableTab span {\n" 127 + " white-space:nowrap;\n" 128 + " padding-top:5px;\n" 129 + " padding-left:12px;\n" 130 + " padding-right:12px;\n" 131 + " margin-right:3px;\n" 132 + " display:inline-block;\n" 133 + " float:left;\n" 134 + " background-color:#4D7A97;\n" 135 + " height:16px;\n" 136 + "}", 137 // Test the formatting styles for proper content display in use and constant values pages. 138 ".overviewSummary td.colFirst, .overviewSummary th.colFirst,\n" 139 + ".requiresSummary td.colFirst, .requiresSummary th.colFirst,\n" 140 + ".packagesSummary td.colFirst, .packagesSummary td.colSecond, .packagesSummary th.colFirst, .packagesSummary th,\n" 141 + ".usesSummary td.colFirst, .usesSummary th.colFirst,\n" 142 + ".providesSummary td.colFirst, .providesSummary th.colFirst,\n" 143 + ".memberSummary td.colFirst, .memberSummary th.colFirst,\n" 144 + ".memberSummary td.colSecond, .memberSummary th.colSecond, .memberSummary th.colConstructorName,\n" 145 + ".typeSummary td.colFirst {\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 + ".packagesSummary caption span.tableTab, .packagesSummary caption span.activeTableTab {\n" 156 + " padding-top:0px;\n" 157 + " padding-left:0px;\n" 158 + " padding-right:0px;\n" 159 + " background-image:none;\n" 160 + " float:none;\n" 161 + " display:inline;\n" 162 + "}", 163 "@import url('resources/fonts/dejavu.css');", 164 ".navPadding {\n" 165 + " padding-top: 107px;\n" 166 + "}", 167 "a[name]:before, a[name]:target, a[id]:before, a[id]:target {\n" 168 + " content:\"\";\n" 169 + " display:inline-block;\n" 170 + " position:relative;\n" 171 + " padding-top:129px;\n" 172 + " margin-top:-129px;\n" 173 + "}\n" 174 + ".searchTagResult:before, .searchTagResult:target {\n" 175 + " color:red;\n" 176 + "}", 177 "a[href]:hover, a[href]:focus {\n" 178 + " text-decoration:none;\n" 179 + " color:#bb7a2a;\n" 180 + "}", 181 "td.colFirst a:link, td.colFirst a:visited,\n" 182 + "td.colSecond a:link, td.colSecond a:visited,\n" 183 + "th.colFirst a:link, th.colFirst a:visited,\n" 184 + "th.colSecond a:link, th.colSecond a:visited,\n" 185 + "th.colConstructorName a:link, th.colConstructorName a:visited,\n" 186 + "td.colLast a:link, td.colLast a:visited,\n" 187 + ".constantValuesContainer td a:link, .constantValuesContainer td a:visited {\n" 188 + " font-weight:bold;\n" 189 + "}"); 190 191 checkOutput("pkg/A.html", true, 192 // Test whether a link to the stylesheet file is inserted properly 193 // in the class documentation. 194 "<link rel=\"stylesheet\" type=\"text/css\" " 195 + "href=\"../stylesheet.css\" title=\"Style\">", 196 "<div class=\"block\">Test comment for a class which has an <a name=\"named_anchor\">" 197 + "anchor_with_name</a> and\n" 198 + " an <a id=\"named_anchor1\">anchor_with_id</a>.</div>"); 199 200 checkOutput("pkg/package-summary.html", true, 201 "<td class=\"colLast\">\n" 202 + "<div class=\"block\">Test comment for a class which has an <a name=\"named_anchor\">" 203 + "anchor_with_name</a> and\n" 204 + " an <a id=\"named_anchor1\">anchor_with_id</a>.</div>\n" 205 + "</td>"); 206 207 checkOutput("index.html", true, 208 "<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" title=\"Style\">"); 209 210 checkOutput("stylesheet.css", false, 211 "* {\n" 212 + " margin:0;\n" 213 + " padding:0;\n" 214 + "}", 215 "a:active {\n" 216 + " text-decoration:none;\n" 217 + " color:#4A6782;\n" 218 + "}", 219 "a[name]:hover {\n" 220 + " text-decoration:none;\n" 221 + " color:#353833;\n" 222 + "}"); 223 } 224} 225