2023-03-28 00:04:53 +00:00
|
|
|
package d2fonts
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"path/filepath"
|
|
|
|
|
"testing"
|
|
|
|
|
|
2023-03-28 02:19:12 +00:00
|
|
|
"oss.terrastruct.com/d2/lib/font"
|
2023-03-28 00:04:53 +00:00
|
|
|
"oss.terrastruct.com/util-go/assert"
|
|
|
|
|
"oss.terrastruct.com/util-go/diff"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestCutFont(t *testing.T) {
|
|
|
|
|
f := Font{
|
|
|
|
|
Family: SourceCodePro,
|
|
|
|
|
Style: FONT_STYLE_REGULAR,
|
|
|
|
|
}
|
|
|
|
|
fontBuf := FontFaces[f]
|
2023-03-28 02:19:12 +00:00
|
|
|
fontBuf = font.UTF8CutFont(fontBuf, "a")
|
2023-03-28 00:04:53 +00:00
|
|
|
err := diff.Testdata(filepath.Join("testdata", "d2fonts", "cut"), ".txt", fontBuf)
|
|
|
|
|
assert.Success(t, err)
|
|
|
|
|
}
|