[evolution/wip/mcrha/webkit-jsc-api] test-html-editor-units: Adapt most (except of one) of /issue tests and fix found bugs in the new cod



commit 92b86bf9b27d35f31ce6435190c4f3330462798a
Author: Milan Crha <mcrha redhat com>
Date:   Fri Apr 3 13:57:06 2020 +0200

    test-html-editor-units: Adapt most (except of one) of /issue tests and fix found bugs in the new code

 data/webkit/e-convert.js                 |  2 +-
 data/webkit/e-editor.js                  |  4 +-
 src/e-util/test-html-editor-units-bugs.c | 66 ++++++++++++++++----------------
 src/e-util/test-web-view-jsc.c           |  2 +-
 4 files changed, 37 insertions(+), 37 deletions(-)
---
diff --git a/data/webkit/e-convert.js b/data/webkit/e-convert.js
index 24e9d45bcb..93440d2359 100644
--- a/data/webkit/e-convert.js
+++ b/data/webkit/e-convert.js
@@ -517,7 +517,7 @@ EvoConvert.formatParagraph = function(str, ltr, align, indent, whiteSpace, wrapW
                                else
                                        worker.commitSpaces(ii);
 
-                               var add = " ".repeat(EvoConvert.TAB_WIDTH - ((worker.lineLetters - 
worker.ignoreLineLetters) % EvoConvert.TAB_WIDTH));
+                               var add = chr; // this expands the tab, instead of leaving it '\t'...  " 
".repeat(EvoConvert.TAB_WIDTH - ((worker.lineLetters - worker.ignoreLineLetters) % EvoConvert.TAB_WIDTH));
 
                                worker.lineLetters = worker.lineLetters - ((worker.lineLetters - 
worker.ignoreLineLetters) % EvoConvert.TAB_WIDTH) + EvoConvert.TAB_WIDTH;
 
diff --git a/data/webkit/e-editor.js b/data/webkit/e-editor.js
index c05beb9c82..b029c7767e 100644
--- a/data/webkit/e-editor.js
+++ b/data/webkit/e-editor.js
@@ -3492,7 +3492,7 @@ EvoEditor.AfterInputEvent = function(inputEvent, isWordDelim)
                // the replace call below replaces &nbsp; (0xA0) with regular space
                matches = EvoEditor.findSmileys(text.replace(/ /g, " "), EvoEditor.UNICODE_SMILEYS);
                if (matches) {
-                       var sz = matches.length, node, tmpElement = null;
+                       var ii, sz = matches.length, node, tmpElement = null;
 
                        if (sz > 1)
                                EvoUndoRedo.StartRecord(EvoUndoRedo.RECORD_KIND_GROUP, "magicSmiley");
@@ -5254,7 +5254,7 @@ EvoEditor.processLoadedContent = function()
 
                        if (!EvoEditor.IsBlockNode(node) && (node.nodeType == node.ELEMENT_NODE || 
(node.nodeValue && node.nodeValue != "\n" && node.nodeValue != "\r\n"))) {
                                if (!addingTo) {
-                                       addingTo = document.createElement("DIV");
+                                       addingTo = 
document.createElement(EvoEditor.hasElementWithTagNameAsParent(node, "PRE") ? "PRE" : "DIV");
                                        blockquoteNode.insertBefore(addingTo, node);
                                        EvoEditor.maybeUpdateParagraphWidth(addingTo);
                                }
diff --git a/src/e-util/test-html-editor-units-bugs.c b/src/e-util/test-html-editor-units-bugs.c
index 0cc49835f7..47254aa35d 100644
--- a/src/e-util/test-html-editor-units-bugs.c
+++ b/src/e-util/test-html-editor-units-bugs.c
@@ -1515,7 +1515,7 @@ test_issue_86 (TestFixture *fixture)
                "> > \n"
                "> > level 1\n"
                "> \n"
-               "> back normal text"))
+               "> back normal text\n"))
                g_test_fail ();
 
        g_free (to_insert);
@@ -1547,10 +1547,10 @@ test_issue_103 (TestFixture *fixture)
                "before\n"
                LONG_URL "\n"
                "after\n"
-               "prefix text \n"
+               "prefix text\n"
                SHORTER_URL " suffix\n"
                "prefix " SHORT_URL " suffix\n"
-               "end")) {
+               "end\n")) {
                g_test_fail ();
                return;
        }
@@ -1577,7 +1577,7 @@ test_issue_104 (TestFixture *fixture)
                "undo:test:1\n"
                "undo:redo\n",
                HTML_PREFIX "<div style=\"width: 71ch;\">txt to rplac</div>" HTML_SUFFIX,
-               "txt to rplac"))
+               "txt to rplac\n"))
                g_test_fail ();
 }
 
