diff options
author | Oleg Besedin | 2011-07-26 18:27:46 +0000 |
---|---|---|
committer | Oleg Besedin | 2011-07-27 19:30:15 +0000 |
commit | b7cf1b1837caf9691753413b9e42103d312d4347 (patch) | |
tree | b2d732490d3e2c0f1eeb935f71b2ecefd750f3a2 /bundles/org.eclipse.equinox.bidi.tests | |
parent | 2883815e408713e8fb8200d84294a2b8789943e7 (diff) | |
download | rt.equinox.bundles-b7cf1b1837caf9691753413b9e42103d312d4347.tar.gz rt.equinox.bundles-b7cf1b1837caf9691753413b9e42103d312d4347.tar.xz rt.equinox.bundles-b7cf1b1837caf9691753413b9e42103d312d4347.zip |
Bug 183164 - API direction cache
Diffstat (limited to 'bundles/org.eclipse.equinox.bidi.tests')
4 files changed, 28 insertions, 22 deletions
diff --git a/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextMethodsTest.java b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextMethodsTest.java index ebfabd96c..933f761a2 100644 --- a/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextMethodsTest.java +++ b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextMethodsTest.java @@ -12,6 +12,7 @@ package org.eclipse.equinox.bidi.internal.tests; import org.eclipse.equinox.bidi.*; +import org.eclipse.equinox.bidi.custom.STextDirections; import org.eclipse.equinox.bidi.custom.STextProcessor; /** @@ -34,20 +35,20 @@ public class STextMethodsTest extends STextTestBase { class MyComma extends STextProcessor { - public String getSeparators(STextEnvironment environment, String text, byte[] dirProps) { + public String getSeparators(STextEnvironment environment, String text, STextDirections dirProps) { return ","; //$NON-NLS-1$ } - public boolean skipProcessing(STextEnvironment environment, String text, byte[] dirProps) { - byte dirProp = getDirProp(text, dirProps, 0); + public boolean skipProcessing(STextEnvironment environment, String text, STextDirections dirProps) { + byte dirProp = dirProps.getOrientationAt(0); if (dirProp == AL) return true; return false; } - public int getDirection(STextEnvironment environment, String text, byte[] dirProps) { + public int getDirection(STextEnvironment environment, String text, STextDirections dirProps) { for (int i = 0; i < text.length(); i++) { - byte dirProp = getDirProp(text, dirProps, i); + byte dirProp = dirProps.getOrientationAt(i); if (dirProp == AL) return dirArabic; } @@ -185,15 +186,19 @@ public class STextMethodsTest extends STextTestBase { dirArabic = RTL; dirHebrew = LTR; msg = "TestDirection #1"; - dirA = processor.getDirection(null, toUT16("###"), null); - dirH = processor.getDirection(null, toUT16("ABC"), null); + String text = toUT16("###"); + dirA = processor.getDirection(null, text, new STextDirections(text)); + text = toUT16("ABC"); + dirH = processor.getDirection(null, toUT16("ABC"), new STextDirections(text)); assertTrue(msg, dirA == RTL && dirH == LTR); dirArabic = RTL; dirHebrew = RTL; msg = "TestDirection #2"; - dirA = processor.getDirection(null, toUT16("###"), null); - dirH = processor.getDirection(null, toUT16("ABC"), null); + text = toUT16("###"); + dirA = processor.getDirection(null, text, new STextDirections(text)); + text = toUT16("ABC"); + dirH = processor.getDirection(null, text, new STextDirections(text)); assertTrue(msg, dirA == RTL && dirH == RTL); dirArabic = dirHebrew = LTR; @@ -212,8 +217,10 @@ public class STextMethodsTest extends STextTestBase { dirArabic = RTL; msg = "TestDirection #10.5"; - dirA = processor.getDirection(null, toUT16("###"), null); - dirH = processor.getDirection(null, toUT16("ABC"), null); + text = toUT16("###"); + dirA = processor.getDirection(null, text, new STextDirections(text)); + text = toUT16("ABC"); + dirH = processor.getDirection(null, text, new STextDirections(text)); assertTrue(msg, dirA == RTL && dirH == LTR); STextEnvironment environment = new STextEnvironment(null, true, STextEnvironment.ORIENT_LTR); data = "ABC,#DEF,HOST,com"; diff --git a/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextNullProcessorTest.java b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextNullProcessorTest.java index 00fedc931..09fb238bc 100644 --- a/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextNullProcessorTest.java +++ b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextNullProcessorTest.java @@ -14,7 +14,7 @@ package org.eclipse.equinox.bidi.internal.tests; import org.eclipse.equinox.bidi.STextEngine; /** - * Tests RTL arithmetic + * Tests null processor */ public class STextNullProcessorTest extends STextTestBase { diff --git a/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextSomeMoreTest.java b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextSomeMoreTest.java index 88d89b3af..4e64ee83f 100644 --- a/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextSomeMoreTest.java +++ b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextSomeMoreTest.java @@ -13,6 +13,7 @@ package org.eclipse.equinox.bidi.internal.tests; import org.eclipse.equinox.bidi.STextEngine; import org.eclipse.equinox.bidi.STextEnvironment; +import org.eclipse.equinox.bidi.custom.STextDirections; import org.eclipse.equinox.bidi.custom.STextProcessor; /** @@ -26,15 +27,15 @@ public class STextSomeMoreTest extends STextTestBase { class Processor1 extends STextProcessor { - public int getSpecialsCount(STextEnvironment env, String text, byte[] dirProps) { + public int getSpecialsCount(STextEnvironment env, String text, STextDirections dirProps) { return 1; } - public int indexOfSpecial(STextEnvironment env, String text, byte[] dirProps, int[] offsets, int caseNumber, int fromIndex) { + public int indexOfSpecial(STextEnvironment env, String text, STextDirections dirProps, int[] offsets, int caseNumber, int fromIndex) { return fromIndex; } - public int processSpecial(STextEnvironment env, String text, byte[] dirProps, int[] offsets, int[] state, int caseNumber, int separLocation) { + public int processSpecial(STextEnvironment env, String text, STextDirections dirProps, int[] offsets, int[] state, int caseNumber, int separLocation) { int len = text.length(); for (int i = len - 1; i >= 0; i--) { STextProcessor.insertMark(text, dirProps, offsets, i); @@ -46,7 +47,7 @@ public class STextSomeMoreTest extends STextTestBase { class Processor2 extends STextProcessor { - public int getSpecialsCount(STextEnvironment env, String text, byte[] dirProps) { + public int getSpecialsCount(STextEnvironment env, String text, STextDirections dirProps) { return 1; } @@ -54,11 +55,11 @@ public class STextSomeMoreTest extends STextTestBase { class Processor3 extends STextProcessor { - public int getSpecialsCount(STextEnvironment env, String text, byte[] dirProps) { + public int getSpecialsCount(STextEnvironment env, String text, STextDirections dirProps) { return 1; } - public int indexOfSpecial(STextEnvironment env, String text, byte[] dirProps, int[] offsets, int caseNumber, int fromIndex) { + public int indexOfSpecial(STextEnvironment env, String text, STextDirections dirProps, int[] offsets, int caseNumber, int fromIndex) { return fromIndex; } } diff --git a/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextTest.java b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextTest.java index f70828f41..6d8149a6b 100644 --- a/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextTest.java +++ b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextTest.java @@ -10,13 +10,11 @@ ******************************************************************************/ package org.eclipse.equinox.bidi.internal.tests; -import org.eclipse.equinox.bidi.STextEnvironment; import org.eclipse.equinox.bidi.custom.STextProcessor; public class STextTest extends STextProcessor { - public String getSeparators(STextEnvironment env, String text, byte[] dirProps) { - return "-=.:"; + public STextTest() { + super("-=.:"); } - } |