test_bug422132.html 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=422132
  5. -->
  6. <head>
  7. <title>Test for Bug 422132</title>
  8. <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
  9. <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  10. <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
  11. <script type="text/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
  12. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
  13. </head>
  14. <body>
  15. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=422132">Mozilla Bug 422132</a>
  16. <p id="display"></p>
  17. <div id="target" style="font-size: 0; width: 200px; height: 200px; overflow: auto;">
  18. <div style="width: 1000px; height: 1000px;"></div>
  19. </div>
  20. <div id="content" style="display: none">
  21. </div>
  22. <pre id="test">
  23. <script class="testbody" type="text/javascript">
  24. /** Test for Bug 422132 **/
  25. SimpleTest.waitForExplicitFinish();
  26. SimpleTest.waitForFocus(function() {
  27. SpecialPowers.pushPrefEnv({
  28. "set":[["general.smoothScroll", false],
  29. ["mousewheel.min_line_scroll_amount", 1],
  30. ["mousewheel.system_scroll_override_on_root_content.enabled", false],
  31. ["mousewheel.transaction.timeout", 100000]]}, runTests)}, window);
  32. function runTests()
  33. {
  34. var target = document.getElementById("target");
  35. var scrollLeft = target.scrollLeft;
  36. var scrollTop = target.scrollTop;
  37. var tests = [
  38. {
  39. prepare: function() {
  40. scrollLeft = target.scrollLeft;
  41. scrollTop = target.scrollTop;
  42. },
  43. event: {
  44. deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  45. deltaX: 0.5,
  46. deltaY: 0.5,
  47. lineOrPageDeltaX: 0,
  48. lineOrPageDeltaY: 0
  49. },
  50. }, {
  51. event: {
  52. deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  53. deltaX: 0.5,
  54. deltaY: 0.5,
  55. lineOrPageDeltaX: 0,
  56. lineOrPageDeltaY: 0
  57. },
  58. check: function() {
  59. is(target.scrollLeft - scrollLeft, 1,
  60. "not scrolled to right by 0.5px delta value with pending 0.5px delta");
  61. is(target.scrollTop - scrollTop, 1,
  62. "not scrolled to bottom by 0.5px delta value with pending 0.5px delta");
  63. },
  64. }, {
  65. prepare: function() {
  66. scrollLeft = target.scrollLeft;
  67. scrollTop = target.scrollTop;
  68. },
  69. event: {
  70. deltaMode: WheelEvent.DOM_DELTA_LINE,
  71. deltaX: 0.5,
  72. deltaY: 0.5,
  73. lineOrPageDeltaX: 0,
  74. lineOrPageDeltaY: 0
  75. },
  76. }, {
  77. event: {
  78. deltaMode: WheelEvent.DOM_DELTA_LINE,
  79. deltaX: 0.5,
  80. deltaY: 0.5,
  81. lineOrPageDeltaX: 1,
  82. lineOrPageDeltaY: 1
  83. },
  84. check: function() {
  85. is(target.scrollLeft - scrollLeft, 1,
  86. "not scrolled to right by 0.5 line delta value with pending 0.5 line delta");
  87. is(target.scrollTop - scrollTop, 1,
  88. "not scrolled to bottom by 0.5 line delta value with pending 0.5 line delta");
  89. }
  90. }
  91. ];
  92. var nextTest = function() {
  93. var test = tests.shift();
  94. if (test.prepare) {
  95. test.prepare();
  96. }
  97. sendWheelAndPaint(target, 10, 10, test.event, function() {
  98. if (test.check) {
  99. test.check();
  100. }
  101. if (tests.length == 0) {
  102. SimpleTest.finish();
  103. return;
  104. }
  105. setTimeout(nextTest, 0);
  106. });
  107. }
  108. nextTest();
  109. }
  110. </script>
  111. </pre>
  112. </body>
  113. </html>