diff --git a/image/README.md b/image/README.md index 9356521..da5bee8 100644 --- a/image/README.md +++ b/image/README.md @@ -84,7 +84,8 @@ func main() { // write board SVG to file yellow := color.RGBA{255, 255, 0, 1} mark := image.MarkSquares(yellow, chess.D2, chess.D4) - if err := image.SVG(f, pos.Board(), mark); err != nil { + arrows := image.MarkArrows(image.Arrow(chess.D2, chess.D4)) + if err := image.SVG(f, pos.Board(), mark, arrows); err != nil { log.Fatal(err) } } @@ -92,5 +93,5 @@ func main() { ### Example Program Result -![rnbqkbnr/pppppppp/8/8/3P4/8/PPP1PPPP/RNBQKBNR b KQkq - 0 1](example.svg) +![rnbqkbnr/pppppppp/8/8/3P4/8/PPP1PPPP/RNBQKBNR b KQkq - 0 1](examples/example.svg) diff --git a/image/black_example.svg b/image/examples/black_example.svg similarity index 100% rename from image/black_example.svg rename to image/examples/black_example.svg diff --git a/image/example.png b/image/examples/example.png similarity index 100% rename from image/example.png rename to image/examples/example.png diff --git a/image/example.svg b/image/examples/example.svg similarity index 100% rename from image/example.svg rename to image/examples/example.svg diff --git a/image/knight_arrows_example.svg b/image/examples/knight_arrows_example.svg similarity index 100% rename from image/knight_arrows_example.svg rename to image/examples/knight_arrows_example.svg diff --git a/image/test.svg b/image/examples/test.svg similarity index 100% rename from image/test.svg rename to image/examples/test.svg diff --git a/image/image_test.go b/image/image_test.go index 0894180..0b84ab3 100755 --- a/image/image_test.go +++ b/image/image_test.go @@ -5,8 +5,6 @@ import ( "crypto/md5" "fmt" "image/color" - "io" - "os" "strings" "testing" @@ -38,16 +36,6 @@ func TestSVG(t *testing.T) { if actualMD5 != expectedMD5 { t.Errorf("expected actual md5 hash to be %s but got %s", expectedMD5, actualMD5) } - - // create actual svg file for visualization - f, err := os.Create("example.svg") - defer f.Close() - if err != nil { - t.Error(err) - } - if _, err := io.Copy(f, bytes.NewBufferString(actualSVG)); err != nil { - t.Error(err) - } } func TestSVGFromBlack(t *testing.T) { @@ -71,16 +59,6 @@ func TestSVGFromBlack(t *testing.T) { if actualMD5 != expectedMD5Black { t.Errorf("expected actual md5 hash to be %s but got %s", expectedMD5Black, actualMD5) } - - // create actual svg file for visualization - f, err := os.Create("black_example.svg") - defer f.Close() - if err != nil { - t.Error(err) - } - if _, err := io.Copy(f, bytes.NewBufferString(actualSVG)); err != nil { - t.Error(err) - } } func TestSVGKnightsAndDiagonals(t *testing.T) { @@ -125,14 +103,4 @@ func TestSVGKnightsAndDiagonals(t *testing.T) { if actualMD5 != expectedMD5KnightsAndDiagonalArrows { t.Errorf("expected actual md5 hash to be %s but got %s", expectedMD5KnightsAndDiagonalArrows, actualMD5) } - - // create actual svg file for visualization - f, err := os.Create("knight_arrows_example.svg") - defer f.Close() - if err != nil { - t.Error(err) - } - if _, err := io.Copy(f, bytes.NewBufferString(actualSVG)); err != nil { - t.Error(err) - } }