Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Besedin2010-02-03 20:08:12 +0000
committerOleg Besedin2010-02-03 20:08:12 +0000
commit4dd8bb56c43c0d3f246cfa78e3ea9655ca77a323 (patch)
treea86bf680ba29005ef47f802b57e31d38a2a640de /bundles/org.eclipse.equinox.bidi.tests
parentc0b663eabd683507baaae70636c753511c5f52ab (diff)
downloadrt.equinox.bundles-4dd8bb56c43c0d3f246cfa78e3ea9655ca77a323.tar.gz
rt.equinox.bundles-4dd8bb56c43c0d3f246cfa78e3ea9655ca77a323.tar.xz
rt.equinox.bundles-4dd8bb56c43c0d3f246cfa78e3ea9655ca77a323.zip
Bug 183164 - [Implementation for] Display of Complex Expressions Containing Bidirectional Text
Diffstat (limited to 'bundles/org.eclipse.equinox.bidi.tests')
-rw-r--r--bundles/org.eclipse.equinox.bidi.tests/.classpath7
-rw-r--r--bundles/org.eclipse.equinox.bidi.tests/.project28
-rw-r--r--bundles/org.eclipse.equinox.bidi.tests/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--bundles/org.eclipse.equinox.bidi.tests/META-INF/MANIFEST.MF11
-rw-r--r--bundles/org.eclipse.equinox.bidi.tests/build.properties5
-rw-r--r--bundles/org.eclipse.equinox.bidi.tests/plugin.xml14
-rw-r--r--bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/ComplExpTest.java127
-rw-r--r--bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/ExtensibilityTest.java68
8 files changed, 267 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.bidi.tests/.classpath b/bundles/org.eclipse.equinox.bidi.tests/.classpath
new file mode 100644
index 000000000..2fbb7a23e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.bidi.tests/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.bidi.tests/.project b/bundles/org.eclipse.equinox.bidi.tests/.project
new file mode 100644
index 000000000..ebebe52e8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.bidi.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.bidi.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.bidi.tests/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.bidi.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..b61df922d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.bidi.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Wed Feb 03 11:32:36 EST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.source=1.3
diff --git a/bundles/org.eclipse.equinox.bidi.tests/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.bidi.tests/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..06d34b1a1
--- /dev/null
+++ b/bundles/org.eclipse.equinox.bidi.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: BiDi tests
+Bundle-SymbolicName: org.eclipse.equinox.bidi.tests;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Require-Bundle: org.junit;bundle-version="3.8.2",
+ org.eclipse.equinox.bidi;bundle-version="0.9.0",
+ org.eclipse.equinox.registry;bundle-version="3.5.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.4
+Export-Package: org.eclipse.equinox.bidi.internal.tests;x-internal:=true
diff --git a/bundles/org.eclipse.equinox.bidi.tests/build.properties b/bundles/org.eclipse.equinox.bidi.tests/build.properties
new file mode 100644
index 000000000..e9863e281
--- /dev/null
+++ b/bundles/org.eclipse.equinox.bidi.tests/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/bundles/org.eclipse.equinox.bidi.tests/plugin.xml b/bundles/org.eclipse.equinox.bidi.tests/plugin.xml
new file mode 100644
index 000000000..c70382365
--- /dev/null
+++ b/bundles/org.eclipse.equinox.bidi.tests/plugin.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ id="id2"
+ point="org.eclipse.equinox.bidi.bidiTypes">
+ <typeDescription
+ class="org.eclipse.equinox.bidi.internal.tests.ComplExpTest"
+ description="Test"
+ type="test">
+ </typeDescription>
+ </extension>
+
+</plugin>
diff --git a/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/ComplExpTest.java b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/ComplExpTest.java
new file mode 100644
index 000000000..f514937fe
--- /dev/null
+++ b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/ComplExpTest.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.equinox.bidi.internal.tests;
+
+import org.eclipse.equinox.bidi.complexp.IComplExpProcessor;
+
+public class ComplExpTest implements IComplExpProcessor {
+
+ private static final int[] EMPTY_INT_ARRAY = new int[0];
+ private static final int[][] ALL_LTR = new int[][] { {DIRECTION_LTR, DIRECTION_LTR}, {DIRECTION_LTR, DIRECTION_LTR}};
+
+ public ComplExpTest() {
+ return;
+ }
+
+ public void selectBidiScript(boolean arabic, boolean hebrew) {
+ // empty
+ }
+
+ public boolean handlesArabicScript() {
+ return false;
+ }
+
+ public boolean handlesHebrewScript() {
+ return false;
+ }
+
+ public String leanToFullText(String text) {
+ return text;
+ }
+
+ public String leanToFullText(String text, int initState) {
+ return text;
+ }
+
+ public int[] leanBidiCharOffsets(String text) {
+ return EMPTY_INT_ARRAY;
+ }
+
+ public int[] leanBidiCharOffsets(String text, int initState) {
+ return EMPTY_INT_ARRAY;
+ }
+
+ public int[] leanBidiCharOffsets() {
+ return EMPTY_INT_ARRAY;
+ }
+
+ public int[] fullBidiCharOffsets() {
+ return EMPTY_INT_ARRAY;
+ }
+
+ public String fullToLeanText(String text) {
+ return text;
+ }
+
+ public String fullToLeanText(String text, int initState) {
+ return text;
+ }
+
+ public int getFinalState() {
+ return STATE_NOTHING_GOING;
+ }
+
+ public int leanToFullPos(int pos) {
+ return pos;
+ }
+
+ public int fullToLeanPos(int pos) {
+ return pos;
+ }
+
+ public void assumeMirrored(boolean mirrored) {
+ // empty
+ }
+
+ public boolean isMirrored() {
+ return false;
+ }
+
+ public void assumeOrientation(int orientation) {
+ // empty
+ }
+
+ public int recallOrientation() {
+ return ORIENT_LTR;
+ }
+
+ public void setArabicDirection(int not_mirrored, int mirrored) {
+ // empty
+ }
+
+ public void setArabicDirection(int direction) {
+ // empty
+ }
+
+ public void setHebrewDirection(int not_mirrored, int mirrored) {
+ // empty
+ }
+
+ public void setHebrewDirection(int direction) {
+ // empty
+ }
+
+ public void setDirection(int not_mirrored, int mirrored) {
+ // empty
+ }
+
+ public void setDirection(int direction) {
+ // empty
+ }
+
+ public int[][] getDirection() {
+ return ALL_LTR;
+ }
+
+ public int getCurDirection() {
+ return DIRECTION_LTR;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/ExtensibilityTest.java b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/ExtensibilityTest.java
new file mode 100644
index 000000000..af0ffdcd1
--- /dev/null
+++ b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/ExtensibilityTest.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.equinox.bidi.internal.tests;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.eclipse.equinox.bidi.complexp.IComplExpProcessor;
+import org.eclipse.equinox.bidi.complexp.StringProcessor;
+
+/**
+ * Tests contribution of BiDi processors.
+ */
+public class ExtensibilityTest extends TestCase {
+ public static Test suite() {
+ return new TestSuite(ExtensibilityTest.class);
+ }
+
+ public ExtensibilityTest() {
+ super();
+ }
+
+ public ExtensibilityTest(String name) {
+ super(name);
+ }
+
+ public void testBaseContributions() {
+ String[] types = StringProcessor.getKnownTypes();
+ assertNotNull(types);
+ assertTrue(types.length > 0);
+
+ // check one of the types that we know should be there
+ assertTrue(isTypePresent(types, "regex"));
+
+ IComplExpProcessor processor = StringProcessor.getProcessor("regex");
+ assertNotNull(processor);
+ }
+
+ public void testOtherContributions() {
+ String[] types = StringProcessor.getKnownTypes();
+ assertNotNull(types);
+ assertTrue(types.length > 0);
+
+ // check the type added by the test bundle
+ assertTrue(isTypePresent(types, "test"));
+
+ IComplExpProcessor processor = StringProcessor.getProcessor("test");
+ assertNotNull(processor);
+ }
+
+ private boolean isTypePresent(String[] types, String type) {
+ for(int i = 0; i < types.length; i++) {
+ if ("regex".equalsIgnoreCase(types[i]))
+ return true;
+ }
+ return false;
+ }
+}

Back to the top