text options!
This commit is contained in:
parent
b3386853bb
commit
d84d6790c0
25 changed files with 526 additions and 287 deletions
|
|
@ -6,6 +6,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/blendlabs/go-assert"
|
||||
"github.com/wcharczuk/go-chart/drawing"
|
||||
)
|
||||
|
||||
func TestVectorRendererPath(t *testing.T) {
|
||||
|
|
@ -50,3 +51,27 @@ func TestVectorRendererMeasureText(t *testing.T) {
|
|||
assert.Equal(21, tb.Width())
|
||||
assert.Equal(15, tb.Height())
|
||||
}
|
||||
|
||||
func TestCanvasStyleSVG(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
f, err := GetDefaultFont()
|
||||
assert.Nil(err)
|
||||
|
||||
set := Style{
|
||||
StrokeColor: drawing.ColorWhite,
|
||||
StrokeWidth: 5.0,
|
||||
FillColor: drawing.ColorWhite,
|
||||
FontColor: drawing.ColorWhite,
|
||||
Font: f,
|
||||
Padding: DefaultBackgroundPadding,
|
||||
}
|
||||
|
||||
canvas := &canvas{dpi: DefaultDPI}
|
||||
|
||||
svgString := canvas.styleAsSVG(set)
|
||||
assert.NotEmpty(svgString)
|
||||
assert.True(strings.Contains(svgString, "stroke:rgba(255,255,255,1.0)"))
|
||||
assert.True(strings.Contains(svgString, "stroke-width:5"))
|
||||
assert.True(strings.Contains(svgString, "fill:rgba(255,255,255,1.0)"))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue