For the last milestone, I’ve been focusing a lot on our implementation of Mouse Lock, and thanks to the great work and effort put in by our class and professor, Dave Humphrey, we got our implementation up for review last week Friday. Incidentally we got a review back, which wasn’t quite as bad as I had expected. A lot of things still left to do, but the first round of feedback was definitely less scathing that I was led to believe. In terms of actual implementation I haven’t really contributed as much as I would like, my major one was getting the mouse to disappear upon the lock method being called, other than that most other things have been small potatoes.
I also served as a sync point for the class’ tests. Originally I had thought this task would be fairly simple. I’ve been doing this sorta thing for a while now, keeping track of Jesse, Diogo, and Dave’s changes. Unfortunately it didn’t scale up very well. When nearly the whole class started to get involved in the test creation, handling the pull requests became quite a mess. Especially when during the merges, one or two pull requests would cause an unexpected failure on the code. In such cases, I had to put aside what I was doing to fix the repository as soon as possible in order to prevent other classmates’ repositories from going kaputz. During this time I was also able to push out a test of my own. My test file_MouseEvents.html deals with whether or not our implemention properly handles all the possible mouse events. For example, events that require the presence of a mouse cursor (i.e., mouseover, mouseout) shouldn’t exist when the mouse is locked. Also user generated events (i.e., mousemove, button presses) should only affect the element that has been locked. It doesn’t matter if event happens to occur right over another element, only the one that the mouse is locked to should get the event. My test ended up having something like 42 tests. It’s really only this big because all the tests need to be done twice. Once when mouse lock is active, and once when it’s not. The reason why I test when it’s not active is because I don’t want future changes to break how the mouse works normally. Its initial completion coincided with Friday, the day we would submit our work for review.
Unfortunately, it would seem that most of the tests did not use asynchronous calls correctly or used some sort of timeout method. This causes random failures and is overall, a hallmark of a poorly done test. Of course, my test was part of that group. orz … While fixing my test (I feel like I made it a lot more complex than it needs to be), I’m trying to also tackle a case where 2 tests would fail for mac users. For some reason, mouseout and mouseleave events were not firing under normal circumstances. I’m not really sure what to make of this, and I’ve made a slight change to my code (instead of going to pixel 100 which is the width of my box, it is now 101) and would love to see if this was the reason why it didn’t work before. Fixing the test itself (remove timing issues by utilizing the success callback) proved quite challenging. Aside from maybe a week in Java, my exposure to threads and thread programming has only been in theory. So when it came down to doing it for real, things didn’t turn out quite so smoothly. That said, it finally works without any wonky behaviours.
I’ve taken up another test, file_limitlessScroll.html which has its fair share of problems. I’m actually going to do a full rewrite. There are a lot of errors in there, but there’s one very big logic failure. All the synthesize mouse calls tell it to go to the same place 3 times. It needs to use ScreenX and Y in its calculations to truly be able to emulate movement. The aim is to have this done by Thursday night and have someone peer review this, because in its current form, limitlessScroll is causing mochitest to hang and fail.
Test wise, things are starting to look up, I have peer reviewed 2 tests, both written/rewritten by northWind, and aside from a few lines that were longer than the 80 char limit, it was good. So that’s 2 tests down. =)