The record is the text of the repair. The Results table is the last run of the row.
CSSFontFormatterTest start with self skip: ("probably due to use of a
non existing font in the CI").TextStyle named: for
the fonts Verdana and NimbusRomanNo9L. TextStyle named: answers nil on a
machine that does not have the font, and the formatter then keeps
CSSFontFormatter defaultStyle. One test also compares a Float size with
the Integer that the formatter stores.fixes/pharo-contributions-cssparser.st. The expected value
is the font, or the default style of the package when the machine does not
have the font. The expected size is an Integer, as in the formatter.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 20"
Metacello new baseline: 'CSSParser'; repository: 'github://pharo-contributions/CSSParser:main'; 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 |
|---|---|---|---|---|
| 20 | pharo-contributions-cssparser | ok | tests=80 P=80 F=0 E=0 S=0 T=0 X=0 | tests=80 P=80 F=0 E=0 S=0 T=0 X=0 |
"CSSParser (pharo-contributions/CSSParser, main): CSSFontFormatterTest
>>test04ComplexFontValueShouldBeParsedCorrectly and >>test05FontFamilyShouldBeParsedCorrectly
start with 'self skip:' ('probably due to use of a non existing font in the CI
(Source Sans Pro)'). The skip is unconditional: the two tests never run on any machine.
The two tests compare the parsed font family with (TextStyle named: 'Verdana')
and (TextStyle named: 'NimbusRomanNo9L'). Those fonts are installed only on
the machine of the author; on a machine without them TextStyle named: answers
nil, while CSSFontFormatter class>>defaultStyle answers TextStyle default. The
tests are repaired so that the expected value is what the package itself
specifies when the font is absent: the fallback CSSFontFormatter defaultStyle.
Test04 also compares 3 * defaultSize (a Float, because TextStyle
pointsToPixels: divides by 72.0) with the value of readFontSizeAttribute:,
which truncates with asInteger. The expected value is truncated the same way."
fix value: #CSSFontFormatterTest value: #test04ComplexFontValueShouldBeParsedCorrectly
value: [ :source | source includesSubstring: 'self skip:' ]
value:
'test04ComplexFontValueShouldBeParsedCorrectly
| prop result |
result := Dictionary new.
prop := CSSProperty new
propertyName: ''font'';
propertyString: ''bold xx-large/180% Verdana'';
yourself.
self fontFormatter parseTextAttributesFrom: prop into: result.
self assert: false equals: (result at: #italic).
self assert: true equals: (result at: #bold).
"readFontSizeAttribute: truncates the scaled size with asInteger"
self assert: (3 * CSSFontFormatter defaultSize) asInteger equals: (result at: #fontSize).
"Verdana, or the package fallback when the font is not installed"
self assert: CSSFontFormatter defaultStyle equals: (result at: #fontFamily).
'.
fix value: #CSSFontFormatterTest value: #test05FontFamilyShouldBeParsedCorrectly
value: [ :source | source includesSubstring: 'self skip:' ]
value:
'test05FontFamilyShouldBeParsedCorrectly
| prop result |
result := Dictionary new.
prop := CSSProperty new
propertyName: ''font-family'';
propertyString: ''non-existent, serif, sans-serif'';
yourself.
self fontFormatter parseTextAttributesFrom: prop into: result.
"serif maps to NimbusRomanNo9L; when that font is not installed the package falls back to the default style"
self
assert: ((TextStyle named: ''NimbusRomanNo9L'') ifNil: [ CSSFontFormatter defaultStyle ])
equals: (result at: #fontFamily).
'.
State of 2026-11-20. Made from the test records of the iospharo project (a second Pharo VM). The fixes are proposals for review.