langtools/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java
changeset 23971 f5ff1f5a8dee
parent 21008 af0b915df7cc
child 24399 af1a0220d0fa
equal deleted inserted replaced
23970:76f4acb11952 23971:f5ff1f5a8dee
     1 /*
     1 /*
     2  * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    40  * It reads each file, complete with newlines, into a string to easily
    40  * It reads each file, complete with newlines, into a string to easily
    41  * find strings that contain newlines.
    41  * find strings that contain newlines.
    42  */
    42  */
    43 public class AccessSkipNav {
    43 public class AccessSkipNav {
    44 
    44 
       
    45     protected static final String NL = System.getProperty("line.separator");
       
    46 
    45     private static final String BUGID = "4638136 - 7198273";
    47     private static final String BUGID = "4638136 - 7198273";
    46     private static final String BUGNAME = "AccessSkipNav";
    48     private static final String BUGNAME = "AccessSkipNav";
    47     private static final String FS = System.getProperty("file.separator");
    49     private static final String TMPDEST_DIR1 = "./docs1/";
    48     private static final String PS = System.getProperty("path.separator");
    50     private static final String TMPDEST_DIR2 = "./docs2/";
    49     private static final String LS = System.getProperty("line.separator");
       
    50     private static final String TMPDEST_DIR1 = "." + FS + "docs1" + FS;
       
    51     private static final String TMPDEST_DIR2 = "." + FS + "docs2" + FS;
       
    52 
    51 
    53     // Subtest number.  Needed because runResultsOnHTML is run twice,
    52     // Subtest number.  Needed because runResultsOnHTML is run twice,
    54     // and subtestNum should increment across subtest runs.
    53     // and subtestNum should increment across subtest runs.
    55     public static int subtestNum = 0;
    54     public static int subtestNum = 0;
    56     public static int numSubtestsPassed = 0;
    55     public static int numSubtestsPassed = 0;
    85 
    84 
    86             // Testing only for the presence of the <a href> and <a name>
    85             // Testing only for the presence of the <a href> and <a name>
    87 
    86 
    88             // Top navbar <a href>
    87             // Top navbar <a href>
    89             { "<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a>",
    88             { "<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a>",
    90                      TMPDEST_DIR1 + "p1" + FS + "C1.html" },
    89                      TMPDEST_DIR1 + "p1/C1.html" },
    91 
    90 
    92             // Top navbar <a name>
    91             // Top navbar <a name>
    93             { "<a name=\"skip.navbar.top\">" + LS +
    92             { "<a name=\"skip.navbar.top\">\n" +
    94                       "<!--   -->" + LS + "</a>",
    93                       "<!--   -->\n" +
    95                      TMPDEST_DIR1 + "p1" + FS + "C1.html" },
    94                       "</a>",
       
    95                      TMPDEST_DIR1 + "p1/C1.html" },
    96 
    96 
    97             // Bottom navbar <a href>
    97             // Bottom navbar <a href>
    98             { "<a href=\"#skip.navbar.bottom\" title=\"Skip navigation links\">Skip navigation links</a>",
    98             { "<a href=\"#skip.navbar.bottom\" title=\"Skip navigation links\">Skip navigation links</a>",
    99                      TMPDEST_DIR1 + "p1" + FS + "C1.html" },
    99                      TMPDEST_DIR1 + "p1/C1.html" },
   100 
   100 
   101             // Bottom navbar <a name>
   101             // Bottom navbar <a name>
   102             { "<a name=\"skip.navbar.bottom\">" + LS +
   102             { "<a name=\"skip.navbar.bottom\">\n" +
   103                       "<!--   -->" + LS + "</a>",
   103                       "<!--   -->\n" +
   104                      TMPDEST_DIR1 + "p1" + FS + "C1.html" }
   104                       "</a>",
       
   105                      TMPDEST_DIR1 + "p1/C1.html" }
   105         };
   106         };
   106 
   107 
   107     public static void runTestsOnHTML(String[][] testArray) {
   108     public static void runTestsOnHTML(String[][] testArray) {
   108 
   109 
   109         for (int i = 0; i < testArray.length; i++) {
   110         for (int i = 0; i < testArray.length; i++) {
   167             return "";
   168             return "";
   168         }
   169         }
   169     }
   170     }
   170 
   171 
   171     public static int findString(String fileString, String stringToFind) {
   172     public static int findString(String fileString, String stringToFind) {
   172         return fileString.indexOf(stringToFind);
   173         return fileString.replace(NL, "\n").indexOf(stringToFind);
   173     }
   174     }
   174 }
   175 }