Bug 703774 Cast the result of getAttribute() as Number before comparing the values r=enn
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 29 Mar 2012 00:20:13 +0900
changeset 90526 c514f0c6098cc895175acbd575e4ad57c777b00a
parent 90525 2961cc5557921d26a33f4964897151b94d3f4948
child 90527 15a4628f412e69f70a4fb82ab9345dfed9bcdc51
push id22366
push usermak77@bonardo.net
push dateThu, 29 Mar 2012 15:38:30 +0000
treeherdermozilla-central@ff3521bc6559 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersenn
bugs703774
milestone14.0a1
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 703774 Cast the result of getAttribute() as Number before comparing the values r=enn
layout/xul/test/test_bug159346.xul
--- a/layout/xul/test/test_bug159346.xul
+++ b/layout/xul/test/test_bug159346.xul
@@ -22,92 +22,95 @@ var downButton =
                                           "scrollbar-down-bottom");
 
 function init()
 {
   downButton.style.display = "-moz-box";
   SimpleTest.executeSoon(doTest1);
 }
 
+function getCurrentPos()
+{
+  return Number(scrollbar.getAttribute("curpos"));
+}
+
 function doTest1()
 {
   var lastPos = 0;
 
   synthesizeMouseAtCenter(downButton, { type: "mousedown" });
-  ok(scrollbar.getAttribute("curpos") > lastPos,
+  ok(getCurrentPos() > lastPos,
      "scrollbar didn't change curpos by mousedown #1");
-  lastPos = scrollbar.getAttribute("curpos");
+  lastPos = getCurrentPos();
 
   setTimeout(function () {
-    ok(scrollbar.getAttribute("curpos") > lastPos,
+    ok(getCurrentPos() > lastPos,
        "scrollbar didn't change curpos by auto repeat #1");
     synthesizeMouseAtCenter(downButton, { type: "mouseup" });
-    lastPos = scrollbar.getAttribute("curpos");
+    lastPos = getCurrentPos();
 
     setTimeout(function () {
-      is(scrollbar.getAttribute("curpos"), lastPos,
+      is(getCurrentPos(), lastPos,
          "scrollbar changed curpos after mouseup #1");
       SimpleTest.executeSoon(doTest2);
     }, 1000);
   }, 1000);
 }
 
 function doTest2()
 {
   SpecialPowers.setIntPref("ui.scrollbarButtonAutoRepeatBehavior", 0);
 
   scrollbar.setAttribute("curpos", 0);
   var lastPos = 0;
 
   synthesizeMouseAtCenter(downButton, { type: "mousedown" });
-  ok(scrollbar.getAttribute("curpos") > lastPos,
+  ok(getCurrentPos() > lastPos,
      "scrollbar didn't change curpos by mousedown #2");
-  lastPos = scrollbar.getAttribute("curpos");
+  lastPos = getCurrentPos();
 
   synthesizeMouse(downButton, -10, -10, { type: "mousemove" });
-  lastPos = scrollbar.getAttribute("curpos");
+  lastPos = getCurrentPos();
 
   setTimeout(function () {
-    is(scrollbar.getAttribute("curpos"), lastPos,
+    is(getCurrentPos(), lastPos,
        "scrollbar changed curpos by auto repeat when cursor is outside of scrollbar button #2");
     synthesizeMouseAtCenter(downButton, { type: "mousemove" });
-    lastPos = scrollbar.getAttribute("curpos");
+    lastPos = getCurrentPos();
 
     setTimeout(function () {
-      ok(scrollbar.getAttribute("curpos") > lastPos,
+      ok(getCurrentPos() > lastPos,
          "scrollbar didn't change curpos by mousemove after cursor is back on the scrollbar button #2");
       synthesizeMouseAtCenter(downButton, { type: "mouseup" });
       SimpleTest.executeSoon(doTest3);
     }, 1000);
   }, 1000);
 }
 
 function doTest3()
 {
   SpecialPowers.setIntPref("ui.scrollbarButtonAutoRepeatBehavior", 1);
 
   scrollbar.setAttribute("curpos", 0);
   var lastPos = 0;
 
   synthesizeMouseAtCenter(downButton, { type: "mousedown" });
-  ok(scrollbar.getAttribute("curpos") > lastPos,
+  ok(getCurrentPos() > lastPos,
      "scrollbar didn't change curpos by mousedown #3");
-  lastPos = scrollbar.getAttribute("curpos");
-
   synthesizeMouse(downButton, -10, -10, { type: "mousemove" });
-  lastPos = scrollbar.getAttribute("curpos");
+  lastPos = getCurrentPos();
 
   setTimeout(function () {
-    ok(scrollbar.getAttribute("curpos") > lastPos,
+    ok(getCurrentPos() > lastPos,
        "scrollbar didn't change curpos by auto repeat when cursor is outside of scrollbar button #3");
     synthesizeMouseAtCenter(downButton, { type: "mousemove" });
-    lastPos = scrollbar.getAttribute("curpos");
+    lastPos = getCurrentPos();
 
     setTimeout(function () {
-      ok(scrollbar.getAttribute("curpos") > lastPos,
+      ok(getCurrentPos() > lastPos,
          "scrollbar didn't change curpos by mousemove after cursor is back on the scrollbar button #3");
       synthesizeMouseAtCenter(downButton, { type: "mouseup" });
 
       SpecialPowers.clearUserPref("ui.scrollbarButtonAutoRepeatBehavior");
       SimpleTest.finish();
     }, 1000);
   }, 1000);
 }