mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 12:08:58 +01:00
text/v2: add a test to parse a collection file
This test failed atc985e9bdc6
, but fixed at999c64cb78
accidentally. This issue was introduced in 2.9 (maybed19a774316
), so this doesn't have to be cherry-picked.
This commit is contained in:
parent
999c64cb78
commit
88a2c14a8e
@ -448,3 +448,30 @@ func TestGoXFaceMetrics(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestCollection(t *testing.T) {
|
||||||
|
fontFilePaths := []string{
|
||||||
|
// If a font file doesn't exist, the test is skipped.
|
||||||
|
"/System/Library/Fonts/Helvetica.ttc",
|
||||||
|
}
|
||||||
|
for _, path := range fontFilePaths {
|
||||||
|
path := path
|
||||||
|
t.Run(path, func(t *testing.T) {
|
||||||
|
bs, err := os.ReadFile(path)
|
||||||
|
if err != nil {
|
||||||
|
t.Skipf("skipping: failed to read %s", path)
|
||||||
|
}
|
||||||
|
fs, err := text.NewGoTextFaceSourcesFromCollection(bytes.NewBuffer(bs))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
for _, f := range fs {
|
||||||
|
dst := ebiten.NewImage(16, 16)
|
||||||
|
text.Draw(dst, "a", &text.GoTextFace{
|
||||||
|
Source: f,
|
||||||
|
Size: 16,
|
||||||
|
}, nil)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user