glyph-test: Avoid setting solid images as alpha maps.
authorSøren Sandmann Pedersen <ssp@redhat.com>
Mon, 30 Jul 2012 20:21:39 +0000 (16:21 -0400)
committerSøren Sandmann Pedersen <ssp@redhat.com>
Wed, 1 Aug 2012 03:51:53 +0000 (23:51 -0400)
glyph-test would sometimes set a solid image as an alpha map, which is
not allowed. When this happened and the debug spew was enabled,
messages like this one would be generated:

    *** BUG ***
    In pixman_image_set_alpha_map: The expression
            !alpha_map || alpha_map->type == BITS was false
    Set a breakpoint on '_pixman_log_error' to debug

Fix this by not passing the ALLOW_SOLID flag to create_image() when
the resulting is to be used as an alpha map.

test/glyph-test.c

index 0fb6641..84de5aa 100644 (file)
@@ -199,7 +199,7 @@ create_image (int max_size, const pixman_format_code_t *formats, uint32_t flags)
        alpha_x = lcg_rand_n (width);
        alpha_y = lcg_rand_n (height);
        alpha_map =
-           create_image (max_size, formats, (flags & ~ALLOW_ALPHA_MAP));
+           create_image (max_size, formats, (flags & ~(ALLOW_ALPHA_MAP | ALLOW_SOLID)));
        pixman_image_set_alpha_map (image, alpha_map, alpha_x, alpha_y);
        pixman_image_unref (alpha_map);
     }
@@ -330,6 +330,6 @@ int
 main (int argc, const char *argv[])
 {
     return fuzzer_test_main ("glyph", 30000,
-                            0x1B7696A2,
+                            0x741CB2DB,
                             test_glyphs, argc, argv);
 }