[evolution/wip/mcrha/webkit-jsc-api] html-editor: Fix image-related tests



commit 5aa9401d04c82817b61e15168aa4ced9cc5b1745
Author: Milan Crha <mcrha redhat com>
Date:   Mon Mar 23 17:17:06 2020 +0100

    html-editor: Fix image-related tests

 data/webkit/e-editor.js                   | 8 ++++----
 src/e-util/test-html-editor-units-utils.c | 8 ++++++++
 src/e-util/test-html-editor-units.c       | 2 +-
 3 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/data/webkit/e-editor.js b/data/webkit/e-editor.js
index 61fcb1aa03..a4d5ce355d 100644
--- a/data/webkit/e-editor.js
+++ b/data/webkit/e-editor.js
@@ -2465,10 +2465,10 @@ EvoEditor.GetContent = function(flags, cid_uid_prefix)
                                var elem = document.images.item(ii);
                                var src = (elem && elem.src) ? elem.src.toLowerCase() : "";
 
-                               if (elem &&
+                               if (elem && (
                                    src.startsWith("data:") ||
                                    src.startsWith("file://") ||
-                                   src.startsWith("evo-file://")) {
+                                   src.startsWith("evo-file://"))) {
                                        for (jj = 0; jj < img_elems.length; jj++) {
                                                if (elem.src == img_elems[jj].orig_src) {
                                                        img_elems[jj].subelems[img_elems[jj].subelems.length] 
= elem;
@@ -2507,10 +2507,10 @@ EvoEditor.GetContent = function(flags, cid_uid_prefix)
                                var elem = backgrounds[ii];
                                var src = elem ? elem.getAttribute("background").toLowerCase() : "";
 
-                               if (elem &&
+                               if (elem && (
                                    src.startsWith("data:") ||
                                    src.startsWith("file://") ||
-                                   src.startsWith("evo-file://")) {
+                                   src.startsWith("evo-file://"))) {
                                        var bkg = elem.getAttribute("background");
 
                                        for (jj = 0; jj < bkg_elems.length; jj++) {
diff --git a/src/e-util/test-html-editor-units-utils.c b/src/e-util/test-html-editor-units-utils.c
index 25dca04aef..17d6dce84a 100644
--- a/src/e-util/test-html-editor-units-utils.c
+++ b/src/e-util/test-html-editor-units-utils.c
@@ -1311,6 +1311,14 @@ test_utils_dup_image_uri (const gchar *path)
                }
        }
 
+       if (image_uri) {
+               gchar *tmp;
+
+               tmp = g_strconcat ("evo-", image_uri, NULL);
+               g_free (image_uri);
+               image_uri = tmp;
+       }
+
        g_assert_no_error (error);
        g_assert_nonnull (image_uri);
 
diff --git a/src/e-util/test-html-editor-units.c b/src/e-util/test-html-editor-units.c
index 1ccdf57ef2..9983080ee3 100644
--- a/src/e-util/test-html-editor-units.c
+++ b/src/e-util/test-html-editor-units.c
@@ -3669,7 +3669,7 @@ test_image_insert (TestFixture *fixture)
        /* Wait some time until the operation is finished */
        test_utils_wait_milliseconds (500);
 
-       expected_html = g_strconcat (HTML_PREFIX "<div>before*<img src=\"", uri, "\" width=\"24px\" 
height=\"24px\">+after</div>" HTML_SUFFIX, NULL);
+       expected_html = g_strconcat (HTML_PREFIX "<div>before*<img src=\"evo-", uri, "\" width=\"24px\" 
height=\"24px\">+after</div>" HTML_SUFFIX, NULL);
 
        g_free (uri);
        g_free (filename);


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