Add test for the FontPaths option

This commit is contained in:
David Vogel 2025-11-16 15:58:07 +00:00
parent cb8075d88f
commit e8620ad02b
3 changed files with 27 additions and 0 deletions

View File

@ -51,6 +51,18 @@ func TestCLI_FontsWithOptions(t *testing.T) {
} }
} }
func TestCLI_FontsWithFontPaths(t *testing.T) {
caller := typst.CLI{}
result, err := caller.Fonts(&typst.OptionsFonts{IgnoreSystemFonts: true, FontPaths: []string{filepath.Join(".", "test-files")}})
if err != nil {
t.Fatalf("Failed to get available fonts: %v.", err)
}
if len(result) != 5 {
t.Errorf("Unexpected number of detected fonts. Got %d, want %d.", len(result), 5)
}
}
// Test basic compile functionality. // Test basic compile functionality.
func TestCLI_Compile(t *testing.T) { func TestCLI_Compile(t *testing.T) {
const inches = 1 const inches = 1

View File

@ -63,6 +63,21 @@ func TestDocker_FontsWithOptions(t *testing.T) {
} }
} }
func TestDocker_FontsWithFontPaths(t *testing.T) {
caller := typst.Docker{
Image: typstDockerImage(),
Volumes: []string{"./test-files:/fonts"},
}
result, err := caller.Fonts(&typst.OptionsFonts{IgnoreSystemFonts: true, FontPaths: []string{"/fonts"}})
if err != nil {
t.Fatalf("Failed to get available fonts: %v.", err)
}
if len(result) != 5 {
t.Errorf("Unexpected number of detected fonts. Got %d, want %d.", len(result), 5)
}
}
// Test basic compile functionality. // Test basic compile functionality.
func TestDocker_Compile(t *testing.T) { func TestDocker_Compile(t *testing.T) {
const inches = 1 const inches = 1

Binary file not shown.