diff options
author | Curtis D'Entremont | 2006-12-01 19:45:01 +0000 |
---|---|---|
committer | Curtis D'Entremont | 2006-12-01 19:45:01 +0000 |
commit | c5acf8193f80fcceda394f5bd6d712102ed697b4 (patch) | |
tree | 91bafd7c9d4f1157e8b109763757446355cdfca3 /org.eclipse.ua.tests | |
parent | 0b799832b6080baf9e14a7dcb7fe86498423b7fe (diff) | |
download | eclipse.platform.ua-c5acf8193f80fcceda394f5bd6d712102ed697b4.tar.gz eclipse.platform.ua-c5acf8193f80fcceda394f5bd6d712102ed697b4.tar.xz eclipse.platform.ua-c5acf8193f80fcceda394f5bd6d712102ed697b4.zip |
165168 [Help] Better control of how help content is arranged and ordered
Diffstat (limited to 'org.eclipse.ua.tests')
5 files changed, 98 insertions, 0 deletions
diff --git a/org.eclipse.ua.tests/data/help/preferences/helpData1.xml b/org.eclipse.ua.tests/data/help/preferences/helpData1.xml new file mode 100644 index 000000000..c51e67644 --- /dev/null +++ b/org.eclipse.ua.tests/data/help/preferences/helpData1.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<extensions> + <tocOrder> + <toc id="toc1"/> + <category id="category1"/> + <toc id="toc2"/> + <toc id="toc3"/> + </tocOrder> + <hidden> + <index id="index1"/> + <category id="category2"/> + <index id="index2"/> + <toc id="toc4"/> + </hidden> +</extensions>
\ No newline at end of file diff --git a/org.eclipse.ua.tests/data/help/preferences/helpData2.xml b/org.eclipse.ua.tests/data/help/preferences/helpData2.xml new file mode 100644 index 000000000..f660b6f3f --- /dev/null +++ b/org.eclipse.ua.tests/data/help/preferences/helpData2.xml @@ -0,0 +1,3 @@ +<?xml version="1.0" encoding="UTF-8"?> +<extensions> +</extensions>
\ No newline at end of file diff --git a/org.eclipse.ua.tests/data/help/preferences/helpData3.xml b/org.eclipse.ua.tests/data/help/preferences/helpData3.xml new file mode 100644 index 000000000..2fdd8d75e --- /dev/null +++ b/org.eclipse.ua.tests/data/help/preferences/helpData3.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<extensions> + <tocOrder> + </tocOrder> + <hidden> + </hidden> +</extensions>
\ No newline at end of file diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/AllPreferencesTests.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/AllPreferencesTests.java index f9d7d3252..fab3a51e7 100644 --- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/AllPreferencesTests.java +++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/AllPreferencesTests.java @@ -30,5 +30,6 @@ public class AllPreferencesTests extends TestSuite { */ public AllPreferencesTests() { addTest(ProductPreferencesTest.suite()); + addTest(HelpDataTest.suite()); } } diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/HelpDataTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/HelpDataTest.java new file mode 100644 index 000000000..e5370f03f --- /dev/null +++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/HelpDataTest.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ua.tests.help.preferences; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import junit.framework.Assert; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.help.internal.HelpData; +import org.eclipse.ua.tests.plugin.UserAssistanceTestPlugin; + +/* + * Tests the help data ordering of tocs and hiding tocs, indexes, etc. + */ +public class HelpDataTest extends TestCase { + + private static final String[][][] TEST_DATA = new String[][][] { + { { "data/help/preferences/helpData1.xml" }, { "toc1", "category1", "toc2", "toc3" }, { "toc4", "category2" }, { "index1", "index2" } }, + { { "data/help/preferences/helpData2.xml" }, { }, { }, { } }, + { { "data/help/preferences/helpData3.xml" }, { }, { }, { } }, + }; + + /* + * Returns an instance of this Test. + */ + public static Test suite() { + return new TestSuite(HelpDataTest.class); + } + + public void testHelpData() { + for (int i=0;i<TEST_DATA.length;++i) { + String[][] entry = (String[][])TEST_DATA[i]; + String file = entry[0][0]; + List expectedTocOrder = Arrays.asList(entry[1]); + Set expectedHiddenTocs = new HashSet(Arrays.asList(entry[2])); + Set expectedHiddenIndexes = new HashSet(Arrays.asList(entry[3])); + HelpDataTester data = new HelpDataTester(file); + Assert.assertEquals("Did not get the expected toc order from help data file " + file, expectedTocOrder, data.getTocOrder()); + Assert.assertEquals("Did not get the expected hidden tocs from help data file " + file, expectedHiddenTocs, data.getHiddenTocs()); + Assert.assertEquals("Did not get the expected hidden indexes from help data file " + file, expectedHiddenIndexes, data.getHiddenIndexes()); + } + } + + private class HelpDataTester extends HelpData { + + private String path; + + public HelpDataTester(String path) { + this.path = path; + } + + public InputStream getHelpDataFile(String filePath) throws IOException { + return UserAssistanceTestPlugin.getDefault().getBundle().getEntry(path).openStream(); + } + } +} |