Pharo test defects

Package: Turbo (pavel-krivanek/turbo, row 91)

State
Fixed (package repair)
Defect in
see the record
Tests
0
Fix
pavel-krivanek-turbo.st
Upstream repository
pavel-krivanek/turbo

The record is the text of the repair. The Results table is the last run of the row.

Record

Test

Load the package into a Pharo 14 image (build 791) with the load expression of the test run, file in the fixes file of the row if there is one, and run the test classes of the package.

"row 91"
Metacello new baseline: 'Turbo'; repository: 'github://pavel-krivanek/Turbo:master/src'; onConflict: [:e | e useIncoming]; load: #('default').

Results

Last result of the package run (stock Cog and iospharo on the same image).

RowLabelLoadStock Cogiospharo VM
91pavel-krivanek-turbooktests=270 P=270 F=0 E=0 S=0 T=0 X=0tests=270 P=270 F=0 E=0 S=0 T=0 X=0

Fix

Fixes file (filed in after the load): pavel-krivanek-turbo.st (download)
"pavel-krivanek/Turbo: five tests of TbFlowLayoutTest were marked
<expectedFailure> TODO: testContentTwoChildrenVerticalBottomCenter, ...Center,
...CenterLeft, ...CenterRight, ...TopCenter.  Each one prints the elements on a
50 by 13 character grid and compares with a picture.  The layout is right: the
vertical flow layout aligns the column of 23 by 4 and 20 by 6 elements in the
free space with (free / 2.0), that is 13.5 cells across (50 - 23) and 1.5 cells
down (13 - 10).  TbCanvas>>at:write: rounds a cell position with #rounded, and
Pharo rounds a half up, so the column starts in cell 14 across and row 2 down.
The pictures in the test had been drawn for a half that is cut off (cell 13,
row 1) and so every one of them was one cell off.  Rounding a half up is the
documented behaviour of Float>>rounded and is the same on every VM; no other
test depends on the choice.  The repair draws the five pictures for a half that
rounds up, and removes the expectedFailure marks.  The pictures of the other
alignments have no half cell and stay as they are.
The class that loads from Tonel files holds the lines of each picture with the
carriage return (Cr) as line end, and the canvas text has the same line end.
A picture that is compiled from this file has the line feed, so each new
picture changes the line feed to the carriage return when the method runs.
TbBoundsTest>>testAtRandom failed in about one run in ten: TbBounds>>atRandom
adds (width atRandom) and (height atRandom), each from 1 to the size, to the top
left corner, so a point can lie on the right or bottom edge.  The edge is outside
the bounds, because TbBounds>>containsPoint: takes the corner as exclusive.  The
repair takes a random offset from 0 to size - 1."


fix value: #TbFlowLayoutTest value: #expectedContentTestContentTwoChildrenVerticalBottomCenter
	value: [ :source | (source includesSubstring: 'String cr') not ]
	value:
'expectedContentTestContentTwoChildrenVerticalBottomCenter

	"The element column uses #alignBottomCenter. The free cells are odd (27 wide, 3 high), so the layout gives a half cell and TbCanvas>>at:write: rounds a cell position half up: the column starts one cell further right and one row further down than a rounding down would give."
	^ (''
..................................................
..................................................
..................................................
..............*---------------------*.............
..............|                     |.............
..............|                     |.............
..............*---------------------*.............
..............*------------------*................
..............|                  |................
..............| Hello Turbo      |................
..............|                  |................
..............|                  |................
..............*------------------*................
'' copyReplaceAll: String lf with: String cr) allButFirst'.

fix value: #TbFlowLayoutTest value: #testContentTwoChildrenVerticalBottomCenter
	value: [ :source | source includesSubstring: 'expectedFailure' ]
	value:
'testContentTwoChildrenVerticalBottomCenter

	space root layout: TbFlowLayout vertical.
	space root layout alignBottomCenter.
	space root addChild: e1.
	space root addChild: e2.
	e2 addChild: e3.

	self firePulse.
	self assert: self content equals: self expectedContentTestContentTwoChildrenVerticalBottomCenter.
'.

fix value: #TbFlowLayoutTest value: #expectedContentTestContentTwoChildrenVerticalCenter
	value: [ :source | (source includesSubstring: 'String cr') not ]
	value:
'expectedContentTestContentTwoChildrenVerticalCenter

	"The element column uses #alignCenter. The free cells are odd (27 wide, 3 high), so the layout gives a half cell and TbCanvas>>at:write: rounds a cell position half up: the column starts one cell further right and one row further down than a rounding down would give."
	^ (''
..................................................
..................................................
..............*---------------------*.............
..............|                     |.............
..............|                     |.............
..............*---------------------*.............
..............*------------------*................
..............|                  |................
..............| Hello Turbo      |................
..............|                  |................
..............|                  |................
..............*------------------*................
..................................................
'' copyReplaceAll: String lf with: String cr) allButFirst'.

fix value: #TbFlowLayoutTest value: #testContentTwoChildrenVerticalCenter
	value: [ :source | source includesSubstring: 'expectedFailure' ]
	value:
