MCPcopy Index your code
hub / github.com/tdewolff/canvas / TestTextBox

Function TestTextBox

text_test.go:328–338  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

326}
327
328func TestTextBox(t *testing.T) {
329 c := New(100, 100)
330 ctx := NewContext(c)
331 font, err := LoadFontFile("resources/DejaVuSerif.ttf", FontRegular)
332 if err != nil {
333 t.Fatal(err)
334 }
335 face := font.Face(12, Black)
336 ctx.DrawText(0, 0, NewTextBox(face, "\ntext", 100, 100, Left, Top, nil))
337 ctx.DrawText(0, 0, NewTextBox(face, "text\n\ntext2", 100, 100, Left, Top, nil))
338}

Callers

nothing calls this directly

Calls 6

DrawTextMethod · 0.95
NewContextFunction · 0.85
LoadFontFileFunction · 0.85
NewTextBoxFunction · 0.85
NewFunction · 0.70
FaceMethod · 0.45

Tested by

no test coverage detected