test/com/sun/javadoc/testStylesheet/TestStylesheet.java

Mon, 16 Oct 2017 16:07:48 +0800

author
aoqi
date
Mon, 16 Oct 2017 16:07:48 +0800
changeset 2893
ca5783d9a597
parent 2723
477c2ce534d0
parent 2525
2eb010b6cb22
permissions
-rw-r--r--

merge

     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  */
    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  * @build    JavadocTester TestStylesheet
    31  * @run main TestStylesheet
    32  */
    34 public class TestStylesheet extends JavadocTester {
    36     //Test information.
    37     private static final String BUG_ID = "4494033-7028815-7052425-8007338-8072461";
    39     //Javadoc arguments.
    40     private static final String[] ARGS = new String[] {
    41         "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg"
    42     };
    44     //Input for string search tests.
    45     private static final String[][] TEST = {
    46         {BUG_ID + FS + "stylesheet.css",
    47             "/* Javadoc style sheet */"},
    48         {BUG_ID + FS + "stylesheet.css",
    49             "/*" + NL + "Overall document style" + NL + "*/"},
    50         {BUG_ID + FS + "stylesheet.css",
    51             "/*" + NL + "Heading styles" + NL + "*/"},
    52         {BUG_ID + FS + "stylesheet.css",
    53             "/*" + NL + "Navigation bar styles" + NL + "*/"},
    54         {BUG_ID + FS + "stylesheet.css",
    55             "body {" + NL + "    background-color:#ffffff;" + NL +
    56             "    color:#353833;" + NL +
    57             "    font-family:'DejaVu Sans', Arial, Helvetica, sans-serif;" + NL +
    58             "    font-size:14px;" + NL + "    margin:0;" + NL + "}"},
    59         {BUG_ID + FS + "stylesheet.css",
    60             "ul {" + NL + "    list-style-type:disc;" + NL + "}"},
    61         {BUG_ID + FS + "stylesheet.css",
    62             ".overviewSummary caption, .memberSummary caption, .typeSummary caption," + NL +
    63             ".useSummary caption, .constantsSummary caption, .deprecatedSummary caption {" + NL +
    64             "    position:relative;" + NL +
    65             "    text-align:left;" + NL +
    66             "    background-repeat:no-repeat;" + NL +
    67             "    color:#253441;" + NL +
    68             "    font-weight:bold;" + NL +
    69             "    clear:none;" + NL +
    70             "    overflow:hidden;" + NL +
    71             "    padding:0px;" + NL +
    72             "    padding-top:10px;" + NL +
    73             "    padding-left:1px;" + NL +
    74             "    margin:0px;" + NL +
    75             "    white-space:pre;" + NL +
    76             "}"},
    77         {BUG_ID + FS + "stylesheet.css",
    78             ".overviewSummary caption span, .memberSummary caption span, .typeSummary caption span," + NL +
    79             ".useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span {" + NL +
    80             "    white-space:nowrap;" + NL +
    81             "    padding-top:5px;" + NL +
    82             "    padding-left:12px;" + NL +
    83             "    padding-right:12px;" + NL +
    84             "    padding-bottom:7px;" + NL +
    85             "    display:inline-block;" + NL +
    86             "    float:left;" + NL +
    87             "    background-color:#F8981D;" + NL +
    88             "    border: none;" + NL +
    89             "    height:16px;" + NL +
    90             "}"},
    91         {BUG_ID + FS + "stylesheet.css",
    92             ".memberSummary caption span.activeTableTab span {" + NL +
    93             "    white-space:nowrap;" + NL +
    94             "    padding-top:5px;" + NL +
    95             "    padding-left:12px;" + NL +
    96             "    padding-right:12px;" + NL +
    97             "    margin-right:3px;" + NL +
    98             "    display:inline-block;" + NL +
    99             "    float:left;" + NL +
   100             "    background-color:#F8981D;" + NL +
   101             "    height:16px;" + NL +
   102             "}"},
   103         {BUG_ID + FS + "stylesheet.css",
   104             ".memberSummary caption span.tableTab span {" + NL +
   105             "    white-space:nowrap;" + NL +
   106             "    padding-top:5px;" + NL +
   107             "    padding-left:12px;" + NL +
   108             "    padding-right:12px;" + NL +
   109             "    margin-right:3px;" + NL +
   110             "    display:inline-block;" + NL +
   111             "    float:left;" + NL +
   112             "    background-color:#4D7A97;" + NL +
   113             "    height:16px;" + NL +
   114             "}"},
   115         {BUG_ID + FS + "stylesheet.css",
   116             ".memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab {" + NL +
   117             "    padding-top:0px;" + NL +
   118             "    padding-left:0px;" + NL +
   119             "    padding-right:0px;" + NL +
   120             "    background-image:none;" + NL +
   121             "    float:none;" + NL +
   122             "    display:inline;" + NL +
   123             "}"},
   124         {BUG_ID + FS + "stylesheet.css",
   125             "@import url('resources/fonts/dejavu.css');"},
   126         // Test the formatting styles for proper content display in use and constant values pages.
   127         {BUG_ID + FS + "stylesheet.css",
   128             ".overviewSummary td.colFirst, .overviewSummary th.colFirst," + NL +
   129             ".useSummary td.colFirst, .useSummary th.colFirst," + NL +
   130             ".overviewSummary td.colOne, .overviewSummary th.colOne," + NL +
   131             ".memberSummary td.colFirst, .memberSummary th.colFirst," + NL +
   132             ".memberSummary td.colOne, .memberSummary th.colOne," + NL +
   133             ".typeSummary td.colFirst{" + NL +
   134             "    width:25%;" + NL +
   135             "    vertical-align:top;" + NL +
   136             "}"},
   137         {BUG_ID + FS + "stylesheet.css",
   138             ".overviewSummary td, .memberSummary td, .typeSummary td," + NL +
   139             ".useSummary td, .constantsSummary td, .deprecatedSummary td {" + NL +
   140             "    text-align:left;" + NL +
   141             "    padding:0px 0px 12px 10px;" + NL +
   142             "}"},
   143         // Test whether a link to the stylesheet file is inserted properly
   144         // in the class documentation.
   145         {BUG_ID + FS + "pkg" + FS + "A.html",
   146             "<link rel=\"stylesheet\" type=\"text/css\" " +
   147             "href=\"../stylesheet.css\" title=\"Style\">"}
   148     };
   149     private static final String[][] NEGATED_TEST = {
   150         {BUG_ID + FS + "stylesheet.css",
   151             "* {" + NL + "    margin:0;" + NL + "    padding:0;" + NL + "}"}
   152     };
   154     /**
   155      * The entry point of the test.
   156      * @param args the array of command line arguments.
   157      */
   158     public static void main(String[] args) {
   159         TestStylesheet tester = new TestStylesheet();
   160         run(tester, ARGS, TEST, NEGATED_TEST);
   161         tester.printSummary();
   162     }
   164     /**
   165      * {@inheritDoc}
   166      */
   167     public String getBugId() {
   168         return BUG_ID;
   169     }
   171     /**
   172      * {@inheritDoc}
   173      */
   174     public String getBugName() {
   175         return getClass().getName();
   176     }
   177 }

mercurial