8175799: module summary page shows duplicated output

Reviewed-by: jjg, ksrini
This commit is contained in:
Bhavesh Patel 2017-03-13 09:55:31 -07:00
parent 50644d73dd
commit 7a72caecad
4 changed files with 103 additions and 14 deletions

View File

@ -144,7 +144,6 @@ public class ModuleIndexWriter extends AbstractModuleIndexWriter {
Content div = HtmlTree.DIV(HtmlStyle.contentContainer, table);
if (configuration.allowTag(HtmlTag.MAIN)) {
htmlTree.addContent(div);
body.addContent(htmlTree);
} else {
body.addContent(div);
}
@ -189,7 +188,6 @@ public class ModuleIndexWriter extends AbstractModuleIndexWriter {
addOverviewComment(div);
if (configuration.allowTag(HtmlTag.MAIN)) {
htmlTree.addContent(div);
body.addContent(htmlTree);
} else {
body.addContent(div);
}
@ -210,12 +208,16 @@ public class ModuleIndexWriter extends AbstractModuleIndexWriter {
}
/**
* Not required for this page.
* For HTML 5, add the htmlTree to the body. For HTML 4, do nothing.
*
* @param body the documentation tree to which the overview will be added
*/
@Override
protected void addOverview(Content body) {}
protected void addOverview(Content body) {
if (configuration.allowTag(HtmlTag.MAIN)) {
body.addContent(htmlTree);
}
}
/**
* Adds the top text (from the -top option), the upper

View File

@ -134,7 +134,6 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
Content div = HtmlTree.DIV(HtmlStyle.contentContainer, table);
if (configuration.allowTag(HtmlTag.MAIN)) {
htmlTree.addContent(div);
body.addContent(htmlTree);
} else {
body.addContent(div);
}
@ -182,7 +181,6 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
addOverviewComment(div);
if (configuration.allowTag(HtmlTag.MAIN)) {
htmlTree.addContent(div);
body.addContent(htmlTree);
} else {
body.addContent(div);
}
@ -203,12 +201,16 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
}
/**
* Not required for this page.
* For HTML 5, add the htmlTree to the body. For HTML 4, do nothing.
*
* @param body the documentation tree to which the overview will be added
*/
@Override
protected void addOverview(Content body) {}
protected void addOverview(Content body) {
if (configuration.allowTag(HtmlTag.MAIN)) {
body.addContent(htmlTree);
}
}
/**
* Adds the top text (from the -top option), the upper

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/*
* @test
* @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363 8168766 8168688 8162674 8160196
* @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363 8168766 8168688 8162674 8160196 8175799
* @summary Test modules support in javadoc.
* @author bpatel
* @library ../lib
@ -44,6 +44,7 @@ public class TestModules extends JavadocTester {
@Test
void testHtml4() {
javadoc("-d", "out", "-use",
"-overview", testSrc("overview.html"),
"--module-source-path", testSrc,
"--module", "moduleA,moduleB",
"testpkgmdlA", "testpkgmdlB");
@ -65,6 +66,7 @@ public class TestModules extends JavadocTester {
@Test
void testHtml5() {
javadoc("-d", "out-html5", "-html5", "-use",
"-overview", testSrc("overview.html"),
"--module-source-path", testSrc,
"--module", "moduleA,moduleB",
"testpkgmdlA", "testpkgmdlB");
@ -86,6 +88,7 @@ public class TestModules extends JavadocTester {
@Test
void testHtml4NoComment() {
javadoc("-d", "out-nocomment", "-nocomment", "-use",
"-overview", testSrc("overview.html"),
"--module-source-path", testSrc,
"--module", "moduleA,moduleB",
"testpkgmdlA", "testpkgmdlB");
@ -103,6 +106,7 @@ public class TestModules extends JavadocTester {
@Test
void testHtml5NoComment() {
javadoc("-d", "out-html5-nocomment", "-nocomment", "-html5", "-use",
"-overview", testSrc("overview.html"),
"--module-source-path", testSrc,
"--module", "moduleA,moduleB",
"testpkgmdlA", "testpkgmdlB");
@ -120,6 +124,7 @@ public class TestModules extends JavadocTester {
@Test
void testHtml4UnnamedModule() {
javadoc("-d", "out-nomodule", "-use",
"-overview", testSrc("overview.html"),
"-sourcepath", testSrc,
"testpkgnomodule", "testpkgnomodule1");
checkExit(Exit.OK);
@ -136,6 +141,7 @@ public class TestModules extends JavadocTester {
@Test
void testHtml5UnnamedModule() {
javadoc("-d", "out-html5-nomodule", "-html5", "-use",
"-overview", testSrc("overview.html"),
"-sourcepath", testSrc,
"testpkgnomodule", "testpkgnomodule1");
checkExit(Exit.OK);
@ -265,6 +271,23 @@ public class TestModules extends JavadocTester {
+ "</a>\n"
+ "<div class=\"block\">This is a test description for the moduleB module. Search "
+ "word <a id=\"search_word\">search_word</a> with no description.</div>");
checkOutput("overview-summary.html", found,
"</script>\n"
+ "<div class=\"contentContainer\">\n"
+ "<div class=\"block\">The overview summary page header.</div>\n"
+ "</div>\n"
+ "<div class=\"contentContainer\">\n"
+ "<table class=\"overviewSummary\" summary=\"Module Summary table, listing modules, and an explanation\">\n"
+ "<caption><span>Modules</span><span class=\"tabEnd\">&nbsp;</span></caption>");
checkOutput("overview-summary.html", false,
"</table>\n"
+ "</div>\n"
+ "<div class=\"contentContainer\">\n"
+ "<div class=\"block\">The overview summary page header.</div>\n"
+ "</div>\n"
+ "<div class=\"contentContainer\">\n"
+ "<table class=\"overviewSummary\" summary=\"Module Summary table, listing modules, and an explanation\">\n"
+ "<caption><span>Modules</span><span class=\"tabEnd\">&nbsp;</span></caption>");
}
void checkNoDescription(boolean found) {
@ -305,6 +328,27 @@ public class TestModules extends JavadocTester {
+ "</a>\n"
+ "<div class=\"block\">This is a test description for the moduleB module. Search "
+ "word <a id=\"search_word\">search_word</a> with no description.</div>");
checkOutput("overview-summary.html", found,
"</nav>\n"
+ "</header>\n"
+ "<main role=\"main\">\n"
+ "<div class=\"contentContainer\">\n"
+ "<div class=\"block\">The overview summary page header.</div>\n"
+ "</div>\n"
+ "<div class=\"contentContainer\">\n"
+ "<table class=\"overviewSummary\">\n"
+ "<caption><span>Modules</span><span class=\"tabEnd\">&nbsp;</span></caption>");
checkOutput("overview-summary.html", false,
"</table>\n"
+ "</div>\n"
+ "</main>\n"
+ "<main role=\"main\">\n"
+ "<div class=\"contentContainer\">\n"
+ "<div class=\"block\">The overview summary page header.</div>\n"
+ "</div>\n"
+ "<div class=\"contentContainer\">\n"
+ "<table class=\"overviewSummary\">\n"
+ "<caption><span>Modules</span><span class=\"tabEnd\">&nbsp;</span></caption>");
}
void checkHtml5NoDescription(boolean found) {
@ -403,14 +447,29 @@ public class TestModules extends JavadocTester {
+ "<tr>\n"
+ "<th class=\"colFirst\" scope=\"col\">Module</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+ "</tr>");
+ "</tr>",
"</table>\n"
+ "</div>\n"
+ "<div class=\"contentContainer\">\n"
+ "<div class=\"block\">The overview summary page header.</div>\n"
+ "</div>\n"
+ "<div class=\"contentContainer\">\n"
+ "<table class=\"overviewSummary\" summary=\"Packages table, listing packages, and an explanation\">\n"
+ "<caption><span>Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>");
checkOutput("overview-summary.html", true,
"<table class=\"overviewSummary\" summary=\"Packages table, listing packages, and an explanation\">\n"
+ "<caption><span>Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+ "<tr>\n"
+ "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+ "</tr>");
+ "</tr>",
"</script>\n"
+ "<div class=\"contentContainer\">\n"
+ "<div class=\"block\">The overview summary page header.</div>\n"
+ "</div>\n"
+ "<div class=\"contentContainer\">\n"
+ "<table class=\"overviewSummary\" summary=\"Packages table, listing packages, and an explanation\">\n"
+ "<caption><span>Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>");
}
void checkHtml5OverviewSummaryModules() {
@ -437,14 +496,34 @@ public class TestModules extends JavadocTester {
+ "<tr>\n"
+ "<th class=\"colFirst\" scope=\"col\">Module</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+ "</tr>");
+ "</tr>",
"</table>\n"
+ "</div>\n"
+ "</main>\n"
+ "<main role=\"main\">\n"
+ "<div class=\"contentContainer\">\n"
+ "<div class=\"block\">The overview summary page header.</div>\n"
+ "</div>\n"
+ "<div class=\"contentContainer\">\n"
+ "<table class=\"overviewSummary\">\n"
+ "<caption><span>Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>");
checkOutput("overview-summary.html", true,
"<table class=\"overviewSummary\">\n"
+ "<caption><span>Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+ "<tr>\n"
+ "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+ "</tr>");
+ "</tr>",
"</script>\n"
+ "</nav>\n"
+ "</header>\n"
+ "<main role=\"main\">\n"
+ "<div class=\"contentContainer\">\n"
+ "<div class=\"block\">The overview summary page header.</div>\n"
+ "</div>\n"
+ "<div class=\"contentContainer\">\n"
+ "<table class=\"overviewSummary\">\n"
+ "<caption><span>Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>");
}
void checkModuleSummary() {

View File

@ -0,0 +1,6 @@
<!DOCTYPE HTML>
<html>
<body>
The overview summary page header.
</body>
</html>