GitHub / windows amd64 native GitHub-hosted native CI: success
GitHub / darwin amd64 native GitHub-hosted native CI: success
GitHub / linux amd64 native GitHub-hosted native CI: success
ci-platforms / darwin amd64 smoke (push) Skipped
ci-platforms / windows amd64 smoke (push) Skipped
ci-platforms / darwin arm64 smoke (push) Skipped
ci / build (amd64, linux, ubuntu-24.04) (push) Failing after 9m5s
github-native / gitea-pending (push) Skipped
GitHub / darwin arm64 native GitHub-hosted native CI: failure
github-native / darwin amd64 native (push) Skipped
github-native / linux amd64 native (push) Skipped
github-native / windows amd64 native (push) Skipped
github-native / darwin arm64 native (push) Skipped
github-native / gitea-result (push) Skipped
ci / checks (push) Failing after 47m1s
ci / release (push) Skipped
25 lines
768 B
Go
25 lines
768 B
Go
package text
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"aego/core/mathx"
|
|
)
|
|
|
|
func TestGlyphVerticalBoundsRemainConservative(t *testing.T) {
|
|
f := NewFont(14, 2, 18, 14)
|
|
f.SetGlyph('A', FontGlyph{Offset: mathx.Vec2{Y: -42}, Size: mathx.Vec2{Y: 60}})
|
|
f.SetGlyph('?', FontGlyph{Offset: mathx.Vec2{Y: 5}, Size: mathx.Vec2{Y: 50}})
|
|
f.SetFallback('?')
|
|
f.SetGlyph('A', FontGlyph{Offset: mathx.Vec2{Y: -2}, Size: mathx.Vec2{Y: 8}})
|
|
lo, hi := f.GlyphVerticalBounds()
|
|
if lo > -42 || hi < 55 {
|
|
t.Fatalf("lost conservative bounds after replacing a glyph: %v..%v", lo, hi)
|
|
}
|
|
f.SetGlyph('界', FontGlyph{Offset: mathx.Vec2{Y: -70}, Size: mathx.Vec2{Y: 160}})
|
|
lo, hi = f.GlyphVerticalBounds()
|
|
if lo > -70 || hi < 90 {
|
|
t.Fatalf("new non-ASCII glyph is outside bounds: %v..%v", lo, hi)
|
|
}
|
|
}
|