test/langtools/jdk/javadoc/doclet/testNavigation/TestNavigation.java
changeset 49551 0d4786e42471
parent 49139 771616d26ca1
child 50293 edfb87b2520e
--- a/test/langtools/jdk/javadoc/doclet/testNavigation/TestNavigation.java	Mon Apr 09 04:43:03 2018 -0700
+++ b/test/langtools/jdk/javadoc/doclet/testNavigation/TestNavigation.java	Mon Apr 09 09:45:51 2018 -0700
@@ -24,24 +24,36 @@
 /*
  * @test
  * @bug      4131628 4664607 7025314 8023700 7198273 8025633 8026567 8081854 8150188 8151743 8196027 8182765
+ *           8196200
  * @summary  Make sure the Next/Prev Class links iterate through all types.
  *           Make sure the navagation is 2 columns, not 3.
  * @author   jamieh
- * @library  ../lib
+ * @library  /tools/lib ../lib
  * @modules jdk.javadoc/jdk.javadoc.internal.tool
- * @build    JavadocTester
+ * @build    toolbox.ToolBox JavadocTester
  * @run main TestNavigation
  */
 
+import java.io.IOException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import toolbox.*;
+
 public class TestNavigation extends JavadocTester {
 
+    public final ToolBox tb;
     public static void main(String... args) throws Exception {
         TestNavigation tester = new TestNavigation();
-        tester.runTests();
+        tester.runTests(m -> new Object[] { Paths.get(m.getName()) });
+    }
+
+    public TestNavigation() {
+        tb = new ToolBox();
     }
 
     @Test
-    void test() {
+    void test(Path ignore) {
         javadoc("-d", "out",
                 "-overview", testSrc("overview.html"),
                 "-sourcepath", testSrc,
@@ -96,7 +108,7 @@
     }
 
     @Test
-    void test_html4() {
+    void test_html4(Path ignore) {
         javadoc("-d", "out-html4",
                 "-html4",
                 "-overview", testSrc("overview.html"),
@@ -135,7 +147,7 @@
 
     // Test for checking additional padding to offset the fixed navigation bar in HTML5.
     @Test
-    void test1() {
+    void test1(Path ignore) {
         javadoc("-d", "out-1",
                 "-html5",
                 "-sourcepath", testSrc,
@@ -167,7 +179,7 @@
 
     // Test to make sure that no extra padding for nav bar gets generated if -nonavbar is specified for HTML4.
     @Test
-    void test2() {
+    void test2(Path ignore) {
         javadoc("-d", "out-2",
                 "-nonavbar",
                 "-sourcepath", testSrc,
@@ -197,7 +209,7 @@
 
     // Test to make sure that no extra padding for nav bar gets generated if -nonavbar is specified for HTML5.
     @Test
-    void test3() {
+    void test3(Path ignore) {
         javadoc("-d", "out-3",
                 "-html5",
                 "-nonavbar",
@@ -227,4 +239,89 @@
                 + "</script>\n"
                 + "</nav>");
     }
+
+    @Test
+    void test4(Path base) throws IOException {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                "package pkg1; public class A {\n"
+                + "    /**\n"
+                + "     * Class with members.\n"
+                + "     */\n"
+                + "    public static class X {\n"
+                + "        /**\n"
+                + "         * A ctor\n"
+                + "         */\n"
+                + "        public X() {\n"
+                + "        }\n"
+                + "        /**\n"
+                + "         * A field\n"
+                + "         */\n"
+                + "        public int field;\n"
+                + "        /**\n"
+                + "         * A method\n"
+                + "         */\n"
+                + "        public void method() {\n"
+                + "        }\n"
+                + "        /**\n"
+                + "         * An inner class\n"
+                + "         */\n"
+                + "        public static class IC {\n"
+                + "        }\n"
+                + "    }\n"
+                + "    /**\n"
+                + "     * Class with all inherited members.\n"
+                + "     */\n"
+                + "    public static class Y extends X {\n"
+                + "    }\n"
+                + "}");
+
+        tb.writeJavaFiles(src,
+                "package pkg1; public class C {\n"
+                + "}");
+
+        tb.writeJavaFiles(src,
+                "package pkg1; public interface InterfaceWithNoMembers {\n"
+                + "}");
+
+        javadoc("-d", "out-4",
+                "-sourcepath", src.toString(),
+                "pkg1");
+        checkExit(Exit.OK);
+
+        checkOrder("pkg1/A.X.html",
+                "Summary",
+                "<li><a href=\"#nested.class.summary\">Nested</a>&nbsp;|&nbsp;</li>",
+                "<li><a href=\"#field.summary\">Field</a>&nbsp;|&nbsp;</li>",
+                "<li><a href=\"#constructor.summary\">Constr</a>&nbsp;|&nbsp;</li>",
+                "<li><a href=\"#method.summary\">Method</a></li>");
+
+        checkOrder("pkg1/A.Y.html",
+                "Summary",
+                "<li><a href=\"#nested.class.summary\">Nested</a>&nbsp;|&nbsp;</li>",
+                "<li><a href=\"#field.summary\">Field</a>&nbsp;|&nbsp;</li>",
+                "<li><a href=\"#constructor.summary\">Constr</a>&nbsp;|&nbsp;</li>",
+                "<li><a href=\"#method.summary\">Method</a></li>");
+
+        checkOrder("pkg1/A.X.IC.html",
+                "Summary",
+                "<li>Nested&nbsp;|&nbsp;</li>",
+                "<li>Field&nbsp;|&nbsp;</li>",
+                "<li><a href=\"#constructor.summary\">Constr</a>&nbsp;|&nbsp;</li>",
+                "<li><a href=\"#method.summary\">Method</a></li>");
+
+        checkOrder("pkg1/C.html",
+                "Summary",
+                "<li>Nested&nbsp;|&nbsp;</li>",
+                "<li>Field&nbsp;|&nbsp;</li>",
+                "<li><a href=\"#constructor.summary\">Constr</a>&nbsp;|&nbsp;</li>",
+                "<li><a href=\"#method.summary\">Method</a></li>");
+
+        checkOrder("pkg1/InterfaceWithNoMembers.html",
+                "Summary",
+                "<li>Nested&nbsp;|&nbsp;</li>",
+                "<li>Field&nbsp;|&nbsp;</li>",
+                "<li>Constr&nbsp;|&nbsp;</li>",
+                "<li>Method</li>");
+    }
 }