Permalink
Browse files

Merge branch 'mouselock-tests-constantXY' of git://github.com/diogogm…

…t/mozilla-central into mouselock-tests

Conflicts:
	dom/tests/mochitest/pointerlock/file_screenXYclientXYConst.html
  • Loading branch information...
2 parents 6213bcb + 1f5fa3e commit 3e349fe117987e1691b204bc42121fc267252f24 @rhung committed Jan 26, 2012
Showing with 14 additions and 25 deletions.
  1. +14 −25 dom/tests/mochitest/pointerlock/file_screenXYclientXYConst.html
@@ -50,17 +50,13 @@
var moveUnlocked = function (e) {
// Mouse should be unlocked here
- is(pointer.isLocked(), false, "Mouse should be unlocked");
- // clientX/clientY should be equal to divWidth/divHeight
- // since the mouse isn't locked
- is(e.clientX, divWidth, "clientX should be dynamic since mouse isn't "
- + " locked");
- is(e.clientY, divHeight, "clientY should be dynamic since mouse isn't "
- + " locked");
- screenXUnlocked = e.screenX;
- screenYUnlocked = e.screenY;
- clientXUnlocked = e.clientX;
- clientYUnlocked = e.clientY;
+ is(pointer.islocked(), false, "Mouse should be unlocked");
+ // clientXY should be equal to divWidth/divHeight since the
+ // mouse isn't locked
+ is(e.clientX, divWidth, "clientX should be equal to the width of div " +
+ "element when mouse isn't locked");
+ is(e.clientY, divHeight, "clientY should be equal to the height of " +
+ "div element when mouse isn't locked");
// Remove the current mousemove listener from "div" and add a new one
div.removeEventListener("mousemove", moveUnlocked, false);
@@ -101,20 +97,13 @@
var moveLocked = function (e) {
// Mouse should be locked here
- ok(pointer.isLocked(), "Mouse should be locked");
- // When mouse lock is enabled clientX, clientY, screenX, and screenY
- // must hold constant values
- // as if the mouse did not move at all once mouse lock was entered
- is(e.screenX, screenXUnlocked, "screenX must hold constant value "
- + " as if the mouse did not move at all once mouse was lock");
- is(e.screenY, screenYUnlocked, "screenY must hold constant value "
- +" as if the mouse did not move at all once mouse was lock");
- is(e.clientX, clientXUnlocked, "clientX must hold constant value "
- + " as if the mouse did not move at all once mouse was lock");
- is(e.clientY, clientYUnlocked, "clientY must hold constant value "
- + " as if the mouse did not move at all once mouse was lock");
-
- div.removeEventListener("mousemove", moveLocked, false);
+ ok(pointer.islocked(), "Mouse should be locked");
+ // clientXY and screenXY should be equal to zero when
+ // the mouse is locked
+ is(e.clientX, 0, "clientX should be equal to 0 when mouse is locked");
+ is(e.clientY, 0, "clientY should be equal to 0 when mouse is locked");
+ is(e.screenX, 0, "screenX should be equal to 0 when mouse is locked");
+ is(e.screenY, 0, "screenY should be equal to 0 when mouse is locked");
document.mozCancelFullScreen();
};

0 comments on commit 3e349fe

Please sign in to comment.