1 /* 2 * Copyright (c) 2005, 2015, 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 27 * @summary Run tests on doclet stylesheet. 28 * @author jamieh 29 * @library ../lib 30 * @modules jdk.javadoc 31 * @build JavadocTester 32 * @run main TestStylesheet 33 */ 34 35 public 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 + " position:relative;\n" 86 + " text-align:left;\n" 87 + " background-repeat:no-repeat;\n" 88 + " color:#253441;\n" 89 + " font-weight:bold;\n" 90 + " clear:none;\n" 91 + " overflow:hidden;\n" 92 + " padding:0px;\n" 93 + " padding-top:10px;\n" 94 + " padding-left:1px;\n" 95 + " margin:0px;\n" 96 + " white-space:pre;\n" 97 + "}", 98 ".overviewSummary caption span, .memberSummary caption span, .typeSummary caption span,\n" 99 + ".useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span {\n" 100 + " white-space:nowrap;\n" 101 + " padding-top:5px;\n" 102 + " padding-left:12px;\n" 103 + " padding-right:12px;\n" 104 + " padding-bottom:7px;\n" 105 + " display:inline-block;\n" 106 + " float:left;\n" 107 + " background-color:#F8981D;\n" 108 + " border: none;\n" 109 + " height:16px;\n" 110 + "}", 111 ".memberSummary caption span.activeTableTab span {\n" 112 + " white-space:nowrap;\n" 113 + " padding-top:5px;\n" 114 + " padding-left:12px;\n" 115 + " padding-right:12px;\n" 116 + " margin-right:3px;\n" 117 + " display:inline-block;\n" 118 + " float:left;\n" 119 + " background-color:#F8981D;\n" 120 + " height:16px;\n" 121 + "}", 122 ".memberSummary caption span.tableTab span {\n" 123 + " white-space:nowrap;\n" 124 + " padding-top:5px;\n" 125 + " padding-left:12px;\n" 126 + " padding-right:12px;\n" 127 + " margin-right:3px;\n" 128 + " display:inline-block;\n" 129 + " float:left;\n" 130 + " background-color:#4D7A97;\n" 131 + " height:16px;\n" 132 + "}", 133 // Test the formatting styles for proper content display in use and constant values pages. 134 ".overviewSummary td.colFirst, .overviewSummary th.colFirst,\n" 135 + ".useSummary td.colFirst, .useSummary th.colFirst,\n" 136 + ".overviewSummary td.colOne, .overviewSummary th.colOne,\n" 137 + ".memberSummary td.colFirst, .memberSummary th.colFirst,\n" 138 + ".memberSummary td.colOne, .memberSummary th.colOne,\n" 139 + ".typeSummary td.colFirst{\n" 140 + " width:25%;\n" 141 + " vertical-align:top;\n" 142 + "}", 143 ".overviewSummary td, .memberSummary td, .typeSummary td,\n" 144 + ".useSummary td, .constantsSummary td, .deprecatedSummary td {\n" 145 + " text-align:left;\n" 146 + " padding:0px 0px 12px 10px;\n" 147 + "}", 148 ".memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab {\n" 149 + " padding-top:0px;\n" 150 + " padding-left:0px;\n" 151 + " padding-right:0px;\n" 152 + " background-image:none;\n" 153 + " float:none;\n" 154 + " display:inline;\n" 155 + "}", 156 "@import url('resources/fonts/dejavu.css');"); 157 158 // Test whether a link to the stylesheet file is inserted properly 159 // in the class documentation. 160 checkOutput("pkg/A.html", true, 161 "<link rel=\"stylesheet\" type=\"text/css\" " 162 + "href=\"../stylesheet.css\" title=\"Style\">"); 163 164 checkOutput("index.html", true, 165 "<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" title=\"Style\">"); 166 167 checkOutput("stylesheet.css", false, 168 "* {\n" 169 + " margin:0;\n" 170 + " padding:0;\n" 171 + "}"); 172 } 173 }