View | Details | Raw Unified | Return to bug 183164 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/equinox/bidi/internal/tests/STextFullToLeanTest.java (-2 / +2 lines)
Lines 68-81 Link Here
68
		data = "update \"AB_CDE\" set \"COL1\"@='01', \"COL2\"@='02' /* GH IJK";
68
		data = "update \"AB_CDE\" set \"COL1\"@='01', \"COL2\"@='02' /* GH IJK";
69
		text = toUT16(data);
69
		text = toUT16(data);
70
		ISTextExpert expertLTR = STextExpertFactory.getPrivateExpert(type, envLTR);
70
		ISTextExpert expertLTR = STextExpertFactory.getPrivateExpert(type, envLTR);
71
		expertLTR.resetState();
71
		expertLTR.clearState();
72
		lean = expertLTR.fullToLeanText(text);
72
		lean = expertLTR.fullToLeanText(text);
73
73
74
		state1 = expertLTR.getState();
74
		state1 = expertLTR.getState();
75
		model = "update \"AB_CDE\" set \"COL1\"='01', \"COL2\"='02' /* GH IJK";
75
		model = "update \"AB_CDE\" set \"COL1\"='01', \"COL2\"='02' /* GH IJK";
76
		assertEquals(msg + "LTR lean", model, toPseudo(lean));
76
		assertEquals(msg + "LTR lean", model, toPseudo(lean));
77
		ISTextExpert expertLTR2 = STextExpertFactory.getPrivateExpert(type, envLTR);
77
		ISTextExpert expertLTR2 = STextExpertFactory.getPrivateExpert(type, envLTR);
78
		expertLTR2.resetState();
78
		expertLTR2.clearState();
79
		full = expertLTR2.leanToFullText(lean);
79
		full = expertLTR2.leanToFullText(lean);
80
80
81
		assertEquals(msg + "LTR full", data, toPseudo(full));
81
		assertEquals(msg + "LTR full", data, toPseudo(full));
(-)src/org/eclipse/equinox/bidi/internal/tests/STextMethodsTest.java (-7 / +7 lines)
Lines 165-177 Link Here
165
		String data, lean, full, model;
165
		String data, lean, full, model;
166
		int dirA, dirH;
166
		int dirA, dirH;
167
		ISTextExpert expertRL = STextExpertFactory.getExpert("test.MyCommaRL");
167
		ISTextExpert expertRL = STextExpertFactory.getExpert("test.MyCommaRL");
168
		dirA = expertRL.getCurDirection(toUT16("###"));
168
		dirA = expertRL.getTextDirection(toUT16("###"));
169
		dirH = expertRL.getCurDirection(toUT16("ABC"));
169
		dirH = expertRL.getTextDirection(toUT16("ABC"));
170
		assertTrue("TestDirection #1", dirA == RTL && dirH == LTR);
170
		assertTrue("TestDirection #1", dirA == RTL && dirH == LTR);
171
171
172
		ISTextExpert expertRR = STextExpertFactory.getExpert("test.MyCommaRR");
172
		ISTextExpert expertRR = STextExpertFactory.getExpert("test.MyCommaRR");
173
		dirA = expertRR.getCurDirection(toUT16("###"));
173
		dirA = expertRR.getTextDirection(toUT16("###"));
174
		dirH = expertRR.getCurDirection(toUT16("ABC"));
174
		dirH = expertRR.getTextDirection(toUT16("ABC"));
175
		assertTrue("TestDirection #2", dirA == RTL && dirH == RTL);
175
		assertTrue("TestDirection #2", dirA == RTL && dirH == RTL);
176
176
177
		ISTextExpert expertLL = STextExpertFactory.getExpert("test.MyCommaLL");
177
		ISTextExpert expertLL = STextExpertFactory.getExpert("test.MyCommaLL");
Lines 186-193 Link Here
186
186
187
		STextEnvironment environment = new STextEnvironment(null, true, STextEnvironment.ORIENT_LTR);
187
		STextEnvironment environment = new STextEnvironment(null, true, STextEnvironment.ORIENT_LTR);
188
		ISTextExpert expert = STextExpertFactory.getExpert("test.MyCommaRL", environment);
188
		ISTextExpert expert = STextExpertFactory.getExpert("test.MyCommaRL", environment);
189
		dirA = expert.getCurDirection(toUT16("###"));
189
		dirA = expert.getTextDirection(toUT16("###"));
190
		dirH = expert.getCurDirection(toUT16("ABC"));
190
		dirH = expert.getTextDirection(toUT16("ABC"));
191
		assertTrue("TestDirection #10.5", dirA == RTL && dirH == LTR);
191
		assertTrue("TestDirection #10.5", dirA == RTL && dirH == LTR);
192
192
193
		lean = toUT16("ABC,#DEF,HOST,com");
193
		lean = toUT16("ABC,#DEF,HOST,com");
Lines 231-237 Link Here
231
		full = expert.leanToFullText(lean);
231
		full = expert.leanToFullText(lean);
232
		model = "ABc,|#DEF,HOST,com";
