Bug 573933. Part 3: Fix button-state test to render a margin around the button so we don't get into any weird sampling issues. Also, use a canvas that's just as big as necessary. r=dbaron
authorRobert O'Callahan <robert@ocallahan.org>
Fri, 16 Jul 2010 09:07:43 +1200
changeset 47725 152633f27b604278772135288df05c48ea817b3c
parent 47724 acb4d17b70cd517c11e0dc709f29431c37b10302
child 47726 c4856286646754956d505bbc95a22572cc85e846
push id14413
push userrocallahan@mozilla.com
push dateThu, 15 Jul 2010 21:12:02 +0000
treeherdermozilla-central@e1d7fd5255fd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs573933
milestone2.0b2pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 573933. Part 3: Fix button-state test to render a margin around the button so we don't get into any weird sampling issues. Also, use a canvas that's just as big as necessary. r=dbaron
content/events/test/test_bug426082.html
--- a/content/events/test/test_bug426082.html
+++ b/content/events/test/test_bug426082.html
@@ -123,45 +123,51 @@ function tests() {
 function sendMouseEvent(t, elem) {
   var r = elem.getBoundingClientRect();
   synthesizeMouse(elem, r.width / 2, r.height / 2, {type: t});
 }
 
 function compareSnapshots_(c1, c2, shouldBeIdentical, msg) {
   var [correct, c1url, c2url] = compareSnapshots(c1, c2, shouldBeIdentical);
   if (correct) {
-    ok(true, msg);
+    if (shouldBeIdentical) {
+      ok(true, msg + " - expected " + c1url);
+    } else {
+      ok(true, msg + " - got " + c1url + " and " + c2url);
+    }
   } else {
     if (shouldBeIdentical) {
       ok(false, msg + " - expected " + c1url + " but got " + c2url);
     } else {
       ok(false, msg + " - expected something other than " + c1url);
     }
   }
 }
 
 function takeSnapshot(canvas) {
   var r = buttonRect();
   var ctx = canvas.getContext("2d");
   netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+  canvas.width = r.width + 4;
+  canvas.height = r.height + 4;
   ctx.clearRect(0, 0, canvas.width, canvas.height);
-  ctx.drawWindow(window, r.left, r.top, r.width, r.height, "#FFF");
+  ctx.drawWindow(window, r.left - 2, r.top - 2, r.width + 4, r.height + 4, "#FFF");
 }
 
 function buttonRect() {
   return button.getBoundingClientRect();
 }
 
 
 </script>
 </pre>
 <p><input type="button" value="Button" id="button"></p>
 <p><label for="button" id="label">Label</label></p>
 <p id="outside">Something under the label</p>
 
-<canvas id="normalButtonCanvas" width="200" height="100"></canvas>
-<canvas id="pressedButtonCanvas" width="200" height="100"></canvas>
-<canvas id="normalFocusedButtonCanvas" width="200" height="100"></canvas>
-<canvas id="pressedFocusedButtonCanvas" width="200" height="100"></canvas>
-<canvas id="currentSnapshot" width="200" height="100"></canvas>
+<canvas id="normalButtonCanvas"></canvas>
+<canvas id="pressedButtonCanvas"></canvas>
+<canvas id="normalFocusedButtonCanvas"></canvas>
+<canvas id="pressedFocusedButtonCanvas"></canvas>
+<canvas id="currentSnapshot"></canvas>
 
 </body>
 </html>