diff options
author | Frediano Ziglio <fziglio@redhat.com> | 2020-03-01 09:32:38 +0000 |
---|---|---|
committer | Frediano Ziglio <fziglio@redhat.com> | 2020-03-02 09:57:56 +0000 |
commit | 2cec5f99afd40604b7a59ca1b473a04d9aea3588 (patch) | |
tree | 9b9e69336b8def5f16957c2d5aeba0bb95e9cedd /tests | |
parent | 27fd63ff727c0d818d8be9b1e5b6235afd2dc788 (diff) |
test-quic: Run 1 random quic test per color mode
Reduce execution time. No need to run so much tests, coverage
stays more or less the same.
We iterate twice to check RGB mode with alpha, otherwise the
coverage reduce about 10-20%.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-quic.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/tests/test-quic.c b/tests/test-quic.c index efc4245..6a5e3cf 100644 --- a/tests/test-quic.c +++ b/tests/test-quic.c @@ -27,6 +27,8 @@ typedef enum { COLOR_MODE_RGB, COLOR_MODE_RGB16, COLOR_MODE_GRAY, + + COLOR_MODE_END } color_mode_t; static color_mode_t color_mode = COLOR_MODE_RGB; @@ -339,9 +341,9 @@ static void pixbuf_compare(GdkPixbuf *pixbuf_a, GdkPixbuf *pixbuf_b) } } -static GdkPixbuf *pixbuf_new_random(void) +static GdkPixbuf *pixbuf_new_random(int alpha) { - gboolean has_alpha = g_random_boolean(); + gboolean has_alpha = alpha >= 0 ? alpha : g_random_boolean(); gint width = g_random_int_range(100, 2000); gint height = g_random_int_range(100, 500); GdkPixbuf *random_pixbuf; @@ -392,13 +394,17 @@ int main(int argc, char **argv) g_object_unref(source_pixbuf); } } else if (argc == 1) { - unsigned int count; - - for (count = 0; count < 50; count++) { - color_mode = (color_mode_t) (count % 3); - GdkPixbuf *pixbuf = pixbuf_new_random(); - test_pixbuf(pixbuf); - g_object_unref(pixbuf); + int alpha; + for (alpha = 0; alpha < 2; alpha++) { + for (color_mode = COLOR_MODE_RGB; color_mode < COLOR_MODE_END; color_mode++) { + /* alpha affects only COLOR_MODE_RGB more, reduce number of tests */ + if (color_mode != COLOR_MODE_RGB && alpha) { + continue; + } + GdkPixbuf *pixbuf = pixbuf_new_random(alpha); + test_pixbuf(pixbuf); + g_object_unref(pixbuf); + } } } else { g_assert_not_reached(); |