Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2008-08-28 15:04:07 +0000
committerThomas Watson2008-08-28 15:04:07 +0000
commita726458969a725079ab544f639a466067402f340 (patch)
tree5bafa7973ebf3a53b75430f26426e8d95fad538f
parent7fd80bd01f581e44c1be29de8e2a0b380d1af9b9 (diff)
downloadrt.equinox.framework-a726458969a725079ab544f639a466067402f340.tar.gz
rt.equinox.framework-a726458969a725079ab544f639a466067402f340.tar.xz
rt.equinox.framework-a726458969a725079ab544f639a466067402f340.zip
Bug 243654 TextProcessor should also be active on the Mac
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/BidiTextProcessorTestCase.java81
-rw-r--r--bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/util/TextProcessor.java2
2 files changed, 36 insertions, 47 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/BidiTextProcessorTestCase.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/BidiTextProcessorTestCase.java
index 497fa1186..cb2584f48 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/BidiTextProcessorTestCase.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/BidiTextProcessorTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
+ * Copyright (c) 2006, 2008 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
@@ -32,9 +32,9 @@ public class BidiTextProcessorTestCase extends TextProcessorTestCase {
private static String PATH_2_RESULT = LRE + PATH_2 + PDF;
private static String PATH_3_RESULT = LRE + PATH_3 + PDF;
private static String PATH_4_RESULT = LRE + PATH_4 + PDF;
- private static String PATH_5_RESULT = LRE + "d" + ":" + "\\" + HEBREW_STRING_2 + " abcdef-" + HEBREW_STRING_3 + "\\" + "xyz" + "\\" + "abcdef" + "\\" + HEBREW_STRING_4 + LRM + "\\" + HEBREW_STRING_5 + "." + "java" + PDF;
+ private static String PATH_5_RESULT = LRE + "d" + ":" + "\\" + HEBREW_STRING_2 + " abcdef-" + HEBREW_STRING_3 + "\\" + "xyz" + "\\" + "abcdef" + "\\" + HEBREW_STRING_4 + LRM + "\\" + HEBREW_STRING_5 + "." + "java" + PDF;
private static String PATH_6_RESULT = LRE + "d" + ":" + "\\" + HEBREW_STRING_2 + " abcdef-" + HEBREW_STRING_3 + "\\" + "xyz" + "\\" + "abcdef" + "\\" + HEBREW_STRING_4 + LRM + "\\" + HEBREW_STRING_5 + LRM + "." + HEBREW_STRING_6 + PDF;
- private static String PATH_7_RESULT = LRE + "d" + ":" + "\\" + HEBREW_STRING_2 + " abcdef-" + HEBREW_STRING_3 + "\\" + "xyz" + "\\" + "abcdef" + "\\" + HEBREW_STRING_4 + "\\" + "Test" + "." + "java" + PDF;
+ private static String PATH_7_RESULT = LRE + "d" + ":" + "\\" + HEBREW_STRING_2 + " abcdef-" + HEBREW_STRING_3 + "\\" + "xyz" + "\\" + "abcdef" + "\\" + HEBREW_STRING_4 + "\\" + "Test" + "." + "java" + PDF;
private static String PATH_8_RESULT = LRE + PATH_8 + PDF;
private static String PATH_9_RESULT = LRE + PATH_9 + PDF;
private static String PATH_10_RESULT = LRE + PATH_10 + PDF;
@@ -59,10 +59,10 @@ public class BidiTextProcessorTestCase extends TextProcessorTestCase {
private static String STRING_14_RESULT = LRE + "d:\\myFolder\\" + HEBREW_STRING_2 + LRM + "\\123myfile." + HEBREW_STRING_6 + PDF;
private static String STRING_15_RESULT = LRE + "d:\\myFolder\\" + HEBREW_STRING_2 + "12-=" + LRM + "\\<>?34" + HEBREW_STRING_6 + ".java" + PDF;
private static String STRING_16_RESULT = LRE + HEBREW_STRING_2 + LRM + "/" + HEBREW_STRING_6 + LRM + "/" + HEBREW_STRING_4 + LRM + "." + HEBREW_STRING_5 + PDF;
- private static String STRING_17_RESULT = LRE + HEBREW_STRING_7 + LRM + "/" + HEBREW_STRING_8 + LRM + "/" + HEBREW_STRING_9 + LRM + "/" + HEBREW_STRING_10 + LRM + "/" +HEBREW_STRING_11 + LRM + "/" + HEBREW_STRING_12 + LRM + "/" + HEBREW_STRING_13 + PDF;
+ private static String STRING_17_RESULT = LRE + HEBREW_STRING_7 + LRM + "/" + HEBREW_STRING_8 + LRM + "/" + HEBREW_STRING_9 + LRM + "/" + HEBREW_STRING_10 + LRM + "/" + HEBREW_STRING_11 + LRM + "/" + HEBREW_STRING_12 + LRM + "/" + HEBREW_STRING_13 + PDF;
private static String STRING_18_RESULT = LRE + "_" + HEBREW_STRING_2 + " mixed text starts and ends with neutral." + PDF;
private static String STRING_19_RESULT = LRE + "english and " + HEBREW_STRING_2 + " text starts with LTR ends with neutral _" + PDF;
-
+
private static String OTHER_STRING_NO_DELIM = LRE + "\u05ea\u05e9\u05e8\u05e7\u05e6 abcdef-\u05e5\u05e4\u05e3" + PDF;
private static String OTHER_STRING_1_RESULT = LRE + "*" + "." + "java" + PDF;
@@ -73,40 +73,29 @@ public class BidiTextProcessorTestCase extends TextProcessorTestCase {
private static String OTHER_STRING_2_ND_RESULT = LRE + "*" + "." + "\u05d0\u05d1\u05d2" + PDF;
private static String OTHER_STRING_3_ND_RESULT = LRE + "\u05d0\u05d1\u05d2 " + "=" + " \u05ea\u05e9\u05e8\u05e7\u05e6" + PDF;
- private static String[] RESULT_DEFAULT_PATHS = { PATH_1_RESULT,
- PATH_2_RESULT, PATH_3_RESULT, PATH_4_RESULT, PATH_5_RESULT,
- PATH_6_RESULT, PATH_7_RESULT, PATH_8_RESULT, PATH_9_RESULT,
- PATH_10_RESULT, PATH_11_RESULT, PATH_12_RESULT, PATH_13_RESULT };
-
- private static String[] RESULT_ADDITIONAL_STRINGS = { STRING_1_RESULT,
- STRING_2_RESULT, STRING_3_RESULT, STRING_4_RESULT, STRING_5_RESULT,
- STRING_6_RESULT, STRING_7_RESULT, STRING_8_RESULT, STRING_9_RESULT,
- STRING_10_RESULT, STRING_11_RESULT, STRING_12_RESULT,
- STRING_13_RESULT, STRING_14_RESULT, STRING_15_RESULT,
- STRING_16_RESULT, STRING_17_RESULT, STRING_18_RESULT,
- STRING_19_RESULT };
-
- private static String[] RESULT_STAR_PATHS = { OTHER_STRING_1_RESULT,
- OTHER_STRING_2_RESULT };
-
- private static String[] RESULT_EQUALS_PATHS = { OTHER_STRING_3_RESULT };
-
- private static String[] RESULT_STAR_PATHS_ND = { OTHER_STRING_1_ND_RESULT,
- OTHER_STRING_2_ND_RESULT };
-
- private static String[] RESULT_EQUALS_PATHS_ND = { OTHER_STRING_3_ND_RESULT };
+ private static String[] RESULT_DEFAULT_PATHS = {PATH_1_RESULT, PATH_2_RESULT, PATH_3_RESULT, PATH_4_RESULT, PATH_5_RESULT, PATH_6_RESULT, PATH_7_RESULT, PATH_8_RESULT, PATH_9_RESULT, PATH_10_RESULT, PATH_11_RESULT, PATH_12_RESULT, PATH_13_RESULT};
+
+ private static String[] RESULT_ADDITIONAL_STRINGS = {STRING_1_RESULT, STRING_2_RESULT, STRING_3_RESULT, STRING_4_RESULT, STRING_5_RESULT, STRING_6_RESULT, STRING_7_RESULT, STRING_8_RESULT, STRING_9_RESULT, STRING_10_RESULT, STRING_11_RESULT, STRING_12_RESULT, STRING_13_RESULT, STRING_14_RESULT, STRING_15_RESULT, STRING_16_RESULT, STRING_17_RESULT, STRING_18_RESULT, STRING_19_RESULT};
+
+ private static String[] RESULT_STAR_PATHS = {OTHER_STRING_1_RESULT, OTHER_STRING_2_RESULT};
+
+ private static String[] RESULT_EQUALS_PATHS = {OTHER_STRING_3_RESULT};
+
+ private static String[] RESULT_STAR_PATHS_ND = {OTHER_STRING_1_ND_RESULT, OTHER_STRING_2_ND_RESULT};
+
+ private static String[] RESULT_EQUALS_PATHS_ND = {OTHER_STRING_3_ND_RESULT};
// whether or not the current platform supports directional characters
private static boolean isSupportedPlatform = false;
- static{
+ static {
String osName = System.getProperty("os.name").toLowerCase(); //$NON-NLS-1$
- if (osName.startsWith("windows") || osName.startsWith("linux")) { //$NON-NLS-1$ //$NON-NLS-2$
-
+ if (osName.startsWith("windows") || osName.startsWith("linux") || osName.startsWith("mac")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
// Only consider platforms that can support control characters
isSupportedPlatform = true;
}
}
-
+
protected static String defaultDelimiters = TextProcessor.getDefaultDelimiters();
/**
@@ -138,7 +127,7 @@ public class BidiTextProcessorTestCase extends TextProcessorTestCase {
verifyBidiResult("Deprocess path " + (i + 1), resultDP, TEST_DEFAULT_PATHS[i]);
}
}
-
+
public void testBidiPathsWithNullDelimiter() {
// should use default delimiters
for (int i = 0; i < TEST_DEFAULT_PATHS.length; i++) {
@@ -149,7 +138,7 @@ public class BidiTextProcessorTestCase extends TextProcessorTestCase {
verifyResult("Process path " + (i + 1), result, TEST_DEFAULT_PATHS[i]);
}
}
-
+
public void testBidiStringWithNoDelimiters() {
String result = TextProcessor.process(OTHER_STRING_NO_DELIM);
assertEquals("Other string containing no delimiters not equivalent.", OTHER_STRING_NO_DELIM, result);
@@ -179,7 +168,7 @@ public class BidiTextProcessorTestCase extends TextProcessorTestCase {
testNum++;
}
}
-
+
public void testOtherStringsDeprocess() {
int testNum = 1;
for (int i = 0; i < TEST_STAR_PATHS.length; i++) {
@@ -195,7 +184,7 @@ public class BidiTextProcessorTestCase extends TextProcessorTestCase {
verifyBidiResult("Deprocess other (equals) string" + testNum, resultDP, TEST_EQUALS_PATHS[i]);
testNum++;
}
- }
+ }
public void testOtherStringsWithNullDelimiter() {
int testNum = 1;
@@ -207,18 +196,18 @@ public class BidiTextProcessorTestCase extends TextProcessorTestCase {
verifyResult("Other (star) string" + testNum, result, TEST_STAR_PATHS[i]);
testNum++;
}
-
+
for (int i = 0; i < TEST_EQUALS_PATHS.length; i++) {
String result = TextProcessor.process(TEST_EQUALS_PATHS[i], null);
if (isSupportedPlatform)
verifyBidiResult("Other (equals) string" + testNum, result, RESULT_EQUALS_PATHS_ND[i]);
- else{
+ else {
verifyResult("Other (equals) string" + testNum, result, TEST_EQUALS_PATHS[i]);
}
testNum++;
}
}
-
+
/*
* Test the result to ensure markers aren't added more than once if the
* string is processed multiple times.
@@ -261,7 +250,7 @@ public class BidiTextProcessorTestCase extends TextProcessorTestCase {
}
}
- public void testAdditionalStrings(){
+ public void testAdditionalStrings() {
for (int i = 0; i < TEST_ADDITIONAL_STRINGS.length; i++) {
String result = TextProcessor.process(TEST_ADDITIONAL_STRINGS[i]);
if (isSupportedPlatform)
@@ -270,15 +259,15 @@ public class BidiTextProcessorTestCase extends TextProcessorTestCase {
verifyResult("Additional string " + (i + 1), result, TEST_ADDITIONAL_STRINGS[i]);
}
}
-
- public void testAdditionalStringsDeprocess(){
+
+ public void testAdditionalStringsDeprocess() {
for (int i = 0; i < TEST_ADDITIONAL_STRINGS.length; i++) {
String result = TextProcessor.process(TEST_ADDITIONAL_STRINGS[i]);
String resultDP = TextProcessor.deprocess(result);
verifyBidiResult("Additional string " + (i + 1), resultDP, TEST_ADDITIONAL_STRINGS[i]);
}
- }
-
+ }
+
public void testEmptyStringParams() {
verifyBidiResult("TextProcessor.process(String) for empty string ", TextProcessor.process(""), EMPTY_STRING);
verifyBidiResult("TextProcessor.process(String, String) for empty strings ", TextProcessor.process("", ""), EMPTY_STRING);
@@ -287,16 +276,16 @@ public class BidiTextProcessorTestCase extends TextProcessorTestCase {
public void testEmptyStringParamsDeprocess() {
verifyBidiResult("TextProcessor.deprocess(String) for empty string ", TextProcessor.deprocess(""), EMPTY_STRING);
}
-
+
public void testNullParams() {
assertNull("TextProcessor.process(String) for null param ", TextProcessor.process(null));
assertNull("TextProcessor.process(String, String) for params ", TextProcessor.process(null, null));
}
-
+
public void testNullParamsDeprocess() {
assertNull("TextProcessor.deprocess(String) for null param ", TextProcessor.deprocess(null));
}
-
+
private void verifyBidiResult(String testName, String result, String expected) {
boolean testResult = result.equals(expected);
assertTrue(testName + " result string is not the same as expected string.", testResult);
diff --git a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/util/TextProcessor.java b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/util/TextProcessor.java
index 166701d9f..6f2b039ae 100644
--- a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/util/TextProcessor.java
+++ b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/util/TextProcessor.java
@@ -77,7 +77,7 @@ public class TextProcessor {
if ("iw".equals(lang) || "he".equals(lang) || "ar".equals(lang) || "fa".equals(lang) || "ur".equals(lang)) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
String osName = System.getProperty("os.name").toLowerCase(); //$NON-NLS-1$
- if (osName.startsWith("windows") || osName.startsWith("linux")) { //$NON-NLS-1$ //$NON-NLS-2$
+ if (osName.startsWith("windows") || osName.startsWith("linux") || osName.startsWith("mac")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
IS_PROCESSING_NEEDED = true;
}
}

Back to the top