Skip to content
This repository has been archived by the owner on Aug 23, 2024. It is now read-only.

Commit

Permalink
Adds support for go mod (finally) (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
wcharczuk authored Nov 23, 2020
1 parent 962b9ab commit c1468e8
Show file tree
Hide file tree
Showing 89 changed files with 1,162 additions and 965 deletions.
9 changes: 3 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@ jobs:
build:
working_directory: /go/src/github.com/wcharczuk/go-chart
docker:
- image: circleci/golang:1.11
- image: circleci/golang:1.15
steps:
- checkout
- run:
name: new-install
command: make new-install
- run:
name: ci
command: make ci
- store_artifacts:
path: coverage.html
destination: coverage.html
name: Continuous Integration
command: make
15 changes: 2 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
all: test

ci: profanity coverage
all: new-install test

new-install:
@go get -v -u ./...
@go get -v -u github.com/blend/go-sdk/cmd/coverage
@go get -v -u github.com/blend/go-sdk/cmd/profanity

generate:
@go generate ./...

test:
@go test ./...

.PHONY: profanity
profanity:
@profanity

coverage:
@coverage
@go test ./...
4 changes: 2 additions & 2 deletions _examples/horizontal_stacked_bar/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package main
import (
"os"

"github.com/wcharczuk/go-chart"
"github.com/wcharczuk/go-chart/drawing"
"github.com/wcharczuk/go-chart/v2"
"github.com/wcharczuk/go-chart/v2/drawing"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions _examples/stacked_bar_labels/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package main
import (
"os"

"github.com/wcharczuk/go-chart"
"github.com/wcharczuk/go-chart/drawing"
"github.com/wcharczuk/go-chart/v2"
"github.com/wcharczuk/go-chart/v2/drawing"
)

func main() {
Expand Down
39 changes: 19 additions & 20 deletions annotation_series_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ import (
"image/color"
"testing"

"github.com/blend/go-sdk/assert"

"github.com/wcharczuk/go-chart/drawing"
"github.com/wcharczuk/go-chart/v2/drawing"
"github.com/wcharczuk/go-chart/v2/testutil"
)

func TestAnnotationSeriesMeasure(t *testing.T) {
assert := assert.New(t)
// replaced new assertions helper

as := AnnotationSeries{
Annotations: []Value2{
Expand All @@ -22,10 +21,10 @@ func TestAnnotationSeriesMeasure(t *testing.T) {
}

r, err := PNG(110, 110)
assert.Nil(err)
testutil.AssertNil(t, err)

f, err := GetDefaultFont()
assert.Nil(err)
testutil.AssertNil(t, err)

xrange := &ContinuousRange{
Min: 1.0,
Expand All @@ -50,15 +49,15 @@ func TestAnnotationSeriesMeasure(t *testing.T) {
}

box := as.Measure(r, cb, xrange, yrange, sd)
assert.False(box.IsZero())
assert.Equal(-5.0, box.Top)
assert.Equal(5.0, box.Left)
assert.Equal(146.0, box.Right) //the top,left annotation sticks up 5px and out ~44px.
assert.Equal(115.0, box.Bottom)
testutil.AssertFalse(t, box.IsZero())
testutil.AssertEqual(t, -5.0, box.Top)
testutil.AssertEqual(t, 5.0, box.Left)
testutil.AssertEqual(t, 146.0, box.Right) //the top,left annotation sticks up 5px and out ~44px.
testutil.AssertEqual(t, 115.0, box.Bottom)
}

func TestAnnotationSeriesRender(t *testing.T) {
assert := assert.New(t)
// replaced new assertions helper

as := AnnotationSeries{
Style: Style{
Expand All @@ -74,10 +73,10 @@ func TestAnnotationSeriesRender(t *testing.T) {
}

r, err := PNG(110, 110)
assert.Nil(err)
testutil.AssertNil(t, err)

f, err := GetDefaultFont()
assert.Nil(err)
testutil.AssertNil(t, err)

xrange := &ContinuousRange{
Min: 1.0,
Expand All @@ -104,13 +103,13 @@ func TestAnnotationSeriesRender(t *testing.T) {
as.Render(r, cb, xrange, yrange, sd)

rr, isRaster := r.(*rasterRenderer)
assert.True(isRaster)
assert.NotNil(rr)
testutil.AssertTrue(t, isRaster)
testutil.AssertNotNil(t, rr)

c := rr.i.At(38, 70)
converted, isRGBA := color.RGBAModel.Convert(c).(color.RGBA)
assert.True(isRGBA)
assert.Equal(0, converted.R)
assert.Equal(0, converted.G)
assert.Equal(0, converted.B)
testutil.AssertTrue(t, isRGBA)
testutil.AssertEqual(t, 0, converted.R)
testutil.AssertEqual(t, 0, converted.G)
testutil.AssertEqual(t, 0, converted.B)
}
Loading

0 comments on commit c1468e8

Please sign in to comment.