Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2012-01-04 15:48:24 +0000
committerDani Megert2012-01-04 15:48:24 +0000
commit60f31587f7b264eca3911ae21d595b0d2e35a568 (patch)
treeebd6af04302779eb1838b83b72d64cb3bb08dabc /org.eclipse.jface.text.tests
parent257a6c7c822fb9ee0fe5cb6fd24d98c27b5f7ba0 (diff)
downloadeclipse.platform.text-60f31587f7b264eca3911ae21d595b0d2e35a568.tar.gz
eclipse.platform.text-60f31587f7b264eca3911ae21d595b0d2e35a568.tar.xz
eclipse.platform.text-60f31587f7b264eca3911ae21d595b0d2e35a568.zip
Fixed bug 367378: org.eclipse.jface.internal.text.html.HTML2TextReader
hangs when reading file with <head>
Diffstat (limited to 'org.eclipse.jface.text.tests')
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/HTML2TextReaderTest.java (renamed from org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/HTML2TextReaderTester.java)19
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/JFaceTextTestSuite.java4
2 files changed, 17 insertions, 6 deletions
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/HTML2TextReaderTester.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/HTML2TextReaderTest.java
index 981a14008..ab7163f02 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/HTML2TextReaderTester.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/HTML2TextReaderTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2011 IBM Corporation and others.
+ * Copyright (c) 2006, 2012 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
@@ -14,6 +14,7 @@ import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
@@ -30,18 +31,18 @@ import org.eclipse.jface.internal.text.html.HTML2TextReader;
import org.eclipse.jface.text.TextPresentation;
-public class HTML2TextReaderTester extends TestCase {
+public class HTML2TextReaderTest extends TestCase {
private static final boolean DEBUG= false;
private static final String LD= System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- public HTML2TextReaderTester(String name) {
+ public HTML2TextReaderTest(String name) {
super(name);
}
public static Test suite() {
- return new TestSuite(HTML2TextReaderTester.class);
+ return new TestSuite(HTML2TextReaderTest.class);
}
private void verify(String input, String expectedOutput, int styleRangeCount) throws IOException {
@@ -123,6 +124,16 @@ public class HTML2TextReaderTester extends TestCase {
verify(string, expected, 0);
}
+ public void testBug367378() throws IOException {
+ verify("<head>", "", 0);
+ verify("<head>some styles</html>", "", 0);
+
+ char[] cb= new char[20];
+ StringReader reader= new StringReader("<head>");
+ new HTML2TextReader(reader, null).read(cb);
+ assertTrue(Arrays.equals(new char[20], cb));
+ }
+
public void testComments() throws Exception {
String string= "<!-- begin-user-doc -->no comment<!-- end-user-doc -->";
String expected= "no comment";
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/JFaceTextTestSuite.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/JFaceTextTestSuite.java
index bc8fc7b7c..40f17217f 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/JFaceTextTestSuite.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/JFaceTextTestSuite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 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
@@ -26,7 +26,7 @@ public class JFaceTextTestSuite extends TestSuite {
public static Test suite() {
TestSuite suite= new TestSuite("Test Suite for org.eclipse.jface.text"); //$NON-NLS-1$
- suite.addTest(HTML2TextReaderTester.suite());
+ suite.addTest(HTML2TextReaderTest.suite());
suite.addTest(TextHoverPopupTest.suite());
suite.addTest(TextPresentationTest.suite());
suite.addTest(DefaultUndoManagerTest.suite());

Back to the top