232
		model = "ABc,|#DEF,HOST,com";
233
		assertEquals("TestDirection #17 full", model, toPseudo(full));
233
		assertEquals("TestDirection #17 full", model, toPseudo(full));
234
		int dir = expert.getCurDirection(lean);
234
		int dir = expert.getTextDirection(lean);
235
		assertEquals("Test curDirection", RTL, dir);
235
		assertEquals("Test curDirection", RTL, dir);
236
	}
236
	}
237
237
(-)src/org/eclipse/equinox/bidi/internal/tests/STextProcessorTest.java (-6 / +4 lines)
Lines 12-20 Link Here
12
package org.eclipse.equinox.bidi.internal.tests;
12
package org.eclipse.equinox.bidi.internal.tests;
13
13
14
import java.util.Locale;
14
import java.util.Locale;
15
import org.eclipse.equinox.bidi.STextProcessor;
15
import org.eclipse.equinox.bidi.STextTypeHandlerFactory;
16
import org.eclipse.equinox.bidi.STextTypeHandlerFactory;
16
import org.eclipse.equinox.bidi.STextProcessor;
17
import org.eclipse.equinox.bidi.custom.STextTypeHandler;
18
17
19
/**
18
/**
20
 * Tests methods in BidiComplexUtil
19
 * Tests methods in BidiComplexUtil
Lines 84-93 Link Here
84
	}
83
	}
85
84
86
	private void doTest3(String msg, String data, String result, String resLean) {
85
	private void doTest3(String msg, String data, String result, String resLean) {
87
		STextTypeHandler handler = STextTypeHandlerFactory.getHandler(STextTypeHandlerFactory.COMMA_DELIMITED);
86
		String full = STextProcessor.processTyped(toUT16(data), STextTypeHandlerFactory.COMMA_DELIMITED);
88
		String full = STextProcessor.process(toUT16(data), handler);
89
		assertEquals(msg + "full", result, toPseudo(full));
87
		assertEquals(msg + "full", result, toPseudo(full));
90
		String lean = STextProcessor.deprocess(full, handler);
88
		String lean = STextProcessor.deprocessTyped(full, STextTypeHandlerFactory.COMMA_DELIMITED);
91
		assertEquals(msg + "lean", resLean, toPseudo(lean));
89
		assertEquals(msg + "lean", resLean, toPseudo(lean));
92
	}
90
	}
93
91
Lines 98-104 Link Here
98
		assertEquals(txt, result, toPseudo(full));
96
		assertEquals(txt, result, toPseudo(full));
99
	}
97
	}
100
98
101
	public void testBidiComplexUtil() {
99
	public void testSTextProcessor() {
102
100
103
		// Test process() and deprocess() with default delimiters
101
		// Test process() and deprocess() with default delimiters
104
		doTest1("ABC/DEF/G", ">@ABC@/DEF@/G@^");
102
		doTest1("ABC/DEF/G", ">@ABC@/DEF@/G@^");
(-)src/org/eclipse/equinox/bidi/internal/tests/TestHandler1.java (-4 / +3 lines)
Lines 11-30 Link Here
11
package org.eclipse.equinox.bidi.internal.tests;
11
package org.eclipse.equinox.bidi.internal.tests;
12
12
13
import org.eclipse.equinox.bidi.advanced.ISTextExpert;
13
import org.eclipse.equinox.bidi.advanced.ISTextExpert;
14
import org.eclipse.equinox.bidi.advanced.STextEnvironment;
15
import org.eclipse.equinox.bidi.custom.*;
14
import org.eclipse.equinox.bidi.custom.*;
16
15
17
public class TestHandler1 extends STextTypeHandler {
16
public class TestHandler1 extends STextTypeHandler {
18
17
19
	public int getSpecialsCount(STextEnvironment env) {
18
	public int getSpecialsCount(ISTextExpert expert) {
20
		return 1;
19
		return 1;
21
	}
20
	}
22
21
23
	public int indexOfSpecial(STextEnvironment env, String text, STextCharTypes charTypes, STextOffsets offsets, int caseNumber, int fromIndex) {
22
	public int indexOfSpecial(ISTextExpert expert, String text, STextCharTypes charTypes, STextOffsets offsets, int caseNumber, int fromIndex) {
24
		return fromIndex;
23
		return fromIndex;
25
	}
24
	}
26
25
27
	public int processSpecial(ISTextExpert expert, STextEnvironment env, String text, STextCharTypes charTypes, STextOffsets offsets, int caseNumber, int separLocation) {
26
	public int processSpecial(ISTextExpert expert, String text, STextCharTypes charTypes, STextOffsets offsets, int caseNumber, int separLocation) {
28
		int len = text.length();
27
		int len = text.length();
29
		for (int i = len - 1; i >= 0; i--) {
28
		for (int i = len - 1; i >= 0; i--) {
30
			STextTypeHandler.insertMark(text, charTypes, offsets, i);
29
			STextTypeHandler.insertMark(text, charTypes, offsets, i);
(-)src/org/eclipse/equinox/bidi/internal/tests/TestHandler2.java (-2 / +2 lines)
Lines 10-21 Link Here
10
 ******************************************************************************/
