Lines 11-18
Link Here
|
11 |
|
11 |
|
12 |
package org.eclipse.equinox.bidi.internal.tests; |
12 |
package org.eclipse.equinox.bidi.internal.tests; |
13 |
|
13 |
|
14 |
import org.eclipse.equinox.bidi.*; |
14 |
import org.eclipse.equinox.bidi.STextEngine; |
15 |
import org.eclipse.equinox.bidi.custom.*; |
15 |
import org.eclipse.equinox.bidi.STextEnvironment; |
|
|
16 |
import org.eclipse.equinox.bidi.custom.STextProcessor; |
16 |
|
17 |
|
17 |
/** |
18 |
/** |
18 |
* Tests most public methods of BidiComplexEngine |
19 |
* Tests most public methods of BidiComplexEngine |
Lines 20-27
Link Here
|
20 |
|
21 |
|
21 |
public class STextMethodsTest extends STextTestBase { |
22 |
public class STextMethodsTest extends STextTestBase { |
22 |
|
23 |
|
23 |
final static int LTR = STextFeatures.DIR_LTR; |
24 |
final static int LTR = STextEngine.DIR_LTR; |
24 |
final static int RTL = STextFeatures.DIR_RTL; |
25 |
final static int RTL = STextEngine.DIR_RTL; |
25 |
final static STextEnvironment envLTR = new STextEnvironment(null, false, STextEnvironment.ORIENT_LTR); |
26 |
final static STextEnvironment envLTR = new STextEnvironment(null, false, STextEnvironment.ORIENT_LTR); |
26 |
final static STextEnvironment envRTL = new STextEnvironment(null, false, STextEnvironment.ORIENT_RTL); |
27 |
final static STextEnvironment envRTL = new STextEnvironment(null, false, STextEnvironment.ORIENT_RTL); |
27 |
final static STextEnvironment envRTLMIR = new STextEnvironment(null, true, STextEnvironment.ORIENT_RTL); |
28 |
final static STextEnvironment envRTLMIR = new STextEnvironment(null, true, STextEnvironment.ORIENT_RTL); |
Lines 29-34
Link Here
|
29 |
final static STextEnvironment envCLR = new STextEnvironment(null, false, STextEnvironment.ORIENT_CONTEXTUAL_LTR); |
30 |
final static STextEnvironment envCLR = new STextEnvironment(null, false, STextEnvironment.ORIENT_CONTEXTUAL_LTR); |
30 |
final static STextEnvironment envCRL = new STextEnvironment(null, false, STextEnvironment.ORIENT_CONTEXTUAL_RTL); |
31 |
final static STextEnvironment envCRL = new STextEnvironment(null, false, STextEnvironment.ORIENT_CONTEXTUAL_RTL); |
31 |
final static STextEnvironment envERR = new STextEnvironment(null, false, 9999); |
32 |
final static STextEnvironment envERR = new STextEnvironment(null, false, 9999); |
|
|
33 |
final static byte AL = Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC; |
34 |
int dirArabic, dirHebrew; |
35 |
|
36 |
class MyComma extends STextProcessor { |
37 |
|
38 |
public String getSeparators(STextEnvironment environment, String text, byte[] dirProps) { |
39 |
return ","; //$NON-NLS-1$ |
40 |
} |
41 |
|
42 |
public boolean skipProcessing(STextEnvironment environment, String text, byte[] dirProps) { |
43 |
byte dirProp = getDirProp(text, dirProps, 0); |
44 |
if (dirProp == AL) |
45 |
return true; |
46 |
return false; |
47 |
} |
48 |
|
49 |
public int getDirection(STextEnvironment environment, String text, byte[] dirProps) { |
50 |
for (int i = 0; i < text.length(); i++) { |
51 |
byte dirProp = getDirProp(text, dirProps, i); |
52 |
if (dirProp == AL) |
53 |
return dirArabic; |
54 |
} |
55 |
return dirHebrew; |
56 |
} |
57 |
} |
58 |
|
59 |
STextProcessor processor; |
32 |
|
60 |
|
33 |
private void doTestTools() { |
61 |
private void doTestTools() { |
34 |
|
62 |
|
Lines 49-68
Link Here
|
49 |
String data, lean, full, model; |
77 |
String data, lean, full, model; |
50 |
int[] state = new int[1]; |
78 |
int[] state = new int[1]; |
51 |
state[0] = -1; |
79 |
state[0] = -1; |
52 |
String type = ISTextTypes.JAVA; |
80 |
processor = STextEngine.PROC_JAVA; |
53 |
data = "A=B+C;/* D=E+F;"; |
81 |
data = "A=B+C;/* D=E+F;"; |
54 |
lean = toUT16(data); |
82 |
lean = toUT16(data); |
55 |
full = STextEngine.leanToFullText(type, null, null, lean, state); |
83 |
full = STextEngine.leanToFullText(processor, null, lean, state); |
56 |
model = "A@=B@+C@;/* D=E+F;"; |
84 |
model = "A@=B@+C@;/* D=E+F;"; |
57 |
assertEquals("full1", model, toPseudo(full)); |
85 |
assertEquals("full1", model, toPseudo(full)); |
58 |
data = "A=B+C; D=E+F;"; |
86 |
data = "A=B+C; D=E+F;"; |
59 |
lean = toUT16(data); |
87 |
lean = toUT16(data); |
60 |
full = STextEngine.leanToFullText(type, null, null, lean, state); |
88 |
full = STextEngine.leanToFullText(processor, null, lean, state); |
61 |
model = "A=B+C; D=E+F;"; |
89 |
model = "A=B+C; D=E+F;"; |
62 |
assertEquals("full2", model, toPseudo(full)); |
90 |
assertEquals("full2", model, toPseudo(full)); |
63 |
data = "A=B+C;*/ D=E+F;"; |
91 |
data = "A=B+C;*/ D=E+F;"; |
64 |
lean = toUT16(data); |
92 |
lean = toUT16(data); |
65 |
full = STextEngine.leanToFullText(type, null, null, lean, state); |
93 |
full = STextEngine.leanToFullText(processor, null, lean, state); |
66 |
model = "A=B+C;@*/ D@=E@+F;"; |
94 |
model = "A=B+C;@*/ D@=E@+F;"; |
67 |
assertEquals("full3", model, toPseudo(full)); |
95 |
assertEquals("full3", model, toPseudo(full)); |
68 |
} |
96 |
} |
Lines 82-169
Link Here
|
82 |
assertEquals("orient #4", STextEnvironment.ORIENT_UNKNOWN, orient); |
110 |
assertEquals("orient #4", STextEnvironment.ORIENT_UNKNOWN, orient); |
83 |
} |
111 |
} |
84 |
|
112 |
|
85 |
private void doTestOrient(STextFeatures f, String label, String data, String resLTR, String resRTL, String resCon) { |
113 |
private void doTestOrient(String label, String data, String resLTR, String resRTL, String resCon) { |
86 |
String full, lean; |
114 |
String full, lean; |
87 |
String type = ISTextTypes.COMMA_DELIMITED; |
|
|
88 |
|
115 |
|
89 |
lean = toUT16(data); |
116 |
lean = toUT16(data); |
90 |
full = STextEngine.leanToFullText(type, f, envLTR, lean, null); |
117 |
full = STextEngine.leanToFullText(processor, envLTR, lean, null); |
91 |
assertEquals(label + "LTR full", resLTR, toPseudo(full)); |
118 |
assertEquals(label + "LTR full", resLTR, toPseudo(full)); |
92 |
full = STextEngine.leanToFullText(type, f, envRTL, lean, null); |
119 |
full = STextEngine.leanToFullText(processor, envRTL, lean, null); |
93 |
assertEquals("label + RTL full", resRTL, toPseudo(full)); |
120 |
assertEquals("label + RTL full", resRTL, toPseudo(full)); |
94 |
full = STextEngine.leanToFullText(type, f, envCRL, lean, null); |
121 |
full = STextEngine.leanToFullText(processor, envCRL, lean, null); |
95 |
assertEquals(label + "CON full", resCon, toPseudo(full)); |
122 |
assertEquals(label + "CON full", resCon, toPseudo(full)); |
96 |
} |
123 |
} |
97 |
|
124 |
|
98 |
private void doTestScripts(STextFeatures f1) { |
125 |
private void doTestSkipProcessing() { |
99 |
STextFeatures f2; |
126 |
processor = new MyComma(); |
100 |
boolean flag; |
127 |
doTestOrient("Skip #1 ", "BCD,EF", "BCD@,EF", ">@BCD@,EF@^", "@BCD@,EF"); |
101 |
flag = f1.getIgnoreArabic(); |
128 |
doTestOrient("Skip #2 ", "#CD,EF", "#CD,EF", ">@#CD,EF@^", "@#CD,EF"); |
102 |
assertFalse("Ignores Arabic 1", flag); |
|
|
103 |
flag = f1.getIgnoreHebrew(); |
104 |
assertFalse("Ignores Hebrew 1", flag); |
105 |
|
106 |
f2 = new STextFeatures(f1.getSeparators(), 0, -1, -1, true, true); |
107 |
flag = f2.getIgnoreArabic(); |
108 |
assertTrue("Ignores Arabic 2", flag); |
109 |
flag = f2.getIgnoreHebrew(); |
110 |
assertTrue("Ignores Hebrew 2", flag); |
111 |
doTestOrient(f2, "Scripts #1 ", "BCD,EF", "BCD,EF", ">@BCD,EF@^", "@BCD,EF"); |
112 |
f2 = new STextFeatures(f1.getSeparators(), 0, -1, -1, false, true); |
113 |
flag = f2.getIgnoreArabic(); |
114 |
assertFalse("Ignores Arabic 3", flag); |
115 |
flag = f2.getIgnoreHebrew(); |
116 |
assertTrue("Ignores Hebrew 3", flag); |
117 |
doTestOrient(f2, "Scripts #2 ", "d,EF", "d,EF", ">@d,EF@^", "d,EF"); |
118 |
doTestOrient(f2, "Scripts #3 ", "#,eF", "#,eF", ">@#,eF@^", "@#,eF"); |
119 |
doTestOrient(f2, "Scripts #4 ", "#,12", "#@,12", ">@#@,12@^", "@#@,12"); |
120 |
doTestOrient(f2, "Scripts #5 ", "#,##", "#@,##", ">@#@,##@^", "@#@,##"); |
121 |
doTestOrient(f2, "Scripts #6 ", "#,89", "#@,89", ">@#@,89@^", "@#@,89"); |
122 |
doTestOrient(f2, "Scripts #7 ", "#,ef", "#,ef", ">@#,ef@^", "@#,ef"); |
123 |
doTestOrient(f2, "Scripts #8 ", "#,", "#,", ">@#,@^", "@#,"); |
124 |
doTestOrient(f2, "Scripts #9 ", "9,ef", "9,ef", ">@9,ef@^", "9,ef"); |
125 |
doTestOrient(f2, "Scripts #10 ", "9,##", "9@,##", ">@9@,##@^", "9@,##"); |
126 |
doTestOrient(f2, "Scripts #11 ", "7,89", "7@,89", ">@7@,89@^", "7@,89"); |
127 |
doTestOrient(f2, "Scripts #12 ", "7,EF", "7,EF", ">@7,EF@^", "@7,EF"); |
128 |
doTestOrient(f2, "Scripts #13 ", "BCD,EF", "BCD,EF", ">@BCD,EF@^", "@BCD,EF"); |
129 |
|
130 |
f2 = new STextFeatures(f1.getSeparators(), 0, -1, -1, true, false); |
131 |
flag = f2.getIgnoreArabic(); |
132 |
assertTrue("Ignores Arabic 4", flag); |
133 |
flag = f2.getIgnoreHebrew(); |
134 |
assertFalse("Ignores Hebrew 4", flag); |
135 |
doTestOrient(f2, "Scripts #14 ", "BCd,EF", "BCd,EF", ">@BCd,EF@^", "@BCd,EF"); |
136 |
doTestOrient(f2, "Scripts #15 ", "BCD,eF", "BCD,eF", ">@BCD,eF@^", "@BCD,eF"); |
137 |
doTestOrient(f2, "Scripts #16 ", "BCD,EF", "BCD@,EF", ">@BCD@,EF@^", "@BCD@,EF"); |
138 |
doTestOrient(f2, "Scripts #17 ", "BCD,12", "BCD@,12", ">@BCD@,12@^", "@BCD@,12"); |
139 |
doTestOrient(f2, "Scripts #18 ", "BCD,", "BCD,", ">@BCD,@^", "@BCD,"); |
140 |
|
141 |
f2 = new STextFeatures(f1.getSeparators(), 0, -1, -1, false, false); |
142 |
doTestOrient(f2, "Scripts #19 ", "123,45|67", "123,45|67", ">@123,45|67@^", "@123,45|67"); |
143 |
doTestOrient(f2, "Scripts #20 ", "5,e", "5,e", ">@5,e@^", "5,e"); |
144 |
doTestOrient(f2, "Scripts #21 ", "5,#", "5@,#", ">@5@,#@^", "5@,#"); |
145 |
doTestOrient(f2, "Scripts #22 ", "5,6", "5@,6", ">@5@,6@^", "5@,6"); |
146 |
doTestOrient(f2, "Scripts #23 ", "5,D", "5@,D", ">@5@,D@^", "5@,D"); |
147 |
doTestOrient(f2, "Scripts #24 ", "5,--", "5,--", ">@5,--@^", "@5,--"); |
148 |
} |
129 |
} |
149 |
|
130 |
|
150 |
private void doTestLeanOffsets() { |
131 |
private void doTestLeanOffsets() { |
151 |
String lean, data, label; |
132 |
String lean, data, label; |
152 |
int[] state = new int[1]; |
133 |
int[] state = new int[1]; |
153 |
String type = ISTextTypes.JAVA; |
134 |
processor = STextEngine.PROC_JAVA; |
154 |
int[] offsets; |
135 |
int[] offsets; |
155 |
int[] model; |
136 |
int[] model; |
156 |
|
137 |
|
157 |
data = "A=B+C;/* D=E+F;"; |
138 |
data = "A=B+C;/* D=E+F;"; |
158 |
lean = toUT16(data); |
139 |
lean = toUT16(data); |
159 |
state[0] = -1; |
140 |
state[0] = -1; |
160 |
offsets = STextEngine.leanBidiCharOffsets(type, null, null, lean, state); |
141 |
offsets = STextEngine.leanBidiCharOffsets(processor, null, lean, state); |
161 |
model = new int[] {1, 3, 5}; |
142 |
model = new int[] {1, 3, 5}; |
162 |
label = "leanBidiCharOffsets() #1 "; |
143 |
label = "leanBidiCharOffsets() #1 "; |
163 |
assertEquals(label, array_display(model), array_display(offsets)); |
144 |
assertEquals(label, array_display(model), array_display(offsets)); |
164 |
data = "A=B+C;*/ D=E+F;"; |
145 |
data = "A=B+C;*/ D=E+F;"; |
165 |
lean = toUT16(data); |
146 |
lean = toUT16(data); |
166 |
offsets = STextEngine.leanBidiCharOffsets(type, null, null, lean, state); |
147 |
offsets = STextEngine.leanBidiCharOffsets(processor, null, lean, state); |
167 |
model = new int[] {6, 10, 12}; |
148 |
model = new int[] {6, 10, 12}; |
168 |
label = "leanBidiCharOffsets() #2 "; |
149 |
label = "leanBidiCharOffsets() #2 "; |
169 |
assertEquals(label, array_display(model), array_display(offsets)); |
150 |
assertEquals(label, array_display(model), array_display(offsets)); |
Lines 172-190
Link Here
|
172 |
private void doTestFullOffsets(String label, String data, int[] resLTR, int[] resRTL, int[] resCon) { |
153 |
private void doTestFullOffsets(String label, String data, int[] resLTR, int[] resRTL, int[] resCon) { |
173 |
String full, lean, msg; |
154 |
String full, lean, msg; |
174 |
int[] offsets; |
155 |
int[] offsets; |
175 |
String type = ISTextTypes.COMMA_DELIMITED; |
156 |
processor = STextEngine.PROC_COMMA_DELIMITED; |
176 |
|
157 |
|
177 |
lean = toUT16(data); |
158 |
lean = toUT16(data); |
178 |
full = STextEngine.leanToFullText(type, null, envLTR, lean, null); |
159 |
full = STextEngine.leanToFullText(processor, envLTR, lean, null); |
179 |
offsets = STextEngine.fullBidiCharOffsets(type, null, envLTR, full, null); |
160 |
offsets = STextEngine.fullBidiCharOffsets(processor, envLTR, full, null); |
180 |
msg = label + "LTR "; |
161 |
msg = label + "LTR "; |
181 |
assertEquals(msg, array_display(resLTR), array_display(offsets)); |
162 |
assertEquals(msg, array_display(resLTR), array_display(offsets)); |
182 |
full = STextEngine.leanToFullText(type, null, envRTL, lean, null); |
163 |
full = STextEngine.leanToFullText(processor, envRTL, lean, null); |
183 |
offsets = STextEngine.fullBidiCharOffsets(type, null, envRTL, full, null); |
164 |
offsets = STextEngine.fullBidiCharOffsets(processor, envRTL, full, null); |
184 |
msg = label + "RTL "; |
165 |
msg = label + "RTL "; |
185 |
assertEquals(msg, array_display(resRTL), array_display(offsets)); |
166 |
assertEquals(msg, array_display(resRTL), array_display(offsets)); |
186 |
full = STextEngine.leanToFullText(type, null, envCLR, lean, null); |
167 |
full = STextEngine.leanToFullText(processor, envCLR, lean, null); |
187 |
offsets = STextEngine.fullBidiCharOffsets(type, null, envCLR, full, null); |
168 |
offsets = STextEngine.fullBidiCharOffsets(processor, envCLR, full, null); |
188 |
msg = label + "CON "; |
169 |
msg = label + "CON "; |
189 |
assertEquals(msg, array_display(resCon), array_display(offsets)); |
170 |
assertEquals(msg, array_display(resCon), array_display(offsets)); |
190 |
} |
171 |
} |
Lines 200-278
Link Here
|
200 |
|
181 |
|
201 |
private void doTestDirection() { |
182 |
private void doTestDirection() { |
202 |
String data, lean, full, model, msg; |
183 |
String data, lean, full, model, msg; |
203 |
ISTextProcessor processor = STextStringProcessor.getProcessor(ISTextTypes.COMMA_DELIMITED); |
184 |
int dirA, dirH; |
204 |
STextFeatures f1 = processor.getFeatures(null); |
185 |
processor = new MyComma(); |
|
|
186 |
dirArabic = RTL; |
187 |
dirHebrew = LTR; |
205 |
msg = "TestDirection #1"; |
188 |
msg = "TestDirection #1"; |
206 |
assertTrue(msg, f1.getDirArabic() == LTR && f1.getDirHebrew() == LTR); |
189 |
dirA = processor.getDirection(null, toUT16("###"), null); |
|
|
190 |
dirH = processor.getDirection(null, toUT16("ABC"), null); |
191 |
assertTrue(msg, dirA == RTL && dirH == LTR); |
207 |
|
192 |
|
208 |
STextFeatures f2 = new STextFeatures(f1.getSeparators(), 0, RTL, RTL, false, false); |
193 |
dirArabic = RTL; |
209 |
f1 = f2; |
194 |
dirHebrew = RTL; |
210 |
msg = "TestDirection #2"; |
195 |
msg = "TestDirection #2"; |
211 |
assertTrue(msg, f1.getDirArabic() == RTL && f1.getDirHebrew() == RTL); |
196 |
dirA = processor.getDirection(null, toUT16("###"), null); |
|
|
197 |
dirH = processor.getDirection(null, toUT16("ABC"), null); |
198 |
assertTrue(msg, dirA == RTL && dirH == RTL); |
212 |
|
199 |
|
213 |
STextEnvironment environment = new STextEnvironment(null, false, STextEnvironment.ORIENT_LTR); |
200 |
dirArabic = dirHebrew = LTR; |
214 |
processor = STextStringProcessor.getProcessor(ISTextTypes.EMAIL); |
|
|
215 |
f1 = processor.getFeatures(environment); |
216 |
msg = "TestDirection #3"; |
201 |
msg = "TestDirection #3"; |
217 |
assertTrue(msg, f1.getDirArabic() == LTR && f1.getDirHebrew() == LTR); |
202 |
data = "ABC,#DEF,HOST,com"; |
218 |
data = "#ABC.#DEF:HOST.com"; |
|
|
219 |
lean = toUT16(data); |
203 |
lean = toUT16(data); |
220 |
full = STextEngine.leanToFullText(processor, null, environment, lean, null); |
204 |
full = STextEngine.leanToFullText(processor, null, lean, null); |
221 |
model = "#ABC@.#DEF@:HOST.com"; |
205 |
model = "ABC@,#DEF@,HOST,com"; |
222 |
assertEquals("TestDirection #9 full", model, toPseudo(full)); |
206 |
assertEquals("TestDirection #9 full", model, toPseudo(full)); |
223 |
|
207 |
|
224 |
data = "ABC.DEF:HOST.com"; |
208 |
data = "ABC,DEF,HOST,com"; |
225 |
lean = toUT16(data); |
209 |
lean = toUT16(data); |
226 |
full = STextEngine.leanToFullText(processor, null, environment, lean, null); |
210 |
full = STextEngine.leanToFullText(processor, null, lean, null); |
227 |
model = "ABC@.DEF@:HOST.com"; |
211 |
model = "ABC@,DEF@,HOST,com"; |
228 |
assertEquals("TestDirection #10 full", model, toPseudo(full)); |
212 |
assertEquals("TestDirection #10 full", model, toPseudo(full)); |
229 |
|
213 |
|
230 |
environment = new STextEnvironment(null, true, STextEnvironment.ORIENT_LTR); |
214 |
dirArabic = RTL; |
231 |
f1 = processor.getFeatures(environment); |
|
|
232 |
msg = "TestDirection #10.5"; |
215 |
msg = "TestDirection #10.5"; |
233 |
assertTrue(msg, f1.getDirArabic() == RTL && f1.getDirHebrew() == LTR); |
216 |
dirA = processor.getDirection(null, toUT16("###"), null); |
234 |
data = "#ABC.#DEF:HOST.com"; |
217 |
dirH = processor.getDirection(null, toUT16("ABC"), null); |
|
|
218 |
assertTrue(msg, dirA == RTL && dirH == LTR); |
219 |
STextEnvironment environment = new STextEnvironment(null, true, STextEnvironment.ORIENT_LTR); |
220 |
data = "ABC,#DEF,HOST,com"; |
235 |
lean = toUT16(data); |
221 |
lean = toUT16(data); |
236 |
full = STextEngine.leanToFullText(processor, null, environment, lean, null); |
222 |
full = STextEngine.leanToFullText(processor, environment, lean, null); |
237 |
model = "<&#ABC.#DEF:HOST.com&^"; |
223 |
model = "<&ABC,#DEF,HOST,com&^"; |
238 |
assertEquals("TestDirection #11 full", model, toPseudo(full)); |
224 |
assertEquals("TestDirection #11 full", model, toPseudo(full)); |
239 |
|
225 |
|
240 |
data = "#ABc.#DEF:HOSt.COM"; |
226 |
data = "ABc,#DEF,HOSt,COM"; |
241 |
lean = toUT16(data); |
227 |
lean = toUT16(data); |
242 |
full = STextEngine.leanToFullText(processor, null, environment, lean, null); |
228 |
full = STextEngine.leanToFullText(processor, environment, lean, null); |
243 |
model = "<&#ABc.#DEF:HOSt.COM&^"; |
229 |
model = "<&ABc,#DEF,HOSt,COM&^"; |
244 |
assertEquals("TestDirection #12 full", model, toPseudo(full)); |
230 |
assertEquals("TestDirection #12 full", model, toPseudo(full)); |
245 |
|
231 |
|
246 |
data = "#ABc.#DEF:HOSt."; |
232 |
data = "ABc,#DEF,HOSt,"; |
247 |
lean = toUT16(data); |
233 |
lean = toUT16(data); |
248 |
full = STextEngine.leanToFullText(processor, null, environment, lean, null); |
234 |
full = STextEngine.leanToFullText(processor, environment, lean, null); |
249 |
model = "<&#ABc.#DEF:HOSt.&^"; |
235 |
model = "<&ABc,#DEF,HOSt,&^"; |
250 |
assertEquals("TestDirection #13 full", model, toPseudo(full)); |
236 |
assertEquals("TestDirection #13 full", model, toPseudo(full)); |
251 |
|
237 |
|
252 |
data = "ABC.DEF:HOST.com"; |
238 |
data = "ABC,DEF,HOST,com"; |
253 |
lean = toUT16(data); |
239 |
lean = toUT16(data); |
254 |
full = STextEngine.leanToFullText(processor, null, environment, lean, null); |
240 |
full = STextEngine.leanToFullText(processor, environment, lean, null); |
255 |
model = "ABC@.DEF@:HOST.com"; |
241 |
model = "ABC@,DEF@,HOST,com"; |
256 |
assertEquals("TestDirection #14 full", model, toPseudo(full)); |
242 |
assertEquals("TestDirection #14 full", model, toPseudo(full)); |
257 |
|
243 |
|
258 |
data = "--.---:----"; |
244 |
data = "--,---,----"; |
259 |
lean = toUT16(data); |
245 |
lean = toUT16(data); |
260 |
full = STextEngine.leanToFullText(processor, null, environment, lean, null); |
246 |
full = STextEngine.leanToFullText(processor, environment, lean, null); |
261 |
model = "--.---:----"; |
247 |
model = "--,---,----"; |
262 |
assertEquals("TestDirection #15 full", model, toPseudo(full)); |
248 |
assertEquals("TestDirection #15 full", model, toPseudo(full)); |
263 |
|
249 |
|
264 |
data = "ABC.|DEF:HOST.com"; |
250 |
data = "ABC,|DEF,HOST,com"; |
265 |
lean = toUT16(data); |
251 |
lean = toUT16(data); |
266 |
full = STextEngine.leanToFullText(processor, null, environment, lean, null); |
252 |
full = STextEngine.leanToFullText(processor, environment, lean, null); |
267 |
model = "ABC.|DEF@:HOST.com"; |
253 |
model = "ABC,|DEF@,HOST,com"; |
268 |
assertEquals("TestDirection #16 full", model, toPseudo(full)); |
254 |
assertEquals("TestDirection #16 full", model, toPseudo(full)); |
269 |
|
255 |
|
270 |
data = "#ABc.|#DEF:HOST.com"; |
256 |
data = "ABc,|#DEF,HOST,com"; |
271 |
lean = toUT16(data); |
257 |
lean = toUT16(data); |
272 |
full = STextEngine.leanToFullText(processor, null, envRTLMIR, lean, null); |
258 |
full = STextEngine.leanToFullText(processor, envRTLMIR, lean, null); |
273 |
model = "#ABc.|#DEF:HOST.com"; |
259 |
model = "ABc,|#DEF,HOST,com"; |
274 |
assertEquals("TestDirection #17 full", model, toPseudo(full)); |
260 |
assertEquals("TestDirection #17 full", model, toPseudo(full)); |
275 |
assertEquals("Test curDirection", RTL, STextEngine.getCurDirection(processor, null, envRTLMIR, lean)); |
261 |
assertEquals("Test curDirection", RTL, STextEngine.getCurDirection(processor, envRTLMIR, lean)); |
276 |
} |
262 |
} |
277 |
|
263 |
|
278 |
public void testMethods() { |
264 |
public void testMethods() { |
Lines 283-301
Link Here
|
283 |
|
269 |
|
284 |
doTestOrientation(); |
270 |
doTestOrientation(); |
285 |
|
271 |
|
286 |
ISTextProcessor processor = STextStringProcessor.getProcessor(ISTextTypes.COMMA_DELIMITED); |
272 |
processor = STextEngine.PROC_COMMA_DELIMITED; |
287 |
STextFeatures f = processor.getFeatures(null); |
273 |
doTestOrient("Methods #1 ", "", "", "", ""); |
288 |
doTestOrient(f, "Methods #1 ", "", "", "", ""); |
274 |
doTestOrient("Methods #2 ", "abc", "abc", ">@abc@^", "abc"); |
289 |
doTestOrient(f, "Methods #2 ", "abc", "abc", ">@abc@^", "abc"); |
275 |
doTestOrient("Methods #3 ", "ABC", "ABC", ">@ABC@^", "@ABC"); |
290 |
doTestOrient(f, "Methods #3 ", "ABC", "ABC", ">@ABC@^", "@ABC"); |
276 |
doTestOrient("Methods #4 ", "bcd,ef", "bcd,ef", ">@bcd,ef@^", "bcd,ef"); |
291 |
doTestOrient(f, "Methods #4 ", "bcd,ef", "bcd,ef", ">@bcd,ef@^", "bcd,ef"); |
277 |
doTestOrient("Methods #5 ", "BCD,EF", "BCD@,EF", ">@BCD@,EF@^", "@BCD@,EF"); |
292 |
doTestOrient(f, "Methods #5 ", "BCD,EF", "BCD@,EF", ">@BCD@,EF@^", "@BCD@,EF"); |
278 |
doTestOrient("Methods #6 ", "cde,FG", "cde,FG", ">@cde,FG@^", "cde,FG"); |
293 |
doTestOrient(f, "Methods #6 ", "cde,FG", "cde,FG", ">@cde,FG@^", "cde,FG"); |
279 |
doTestOrient("Methods #7 ", "CDE,fg", "CDE,fg", ">@CDE,fg@^", "@CDE,fg"); |
294 |
doTestOrient(f, "Methods #7 ", "CDE,fg", "CDE,fg", ">@CDE,fg@^", "@CDE,fg"); |
280 |
doTestOrient("Methods #8 ", "12..def,GH", "12..def,GH", ">@12..def,GH@^", "12..def,GH"); |
295 |
doTestOrient(f, "Methods #8 ", "12..def,GH", "12..def,GH", ">@12..def,GH@^", "12..def,GH"); |
281 |
doTestOrient("Methods #9 ", "34..DEF,gh", "34..DEF,gh", ">@34..DEF,gh@^", "@34..DEF,gh"); |
296 |
doTestOrient(f, "Methods #9 ", "34..DEF,gh", "34..DEF,gh", ">@34..DEF,gh@^", "@34..DEF,gh"); |
|
|
297 |
|
282 |
|
298 |
doTestScripts(f); |
283 |
doTestSkipProcessing(); |
299 |
|
284 |
|
300 |
doTestLeanOffsets(); |
285 |
doTestLeanOffsets(); |
301 |
|
286 |
|
Lines 305-314
Link Here
|
305 |
|
290 |
|
306 |
doTestDirection(); |
291 |
doTestDirection(); |
307 |
|
292 |
|
308 |
String type = ISTextTypes.COMMA_DELIMITED; |
293 |
processor = STextEngine.PROC_COMMA_DELIMITED; |
309 |
String data = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"; |
294 |
String data = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"; |
310 |
String lean = toUT16(data); |
295 |
String lean = toUT16(data); |
311 |
String full = STextEngine.leanToFullText(type, null, null, lean, null); |
296 |
String full = STextEngine.leanToFullText(processor, null, lean, null); |
312 |
String model = "A@,B@,C@,D@,E@,F@,G@,H@,I@,J@,K@,L@,M@,N@,O@,P@,Q@,R@,S@,T@,U@,V@,W@,X@,Y@,Z"; |
297 |
String model = "A@,B@,C@,D@,E@,F@,G@,H@,I@,J@,K@,L@,M@,N@,O@,P@,Q@,R@,S@,T@,U@,V@,W@,X@,Y@,Z"; |
313 |
assertEquals("many inserts", model, toPseudo(full)); |
298 |
assertEquals("many inserts", model, toPseudo(full)); |
314 |
} |
299 |
} |