From 7d98e87af887faed21ab69f80cb0212e732ede2c Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Thu, 10 Mar 2016 09:05:21 -0500 Subject: Don't fail to find the a8r8g8b8 format pointlessly Without this, trying to test eg. just r5g6b5 would fail, because we'd ignore anything we didn't whitelist. Reviewed-by: Eric Anholt Signed-off-by: Adam Jackson --- tests.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tests.c b/tests.c index cca96b4..9c8adaf 100644 --- a/tests.c +++ b/tests.c @@ -279,6 +279,11 @@ create_formats_list(Display *dpy) describe_format(&formats[nformats].name, NULL, format); + if (format == XRenderFindStandardFormat(dpy, PictStandardARGB32)) + { + argb32index = nformats; + } + if (format_whitelist_len != 0) { bool ok = false; int j; @@ -292,17 +297,14 @@ create_formats_list(Display *dpy) if (!ok) { printf("Ignoring server-supported format: %s\n", formats[nformats].name); - free(formats[nformats].name); - formats[nformats].name = NULL; + if (nformats != argb32index) { + free(formats[nformats].name); + formats[nformats].name = NULL; + } continue; } } - if (format == XRenderFindStandardFormat(dpy, PictStandardARGB32)) - { - argb32index = nformats; - } - printf("Found server-supported format: %s\n", formats[nformats].name); nformats++; -- cgit v1.2.3