Bug 1314852 Make background and border of the input element in test_bug636465.html since it's sometimes not painted correctly r?smaug draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 16 Nov 2016 15:51:21 +0900
changeset 440504 11975670466e99877a6d0135108c53c2736f3651
parent 439375 79feeed4293336089590320a9f30a813fade8e3c
child 537385 ba8db91775311c234010ca8217082a1aa63c1e72
push id36237
push userbmo:masayuki@d-toybox.com
push dateThu, 17 Nov 2016 16:22:44 +0000
reviewerssmaug
bugs1314852, 636465
milestone53.0a1
Bug 1314852 Make background and border of the input element in test_bug636465.html since it's sometimes not painted correctly r?smaug The test compaires 4 screenshots for checking spellchecker's behavior. However, the input element is sometimes not painted correctly on Linux. Even if I make it wait more delay before taking screenshot, the random failure isn't fixed. So, I guess that it's a bug of gfx of Theme API of GTK. On the other hand, the most important thing here is, compairing the foreground contents of the input element. Therefore, this patch makes the background and border of the input element transparent. That prevents to use Theme API. This must be enough for fixing the random orange. MozReview-Commit-ID: L2uXcPLvbNg
editor/libeditor/tests/test_bug636465.html
--- a/editor/libeditor/tests/test_bug636465.html
+++ b/editor/libeditor/tests/test_bug636465.html
@@ -1,17 +1,17 @@
 <!doctype html>
 <title>Mozilla bug 636465</title>
 <link rel=stylesheet href="/tests/SimpleTest/test.css">
 <script src="/tests/SimpleTest/EventUtils.js"></script>
 <script src="/tests/SimpleTest/SimpleTest.js"></script>
 <script src="/tests/SimpleTest/WindowSnapshot.js"></script>
 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=636465"
    target="_blank">Mozilla Bug 636465</a>
-<input id="x" value="foobarbaz" spellcheck="true">
+<input id="x" value="foobarbaz" spellcheck="true" style="background-color: transparent; border: transparent;">
 <script>
 SimpleTest.waitForExplicitFinish();
 
 function runTest() {
   SpecialPowers.Cu.import("resource://gre/modules/AsyncSpellCheckTestHelper.jsm",
                           window);
   var x = document.getElementById("x");
   x.focus();
@@ -23,20 +23,32 @@ function runTest() {
     x.setAttribute("spellcheck", "true");
     x.focus();
     onSpellCheck(x, function () {
       x.blur();
       var spellCheckTrueAgain = snapshotWindow(window);
       x.removeAttribute("spellcheck");
       var spellCheckNone = snapshotWindow(window);
       var after = snapshotWindow(window);
-      ok(compareSnapshots(spellCheckTrue, spellCheckFalse, false)[0],
+      var ret = compareSnapshots(spellCheckTrue, spellCheckFalse, false)[0];
+      ok(ret,
          "Setting the spellcheck attribute to false should work");
-      ok(compareSnapshots(spellCheckTrue, spellCheckTrueAgain, true)[0],
+      if (!ret) {
+        ok(false, "\nspellCheckTrue: " + spellCheckTrue.toDataURL() + "\nspellCheckFalse: " + spellCheckFalse.toDataURL());
+      }
+      ret = compareSnapshots(spellCheckTrue, spellCheckTrueAgain, true)[0];
+      ok(ret,
          "Setting the spellcheck attribute back to true should work");
-      ok(compareSnapshots(spellCheckNone, spellCheckFalse, true)[0],
+      if (!ret) {
+        ok(false, "\nspellCheckTrue: " + spellCheckTrue.toDataURL() + "\nspellCheckTrueAgain: " + spellCheckTrueAgain.toDataURL());
+      }
+      ret = compareSnapshots(spellCheckNone, spellCheckFalse, true)[0];
+      ok(ret,
          "Unsetting the spellcheck attribute should work");
+      if (!ret) {
+        ok(false, "\spellCheckNone: " + spellCheckNone.toDataURL() + "\nspellCheckFalse: " + spellCheckFalse.toDataURL());
+      }
       SimpleTest.finish();
     });
   });
 }
 addLoadEvent(runTest);
 </script>