From da4929693bcadf50f7661a5e5f6141d130a8002f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Philippe=20Bruy=C3=A8re?= Date: Mon, 15 Nov 2021 16:08:08 +0100 Subject: [PATCH] tests wip --- tests/common/test.c | 2 +- tests/random_rects.c | 107 ++++------------------------------------ tests/randoms.c | 114 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 125 insertions(+), 98 deletions(-) create mode 100644 tests/randoms.c diff --git a/tests/common/test.c b/tests/common/test.c index 24ddad9..6152a9e 100644 --- a/tests/common/test.c +++ b/tests/common/test.c @@ -176,7 +176,7 @@ void _print_usage_and_exit () { printf("\t-x width:\tOutput surface width.\n"); printf("\t-y height:\tOutput surface height.\n"); printf("\t-S num samples:\tOutput surface filter, default is 1.\n"); - printf("\t-G gpu_type:\tSet prefered GPU type:\n"); + printf("\t-g gpu_type:\tSet prefered GPU type:\n"); printf("\t\t\t\t- 0: Other\n"); printf("\t\t\t\t- 1: Integrated\n"); printf("\t\t\t\t- 2: Discrete\n"); diff --git a/tests/random_rects.c b/tests/random_rects.c index f192206..fc26077 100644 --- a/tests/random_rects.c +++ b/tests/random_rects.c @@ -1,114 +1,27 @@ #include "test.h" -/*void drawRandomRect (VkvgContext ctx) { +void drawRandomRect (VkvgContext ctx, float s) { float w = (float)test_width; float h = (float)test_height; randomize_color(ctx); - float z = truncf((0.5f*w*rand()/RAND_MAX)+1.f); - float v = truncf((0.5f*w*rand()/RAND_MAX)+1.f); - float x = truncf((w-z)*rand()/RAND_MAX); - float y = truncf((h-v)*rand()/RAND_MAX); + float x = truncf(w*rndf()); + float y = truncf(h*rndf()); - vkvg_rectangle(ctx, x, y, z, v); -}*/ -static float shape_size = 0.2f; - -void _shape_fill(shape_t shape){ - VkvgContext ctx = _initCtx (); - for (uint32_t i=0; i