'testContentTwoChildrenVerticalCenter

	space root layout: TbFlowLayout vertical.
	space root layout alignCenter.
	space root addChild: e1.
	space root addChild: e2.
	e2 addChild: e3.

	self firePulse.
	self assert: self content equals: self expectedContentTestContentTwoChildrenVerticalCenter.
'.

fix value: #TbFlowLayoutTest value: #expectedContentTestContentTwoChildrenVerticalCenterLeft
	value: [ :source | (source includesSubstring: 'String cr') not ]
	value:
'expectedContentTestContentTwoChildrenVerticalCenterLeft

	"The element column uses #alignCenterLeft. The free cells are odd (27 wide, 3 high), so the layout gives a half cell and TbCanvas>>at:write: rounds a cell position half up: the column starts one cell further right and one row further down than a rounding down would give."
	^ (''
..................................................
..................................................
*---------------------*...........................
|                     |...........................
|                     |...........................
*---------------------*...........................
*------------------*..............................
|                  |..............................
| Hello Turbo      |..............................
|                  |..............................
|                  |..............................
*------------------*..............................
..................................................
'' copyReplaceAll: String lf with: String cr) allButFirst'.

fix value: #TbFlowLayoutTest value: #testContentTwoChildrenVerticalCenterLeft
	value: [ :source | source includesSubstring: 'expectedFailure' ]
	value:
'testContentTwoChildrenVerticalCenterLeft

	space root layout: TbFlowLayout vertical.
	space root layout alignCenterLeft.
	space root addChild: e1.
	space root addChild: e2.
	e2 addChild: e3.

	self firePulse.
	self assert: self content equals: self expectedContentTestContentTwoChildrenVerticalCenterLeft.
'.

fix value: #TbFlowLayoutTest value: #expectedContentTestContentTwoChildrenVerticalCenterRight
	value: [ :source | (source includesSubstring: 'String cr') not ]
	value:
'expectedContentTestContentTwoChildrenVerticalCenterRight

	"The element column uses #alignCenterRight. The free cells are odd (27 wide, 3 high), so the layout gives a half cell and TbCanvas>>at:write: rounds a cell position half up: the column starts one cell further right and one row further down than a rounding down would give."
	^ (''
..................................................
..................................................
...........................*---------------------*
...........................|                     |
...........................|                     |
...........................*---------------------*
...........................*------------------*...
...........................|                  |...
...........................| Hello Turbo      |...
...........................|                  |...
...........................|                  |...
...........................*------------------*...
..................................................
'' copyReplaceAll: String lf with: String cr) allButFirst'.

fix value: #TbFlowLayoutTest value: #testContentTwoChildrenVerticalCenterRight
	value: [ :source | source includesSubstring: 'expectedFailure' ]
	value:
'testContentTwoChildrenVerticalCenterRight

	space root layout: TbFlowLayout vertical.
	space root layout alignCenterRight.
	space root addChild: e1.
	space root addChild: e2.
	e2 addChild: e3.

	self firePulse.
	self assert: self content equals: self expectedContentTestContentTwoChildrenVerticalCenterRight.
'.

fix value: #TbFlowLayoutTest value: #expectedContentTestContentTwoChildrenVerticalTopCenter
	value: [ :source | (source includesSubstring: 'String cr') not ]
	value:
'expectedContentTestContentTwoChildrenVerticalTopCenter

	"The element column uses #alignTopCenter. The free cells are odd (27 wide, 3 high), so the layout gives a half cell and TbCanvas>>at:write: rounds a cell position half up: the column starts one cell further right and one row further down than a rounding down would give."
	^ (''
..............*---------------------*.............
..............|                     |.............
..............|                     |.............
..............*---------------------*.............
..............*------------------*................
..............|                  |................
..............| Hello Turbo      |................
..............|                  |................
..............|                  |................
..............*------------------*................
..................................................
..................................................
..................................................
'' copyReplaceAll: String lf with: String cr) allButFirst'.

fix value: #TbFlowLayoutTest value: #testContentTwoChildrenVerticalTopCenter
	value: [ :source | source includesSubstring: 'expectedFailure' ]
	value:
'testContentTwoChildrenVerticalTopCenter

	space root layout: TbFlowLayout vertical.
	space root layout alignTopCenter.
	space root addChild: e1.
	space root addChild: e2.
	e2 addChild: e3.

	self firePulse.
	self assert: self content equals: self expectedContentTestContentTwoChildrenVerticalTopCenter.
'.

fix value: #TbBounds value: #atRandom
	value: [ :source | (source includesSubstring: 'atRandom - 1') not ]
	value:
'atRandom
	"Return a random integer point within this bounds. The corner is not in the bounds, so each offset goes from 0 to size - 1."
	<return: #Point>

	^ (self topLeft + ((self width atRandom - 1) @ (self height atRandom - 1))) asIntegerPoint
'.

State of 2026-11-20. Made from the test records of the iospharo project (a second Pharo VM). The fixes are proposals for review.