The record is the text of the repair. The Results table is the last run of the row.
TbFlowLayoutTest (two children in a
vertical flow, in the centre) are one cell off. The free space is odd,
so the layout gives a position with a half cell. TbCanvas>>at:write:
rounds a half up. The pictures were drawn for a half that is cut off.
The layout code is right, and the other tests of the class agree with
it.TbBounds>>atRandom could answer a point on the right or bottom edge,
which containsPoint: does not count as inside. TbBoundsTest>>testAtRandom
failed in about 1 run of 10 (372 of 4000 points outside on stock Cog
before the repair, 0 after).fixes/pavel-krivanek-turbo.st: the 5 pictures, with the
line ends of the package (CR), no mark of an expected failure, and
atRandom with an offset from 0.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').Last result of the package run (stock Cog and iospharo on the same image).
| Row | Label | Load | Stock Cog | iospharo VM |
|---|---|---|---|---|
| 91 | pavel-krivanek-turbo | ok | tests=270 P=270 F=0 E=0 S=0 T=0 X=0 | tests=270 P=270 F=0 E=0 S=0 T=0 X=0 |
"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.