diff options
author | Chris Goldthorpe | 2007-09-06 23:35:09 +0000 |
---|---|---|
committer | Chris Goldthorpe | 2007-09-06 23:35:09 +0000 |
commit | a84572318622b407c613941e4c1b25809dfccf00 (patch) | |
tree | 4c1145e69525504643072b27a7cdd1ba7691973b /org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc | |
parent | 34151b37ef7452b26bcf378656615f3e95078626 (diff) | |
download | eclipse.platform.ua-a84572318622b407c613941e4c1b25809dfccf00.tar.gz eclipse.platform.ua-a84572318622b407c613941e4c1b25809dfccf00.tar.xz eclipse.platform.ua-a84572318622b407c613941e4c1b25809dfccf00.zip |
Bug 28649 [Webapp] Highlight Contents Tree as Guide is Used
Diffstat (limited to 'org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc')
-rw-r--r-- | org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TopicFinderTest.java | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TopicFinderTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TopicFinderTest.java index 90f4da5dd..35cb55049 100644 --- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TopicFinderTest.java +++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TopicFinderTest.java @@ -14,7 +14,9 @@ package org.eclipse.ua.tests.help.toc; import org.eclipse.help.IToc; import org.eclipse.help.ITopic; import org.eclipse.help.internal.HelpPlugin; +import org.eclipse.help.internal.webapp.data.TocData; import org.eclipse.help.internal.webapp.data.TopicFinder; +import org.eclipse.help.internal.webapp.data.UrlUtil; import junit.framework.TestCase; @@ -68,6 +70,21 @@ public class TopicFinderTest extends TestCase{ assertEquals("filter", path[1].getLabel()); } + public void testTopicInFilteredToc() { + String topic = "http://localhost:8082/help/topic/org.eclipse.ua.tests/data/help/toc/filteredToc/helpInstalled.html"; + TopicFinder finder = new TopicFinder(topic, getTocs()); + int selectedToc = finder.getSelectedToc(); + assertFalse(selectedToc == -1); + ITopic[] path = finder.getTopicPath(); + assertNotNull(path); + String tocHref = getTocs()[selectedToc].getHref(); + assertEquals("/org.eclipse.ua.tests/data/help/toc/root.xml", tocHref); + assertEquals(2, path.length); + assertEquals("filter", path[0].getLabel()); + assertEquals("The plugin org.eclipse.help is installed", path[1].getLabel()); + assertEquals("/org.eclipse.ua.tests/data/help/toc/filteredToc/helpInstalled.html", path[1].getHref()); + } + public void testTopicNotInToc() { String topic = "http://localhost:8082/help/topic/org.eclipse.ua.tests/data/help/manual/filter25.xhtml"; TopicFinder finder = new TopicFinder(topic, getTocs()); @@ -75,4 +92,30 @@ public class TopicFinderTest extends TestCase{ assertNull(finder.getTopicPath()); } + public void testLookupFromPath() { + String topic = "http://localhost:8082/help/topic/org.eclipse.ua.tests/data/help/toc/filteredToc/helpInstalled.html"; + IToc[] tocs = getTocs(); + TopicFinder finder = new TopicFinder(topic, tocs); + String numericPath = finder.getNumericPath(); + int tocIndex = finder.getSelectedToc(); + String fullPath = "" + tocIndex + "_" + numericPath; + int[] intPath = UrlUtil.splitPath(fullPath); + ITopic[] topics = TocData.decodePath(intPath, tocs[tocIndex]); + assertEquals(2, topics.length); + assertEquals("filter", topics[0].getLabel()); + assertEquals("The plugin org.eclipse.help is installed", topics[1].getLabel()); + assertEquals("/org.eclipse.ua.tests/data/help/toc/filteredToc/helpInstalled.html", topics[1].getHref()); + } + + public void testNavURL() { + String topic = "http://localhost:8082/help/topic/org.eclipse.ua.tests/data/help/toc/filteredToc/helpInstalled.html"; + IToc[] tocs = getTocs(); + TopicFinder finder = new TopicFinder(topic, tocs); + int selectedToc = finder.getSelectedToc(); + String navPath = "http://127.0.0.1:1936/help/nav/" + selectedToc; + TopicFinder finder2 = new TopicFinder(navPath, tocs); + assertEquals(selectedToc, finder2.getSelectedToc()); + assertEquals(0, finder2.getTopicPath().length); + } + } |