Woopsi Testing and Fixes

Now that I have time again, I’m back to working on Woopsi. Something I haven’t really done yet is any extensive testing of the gadgets. I’ve checked that the obvious functionality works as I develop the system, but not that all of the functionality works for each gadget. To that end, I’m writing tests for each gadget.

So far, the CycleButton and RadioButtonGroup gadgets both have test suites written. The test program checks that the gadgets can be shelved, unshelved, hidden, shown, enabled, disabled, moved, resized, redimensioned (simultaneous move and resize) and that they produce the correct preferred dimensions. The test system also checks that they fire the expected events when interacted with.

The test system has enabled me to identify and fix a number of bugs. The CycleButton now produces the correct values when getPreferredDimensions() is called. The same is true of the RadioButtonGroup. The latter also redraws correctly when resized. Another bug spotted was in the base Gadget class - its enable() and disable() methods weren’t redrawing.

The last bug fixed is in the Gadget::clipRectToHierarchy() method. In the last set of changes I made this function non-recursive, but did so in such a way that the function did not clip a gadget to its immediate parent’s dimensions.

One bug I’ve spotted but haven’t fixed yet involves the show/hide/shelve/unshelve systems. Imagine gadget A overlaps button B but is hidden. Clicking button B shows gadget A. Upon clicking and releasing the button, gadget A is redrawn in place. Button B is then redrawn to show its newly unclicked state, but button B is actually drawn over the top of gadget A. Somewhere along the line, button B’s rect cache isn’t being flushed when it should so it draws over space that no longer belongs to it.