Skip to content

Commit

Permalink
test updates
Browse files Browse the repository at this point in the history
removed getImgInfo() & loadImage()
  • Loading branch information
BourgeoisBear committed Apr 3, 2024
1 parent d012e6d commit 7d19db3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 29 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module github.com/BourgeoisBear/rasterm

go 1.16

require golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d
require golang.org/x/term v0.18.0
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d h1:SZxvLBoTP5yHO3Frd4z4vrF+DBX9vMVanchswa69toE=
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
38 changes: 14 additions & 24 deletions rasterm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,6 @@ func init() {
os.Stdout.Write([]byte(ESC_ERASE_DISPLAY))
}

func loadImage(path string) (iImg image.Image, imgFmt string, E error) {

pF, E := os.Open(path)
if E != nil {
return
}
defer pF.Close()

return image.Decode(pF)
}

func getFile(fpath string) (*os.File, int64, error) {

pF, E := os.Open(fpath)
Expand All @@ -59,17 +48,6 @@ func getFile(fpath string) (*os.File, int64, error) {
return pF, fInf.Size(), nil
}

func getImgInfo(pF *os.File) (imgCfg image.Config, fmtName string, E error) {

if imgCfg, fmtName, E = image.DecodeConfig(pF); E != nil {
return
}

// REWIND FILE
_, E = pF.Seek(0, 0)
return
}

type TestLogger interface {
Log(...interface{})
Logf(string, ...interface{})
Expand Down Expand Up @@ -106,13 +84,25 @@ func testEx(iLog TestLogger, out io.Writer, mode string, testFiles []string) err

fmt.Println(fpath)

imgCfg, fmtName, e2 := getImgInfo(fIn)
imgCfg, fmtName, e2 := image.DecodeConfig(fIn)
if e2 != nil {
iLog.Log(e2)
continue
}

_, e2 = fIn.Seek(0, 0)
if e2 != nil {
iLog.Log(e2)
continue
}

iImg, _, e2 := image.Decode(fIn)
if e2 != nil {
iLog.Log(e2)
continue
}

iImg, _, e2 := loadImage(fpath)
_, e2 = fIn.Seek(0, 0)
if e2 != nil {
iLog.Log(e2)
continue
Expand Down

0 comments on commit 7d19db3

Please sign in to comment.