diff --git a/cli_test.go b/cli_test.go index 8d3f8cf..c30047c 100644 --- a/cli_test.go +++ b/cli_test.go @@ -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. func TestCLI_Compile(t *testing.T) { const inches = 1 diff --git a/docker_test.go b/docker_test.go index 8c7da04..62060f4 100644 --- a/docker_test.go +++ b/docker_test.go @@ -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. func TestDocker_Compile(t *testing.T) { const inches = 1 diff --git a/test-files/Delius-Regular.ttf b/test-files/Delius-Regular.ttf new file mode 100644 index 0000000..2cd4c9a Binary files /dev/null and b/test-files/Delius-Regular.ttf differ