Hurrah! We (mostly Prof. Humphrey) implemented Mouse Lock in Firefox! Following the specs given by W3C, we implemented Mouse Lock that will be shipped in the new version of firefox in the coming few weeks (I believe by Feb 2012).
To get a grasp what we accomplished, check out the first demos (ever, on firefox) of the mouse lock implementation:
The journey lasted just a couple of weeks, but the amount of new concepts and ideas I was introduced to is amazing. This experience was the first c++ project I was a part of in a non-c++ course (of which I have had only 2). The techniques of Mozilla development, like translating specs into IDL, then coding the classes, using reference tools like MXR and DXR, and debugging in a new environment have been thrilling to learn and participate in. Of-course all of this was in concert with interacting on irc with the open source community, becoming more familiar with git and the make tool, and most of all, going through the actual process of problem solving, solo and in a team.
However, for all the work already done, about 80% of it, we have another 90% left. If the math doesn’t add up, you can take it with up Prof. Humphrey who I have quoted here.
Now the next step of writing tests begins.
I have written 3 Mochi tests for MouseLockable:
- navigator.pointer (readonly) is a MouseLockable
- MouseLockable has lock(), unlock(), islocked()
- “The unlock method cancels the mouse lock state”
Below are the first drafts of the actual js code to test each of them, that I will refactor over the next day and push off to the MouseLockable tests module owner Raymond.
All of them passed when I tried them on Mochi Test Maker on my nightly build, after merging in the latest commits last night.
Test 1: Test to see if navigator.pointer object is of MouseLockable typ
<script class="testbody" type="text/javascript"> /** Test for Bug 633602 **/ /** Test to see if navigator.pointer object is of MouseLockable type **/ var c = navigator.pointer; var IsSameType = c instanceof MouseLockable; is(IsSameType, true, "Error message"); </script>
Test 2: Test to see if MouseLockable has lock(), unlock(), islocked()
<script class="testbody" type="text/javascript"> /** Test for Bug 633602 **/ /** Test to see if MouseLockable has lock(), unlock(), islocked() **/ var hasProperty1 = MouseLockable.prototype.hasOwnProperty('lock'); var hasProperty2 = MouseLockable.prototype.hasOwnProperty('islocked'); var hasProperty3 = MouseLockable.prototype.hasOwnProperty('unlock'); var allPassed = false; if (hasProperty1 && hasProperty2 && hasProperty3) { allPassed = true; } is(allPassed, true, "Error message"); </script>
Test 3: Test to see if unlock() will cancel the lock() state in MouseLockable
<script class="testbody" type="text/javascript"> /** Test for Bug 633602 **/ /** Test to see if unlock() will cancel the lock() state in MouseLockable **/ var np = navigator.pointer; var locked = np.islocked(); np.lock = np.lock(); var locked2 = np.islocked(); np.unlock(); var locked3 = np.islocked(); var allPassed = false; if (!(locked) && (locked2) && !(locked3) ) { allPassed = true; } is(allPassed, true, "Error message"); </script>
3 responses
Do you want to comment?
Comments RSS and TrackBack Identifier URI ?
Trackbacks