remove debug test

This commit is contained in:
elee 2022-03-25 01:04:20 -05:00
parent 86b1432f60
commit f2c0673681
4 changed files with 35 additions and 6 deletions

View File

@ -5,6 +5,7 @@ import (
"os" "os"
"testing" "testing"
"git.tuxpa.in/a/zlog/log"
"gitlab.com/gfxlabs/gfximg/apng" "gitlab.com/gfxlabs/gfximg/apng"
) )
@ -18,6 +19,8 @@ func TestParseFile1(t *testing.T) {
t.Fatalf("decode: %s", err) t.Fatalf("decode: %s", err)
} }
t.Logf("\n nori: %+v\n gawi: %+v", nori, nori.Gawi) t.Logf("\n nori: %+v\n gawi: %+v", nori, nori.Gawi)
a := nori.ExportAnimation()
writeApng(a, "./nori_test/palette.apng")
} }
func TestParseFile2(t *testing.T) { func TestParseFile2(t *testing.T) {
@ -30,6 +33,8 @@ func TestParseFile2(t *testing.T) {
t.Fatalf("decode: %s", err) t.Fatalf("decode: %s", err)
} }
t.Logf("\n nori: %+v\n gawi: %+v", nori, nori.Gawi) t.Logf("\n nori: %+v\n gawi: %+v", nori, nori.Gawi)
a := nori.ExportAnimation()
writeApng(a, "./nori_test/palette.apng")
} }
func TestParsePalette(t *testing.T) { func TestParsePalette(t *testing.T) {
@ -43,12 +48,15 @@ func TestParsePalette(t *testing.T) {
t.Errorf("decode: %s", err) t.Errorf("decode: %s", err)
} }
t.Logf("\n nori: %+v\n gawi: %+v\n palette: %+v\n", nori, nori.Gawi, nori.Gawi.Palette) t.Logf("\n nori: %+v\n gawi: %+v\n palette: %+v\n", nori, nori.Gawi, nori.Gawi.Palette)
out := new(bytes.Buffer)
a := nori.ExportAnimation() a := nori.ExportAnimation()
err = apng.Encode(out, *a) writeApng(a, "./nori_test/palette.apng")
}
func writeApng(a *apng.APNG, fp string) {
out := new(bytes.Buffer)
err := apng.Encode(out, *a)
if err != nil { if err != nil {
t.Errorf("encode: %s", err) log.Errorf("fail to encode apng %s", err)
} }
os.WriteFile("./nori_test/palette.apng", out.Bytes(), 0740) os.WriteFile("./nori_test/palette.apng", out.Bytes(), 0740)
} }

View File

@ -103,7 +103,6 @@ func (n *Reader) decodeGawi() error {
return err return err
} }
} }
fmt.Printf("\n-------\n n:'%+v'\n g:'%+v'", n, g)
if _, err := n.r.Discard(4 * int(g.BmpCount)); err != nil { if _, err := n.r.Discard(4 * int(g.BmpCount)); err != nil {
return err return err
} }

11
go.mod
View File

@ -2,4 +2,13 @@ module git.tuxpa.in/a/gotagonist
go 1.18 go 1.18
require gitlab.com/gfxlabs/gfximg v0.0.5 require (
git.tuxpa.in/a/zlog v1.32.0
gitlab.com/gfxlabs/gfximg v0.0.5
)
require (
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 // indirect
)

13
go.sum
View File

@ -1,2 +1,15 @@
git.tuxpa.in/a/zlog v1.32.0 h1:KKXbRF1x8kJDSzUoGz/pivo+4TVY6xT5sVtdFZ6traY=
git.tuxpa.in/a/zlog v1.32.0/go.mod h1:vUa2Qhu6DLPLqmfRy99FiPqaY2eb6/KQjtMekW3UNnA=
github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
gitlab.com/gfxlabs/gfximg v0.0.5 h1:jtHE6In6axz0zGPy7YnLIZV9RFdcFEZzpdqoXb52K9s= gitlab.com/gfxlabs/gfximg v0.0.5 h1:jtHE6In6axz0zGPy7YnLIZV9RFdcFEZzpdqoXb52K9s=
gitlab.com/gfxlabs/gfximg v0.0.5/go.mod h1:IAYZwCoqy3JFKwkKafragpfecp5Up6FFIzI7VvK2Zzo= gitlab.com/gfxlabs/gfximg v0.0.5/go.mod h1:IAYZwCoqy3JFKwkKafragpfecp5Up6FFIzI7VvK2Zzo=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 h1:foEbQz/B0Oz6YIqu/69kfXPYeFQAuuMYFkjaqXzl5Wo=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=