From ffe2fa169f9fdc411d00e1c75cf3cdc5f3099727 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sun, 12 Feb 2023 22:57:51 +0000 Subject: Extend fuzzpuzz to test more code Now if the input save file loads correctly, fuzzpuzz asks the back-end to draw the puzzle. All the drawing operations are no-ops, but this tests the drawing code in the back-end. --- fuzzpuzz.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'fuzzpuzz.c') diff --git a/fuzzpuzz.c b/fuzzpuzz.c index 0d6cc7a..978c90e 100644 --- a/fuzzpuzz.c +++ b/fuzzpuzz.c @@ -39,6 +39,8 @@ static void savefile_write(void *wctx, const void *buf, int len) fwrite(buf, 1, len, fp); } +static drawing_api drapi = { NULL }; + int main(int argc, char **argv) { const char *err; @@ -47,6 +49,7 @@ int main(int argc, char **argv) const game *ourgame = NULL; midend *me; FILE *in = NULL; + int w, h; if (argc != 1) { fprintf(stderr, "usage: %s\n", argv[0]); @@ -93,7 +96,7 @@ int main(int argc, char **argv) continue; } - me = midend_new(NULL, ourgame, NULL, NULL); + me = midend_new(NULL, ourgame, &drapi, NULL); rewind(in); err = midend_deserialise(me, savefile_read, in); @@ -103,6 +106,9 @@ int main(int argc, char **argv) midend_free(me); continue; } + w = h = INT_MAX; + midend_size(me, &w, &h, false, 1); + midend_redraw(me); midend_serialise(me, savefile_write, stdout); midend_free(me); ret = 0; -- cgit v1.1