[squeak-dev] The Trunk: GraphicsTests-nice.26.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Jul 24 16:58:33 UTC 2010
Nicolas Cellier uploaded a new version of GraphicsTests to project The Trunk:
http://source.squeak.org/trunk/GraphicsTests-nice.26.mcz
==================== Summary ====================
Name: GraphicsTests-nice.26
Author: nice
Time: 24 July 2010, 6:58:29.781 pm
UUID: 8fa06e93-af69-4f78-b92b-86ca77fe39bf
Ancestors: GraphicsTests-wiz.25
Remove potential sends of @-
Now that $- is allowed in binary messages at any place, this potentially is ambiguous.
=============== Diff against GraphicsTests-wiz.25 ===============
Item was changed:
----- Method: PointTest>>testNormal (in category 'testing - testing') -----
testNormal
+ "quick check of results for #normal."
+ | samples rejects results |
+ samples := 0 asPoint eightNeighbors , (Array with: 0 asPoint) .
- " quick check of results for #normal."
+ results :=
+ { 0.0 @ 1.0 .
+ -0.707106781186547 @ 0.707106781186547 .
+ -1.0 @ 0.0 .
+ -0.707106781186547 @ -0.707106781186547 .
+ 0.0 @ -1.0 .
+ 0.707106781186547 @ -0.707106781186547 .
+ 1.0 @ 0.0 .
+ 0.707106781186547 @ 0.707106781186547 .
+ -1 @ 0} .
- | samples rejects results |
+ rejects := (1 to: samples size ) reject:
+ [ :each | ((samples at: each) normal - (results at: each)) abs < 1e-15 asPoint ] .
- samples :=
- 0 asPoint eightNeighbors
- , (Array with: 0 asPoint) .
+ self assert: rejects isEmpty!
- results :=
- { 0.0 at 1.0
- . -0.707106781186547 at 0.707106781186547
- . -1.0 at 0.0
- . -0.707106781186547 at -0.707106781186547
- . 0.0 at -1.0
- . 0.707106781186547 at -0.707106781186547
- . 1.0 at 0.0
- . 0.707106781186547 at 0.707106781186547
- . -1 at 0} .
-
-
- rejects :=
- (1 to: samples size ) reject: [ :each | ((samples at: each) normal - (results at: each)) abs < 1e-15 asPoint ] .
-
- self assert: ( rejects isEmpty ) .
-
-
-
- !
Item was changed:
----- Method: PNGReadWriterTest>>drawTransparentStuffOn: (in category 'helpers') -----
drawTransparentStuffOn: aForm
"Draw stuff on aForm. Avoid any symmetry."
| canvas |
canvas := FormCanvas on: aForm.
+ canvas frameAndFillRectangle: (1 @ 1 corner: aForm extent - 15) fillColor: (Color red alpha: 0.25) borderWidth: 3 borderColor: (Color green alpha: 0.5).
+ canvas fillOval: (aForm boundingBox topRight - (15 @ -5) extent: 20 @ 20) color: (Color white alpha: 0.75) borderWidth: 1 borderColor: Color blue.
- canvas frameAndFillRectangle: (1 at 1 corner: aForm extent - 15) fillColor: (Color red alpha: 0.25) borderWidth: 3 borderColor: (Color green alpha: 0.5).
- canvas fillOval: (aForm boundingBox topRight - (15 at -5) extent: 20 at 20) color: (Color white alpha: 0.75) borderWidth: 1 borderColor: Color blue.
^aForm
+ "(PNGReadWriterTest new drawStuffOn: (Form extent: 32 @ 32 depth: 16)) display"!
- "(PNGReadWriterTest new drawStuffOn: (Form extent: 32 at 32 depth: 16)) display"!
Item was changed:
----- Method: PointTest>>testNormal2 (in category 'testing - testing') -----
testNormal2
+ "quick check of results for #normal.
+ differs from the other testNormal in the way that the difference is measured."
- " quick check of results for #normal.
- differs from the other testNormal in the way that the difference is measured."
+ | samples rejects results differences |
+ samples := 0 asPoint eightNeighbors , (Array with: 0 asPoint) .
- | samples rejects results differences |
+ results :=
+ { 0.0 @ 1.0 .
+ -0.707106781186547 @ 0.707106781186547 .
+ -1.0 @ 0.0 .
+ -0.707106781186547 @ -0.707106781186547 .
+ 0.0 @ -1.0 .
+ 0.707106781186547 @ -0.707106781186547 .
+ 1.0 @ 0.0 .
+ 0.707106781186547 @ 0.707106781186547 .
+ -1 @ 0} .
+ differences := samples with: results collect: [ :each :eachResult |
+ each normal - eachResult ] .
- samples :=
- 0 asPoint eightNeighbors
- , (Array with: 0 asPoint) .
+ rejects := differences reject: [ :each |
+ (each x closeTo: 0.0) and: [each y closeTo: 0.0] ] .
- results :=
- { 0.0 at 1.0
- . -0.707106781186547 at 0.707106781186547
- . -1.0 at 0.0
- . -0.707106781186547 at -0.707106781186547
- . 0.0 at -1.0
- . 0.707106781186547 at -0.707106781186547
- . 1.0 at 0.0
- . 0.707106781186547 at 0.707106781186547
- . -1 at 0} .
+ self assert: rejects isEmpty!
- differences :=
- samples with: results collect: [ :each :eachResult |
- each normal - eachResult ] .
-
- rejects :=
- differences reject: [ :each |
- (each x closeTo: 0.0) and: [each y closeTo: 0.0] ] .
-
- self assert: ( rejects isEmpty ) .
-
-
-
- !
Item was changed:
----- Method: PointTest>>testBasicFourDirections (in category 'testing - testing') -----
testBasicFourDirections
+ "fourDirections returns the four rotation of the receiver in counter clockwise order with the receiver appearing last. "
- " fourDirections returns the four rotation of the reciever in counter clockwise order with the reciever appearing last. "
+ | samples results rejects |
+ self assert: (0 asPoint fourDirections) = (Array new: 4 withAll: 0 asPoint) .
+ samples := 0 asPoint eightNeighbors .
+ results := {
+ { 0 @ -1 . -1 @ 0 . 0 @ 1 . 1 @ 0}.
+ { 1 @ -1 . -1 @ -1 . -1 @ 1 . 1 @ 1}.
+ { 1 @ 0 . 0 @ -1 . -1 @ 0 . 0 @ 1}.
+ { 1 @ 1 . 1 @ -1 . -1 @ -1 . -1 @ 1}.
+ { 0 @ 1 . 1 @ 0 . 0 @ -1 . -1 @ 0}.
+ {-1 @ 1 . 1 @ 1 . 1 @ -1 . -1 @ -1}.
+ {-1 @ 0 . 0 @ 1 . 1 @ 0 . 0 @ -1}.
+ {-1 @ -1 . -1 @ 1 . 1 @ 1 . 1 @ -1} } .
- | samples results rejects |
+ rejects := (1 to: samples size ) reject: [ :each |
- self assert: (0 asPoint fourDirections) = (Array new: 4 withAll: 0 asPoint) .
-
-
- samples :=
- 0 asPoint eightNeighbors .
-
- results :=
- { {0 at -1 . -1 at 0 . 0 at 1 . 1 at 0}
- . {1 at -1 . -1 at -1 . -1 at 1 . 1 at 1}
- . {1 at 0 . 0 at -1 . -1 at 0 . 0 at 1}
- . {1 at 1 . 1 at -1 . -1 at -1 . -1 at 1}
- . {0 at 1 . 1 at 0 . 0 at -1 . -1 at 0}
- . {-1 at 1 . 1 at 1 . 1 at -1 . -1 at -1}
- . {-1 at 0 . 0 at 1 . 1 at 0 . 0 at -1}
- . {-1 at -1 . -1 at 1 . 1 at 1 . 1 at -1} } .
-
- rejects :=
- (1 to: samples size ) reject: [ :each |
(samples at: each) fourDirections = (results at: each) ] .
+ self assert: rejects isEmpty!
- self assert: ( rejects isEmpty) .
-
-
- !
Item was changed:
----- Method: PointTest>>testTheta (in category 'testing - testing') -----
testTheta
| result dir tan x y |
+ self assert: ((0 @ 1) theta - 90.0 degreesToRadians) abs < 1e-15.
+ self assert: ((0 @ -1) theta - 270.0 degreesToRadians) abs < 1e-15.
- self assert: ((0 at 1) theta - 90.0 degreesToRadians) abs < 1e-15.
- self assert: ((0 at -1) theta - 270.0 degreesToRadians) abs < 1e-15.
" See code of old and new theta"
x := 1.0 . y := -1.0.
tan := y / x .
dir := tan arcTan.
result := 360.0 degreesToRadians + dir.
+ self assert: ((x @ y) theta - result) abs < 1e-15.
+ x := -1.0. "Don't reuse old results when you want numeric precision!!"
- self assert: ((x at y) theta - result) abs < 1e-15.
- x := -1.0. "Don't reuse old results whenyou want numeric precision!!"
tan := y / x .
dir := tan arcTan.
result := 180.0 degreesToRadians + dir.
+ self assert: ((x @ y) theta - result) abs < 1e-15.
- self assert: ((x at y) theta - result) abs < 1e-15.
!
Item was changed:
----- Method: PointTest>>testBearingToPoint (in category 'tests - testing') -----
testBearingToPoint
+ self assert: (0 @ 0 bearingToPoint: 0 @ 0) = 0.
+ self assert: (0 @ 0 bearingToPoint: 0 @ -1) = 0.
+ self assert: (0 @ 0 bearingToPoint: 1 @ 0) = 90.
+ self assert: (0 @ 0 bearingToPoint: 0 @ 1) = 180.
+ self assert: (0 @ 0 bearingToPoint: -1 @ 0) = 270.
+ self assert: (0 @ 0 bearingToPoint: 1 @ 1) = 135.
+ self assert: (0 @ 0 bearingToPoint: 0.01 @ 0) = 90.
+ self assert: (0 @ 0 bearingToPoint: -2 @ -3) = 326.
+ self assert: (0 @ 0 bearingToPoint: -0 @ 0) = 0.
- self assert: (0 at 0 bearingToPoint: 0 at 0) = 0.
- self assert: (0 at 0 bearingToPoint: 0 at -1) = 0.
- self assert: (0 at 0 bearingToPoint: 1 at 0) = 90.
- self assert: (0 at 0 bearingToPoint: 0 at 1) = 180.
- self assert: (0 at 0 bearingToPoint: -1 at 0) = 270.
- self assert: (0 at 0 bearingToPoint: 1 at 1) = 135.
- self assert: (0 at 0 bearingToPoint: 0.01 at 0) = 90.
- self assert: (0 at 0 bearingToPoint: -2 at -3) = 326.
- self assert: (0 at 0 bearingToPoint: -0 at 0) = 0.
+ self assert: (-2 @ -3 bearingToPoint: 0 @ 0) = 146.!
- self assert: (-2 at -3 bearingToPoint: 0 at 0) = 146.!
Item was changed:
----- Method: PNGReadWriterTest>>drawStuffOn: (in category 'helpers') -----
drawStuffOn: aForm
"Draw stuff on aForm. Avoid any symmetry."
| canvas |
canvas := FormCanvas on: aForm.
+ canvas frameAndFillRectangle: (1 @ 1 corner: aForm extent - 15) fillColor: Color red borderWidth: 3 borderColor: Color green.
+ canvas fillOval: (aForm boundingBox topRight - (15 @ -5) extent: 20 @ 20) color: Color blue borderWidth: 1 borderColor: Color white.
- canvas frameAndFillRectangle: (1 at 1 corner: aForm extent - 15) fillColor: Color red borderWidth: 3 borderColor: Color green.
- canvas fillOval: (aForm boundingBox topRight - (15 at -5) extent: 20 at 20) color: Color blue borderWidth: 1 borderColor: Color white.
^aForm
+ "(PNGReadWriterTest new drawStuffOn: (Form extent: 32 @ 32 depth: 16)) display"!
- "(PNGReadWriterTest new drawStuffOn: (Form extent: 32 at 32 depth: 16)) display"!
More information about the Squeak-dev
mailing list
|