10
 ******************************************************************************/
11
package org.eclipse.equinox.bidi.internal.tests;
11
package org.eclipse.equinox.bidi.internal.tests;
12
12
13
import org.eclipse.equinox.bidi.advanced.STextEnvironment;
13
import org.eclipse.equinox.bidi.advanced.ISTextExpert;
14
import org.eclipse.equinox.bidi.custom.STextTypeHandler;
14
import org.eclipse.equinox.bidi.custom.STextTypeHandler;
15
15
16
public class TestHandler2 extends STextTypeHandler {
16
public class TestHandler2 extends STextTypeHandler {
17
17
18
	public int getSpecialsCount(STextEnvironment env) {
18
	public int getSpecialsCount(ISTextExpert expert) {
19
		return 1;
19
		return 1;
20
	}
20
	}
21
21
(-)src/org/eclipse/equinox/bidi/internal/tests/TestHandler3.java (-3 / +3 lines)
Lines 10-25 Link Here
10
 ******************************************************************************/
10
 ******************************************************************************/
11
package org.eclipse.equinox.bidi.internal.tests;
11
package org.eclipse.equinox.bidi.internal.tests;
12
12
13
import org.eclipse.equinox.bidi.advanced.STextEnvironment;
13
import org.eclipse.equinox.bidi.advanced.ISTextExpert;
14
import org.eclipse.equinox.bidi.custom.*;
14
import org.eclipse.equinox.bidi.custom.*;
15
15
16
public class TestHandler3 extends STextTypeHandler {
16
public class TestHandler3 extends STextTypeHandler {
17
17
18
	public int getSpecialsCount(STextEnvironment env) {
18
	public int getSpecialsCount(ISTextExpert expert) {
19
		return 1;
19
		return 1;
20
	}
20
	}
21
21
22
	public int indexOfSpecial(STextEnvironment env, String text, STextCharTypes charTypes, STextOffsets offsets, int caseNumber, int fromIndex) {
22
	public int indexOfSpecial(ISTextExpert expert, String text, STextCharTypes charTypes, STextOffsets offsets, int caseNumber, int fromIndex) {
23
		return fromIndex;
23
		return fromIndex;
24
	}
24
	}
25
}
25
}
(-)src/org/eclipse/equinox/bidi/internal/tests/TestHandlerMyComma.java (-6 / +6 lines)
Lines 11-17 Link Here
11
package org.eclipse.equinox.bidi.internal.tests;
11
package org.eclipse.equinox.bidi.internal.tests;
12
12
13
import org.eclipse.equinox.bidi.STextDirection;
13
import org.eclipse.equinox.bidi.STextDirection;
14
import org.eclipse.equinox.bidi.advanced.STextEnvironment;
14
import org.eclipse.equinox.bidi.advanced.ISTextExpert;
15
import org.eclipse.equinox.bidi.custom.STextCharTypes;
15
import org.eclipse.equinox.bidi.custom.STextCharTypes;
16
import org.eclipse.equinox.bidi.custom.STextTypeHandler;
16
import org.eclipse.equinox.bidi.custom.STextTypeHandler;
17
17
Lines 29-50 Link Here
29
		this.dirHebrew = dirHebrew;
29
		this.dirHebrew = dirHebrew;
30
	}
30
	}
31
31
32
	public String getSeparators(STextEnvironment environment) {
32
	public String getSeparators(ISTextExpert expert) {
33
		return ","; //$NON-NLS-1$
33
		return ","; //$NON-NLS-1$
34
	}
34
	}
35
35
36
	public boolean skipProcessing(STextEnvironment environment, String text, STextCharTypes charTypes) {
36
	public boolean skipProcessing(ISTextExpert expert, String text, STextCharTypes charTypes) {
37
		byte charType = charTypes.getBidiTypeAt(0);
37
		byte charType = charTypes.getBidiTypeAt(0);
38
		if (charType == AL)
38
		if (charType == AL)
39
			return true;
39
			return true;
40
		return false;
40
		return false;
41
	}
41
	}
42
42
43
	public int getDirection(STextEnvironment environment, String text) {
43
	public int getDirection(ISTextExpert expert, String text) {
44
		return getDirection(environment, text, new STextCharTypes(this, environment, text));
44
		return getDirection(expert, text, new STextCharTypes(expert, text));
45
	}
45
	}
46
46
47
	public int getDirection(STextEnvironment environment, String text, STextCharTypes charTypes) {
47
	public int getDirection(ISTextExpert expert, String text, STextCharTypes charTypes) {
48
		for (int i = 0; i < text.length(); i++) {
48
		for (int i = 0; i < text.length(); i++) {
49
			byte charType = charTypes.getBidiTypeAt(i);
49
			byte charType = charTypes.getBidiTypeAt(i);
50
			if (charType == AL)
50
			if (charType == AL)

Return to bug 183164