diff options
author | Tavian Barnes <tavianator@gmail.com> | 2010-05-06 15:18:33 -0600 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2010-05-06 15:18:33 -0600 |
commit | 4031fef0bba9575d1c9d45af06b3a9996311880c (patch) | |
tree | 3143adae8c5ac273e2538f200efbd1b6405b2364 /tests/libdimension/png.c | |
parent | 9c35f4d740762bdc302853df590d9f513368ae17 (diff) | |
download | dimension-4031fef0bba9575d1c9d45af06b3a9996311880c.tar.xz |
Only render in one combined `render' test.
GL and PNG tests now only test import/export.
Diffstat (limited to 'tests/libdimension/png.c')
-rw-r--r-- | tests/libdimension/png.c | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/tests/libdimension/png.c b/tests/libdimension/png.c index 2073310..41771d3 100644 --- a/tests/libdimension/png.c +++ b/tests/libdimension/png.c @@ -23,51 +23,41 @@ int main() { - FILE *ifile, *ofile; - dmnsn_scene *scene; - dmnsn_canvas *canvas; - /* Set the resilience low for tests */ dmnsn_set_resilience(DMNSN_SEVERITY_LOW); - /* - * Render the scene - */ - - /* Allocate our default scene */ - scene = dmnsn_new_default_scene(); + /* Allocate our canvas */ + dmnsn_canvas *canvas = dmnsn_new_canvas(768, 480); /* Optimize the canvas for PNG export */ - if (dmnsn_png_optimize_canvas(scene->canvas) != 0) { - dmnsn_delete_scene(scene); + if (dmnsn_png_optimize_canvas(canvas) != 0) { + dmnsn_delete_canvas(canvas); fprintf(stderr, "--- Couldn't optimize canvas for PNG! ---\n"); return EXIT_FAILURE; } - /* Render scene */ - - printf("Rendering scene\n"); - dmnsn_raytrace_scene(scene); + /* Paint the canvas blue */ + dmnsn_clear_canvas(canvas, dmnsn_blue); /* Write the image to PNG */ printf("Writing scene to PNG\n"); - ofile = fopen("png1.png", "wb"); + FILE *ofile = fopen("png1.png", "wb"); if (!ofile) { - dmnsn_delete_scene(scene); + dmnsn_delete_canvas(canvas); fprintf(stderr, "--- Couldn't open 'png1.png' for writing! ---\n"); return EXIT_FAILURE; } - if (dmnsn_png_write_canvas(scene->canvas, ofile) != 0) { + if (dmnsn_png_write_canvas(canvas, ofile) != 0) { fclose(ofile); - dmnsn_delete_scene(scene); + dmnsn_delete_canvas(canvas); fprintf(stderr, "--- Writing canvas to PNG failed! ---\n"); return EXIT_FAILURE; } fclose(ofile); - dmnsn_delete_scene(scene); + dmnsn_delete_canvas(canvas); /* * Now test PNG import/export @@ -76,7 +66,7 @@ main() { /* Read the image back from PNG */ printf("Reading scene from PNG\n"); - ifile = fopen("png1.png", "rb"); + FILE *ifile = fopen("png1.png", "rb"); if (!ifile) { fprintf(stderr, "--- Couldn't open 'png1.png' for reading! ---\n"); return EXIT_FAILURE; |