Skip to content

Commit

Permalink
Adjust face merge tests after inheritance change
Browse files Browse the repository at this point in the history
In 036631f, the face merge rules around inheritance were refined in
response to the realisation that inheritance wasn't handled quite right
around merging, but the tests weren't.
  • Loading branch information
tecosaur committed Oct 29, 2023
1 parent 036631f commit 2709150
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ end
let f1 = Face(height=140, weight=:bold, inherit=[:a])
f2 = Face(height=1.5, weight=:light, inherit=[:b])
f3 = Face(height=1.2, slant=:italic)
@test merge(f1, f2, f3) == Face(height=252, weight=:light, slant=:italic)
@test merge(f3, f2, f1) == Face(height=140, weight=:bold, slant=:italic, inherit=[:a])
@test merge(f3, f1) == Face(height=140, weight=:bold, slant=:italic, inherit=[:a])
@test merge(f3, f2) == Face(height=1.5*1.2, weight=:light, slant=:italic, inherit=[:b])
@test merge(f1, f2, f3) == Face(height=252, weight=:light, slant=:italic, inherit=[:a]) #\ @test merge(f2, f3) == Face(height=210, weight=:light, slant=:italic, inherit=[:b])
@test merge(f3, f2, f1) == Face(height=140, weight=:bold, slant=:italic)
@test merge(f3, f1) == Face(height=140, weight=:bold, slant=:italic)
@test merge(f3, f2) == Face(height=1.5*1.2, weight=:light, slant=:italic)
end
# Merging, inheritence, and canonicalisation
let aface = Face(font="a", height=1.2)
Expand All @@ -133,9 +133,9 @@ end
StyledStrings.loadface!(:d => dface)
StyledStrings.loadface!(:e => eface)
StyledStrings.loadface!(:f => fface)
@test StyledStrings.getface(:c) == merge(StyledStrings.FACES.current[][:default], aface, bface, cface, Face())
@test StyledStrings.getface(:b) == merge(StyledStrings.FACES.current[][:default], aface, bface, Face())
@test StyledStrings.getface(:a) == merge(StyledStrings.FACES.current[][:default], aface, Face())
@test StyledStrings.getface(:c) == merge(StyledStrings.FACES.current[][:default], aface, bface, Face(height=120), cface)
@test StyledStrings.getface(:b) == merge(StyledStrings.FACES.current[][:default], aface, Face(height=120), bface)
@test StyledStrings.getface(:a) == merge(StyledStrings.FACES.current[][:default], aface)
@test StyledStrings.getface([:c]) == StyledStrings.getface(:c)
@test StyledStrings.getface(bface) == StyledStrings.getface(:b)
@test StyledStrings.getface(cface) == StyledStrings.getface(:c)
Expand Down

0 comments on commit 2709150

Please sign in to comment.