Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Goldthorpe2009-04-22 18:07:19 +0000
committerChris Goldthorpe2009-04-22 18:07:19 +0000
commitae3cc98e75e91841e85a0e0e1baeeb3a514c783a (patch)
tree8cd0e0b0502c2aef2445fbc786688dcc427d56ca /org.eclipse.ua.tests/intro/org
parentd105b7ce9239a889acd08cf3b56c7e8a9ec30c95 (diff)
downloadeclipse.platform.ua-ae3cc98e75e91841e85a0e0e1baeeb3a514c783a.tar.gz
eclipse.platform.ua-ae3cc98e75e91841e85a0e0e1baeeb3a514c783a.tar.xz
eclipse.platform.ua-ae3cc98e75e91841e85a0e0e1baeeb3a514c783a.zip
Bug 273241 – [Intro] The text of item is't trim on Welcome page:
Diffstat (limited to 'org.eclipse.ua.tests/intro/org')
-rw-r--r--org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/other/AllOtherTests.java1
-rw-r--r--org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/other/NormalizeWhitespaceTest.java65
2 files changed, 66 insertions, 0 deletions
diff --git a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/other/AllOtherTests.java b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/other/AllOtherTests.java
index 26d40d85f..c11dc14ca 100644
--- a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/other/AllOtherTests.java
+++ b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/other/AllOtherTests.java
@@ -30,5 +30,6 @@ public class AllOtherTests extends TestSuite {
*/
public AllOtherTests() {
addTest(ReopenStateTest.suite());
+ addTest(NormalizeWhitespaceTest.suite());
}
}
diff --git a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/other/NormalizeWhitespaceTest.java b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/other/NormalizeWhitespaceTest.java
new file mode 100644
index 000000000..1790470fd
--- /dev/null
+++ b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/other/NormalizeWhitespaceTest.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * 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.ua.tests.intro.other;
+
+import org.eclipse.ui.internal.intro.impl.util.StringUtil;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/*
+ * Tests whitespace normalization used by SWT presentation.
+ */
+public class NormalizeWhitespaceTest extends TestCase {
+
+ /*
+ * Returns an instance of this Test.
+ */
+ public static Test suite() {
+ return new TestSuite(NormalizeWhitespaceTest.class);
+ }
+
+ public void testNullString() {
+ assertNull(StringUtil.normalizeWhiteSpace(null));
+ }
+
+ public void testEmptyString() {
+ String result = StringUtil.normalizeWhiteSpace("");
+ assertEquals("", result);
+ }
+
+ public void testSimpleString() {
+ String result = StringUtil.normalizeWhiteSpace("Hello World");
+ assertEquals("Hello World", result);
+ }
+
+ public void testRepeatedSpace() {
+ String result = StringUtil.normalizeWhiteSpace("Hello World");
+ assertEquals("Hello World", result);
+ }
+
+ public void testOtherWhitespace() {
+ String result = StringUtil.normalizeWhiteSpace("Hello\n\r\t World");
+ assertEquals("Hello World", result);
+ }
+
+ public void testLeadingSpace() {
+ String result = StringUtil.normalizeWhiteSpace(" Hello World");
+ assertEquals("Hello World", result);
+ }
+
+ public void testTrailingSpace() {
+ String result = StringUtil.normalizeWhiteSpace("Hello World ");
+ assertEquals("Hello World", result);
+ }
+
+}

Back to the top