diff options
-rw-r--r-- | test.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -268,6 +268,25 @@ test_execute_steps( free((void*) rom_data); } +static const uint8_t +TEST_IMAGE[] = { + 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, + 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, + 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, +}; + +static void +test_write_image( + const char * const img_path +) { + // save png + if (lodepng_encode24_file(img_path, TEST_IMAGE, 3, 3)) { + fprintf(stderr, "lode_png_encode24_file() failed\n"); + exit(EXIT_FAILURE); + } + fprintf(stderr, "saved image as \"%s\"\n", img_path); +} + int main(int argc, char *argv[]) { // render 600 frames for (int i = 2; i < argc; i++) { @@ -275,6 +294,8 @@ int main(int argc, char *argv[]) { test_render_frames("out.png", argv[i]); } else if (argv[1][0] == 'e') { test_execute_steps(argv[i]); + } else if (argv[1][0] == 'i') { + test_write_image(argv[i]); } else { fprintf(stderr, "unknown test: %s\n", argv[i]); exit(EXIT_FAILURE); |