diff options
author | Chris Goldthorpe | 2007-06-29 18:20:43 +0000 |
---|---|---|
committer | Chris Goldthorpe | 2007-06-29 18:20:43 +0000 |
commit | 5de66ead340dc67c69f5d288101e463a93d3c78b (patch) | |
tree | 448d691d2edd64c491d9c9829e16efeb5e4b6589 /org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc | |
parent | 0e6ce108ecfbdc2480c5cb8040f4924d46805af8 (diff) | |
download | eclipse.platform.ua-5de66ead340dc67c69f5d288101e463a93d3c78b.tar.gz eclipse.platform.ua-5de66ead340dc67c69f5d288101e463a93d3c78b.tar.xz eclipse.platform.ua-5de66ead340dc67c69f5d288101e463a93d3c78b.zip |
Bug 191591 - [Webapp] Missing toc files affects display of siblings
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/EnabledTopicTest.java | 65 |
1 files changed, 61 insertions, 4 deletions
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/EnabledTopicTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/EnabledTopicTest.java index 46a2a5f3a..79aacebec 100644 --- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/EnabledTopicTest.java +++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/EnabledTopicTest.java @@ -30,6 +30,7 @@ public class EnabledTopicTest extends TestCase { private String label; private boolean isEnabled; + private List children = new ArrayList(); public ETopic(String label, boolean isEnabled) { this.label = label; @@ -37,12 +38,12 @@ public class EnabledTopicTest extends TestCase { } public ITopic[] getSubtopics() { - return new ITopic[0]; + return (ITopic[])children.toArray(new ITopic[children.size()]); } public IUAElement[] getChildren() { - return new IUAElement[0]; + return getSubtopics(); } public boolean isEnabled(IEvaluationContext context) { @@ -50,12 +51,28 @@ public class EnabledTopicTest extends TestCase { } public String getHref() { - return null; + return "http://www.eclipse.org"; } public String getLabel() { return label; - } + } + + public void addSubTopic(ITopic subTopic) { + children.add(subTopic); + } + } + + private class NoHrefTopic extends ETopic { + + public NoHrefTopic(String label) { + super(label, true); + } + + public String getHref() { + return null; + } + } private class EIndexEntry extends UAElement implements IIndexEntry { @@ -144,6 +161,46 @@ public class EnabledTopicTest extends TestCase { assertEquals("T3", enabled[1].getLabel()); } + public void testNoHref() { + ITopic noHref = new NoHrefTopic("N1"); + assertFalse(EnabledTopicUtils.isEnabled(noHref)); + } + + public void testNoHrefValidChild() { + ETopic noHref = new NoHrefTopic("N1"); + noHref.addSubTopic(new ETopic("T1", true)); + assertTrue(EnabledTopicUtils.isEnabled(noHref)); + } + + public void testNoHrefInvalidChild() { + ETopic noHref = new NoHrefTopic("N1"); + noHref.addSubTopic(new ETopic("T1", false)); + assertFalse(EnabledTopicUtils.isEnabled(noHref)); + } + + public void testNoHrefMixedChildren() { + ETopic noHref = new NoHrefTopic("N1"); + noHref.addSubTopic(new ETopic("T1", false)); + noHref.addSubTopic(new ETopic("T2", true)); + assertTrue(EnabledTopicUtils.isEnabled(noHref)); + } + + public void testNoHrefValidGrandchild() { + ETopic noHref = new NoHrefTopic("N1"); + ETopic subTopic = new NoHrefTopic("N2"); + noHref.addSubTopic(subTopic); + subTopic.addSubTopic(new ETopic("T2", true)); + assertTrue(EnabledTopicUtils.isEnabled(noHref)); + } + + public void testNoHrefInvalidGrandchild() { + ETopic noHref = new NoHrefTopic("N1"); + ETopic subTopic = new NoHrefTopic("N2"); + noHref.addSubTopic(subTopic); + subTopic.addSubTopic(new ETopic("T2", false)); + assertFalse(EnabledTopicUtils.isEnabled(noHref)); + } + public void testEmptyIndexEntry() { EIndexEntry entry1 = new EIndexEntry("abc"); assertFalse(EnabledTopicUtils.isEnabled(entry1)); |