mirror of
https://github.com/Dadido3/go-typst.git
synced 2025-11-20 03:49:34 +00:00
Add test for the FontPaths option
This commit is contained in:
parent
cb8075d88f
commit
e8620ad02b
12
cli_test.go
12
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.
|
// Test basic compile functionality.
|
||||||
func TestCLI_Compile(t *testing.T) {
|
func TestCLI_Compile(t *testing.T) {
|
||||||
const inches = 1
|
const inches = 1
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
BIN
test-files/Delius-Regular.ttf
Normal file
BIN
test-files/Delius-Regular.ttf
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user