@@ -1615,39 +1615,39 @@ test_issue_107 (TestFixture *fixture)
                "",
                HTML_PREFIX
                "<div style=\"width: 71ch;\">On Today, User wrote:</div>"
-               "<blockquote type=\"cite\" " BLOCKQUOTE_STYLE ">"
-               "<div style=\"width: 71ch;\">&gt; text</div>"
-               "<div style=\"width: 71ch;\">&gt; <a 
href=\"https://www.01.org/\";>https://www.01.org/</a>&nbsp;?</div>"
-               "<div style=\"width: 71ch;\">&gt; <a 
href=\"https://www.02.org/\";>https://www.02.org/</a>&nbsp;A</div>"
-               "<div style=\"width: 71ch;\">&gt; <a 
href=\"https://www.03.org/\";>https://www.03.org/</a>&nbsp;ěšč</div>"
-               "<div style=\"width: 71ch;\">&gt; <a href=\"https://www.04.org/\";>https://www.04.org/</a> 
?</div>"
-               "<div style=\"width: 71ch;\">&gt; <a 
href=\"https://www.05.org/\";>https://www.05.org/</a></div>"
-               "<div style=\"width: 71ch;\">&gt; <a 
href=\"https://www.06.org/\";>https://www.06.org/</a>&nbsp;</div>"
-               "<div style=\"width: 71ch;\">&gt; <a 
href=\"https://www.07.org/\";>https://www.07.org/</a>&nbsp;&nbsp;</div>"
-               "<div style=\"width: 71ch;\">&gt; <a 
href=\"https://www.08.org/\";>https://www.08.org/</a>&nbsp;&gt;&nbsp;&lt;&nbsp;</div>"
-               "<div style=\"width: 71ch;\">&gt; &lt;<a 
href=\"https://www.09.org/\";>https://www.09.org/</a>&gt;</div>"
-               "<div style=\"width: 71ch;\">&gt; &lt;<a 
href=\"https://www.10.org/\";>https://www.10.org/</a>&nbsp;?&gt;</div>"
-               "<div style=\"width: 71ch;\">&gt; &nbsp;<a 
href=\"https://www.11.org/\";>https://www.11.org/</a>&nbsp;</div>"
-               "<div style=\"width: 71ch;\">&gt; &lt;&nbsp;<a 
href=\"https://www.12.org/\";>https://www.12.org/</a>&nbsp;&gt;</div>"
-               "<div style=\"width: 71ch;\">&gt; &nbsp;&lt;<a 
href=\"https://www.13.org/\";>https://www.13.org/</a>&gt;&nbsp;</div>"
-               "<div style=\"width: 71ch;\">&gt; Text <a 
href=\"https://www.14.org/\";>https://www.14.org/</a>\temail: user@no.where</div>"
+               "<blockquote type=\"cite\">"
+               "<div>" QUOTE_SPAN (QUOTE_CHR) "text</div>"
+               "<div>" QUOTE_SPAN (QUOTE_CHR) "<a 
href=\"https://www.01.org/\";>https://www.01.org/</a>&nbsp;?</div>"
+               "<div>" QUOTE_SPAN (QUOTE_CHR) "<a 
href=\"https://www.02.org/\";>https://www.02.org/</a>&nbsp;A</div>"
+               "<div>" QUOTE_SPAN (QUOTE_CHR) "<a 
href=\"https://www.03.org/\";>https://www.03.org/</a>&nbsp;ěšč</div>"
+               "<div>" QUOTE_SPAN (QUOTE_CHR) "<a href=\"https://www.04.org/\";>https://www.04.org/</a> 
?</div>"
+               "<div>" QUOTE_SPAN (QUOTE_CHR) "<a href=\"https://www.05.org/\";>https://www.05.org/</a></div>"
+               "<div>" QUOTE_SPAN (QUOTE_CHR) "<a 
href=\"https://www.06.org/\";>https://www.06.org/</a>&nbsp;</div>"
+               "<div>" QUOTE_SPAN (QUOTE_CHR) "<a 
href=\"https://www.07.org/\";>https://www.07.org/</a>&nbsp;&nbsp;</div>"
+               "<div>" QUOTE_SPAN (QUOTE_CHR) "<a 
href=\"https://www.08.org/\";>https://www.08.org/</a>&nbsp;&gt;&nbsp;&lt;&nbsp;</div>"
+               "<div>" QUOTE_SPAN (QUOTE_CHR) "&lt;<a 
href=\"https://www.09.org/\";>https://www.09.org/</a>&gt;</div>"
+               "<div>" QUOTE_SPAN (QUOTE_CHR) "&lt;<a 
href=\"https://www.10.org/\";>https://www.10.org/</a>&nbsp;?&gt;</div>"
+               "<div>" QUOTE_SPAN (QUOTE_CHR) "&nbsp;<a 
href=\"https://www.11.org/\";>https://www.11.org/</a>&nbsp;</div>"
+               "<div>" QUOTE_SPAN (QUOTE_CHR) "&lt;&nbsp;<a 
href=\"https://www.12.org/\";>https://www.12.org/</a>&nbsp;&gt;</div>"
+               "<div>" QUOTE_SPAN (QUOTE_CHR) "&nbsp;&lt;<a 
href=\"https://www.13.org/\";>https://www.13.org/</a>&gt;&nbsp;</div>"
+               "<div>" QUOTE_SPAN (QUOTE_CHR) "Text <a 
href=\"https://www.14.org/\";>https://www.14.org/</a>\temail: <a 
href=\"mailto:user@no.where\";>user@no.where</a></div>"
                "</blockquote>" HTML_SUFFIX,
                "On Today, User wrote:\n"
                "> text\n"
