diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-04-28 16:00:48 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-04-28 16:00:48 -0700 |
commit | 4d3ceaac75ea66bbbde8482408378f60b131c669 (patch) | |
tree | bc80140dd9a85eae55ef2b011cb6f5b0d49fa8d4 /tests/cubegeom.c | |
parent | 6733bb59e4a7e32b5591940ffc4df35efca6f63e (diff) |
add working cubegeom test
Diffstat (limited to 'tests/cubegeom.c')
-rw-r--r-- | tests/cubegeom.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/cubegeom.c b/tests/cubegeom.c index 529e1355..17d6e909 100644 --- a/tests/cubegeom.c +++ b/tests/cubegeom.c @@ -29,6 +29,20 @@ REDISTRIBUTION OF THIS SOFTWARE. #include <string.h> #include <assert.h> +void verify() { + int width = 640, height = 480; + unsigned char *data = (unsigned char*)malloc(width*height*4); + glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, data); + int sum = 0; + for (int x = 0; x < width*height*4; x++) { + if (x % 4 != 3) sum += x * data[x]; + } +#if EMSCRIPTEN + int result = sum; + REPORT_RESULT(); +#endif +} + int main(int argc, char *argv[]) { SDL_Surface *screen; @@ -267,7 +281,9 @@ int main(int argc, char *argv[]) // END SDL_GL_SwapBuffers(); - + + verify(); + #if !EMSCRIPTEN SDL_Delay(3000); #endif |