Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image/jpeg and image/png tests fail to build? #363

Open
dkegel-fastly opened this issue Jan 20, 2022 · 4 comments
Open

image/jpeg and image/png tests fail to build? #363

dkegel-fastly opened this issue Jan 20, 2022 · 4 comments

Comments

@dkegel-fastly
Copy link

I just cloned the repo and tried

cd image/jpeg
tinygo test

This failed with

reader_test.go:92:2: wrong number of return values (want 2, got 1)

It looks like an internal disagreement about the return values of Decode()... @sago35, could you comment?

@sago35
Copy link
Member

sago35 commented Jan 20, 2022

@dkegel-fastly
I changed the interface from Go's image package.

https://github.com/tinygo-org/drivers/tree/release/examples/ili9341/slideshow

func drawPng(display *ili9341.Device) error {
p := strings.NewReader(pngImage)
png.SetCallback(buffer[:], func(data []uint16, x, y, w, h, width, height int16) {
err := display.DrawRGBBitmap(x, y, data[:w*h], w, h)
if err != nil {
errorMessage(fmt.Errorf("error drawPng: %s", err))
}
})
return png.Decode(p)
}

However, it failed because I did not change the tests.

I think we can either maintain the test or remove it.

@dkegel-fastly
Copy link
Author

I'd vote for fixing the test and turning it on in CI, on the theory that it helps prevent bitrot.

@deadprogram
Copy link
Member

I changed the interface from Go's image package.

Is that strictly needed? I have not looked at the specifics in this case, just asking.

@sago35
Copy link
Member

sago35 commented Jan 24, 2022

Is that strictly needed? I have not looked at the specifics in this case, just asking.

Due to memory size limitations, it was not possible to return image.Image.
I changed the function signature to make the user aware of the mistake, but in hindsight I think it would have been better to just return nil.

  • Go's image/png : func Decode(r io.Reader) (image.Image, error)
  • tinygo.org/x/image/png : func Decode(r io.Reader) error

I'd vote for fixing the test and turning it on in CI, on the theory that it helps prevent bitrot.

I'll take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants