veandco / go-sdl2

SDL2 binding for Go
https://godoc.org/github.com/veandco/go-sdl2
BSD 3-Clause "New" or "Revised" License
2.2k stars 218 forks source link

Weird Bug #356

Open Pixdigit opened 6 years ago

Pixdigit commented 6 years ago

I have absolutely no idea what why or how. Technically it probably isnt even an error with go-sdl2 but I hope you have some insight.

I have worked on my Project (branch fix_renderer) for quite some time on my laptop now. However now coming back home when I run the tests on my desktop pc I don't get any output from the renderer at all. In testEnv I made a small sample program that just fills the renderer and presents. That program worked. So I made a small test func at the bottom of screen_test.go called TestRenderer2TMP that had the exact same code. This one didn't work when run in isolation or with all other tests. So I asked a friend and he had the exact same problem on his pc. Now I run this on my laptop. When I run the test in isolation it doesn't work either. As well as the small program I wrote. However when I run the test together with all other tests it magically works again. And all of this behaviour is stable. Meaning that it doesn't change from run to run. I am completely lost and I have no idea where to begin.

veeableful commented 6 years ago

Hmm I think it's because of how Go run tests and how we setup SDL currently. If you initialize SDL in your test function, it should work.

This is certainly an area that we can improve on though. I'll keep this in mind for future development!

Pixdigit commented 6 years ago

SDL is initialized in all cases the same way. There should be no difference since the exact same code is run. Or are go tests run in their own goroutine?

Pixdigit commented 5 years ago

Depends on what you see as solved. The error still exists but not within go-sdl2 so you decide.

veeableful commented 5 years ago

@Pixdigit Ack sorry! I labeled this one by mistake. I meant to label this one. Don't mind me!