Bug 457230: HTML2TextReader mangles bold style ranges after <pre>
authorMarkus Keller <markus_keller@ch.ibm.com>
Thu, 15 Jan 2015 16:56:58 +0000 (17:56 +0100)
committerMarkus Keller <markus_keller@ch.ibm.com>
Thu, 15 Jan 2015 16:56:58 +0000 (17:56 +0100)
fixed test to account for Windows line delimiters

org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/HTML2TextReaderTest.java

index b38a7fb..12aef7b 100644 (file)
@@ -257,12 +257,12 @@ public class HTML2TextReaderTest extends TestCase {
        }
        
        public void testStylesWithPre() throws IOException {
-               String string= "I am <b>bold</b>.\n<p>\n<pre>One\n\n<b>T</b>hree.</pre>\n<p>\n<b>Author:</b> me.";
-               String expected= "I am bold. \nOne\n\nThree. \nAuthor: me.";
+               String string= "I am <b>bold</b>." + LD + "<p>" + LD + "<pre>One" + LD + LD + "<b>T</b>hree.</pre>" + LD + "<p>" + LD + "<b>Author:</b> me.";
+               String expected= "I am bold. " + LD + "One" + LD + LD + "Three. " + LD + "Author: me.";
                StyleRange[] ranges= {
                                new StyleRange(5, 4, null, null, SWT.BOLD),
-                               new StyleRange(17, 1, null, null, SWT.BOLD),
-                               new StyleRange(25, 7, null, null, SWT.BOLD)
+                               new StyleRange(14 + 3*LD.length(), 1, null, null, SWT.BOLD),
+                               new StyleRange(21 + 4*LD.length(), 7, null, null, SWT.BOLD)
                };
                verify(string, expected, ranges);
        }