-               "> https://www.01.org/ ?\n"
-               "> https://www.02.org/ A\n"
-               "> https://www.03.org/ ěšč\n"
+               "> https://www.01.org/"; UNICODE_NBSP "?\n"
+               "> https://www.02.org/"; UNICODE_NBSP "A\n"
+               "> https://www.03.org/"; UNICODE_NBSP "ěšč\n"
                "> https://www.04.org/ ?\n"
                "> https://www.05.org/\n";
-               "> https://www.06.org/ \n"
-               "> https://www.07.org/  \n"
-               "> https://www.08.org/ > < \n"
+               "> https://www.06.org/"; UNICODE_NBSP "\n"
+               "> https://www.07.org/"; UNICODE_NBSP UNICODE_NBSP "\n"
+               "> https://www.08.org/"; UNICODE_NBSP ">" UNICODE_NBSP "<" UNICODE_NBSP "\n"
                "> <https://www.09.org/>\n"
-               "> <https://www.10.org/ ?>\n"
-               ">  https://www.11.org/ \n"
-               "> < https://www.12.org/ >\n"
-               ">  <https://www.13.org/> \n"
-               "> Text https://www.14.org/\temail: user@no.where")) {
+               "> <https://www.10.org/"; UNICODE_NBSP "?>\n"
+               "> " UNICODE_NBSP "https://www.11.org/"; UNICODE_NBSP "\n"
+               "> <" UNICODE_NBSP "https://www.12.org/"; UNICODE_NBSP ">\n"
+               "> " UNICODE_NBSP "<https://www.13.org/>" UNICODE_NBSP "\n"
+               "> Text https://www.14.org/\temail: user@no.where\n")) {
                g_test_fail ();
        }
 }
@@ -1674,8 +1674,8 @@ test_add_html_editor_bug_tests (void)
        test_utils_add_test ("/bug/775042", test_bug_775042);
        test_utils_add_test ("/bug/775691", test_bug_775691);
        test_utils_add_test ("/bug/779707", test_bug_779707);
-       test_utils_add_test ("/bug/780275/html", test_bug_780275_html);
-       test_utils_add_test ("/bug/780275/plain", test_bug_780275_plain);
+       test_utils_add_test ("/bug/780275-html", test_bug_780275_html);
+       test_utils_add_test ("/bug/780275-plain", test_bug_780275_plain);
        test_utils_add_test ("/bug/781722", test_bug_781722);
        test_utils_add_test ("/bug/781116", test_bug_781116);
        test_utils_add_test ("/bug/780088", test_bug_780088);
diff --git a/src/e-util/test-web-view-jsc.c b/src/e-util/test-web-view-jsc.c
index 29b8051502..17bff71041 100644
--- a/src/e-util/test-web-view-jsc.c
+++ b/src/e-util/test-web-view-jsc.c
@@ -1967,7 +1967,7 @@ test_convert_to_plain (TestFixture *fixture)
                  "123 5678\n0123 5678\n0123 678\n1234567890\nabcdefghij\nklmnopq\n012345 356\n9\n0\n",
                  -1 },
        /* 6 */ { HTML ("<div style='width:10ch; " WRAP_STYLE ("pre-wrap") "'>123 5678 0123 5678 0123  678 
1234567890abcdefghijklmnopq 012345         356  9         " TAB TAB "0</div>"),
-                 "123 5678\n0123 5678\n0123  678\n1234567890\nabcdefghij\nklmnopq\n012345   \n356  9   \n    
   \n        0\n",
+                 "123 5678\n0123 5678\n0123  678\n1234567890\nabcdefghij\nklmnopq\n012345   \n356  9   
\n\t\n\t0\n",
                  -1 },
        /* 7 */ { HTML ("<pre>123456789012345\n1\t90123\n123   78901\n  34567   <br>123 5</pre>"),
                  "123456789012345\n1\t90123\n123   78901\n  34567   \n123 5\n",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]