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

Wed, 18 Sep 2013 22:47:06 -0700

author
bpatel
date
Wed, 18 Sep 2013 22:47:06 -0700
changeset 2036
8df12c315ea3
parent 2008
e32a8a29643a
child 2084
6e186ca11ec0
permissions
-rw-r--r--

8024096: some javadoc tests may contain false positive results
Reviewed-by: jjg

     1 /*
     2  * Copyright (c) 2005, 2013, 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
    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";
    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:Arial, Helvetica, sans-serif;" + NL +
    58             "    font-size:76%;" + 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, .packageSummary caption, " +
    63             ".contentContainer ul.blockList li.blockList caption, " +
    64             ".summary caption, .classUseContainer caption, " +
    65             ".constantValuesContainer caption {" + NL +
    66             "    position:relative;" + NL +
    67             "    text-align:left;" + NL +
    68             "    background-repeat:no-repeat;" + NL +
    69             "    color:#FFFFFF;" + NL +
    70             "    font-weight:bold;" + NL +
    71             "    clear:none;" + NL +
    72             "    overflow:hidden;" + NL +
    73             "    padding:0px;" + NL +
    74             "    margin:0px;" + NL +
    75             "}"},
    76         {BUG_ID + FS + "stylesheet.css",
    77             ".overviewSummary caption span, .packageSummary caption span, " +
    78             ".contentContainer ul.blockList li.blockList caption span, " +
    79             ".summary caption span, .classUseContainer caption span, " +
    80             ".constantValuesContainer caption span {" + NL +
    81             "    white-space:nowrap;" + NL +
    82             "    padding-top:8px;" + NL +
    83             "    padding-left:8px;" + NL +
    84             "    display:inline-block;" + NL +
    85             "    float:left;" + NL +
    86             "    background-image:url(resources/titlebar.gif);" + NL +
    87             "}"},
    88         {BUG_ID + FS + "stylesheet.css",
    89             ".contentContainer ul.blockList li.blockList caption " +
    90             "span.activeTableTab span {" + NL +
    91             "    white-space:nowrap;" + NL +
    92             "    padding-top:8px;" + NL +
    93             "    padding-left:8px;" + NL +
    94             "    display:inline-block;" + NL +
    95             "    float:left;" + NL +
    96             "    background-image:url(resources/activetitlebar.gif);" + NL +
    97             "}"},
    98         {BUG_ID + FS + "stylesheet.css",
    99             ".contentContainer ul.blockList li.blockList caption span.tableTab span {" + NL +
   100             "    white-space:nowrap;" + NL +
   101             "    padding-top:8px;" + NL +
   102             "    padding-left:8px;" + NL +
   103             "    display:inline-block;" + NL +
   104             "    float:left;" + NL +
   105             "    background-image:url(resources/titlebar.gif);" + NL +
   106             "}"},
   107         {BUG_ID + FS + "stylesheet.css",
   108             ".contentContainer ul.blockList li.blockList caption span.tableTab, " +
   109             ".contentContainer ul.blockList li.blockList caption span.activeTableTab {" + NL +
   110             "    padding-top:0px;" + NL +
   111             "    padding-left:0px;" + NL +
   112             "    background-image:none;" + NL +
   113             "    float:none;" + NL +
   114             "    display:inline-block;" + NL +
   115             "}"},
   116         // Test whether a link to the stylesheet file is inserted properly
   117         // in the class documentation.
   118         {BUG_ID + FS + "pkg" + FS + "A.html",
   119             "<link rel=\"stylesheet\" type=\"text/css\" " +
   120             "href=\"../stylesheet.css\" title=\"Style\">"}
   121     };
   122     private static final String[][] NEGATED_TEST = {
   123         {BUG_ID + FS + "stylesheet.css",
   124             "* {" + NL + "    margin:0;" + NL + "    padding:0;" + NL + "}"}
   125     };
   127     /**
   128      * The entry point of the test.
   129      * @param args the array of command line arguments.
   130      */
   131     public static void main(String[] args) {
   132         TestStylesheet tester = new TestStylesheet();
   133         run(tester, ARGS, TEST, NEGATED_TEST);
   134         tester.printSummary();
   135     }
   137     /**
   138      * {@inheritDoc}
   139      */
   140     public String getBugId() {
   141         return BUG_ID;
   142     }
   144     /**
   145      * {@inheritDoc}
   146      */
   147     public String getBugName() {
   148         return getClass().getName();
   149     }
   150 }

mercurial