Section 5

The #testClicksInOutsideRegion instance method on the CellClickRegionTestCase class has the same problem. Here is the existing method.

testClicksInOutsideRegion
    | pt regionClass |
    pt := 1@1.
    regionClass := CellClickRegion clickRegionForPoint: pt.
    self shouldnt: [regionClass = CellClickRegionOutside].
    pt := 5@5.
    regionClass := CellClickRegion clickRegionForPoint: pt.
    self should: [regionClass = CellClickRegionOutside].
    pt := 9@9.
    regionClass := CellClickRegion clickRegionForPoint: pt.
    self should: [regionClass = CellClickRegionOutside].
    pt := 16@16.
    regionClass := CellClickRegion clickRegionForPoint: pt.
    self shouldnt: [regionClass = CellClickRegionOutside].

And here it is rewritten.

testClicksInOutsideRegion
    | pt regionClass |
    pt := 1@1.
    regionClass := CellClickRegion clickRegionForPoint: pt.
    self shouldnt: [regionClass = CellClickRegionOutside].

    pt := CellClickRegionOutside regionRectangle topLeft + (1@1).
    regionClass := CellClickRegion clickRegionForPoint: pt.
    self should: [regionClass = CellClickRegionOutside].

    pt := CellClickRegionInside regionRectangle topLeft - (1@1).
    regionClass := CellClickRegion clickRegionForPoint: pt.
    self should: [regionClass = CellClickRegionOutside].

    pt := CellClickRegionInside regionRectangle topLeft + (1@1).
    regionClass := CellClickRegion clickRegionForPoint: pt.
    self shouldnt: [regionClass = CellClickRegionOutside].

After completing these changes, the unit tests are re-run and everything still passes. The changes to these test cases work.

Index Page Next Page

Copyright © 2007, 2008, 2009, 2010 Stephan B Wessels    stevewessels@me.com