Section 5

That took care of the first one. Now on to the second failing test.

We're testing click resolution on an outside region this time. The test point failing is at 10@20 and a result of CellClickRegionRotateCounterClockwise was expected. We got a result of CellClickRegionRotateClockwise instead. This is another test case that should have been caught when we changed the cell sizes.

The design of this test case was based upon a table like this.

Label Point Rotate
A 10@10 Clock Wise
B 20@10 Clock Wise
C 10@15 Clock Wise
D 20@15 Clock Wise
E 10@20 Counter Clock Wise
F 20@20 Counter Clock Wise
G 4@4 Clock Wise
H 26@4 Clock Wise
I 4@15 Clock Wise
J 26@15 Clock Wise
K 4@26 Counter Clock Wise
L 26@26 Counter Clock Wise
M 6@10 Clock Wise
N 22@13 Clock Wise
O 12@22 Counter Clock Wise

And again, this test failure should have been caught when we changed the sizes of the cells since that's obviously a problem here. Our cell size is 40 x 40 and the ignore margin is 4 pixels from each edge. And the inside region margin is 10 pixels from the edges. The new table dimensions should be as follows.

Label Point Rotate
A 10@10 Clock Wise
B 30@10 Clock Wise
C 10@20 Clock Wise
D 30@20 Clock Wise
E 10@30 Counter Clock Wise
F 30@30 Counter Clock Wise
G 4@4 Clock Wise
H 36@4 Clock Wise
I 4@20 Clock Wise
J 36@20 Clock Wise
K 4@36 Counter Clock Wise
L 36@36 Counter Clock Wise
M 6@10 Clock Wise
N 32@18 Clock Wise
O 12@32 Counter Clock Wise

Change the unit test code and re-run.

testClicksInRotateRegions
    | pt regionClass testTable cls rotateRegion |
    pt := 5@5.
    regionClass := CellClickRegion clickRegionForPoint: pt.
    self should: [regionClass = CellClickRegionOutside].
    testTable := {
        10@10->CellClickRegionRotateClockwise.
        30@10->CellClickRegionRotateClockwise.
        10@20->CellClickRegionRotateClockwise.
        30@20->CellClickRegionRotateClockwise.
        10@30->CellClickRegionRotateCounterClockwise.
        30@30->CellClickRegionRotateCounterClockwise.
        4@4->CellClickRegionRotateClockwise.
        36@4->CellClickRegionRotateClockwise.
        4@20->CellClickRegionRotateClockwise.
        36@20->CellClickRegionRotateClockwise.
        4@36->CellClickRegionRotateCounterClockwise.
        36@36->CellClickRegionRotateCounterClockwise.
        6@10->CellClickRegionRotateClockwise.
        32@18->CellClickRegionRotateClockwise.
        12@32->CellClickRegionRotateCounterClockwise.
        }.
    testTable do: [:assoc |
        pt := assoc key.
        cls := assoc value.
        rotateRegion := regionClass rotateRegionForPoint: pt.
        self should: [rotateRegion = cls]]

This test still fails.

Index Page Next Page

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