| 14 | ) |
| 15 | |
| 16 | func TestText(t *testing.T) { |
| 17 | size := image.Point{100, 40} |
| 18 | sizef := math32.Vector2FromPoint(size) |
| 19 | RunTest(t, "text", size.X, size.Y, func(pc *Context) { |
| 20 | pc.BlitBox(math32.Vector2{}, sizef, colors.Uniform(colors.White)) |
| 21 | tsty := &styles.Text{} |
| 22 | tsty.Defaults() |
| 23 | fsty := &styles.FontRender{} |
| 24 | fsty.Defaults() |
| 25 | fsty.Size.Dp(60) |
| 26 | |
| 27 | txt := &Text{} |
| 28 | txt.SetHTML("This is <a>HTML</a> <b>formatted</b> <i>text</i>", fsty, tsty, &pc.UnitContext, nil) |
| 29 | |
| 30 | tsz := txt.Layout(tsty, fsty, &pc.UnitContext, sizef) |
| 31 | _ = tsz |
| 32 | // if tsz.X != 100 || tsz.Y != 40 { |
| 33 | // t.Errorf("unexpected text size: %v", tsz) |
| 34 | // } |
| 35 | txt.HasOverflow = true |
| 36 | txt.Render(pc, math32.Vector2{}) |
| 37 | }) |
| 38 | } |