bug 528792, fix a test by ensuring that we pass in even coords so that zooming+truncating still leaves us with an integer coordinate
authorDaniel Brooks <db48x@db48x.net>
Wed, 18 Nov 2009 03:36:22 -0600
changeset 34976 fd765c193770a48ed529b86cdc56d0090dffbf15
parent 34975 eb6ad91709a7d298f32e70dbee18e9babc4a420a
child 34977 4efe8dde9f52b81d3ce0cd3b8b3af777fd7cb8dd
push id10387
push userdb48x@yahoo.com
push dateWed, 18 Nov 2009 09:36:37 +0000
treeherdermozilla-central@fd765c193770 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs528792
milestone1.9.3a1pre
bug 528792, fix a test by ensuring that we pass in even coords so that zooming+truncating still leaves us with an integer coordinate
toolkit/content/tests/widgets/test_popup_scaled.xul
--- a/toolkit/content/tests/widgets/test_popup_scaled.xul
+++ b/toolkit/content/tests/widgets/test_popup_scaled.xul
@@ -76,23 +76,29 @@ function nextTest()
     setScale(window, 1);
     SimpleTest.finish();
   }
   else {
     screenTest = true;
     setScale(window, 2);
     var box = document.documentElement.boxObject;
 
-    // the iframe is at 4×, but out here css pixels are only 2× device pixels
-    screenx = (x = box.screenX + 120)/2;
-    screeny = (y = box.screenY + 50)/2;
+    // - the iframe is at 4×, but out here css pixels are only 2× device pixels
+    // - the popup manager rounds off (or truncates) the coordinates to
+    //   integers, so ensure we pass in even numbers to openPopupAtScreen
+    screenx = (x = even(box.screenX + 120))/2;
+    screeny = (y = even(box.screenY + 120))/2;
     $("popup").openPopupAtScreen(x, y);
   }
 }
 
+function even(n)
+{
+  return (n % 2) ? n+1 : n;
+}
 ]]>
 </script>
 
 <body xmlns="http://www.w3.org/1999/xhtml">
 <p id="display">
 </p>
 <div id="content" style="display: none">
 </div>