Loading colors/colors_test.go +3 −3 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ func TestMapOfColorsThemes(t *testing.T) { t.Errorf("base color expected") } else { if len(base) != 2 { t.Errorf("expects", 2, "got", len(base)) t.Errorf("expects %d, got %d", 2, len(base)) } } Loading @@ -29,10 +29,10 @@ func TestMapOfColorsThemes(t *testing.T) { for _, v := range themes { if got, ok := m[v]; !ok { t.Errorf("color", v, "expected") t.Errorf("color %v expected", v) } else { if len(got) != 4 { t.Errorf("expects", 4, "got", len(got)) t.Errorf("expects %d got %d", 4, len(got)) } } } Loading draw/isogrids/gradient.go +6 −2 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ import ( "image/color" "net/http" "github.com/ajstarks/svgo" svg "github.com/ajstarks/svgo" "github.com/taironas/tinygraphs/colors" "github.com/taironas/tinygraphs/draw" ) Loading @@ -19,7 +19,11 @@ func RandomGradientColor(w http.ResponseWriter, colors, gColors []color.RGBA, gv step := uint8(100 / len(gColors)) for i, c := range gColors { gradientColors[i] = svg.Offcolor{percentage, draw.RGBToHex(c.R, c.G, c.B), 1} gradientColors[i] = svg.Offcolor{ Offset: percentage, Color: draw.RGBToHex(c.R, c.G, c.B), Opacity: 1, } percentage += step } Loading draw/isogrids/gradient_test.go +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ var ( func TestRandomGradientColor(t *testing.T) { t.Parallel() rec := httptest.NewRecorder() gv := tgColors.GradientVector{0, 0, 1, 1} gv := tgColors.GradientVector{X1: 0, Y1: 0, X2: 1, Y2: 1} RandomGradientColor(rec, colorTheme, colorTheme[1:], gv, 10, 10, 10, float64(50)) if rec.Code != http.StatusOK { t.Errorf("returned %v. Expected %v.", rec.Code, http.StatusOK) Loading draw/spaceinvaders/invader_test.go +4 −4 Original line number Diff line number Diff line Loading @@ -138,12 +138,12 @@ func TestHasFootFromKey(t *testing.T) { got := HasFootFromKey('a') expected := false if got != expected { t.Errorf("expected %d got %d", expected, got) t.Errorf("expected %v got %v", expected, got) } got = HasFootFromKey('b') expected = true if got != expected { t.Errorf("expected %d got %d", expected, got) t.Errorf("expected %v got %v", expected, got) } } Loading @@ -152,12 +152,12 @@ func TestHasArmsUpFromKey(t *testing.T) { got := HasArmsUpFromKey('a') expected := false if got != expected { t.Errorf("expected %d got %d", expected, got) t.Errorf("expected %v got %v", expected, got) } got = HasArmsUpFromKey('b') expected = true if got != expected { t.Errorf("expected %d got %d", expected, got) t.Errorf("expected %v got %v", expected, got) } } Loading draw/squares/gradient.go +6 −2 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ import ( "image/color" "net/http" "github.com/ajstarks/svgo" svg "github.com/ajstarks/svgo" "github.com/taironas/tinygraphs/colors" "github.com/taironas/tinygraphs/draw" ) Loading @@ -19,7 +19,11 @@ func RandomGradientColorSVG(w http.ResponseWriter, colors, gColors []color.RGBA, step := uint8(100 / len(gColors)) for i, c := range gColors { gradientColors[i] = svg.Offcolor{percentage, draw.RGBToHex(c.R, c.G, c.B), 1} gradientColors[i] = svg.Offcolor{ Offset: percentage, Color: draw.RGBToHex(c.R, c.G, c.B), Opacity: 1, } percentage += step } Loading Loading
colors/colors_test.go +3 −3 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ func TestMapOfColorsThemes(t *testing.T) { t.Errorf("base color expected") } else { if len(base) != 2 { t.Errorf("expects", 2, "got", len(base)) t.Errorf("expects %d, got %d", 2, len(base)) } } Loading @@ -29,10 +29,10 @@ func TestMapOfColorsThemes(t *testing.T) { for _, v := range themes { if got, ok := m[v]; !ok { t.Errorf("color", v, "expected") t.Errorf("color %v expected", v) } else { if len(got) != 4 { t.Errorf("expects", 4, "got", len(got)) t.Errorf("expects %d got %d", 4, len(got)) } } } Loading
draw/isogrids/gradient.go +6 −2 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ import ( "image/color" "net/http" "github.com/ajstarks/svgo" svg "github.com/ajstarks/svgo" "github.com/taironas/tinygraphs/colors" "github.com/taironas/tinygraphs/draw" ) Loading @@ -19,7 +19,11 @@ func RandomGradientColor(w http.ResponseWriter, colors, gColors []color.RGBA, gv step := uint8(100 / len(gColors)) for i, c := range gColors { gradientColors[i] = svg.Offcolor{percentage, draw.RGBToHex(c.R, c.G, c.B), 1} gradientColors[i] = svg.Offcolor{ Offset: percentage, Color: draw.RGBToHex(c.R, c.G, c.B), Opacity: 1, } percentage += step } Loading
draw/isogrids/gradient_test.go +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ var ( func TestRandomGradientColor(t *testing.T) { t.Parallel() rec := httptest.NewRecorder() gv := tgColors.GradientVector{0, 0, 1, 1} gv := tgColors.GradientVector{X1: 0, Y1: 0, X2: 1, Y2: 1} RandomGradientColor(rec, colorTheme, colorTheme[1:], gv, 10, 10, 10, float64(50)) if rec.Code != http.StatusOK { t.Errorf("returned %v. Expected %v.", rec.Code, http.StatusOK) Loading
draw/spaceinvaders/invader_test.go +4 −4 Original line number Diff line number Diff line Loading @@ -138,12 +138,12 @@ func TestHasFootFromKey(t *testing.T) { got := HasFootFromKey('a') expected := false if got != expected { t.Errorf("expected %d got %d", expected, got) t.Errorf("expected %v got %v", expected, got) } got = HasFootFromKey('b') expected = true if got != expected { t.Errorf("expected %d got %d", expected, got) t.Errorf("expected %v got %v", expected, got) } } Loading @@ -152,12 +152,12 @@ func TestHasArmsUpFromKey(t *testing.T) { got := HasArmsUpFromKey('a') expected := false if got != expected { t.Errorf("expected %d got %d", expected, got) t.Errorf("expected %v got %v", expected, got) } got = HasArmsUpFromKey('b') expected = true if got != expected { t.Errorf("expected %d got %d", expected, got) t.Errorf("expected %v got %v", expected, got) } } Loading
draw/squares/gradient.go +6 −2 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ import ( "image/color" "net/http" "github.com/ajstarks/svgo" svg "github.com/ajstarks/svgo" "github.com/taironas/tinygraphs/colors" "github.com/taironas/tinygraphs/draw" ) Loading @@ -19,7 +19,11 @@ func RandomGradientColorSVG(w http.ResponseWriter, colors, gColors []color.RGBA, step := uint8(100 / len(gColors)) for i, c := range gColors { gradientColors[i] = svg.Offcolor{percentage, draw.RGBToHex(c.R, c.G, c.B), 1} gradientColors[i] = svg.Offcolor{ Offset: percentage, Color: draw.RGBToHex(c.R, c.G, c.B), Opacity: 1, } percentage += step } Loading