Section 5

The #testClicksInInsideRegion instance method on the CellClickRegionTestCase class needs attention. Here's the existing method.

testClicksInInsideRegion
    | pt regionClass |
    pt := 1@1.
    regionClass := CellClickRegion clickRegionForPoint: pt.
    self shouldnt: [regionClass = CellClickRegionInside].
    pt := 5@5.
    regionClass := CellClickRegion clickRegionForPoint: pt.
    self shouldnt: [regionClass = CellClickRegionInside].
    pt := 9@9.
    regionClass := CellClickRegion clickRegionForPoint: pt.
    self shouldnt: [regionClass = CellClickRegionInside].
    pt := 10@10.
    regionClass := CellClickRegion clickRegionForPoint: pt.
    self should: [regionClass = CellClickRegionInside].

The re-coded method...

testClicksInInsideRegion
    | pt regionClass |
    pt := 1@1.
    regionClass := CellClickRegion clickRegionForPoint: pt.
    self shouldnt: [regionClass = CellClickRegionInside].

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

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

    pt := CellClickRegionInside regionRectangle topLeft.
    regionClass := CellClickRegion clickRegionForPoint: pt.
    self should: [regionClass = CellClickRegionInside].

Index Page Next Page

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