36 lines
533 B
Go
36 lines
533 B
Go
package dithering
|
|
|
|
import (
|
|
"image/color"
|
|
"image/png"
|
|
"math/rand"
|
|
"os/exec"
|
|
"testing"
|
|
"time"
|
|
|
|
"git.nkpl.cc/twocookedfaggots/imageutils"
|
|
)
|
|
|
|
func TestGrid(t *testing.T) {
|
|
rand.Seed(time.Now().UnixNano())
|
|
|
|
command := exec.Command("imv", "-")
|
|
w, err := command.StdinPipe()
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
img := imageutils.Scale(1<<6, grid{color.Gray{uint8(rand.Int() % 64)}})
|
|
|
|
go func() {
|
|
err = png.Encode(w, img)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
}()
|
|
|
|
err = command.Start()
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|