sgothel/jogl — pull request #54 by rhatcher (2012-11-29 15:59:20+00:00)
Title: Fix For Bug 629, Plus First Crack At Associated Unit Tests

The behavior of NEWT event modifiers for AWTCanvas instances appears to be fixed after this change, but there are still some event-related inconsistencies in NewtCanvasAWT and NewtCanvasSWT. Sven has suggested that perhaps the NEWT event delivery infrastructure should be re-thought and I think he's probably right. It's easy to believe that programs might be best served if e.g. event semantics, content, and ordering were consistent regardless of the platform. As things stand currently there appear to be differences regarding what events show up, and when. The changes in this commit do nothing to address these issues, but were submitted anyway because it seemed beneficial to fix the NEWT modifier behavior for AWTCanvas since it probably remains a common case (frankly the day I can wave goodbye to the AWT will be a good day for me, but for now I have to tolerate it).

Other notes regarding the test code:

- The tests are all defined in class TestNewtEventModifiers. This class still has a debug flag set to true that makes it verbose. We may wish to set that back to false to keep the spew level down.

- The remaining test classes extend TestNewtEventModifiers to define how the window and associated GL drawing surface are created.

- It is a real good idea if the mouse and keyboard remain untouched by the user while these tests are running :-).

- I wasn't quite sure yet how the test code is woven in to whatever mechanism runs the full test suite for JOGL, so I made no effort to do this (yet). I simply added the new classes. As things stand currently the test for AWTCanvas runs ok and could be enabled, but the other two for NewtCanvasAWT and NewtCanvasSWT fail and should not be included in the test run until we figure out what's going on there. More investigation is required here.

- This was the first time I've written anything for JUnit (we don't use it at our site because our code is all perfect - heh), so I may have made noob mistakes, failed to follow best practices, etc. Guidance here is of course welcome.

git commit notes follow:

The change to AWTNewtEventFactory appears to fix the original issue
for AWTCanvas instances, and the TestNewtEventModifiersAWTCanvas
appears to work ok too. However, there are still issues with
NewtCanvasAWT and NewtCanvasSWT instances. These might be problems
in the test code, but there's also a good chance there are still
issues in the NEWT event delivery infrastructure. For the time being
I recommend that only TestNewtEventModifiersAWTCanvas be included
in routine unit tests.

The tests are defined in TestNewtEventModifiers, and the remaining
test classes extend it to define how the window and associated
GL drawing surface are created.

File ModifierMappings.txt is simply informational, and shows how
the modifier bits are laid out between AWT and NEWT. This possibly
should have been a spreadsheet.