diff --git a/vxfw/richtext/richtext_test.go b/vxfw/richtext/richtext_test.go index df53cd6..a57b654 100644 --- a/vxfw/richtext/richtext_test.go +++ b/vxfw/richtext/richtext_test.go @@ -5,6 +5,7 @@ import ( "testing" "git.sr.ht/~rockorager/vaxis" + "git.sr.ht/~rockorager/vaxis/vxfw" "github.com/stretchr/testify/assert" ) @@ -127,6 +128,23 @@ func TestFirstLineSegment(t *testing.T) { } } +func TestRichtextSize(t *testing.T) { + app, _ := vxfw.NewApp(vaxis.Options{}) + rt := New([]vaxis.Segment{ + {Text: "Here is some longish text\n"}, + {Text: "Here is some longish text\n"}, + {Text: "Here is some longish text\n"}, + }) + surf, _ := rt.Draw( + vxfw.DrawContext{ + Characters: app.Characters, + Max: vxfw.Size{Width: 100, Height: 10}, + }) + if surf.Size.Height != 3 { + t.Error("wrong size", surf.Size.Height) + } +} + func TestSoftWrapScanner(t *testing.T) { tests := []struct { name string