]> O.S.I.I.S - jp/vkvg.git/commitdiff
tests improvments, print test config header, cmd args parsing
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Wed, 9 Sep 2020 04:44:45 +0000 (06:44 +0200)
committerj-p <jp_bruyere@hotmail.com>
Mon, 10 May 2021 06:46:18 +0000 (08:46 +0200)
31 files changed:
scripts/batchTests.sh
src/vkvg_context.c
src/vkvg_context_internal.c
template.c
tests/arcs.c
tests/circles.c
tests/clip.c
tests/colinear.c
tests/common/test.c
tests/common/test.h
tests/compositing.c
tests/context.c [new file with mode: 0644]
tests/curve.c
tests/dashes.c
tests/fill.c
tests/fill_and_stroke.c
tests/gradient.c
tests/img_surf.c
tests/line_caps.c
tests/line_join.c
tests/lines.c
tests/paint_surf.c
tests/random_rects.c
tests/rect_fill.c
tests/save_restore.c
tests/simple_paint.c
tests/stroke.c
tests/surface.c [new file with mode: 0644]
tests/svg.c
tests/test1.c
tests/text.c

index b8805722dbf5768e1533c58180d11b5ec62a6b43..b7c8d029631a8ac7d62f6c138091735a760749a8 100755 (executable)
@@ -52,14 +52,20 @@ logfile="$logdir/log-$today.txt"
 
 git log -n 1 --pretty=format:'%h %d %s%n%n' > $logfile
 
-echo "_____________________________________________________________________________________________________" >> $logfile
-echo "| Test File Name  |         Sub Test          | Iter | SIZE |   FPS   | Average | Median  | Sigma   |" >> $logfile
-echo "|-----------------|---------------------------|------|------|---------|---------|---------|---------|" >> $logfile
+files=( test_* )
+./"${files[0]}" -p >> $logfile
+
+echo "__________________________________________________________________________________________________________" >> $logfile
+echo "| N° | Test File Name  |         Sub Test          | Iter | Size |   FPS   | Average | Median  | Sigma   |" >> $logfile
+echo "|----|-----------------|---------------------------|------|------|---------|---------|---------|---------|" >> $logfile
 for file in test_*
 do
        if [[ -x "$file" ]]
        then
-               ./"$file" $ITERATIONS $SIZE >> $logfile
+               printf "."
+               ./"$file" -i $ITERATIONS -s $SIZE -q >> $logfile
        fi
 done
-echo "_____________________________________________________________________________________________________" >> $logfile
+echo "__________________________________________________________________________________________________________" >> $logfile
+echo
+echo "results writen in $logfile"
index e9bdf885110db16a75d649679a78139955b2edea..d3051092255f042418808220e224cacc185ba0ca 100644 (file)
@@ -633,10 +633,9 @@ float _draw_dashed_segment (VkvgContext ctx, float hw, vec2 pL, vec2 p, vec2 pR,
 
                _draw_stoke_cap (ctx, hw, p0, normal, dashOn);
                dashOn ^= true;
-
-               curDashOffset += ctx->dashes[curDash++];
-               if (curDash == ctx->dashCount)
+               if (++curDash == ctx->dashCount)
                        curDash = 0;
+               curDashOffset += ctx->dashes[curDash];
        }
        curDashOffset -= segmentLength;
        return segmentLength;
@@ -727,7 +726,7 @@ bool _process_stroke (VkvgContext ctx) {
                        if (!dashOn){
                                //finishing last dash that is already started, draw end caps but not too close to start
                                //the default gap is the next void
-                               uint32_t prevDash = curDash-1;
+                               int32_t prevDash = (int32_t)curDash-1;
                                if (prevDash < 0)
                                        curDash = ctx->dashCount-1;
                                float m = fminf (ctx->dashes[prevDash] - curDashOffset, ctx->dashes[curDash]);
index 4793d7ad4fa305ac7c015f713335710237a2e34d..dceba198b4becf605d6edb53236e0996564fb3eb 100644 (file)
@@ -306,7 +306,7 @@ void _add_triangle_indices(VkvgContext ctx, VKVG_IBO_INDEX_TYPE i0, VKVG_IBO_IND
        ctx->indCount+=3;
 
        _check_index_cache_size(ctx);
-       LOG(VKVG_LOG_INFO, "Triangle IDX: %d %d %d (count=%d)\n", i0,i1,i2,ctx->indCount);
+       LOG(VKVG_LOG_INFO, "Triangle IDX: %d %d %d (indCount=%d)\n", i0,i1,i2,ctx->indCount);
 }
 void _vao_add_rectangle (VkvgContext ctx, float x, float y, float width, float height){
        Vertex v[4] =
index a222a844ce581b7a8e2588ef4b792625a8d1a594..333fcdfabd331684556a56f536b07ef3e1f4cb91 100644 (file)
@@ -4,15 +4,13 @@
 
 #include "test.h"
 
-void test(){
+void test_name(){
        VkvgContext ctx = vkvg_create(surf);
 
        vkvg_destroy(ctx);
 }
 
 int main(int argc, char *argv[]) {
-
-       perform_test (test, "custom test", 800, 600);
-
+       PERFORM_TEST (test_name, argc, argv);
        return 0;
 }
index daeb48c59e912b3e75db556e5bab3d4160a28624..d3e110967a9dd5ba39a2f7f249bcf37b5384cba4 100644 (file)
@@ -84,8 +84,9 @@ void test(){
 }
 
 int main(int argc, char *argv[]) {
+       no_test_size = true;
        PERFORM_TEST (sizes, argc, argv);
        PERFORM_TEST (scaled_up, argc, argv);
-       PERFORM_TEST (test, argc, argv);
+       PERFORM_TEST (test, argc, argv);        
        return 0;
 }
index dbc86f93fb1ceb9b7f2f917de8656ddb90f116c6..3a34d818329d61940a43efa7bf0c5cdbe27237d4 100644 (file)
@@ -55,6 +55,7 @@ void sizes() {
 }
 
 int main(int argc, char *argv[]) {
+       no_test_size = true;
        PERFORM_TEST (fill_and_stroke, argc, argv);
        PERFORM_TEST (sizes, argc, argv);
        PERFORM_TEST (scaled_up, argc, argv);
index 3eb6fbe0cfeb0dfea522aea8e1f2f44c31358a43..032229500018b966d100a86ab42b3b27da5f7ced 100644 (file)
@@ -159,6 +159,7 @@ void test_clip2(){
        vkvg_destroy(ctx);
 }
 int main(int argc, char *argv[]) {
+       no_test_size = true;
        PERFORM_TEST (clipped_paint_ec, argc, argv);
        PERFORM_TEST (clipped_paint_eo, argc, argv);
        PERFORM_TEST (clipped_transformed_ec, argc, argv);
index 68bf3ad1f903a8511ae6e67e90bbc546202d2e52..595ff213a2d731cc10f6744c02aedab9ee178c6d 100644 (file)
@@ -18,7 +18,7 @@ void test(){
 }
 
 int main(int argc, char *argv[]) {
-
+       no_test_size = true;
        PERFORM_TEST (test, argc, argv);
 
        return 0;
index bd283166aec6fd410aba39123f8eccad3b2a27bd..ef7d2073804f6bbc147a0d63c4284d6aab9dbeb1 100644 (file)
@@ -33,15 +33,21 @@ bool mouseDown = false;
 VkvgDevice device      = NULL;
 VkvgSurface surf       = NULL;
 
-uint32_t test_size     = 100;  // items drawn in one run, or complexity
-uint32_t iterations    = 1000;// repeat test n times
-uint32_t test_width    = 1024;
-uint32_t test_height= 768;
-bool    test_vsync = false;
+uint32_t test_size     = 10;   // items drawn in one run, or complexity
+uint32_t iterations    = 100;// repeat test n times
+uint32_t test_width    = 512;
+uint32_t test_height= 512;
+bool   test_vsync      = false;
+bool   quiet           = false;//if true, don't print details and head row
+bool   first_test      = true;//if multiple tests, dont print header row.
+bool   no_test_size= false;//several test consist of a single draw sequence without looping 'size' times
+                                                         //those test must be preceded by setting no_test_size to 'true'
+int    test_index      = 0;
+int            single_test = -1;       //if not < 0, contains the index of the single test to run
 
 
 static bool paused = false;
-static VkSampleCountFlags samples = VK_SAMPLE_COUNT_8_BIT;
+static VkSampleCountFlags samples = VK_SAMPLE_COUNT_1_BIT;
 static vk_engine_t* e;
 
 static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) {
@@ -162,6 +168,98 @@ void clear_test () {
 #ifdef VKVG_TEST_DIRECT_DRAW
 VkvgSurface* surfaces;
 #endif
+_print_usage_and_exit () {
+       printf("\nUsage: test [options]\n\n");
+       printf("\t-i iterations:\tSpecify the repeat count for the test.\n");
+       printf("\t-s size:\tWhen applicable, specify the size of the test.\n");
+       printf("\t-w width:\tOutput surface width.\n");
+       printf("\t-h height:\tOutput surface height.\n");
+       printf("\t-n index:\tRun only a single test, zero based index.\n");
+       printf("\t-q:\t\tQuiet, don't print measures table head row, usefull for batch tests\n");
+       printf("\t-p:\t\tPrint test details and exit without performing test, usefull to print details in logs\n");
+       printf("\t-vsync:\t\tEnable VSync, disabled by default\n");
+       printf("\t-h:\t\tthis help message.\n");
+       printf("\n");
+       exit(-1);
+}
+void _parse_args (int argc, char* argv[]) {
+       for (int i = 1; i < argc; i++) {
+               if (strcmp (argv[i], "-help\0") == 0)
+                       _print_usage_and_exit ();
+               if (strcmp (argv[i], "-p\0") == 0) {
+                       #ifdef DEBUG
+                       printf("Debug build\n");
+                       #else
+                       printf("Release build\n");
+                       #endif
+                       #ifdef VKVG_USE_RENDERDOC
+                       printf("Render doc enabled\n");
+                       #endif
+                       #ifdef VKVG_USE_VALIDATION
+                       printf("Validation enabled\n");
+                       #endif
+                       printf("surf dims:\t%d x %d\n", test_width, test_height);
+                       printf("Samples:\t%d\n", samples);
+                       #ifdef VKVG_TEST_OFFSCREEN
+                       printf("Offscreen:\ttrue\n");
+                       #else
+                       printf("Offscreen:\ttrue\n");
+                       #endif
+                       printf("\n");
+                       exit(0);        
+               }
+               if (strcmp (argv[i], "-vsync\0") == 0)
+                       test_vsync = true;              
+               else if (strcmp (argv[i], "-q\0") == 0)
+                       quiet = true;
+               else if (strcmp (argv[i], "-i\0") == 0) {
+                       if (argc -1 < ++i)
+                               _print_usage_and_exit();
+                       iterations = atoi (argv[i]);
+               }else if (strcmp (argv[i], "-w\0") == 0) {
+                       if (argc -1 < ++i)
+                               _print_usage_and_exit();
+                       test_width = atoi (argv[i]);
+               }else if (strcmp (argv[i], "-h\0") == 0) {
+                       if (argc -1 < ++i)
+                               _print_usage_and_exit();
+                       test_height = atoi (argv[i]);
+               }else if (strcmp (argv[i], "-n\0") == 0) {
+                       if (argc -1 < ++i)
+                               _print_usage_and_exit();
+                       single_test = atoi (argv[i]);
+               }else if (strcmp (argv[i], "-s\0") == 0) {
+                       if (argc -1 < ++i)
+                               _print_usage_and_exit();
+                       test_size = atoi (argv[i]);                     
+               }
+       }
+}
+
+void _print_results (const char *testName, int argc, char* argv[], uint32_t i, double run_total, double* run_time_values) {
+       char* whoami;
+       (whoami = strrchr(argv[0], '/')) ? ++whoami : (whoami = argv[0]);
+
+       double avg_run_time = run_total / (double)i;
+       double med_run_time = median_run_time (run_time_values, i);
+       double standard_dev = standard_deviation (run_time_values, i, avg_run_time);
+       double avg_frames_per_second = (1.0 / avg_run_time);
+       avg_frames_per_second = (avg_frames_per_second<9999) ? avg_frames_per_second:9999;
+
+       if (!quiet && (test_index == 0 || test_index == single_test)) {
+               printf ("______________________________________________________________________________________________________\n");            
+               printf ("| N° | Test File Name  |       Sub Test            | Iter | Size |   FPS   | Average | Median  | Sigma   |\n");
+               printf ("|----|-----------------|---------------------------|------|------|---------|---------|---------|---------|\n");
+       }
+       printf ("| %2d | %-15s | %-25s | ", test_index, whoami + 5, testName);
+       if (no_test_size)
+               printf ("%4d | %4d | %7.2f | %6.5f | %6.5f | %6.5f |\n",
+                       i, 1, avg_frames_per_second, avg_run_time, med_run_time, standard_dev);
+       else
+               printf ("%4d | %4d | %7.2f | %6.5f | %6.5f | %6.5f |\n",
+                       i, test_size, avg_frames_per_second, avg_run_time, med_run_time, standard_dev);
+       
+}
 
 void perform_test_offscreen (void(*testfunc)(void), const char *testName, int argc, char* argv[]) {
        //init random gen
@@ -170,18 +268,14 @@ void perform_test_offscreen (void(*testfunc)(void), const char *testName, int ar
        srand((unsigned) currentTime.tv_usec);
 
        //dumpLayerExts();
-       if (argc > 1)
-               iterations = atoi (argv[1]);
-       if (argc > 2)
-               test_size = atoi (argv[2]);
-       if (iterations == 0 || test_size == 0) {
-               printf("usage: test [iterations] [size]\n");
+       
+       _parse_args (argc, argv);
+
+       if (single_test >= 0 && test_index != single_test){
+               test_index++;
                return;
        }
-
-       char* whoami;
-       (whoami = strrchr(argv[0], '/')) ? ++whoami : (whoami = argv[0]);
-
+       
        uint32_t enabledExtsCount = 0, phyCount = 0;
        const char* enabledExts [10];
 #ifdef VKVG_USE_RENDERDOC
@@ -269,20 +363,9 @@ void perform_test_offscreen (void(*testfunc)(void), const char *testName, int ar
                i++;
        }
 
-       double avg_run_time = run_total / (double)i;
-       double med_run_time = median_run_time (run_time_values, i);
-       double standard_dev = standard_deviation (run_time_values, i, avg_run_time);
-       double avg_frames_per_second = (1.0 / avg_run_time);
-       avg_frames_per_second = (avg_frames_per_second<9999) ? avg_frames_per_second:9999;
-
-       free (run_time_values);
-
-       //printf ("size:%d iter:%d  avgFps: %f avg: %4.2f%% med: %4.2f%% sd: %4.2f%% \n", test_size, i, avg_frames_per_second, avg_run_time, med_run_time, standard_dev);
-       printf ("| %-15s | %-25s | ",whoami + 5, testName);
-       printf ("%4d | %4d | %7.2f | %6.5f | %6.5f | %6.5f |\n",
-                       test_size, i, avg_frames_per_second, avg_run_time, med_run_time, standard_dev);
+       _print_results (testName, argc, argv, i, run_total, run_time_values);
 
-       //printf ("%s size:%d iter:%d  avgFps: %f avg: %4.2f%% med: %4.2f%% sd: %4.2f%% \n", whoami+5, test_size, i, avg_frames_per_second, avg_run_time, med_run_time, standard_dev);
+       free (run_time_values); 
 
        vkDeviceWaitIdle(dev->dev);
 
@@ -291,6 +374,8 @@ void perform_test_offscreen (void(*testfunc)(void), const char *testName, int ar
 
        vkh_device_destroy (dev);
        vkh_app_destroy (app);
+
+       test_index++;
 }
 
 void perform_test (void(*testfunc)(void), const char *testName, int argc, char* argv[]) {
@@ -300,18 +385,13 @@ void perform_test (void(*testfunc)(void), const char *testName, int argc, char*
        srand((unsigned) currentTime.tv_usec);
 
        //dumpLayerExts();
-       if (argc > 1)
-               iterations = atoi (argv[1]);
-       if (argc > 2)
-               test_size = atoi (argv[2]);
-       if (iterations == 0 || test_size == 0) {
-               printf("usage: test [iterations] [size]\n");
+       _parse_args (argc, argv);
+
+       if (single_test >= 0 && test_index != single_test){
+               test_index++;
                return;
        }
 
-       char* whoami;
-       (whoami = strrchr(argv[0], '/')) ? ++whoami : (whoami = argv[0]);
-
        if (test_vsync)
                e = vkengine_create (VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, VK_PRESENT_MODE_FIFO_KHR, test_width, test_height);
        else
@@ -338,7 +418,6 @@ void perform_test (void(*testfunc)(void), const char *testName, int argc, char*
        vkh_presenter_build_blit_cmd (r, vkvg_surface_get_vk_image(surf), test_width, test_height);
 #endif
 
-
        double start_time = 0.0, stop_time = 0.0, run_time = 0.0, run_total = 0.0, min_run_time = -1, max_run_time = 0.0;
        double* run_time_values = (double*)malloc(iterations*sizeof(double));
 
@@ -408,22 +487,10 @@ void perform_test (void(*testfunc)(void), const char *testName, int argc, char*
                i++;
        }
 
-       double avg_run_time = run_total / (double)i;
-       double med_run_time = median_run_time (run_time_values, i);
-       double standard_dev = standard_deviation (run_time_values, i, avg_run_time);
-       double avg_frames_per_second = (1.0 / avg_run_time);
-       avg_frames_per_second = (avg_frames_per_second<9999) ? avg_frames_per_second:9999;
+       _print_results (testName, argc, argv, i, run_total, run_time_values);
 
        free (run_time_values);
 
-
-       //printf ("size:%d iter:%d  avgFps: %f avg: %4.2f%% med: %4.2f%% sd: %4.2f%% \n", test_size, i, avg_frames_per_second, avg_run_time, med_run_time, standard_dev);
-       printf ("| %-15s | %-25s | ",whoami + 5, testName);
-       printf ("%4d | %4d | %7.2f | %6.5f | %6.5f | %6.5f |\n",
-                       test_size, i, avg_frames_per_second, avg_run_time, med_run_time, standard_dev);
-
-       //printf ("%s size:%d iter:%d  avgFps: %f avg: %4.2f%% med: %4.2f%% sd: %4.2f%% \n", whoami+5, test_size, i, avg_frames_per_second, avg_run_time, med_run_time, standard_dev);
-
        vkDeviceWaitIdle(e->dev->dev);
 
 #ifdef VKVG_TEST_DIRECT_DRAW
@@ -438,8 +505,35 @@ void perform_test (void(*testfunc)(void), const char *testName, int argc, char*
        vkvg_device_destroy     (device);
 
        vkengine_destroy (e);
+       
+       test_index++;
+}
+
+
+/* common context init for several tests */
+vkvg_fill_rule_t       fill_rule       = VKVG_FILL_RULE_NON_ZERO;
+vkvg_line_cap_t                line_cap        = VKVG_LINE_CAP_BUTT;
+vkvg_line_join_t       line_join       = VKVG_LINE_JOIN_MITER;
+float          dashes[]        = {20.0f, 10.0f};
+uint32_t       dashes_count= 0;
+float          dash_offset     = 0;
+float          line_width      = 1.f;
+
+VkvgContext _initCtx() {
+       VkvgContext ctx = vkvg_create(surf);
+
+       vkvg_set_line_width     (ctx,line_width);
+       vkvg_set_line_join      (ctx, line_join);
+       vkvg_set_line_cap       (ctx, line_cap);
+       vkvg_set_dash           (ctx, dashes, dashes_count, dash_offset);
+       vkvg_set_fill_rule      (ctx, fill_rule);
+
+       vkvg_clear                      (ctx);
+       return ctx;
 }
 
+
+
 const int star_points[11][2] = {
        { 0, 85 },
        { 75, 75 },
@@ -455,10 +549,10 @@ const int star_points[11][2] = {
 };
 void randomize_color(VkvgContext ctx) {
        vkvg_set_source_rgba(ctx,
-               (float)rand() / RAND_MAX,
-               (float)rand() / RAND_MAX,
-               (float)rand() / RAND_MAX,
-               (float)rand() / RAND_MAX
+               rndf(),
+               rndf(),
+               rndf(),
+               rndf()
        );
 }
 void draw_random_shape (VkvgContext ctx, shape_t shape, float sizeFact) {
@@ -471,29 +565,29 @@ void draw_random_shape (VkvgContext ctx, shape_t shape, float sizeFact) {
 
        switch (shape) {
        case SHAPE_LINE:
-               x = (float)rand()/RAND_MAX * w;
-               y = (float)rand()/RAND_MAX * h;
-               z = (float)rand()/RAND_MAX * w;
-               v = (float)rand()/RAND_MAX * h;
+               x = rndf() * w;
+               y = rndf() * h;
+               z = rndf() * w;
+               v = rndf() * h;
 
                vkvg_move_to(ctx, x, y);
                vkvg_line_to(ctx, z, v);
                vkvg_stroke(ctx);
                break;
        case SHAPE_RECTANGLE:
-               z = truncf((sizeFact*w*rand()/RAND_MAX)+1.f);
-               v = truncf((sizeFact*h*rand()/RAND_MAX)+1.f);
-               x = truncf((w-z)*rand()/RAND_MAX);
-               y = truncf((h-v)*rand()/RAND_MAX);
+               z = truncf((sizeFact*w*rndf())+1.f);
+               v = truncf((sizeFact*h*rndf())+1.f);
+               x = truncf((w-z)*rndf());
+               y = truncf((h-v)*rndf());
 
                vkvg_rectangle(ctx, x+1, y+1, z, v);
                break;
        case SHAPE_ROUNDED_RECTANGLE:
-               z = truncf((sizeFact*w*rand()/RAND_MAX)+1.f);
-               v = truncf((sizeFact*h*rand()/RAND_MAX)+1.f);
-               x = truncf((w-z)*rand()/RAND_MAX);
-               y = truncf((h-v)*rand()/RAND_MAX);
-               r = truncf((0.2f*z*rand()/RAND_MAX)+1.f);
+               z = truncf((sizeFact*w*rndf())+1.f);
+               v = truncf((sizeFact*h*rndf())+1.f);
+               x = truncf((w-z)*rndf());
+               y = truncf((h-v)*rndf());
+               r = truncf((0.2f*z*rndf())+1.f);
 
                if ((r > v / 2) || (r > z / 2))
                        r = MIN(v / 2, z / 2);
@@ -513,10 +607,10 @@ void draw_random_shape (VkvgContext ctx, shape_t shape, float sizeFact) {
                /*x = truncf((float)w * rnd()/RAND_MAX);
                y = truncf((float)h * rnd()/RAND_MAX);
                v = truncf((float)w * rnd()/RAND_MAX * 0.2f);*/
-               x = (float)rand()/RAND_MAX * w;
-               y = (float)rand()/RAND_MAX * h;
+               x = rndf() * w;
+               y = rndf() * h;
 
-               r = truncf((sizeFact*MIN(w,h)*rand()/RAND_MAX)+1.f);
+               r = truncf((sizeFact*MIN(w,h)*rndf())+1.f);
 
                /*float r = 0.5f*w*rand()/RAND_MAX;
                float x = truncf(0.5f * w*rand()/RAND_MAX + r);
@@ -526,9 +620,9 @@ void draw_random_shape (VkvgContext ctx, shape_t shape, float sizeFact) {
                break;
        case SHAPE_TRIANGLE:
        case SHAPE_STAR:
-               x = (float)rand()/RAND_MAX * w;
-               y = (float)rand()/RAND_MAX * h;
-               z = (float)rand()/RAND_MAX * sizeFact + 0.15f; //scale
+               x = rndf() * w;
+               y = rndf() * h;
+               z = rndf() * sizeFact + 0.15f; //scale
 
                vkvg_move_to (ctx, x+star_points[0][0]*z, y+star_points[0][1]*z);
                for (int s=1; s<11; s++)
@@ -536,10 +630,23 @@ void draw_random_shape (VkvgContext ctx, shape_t shape, float sizeFact) {
                vkvg_close_path (ctx);
                break;
        case SHAPE_RANDOM:
-               draw_random_shape(ctx, 1 + rand()%4, sizeFact);
+               draw_random_shape(ctx, 1 + (rndf() * 4), sizeFact);
                break;
        }
 }
+void draw_random_curve (VkvgContext ctx) {
+       float w = (float)test_width;
+       float h = (float)test_height;
+
+       float x2 = w*rndf();
+       float y2 = h*rndf();
+       float cp_x1 = w*rndf();
+       float cp_y1 = h*rndf();
+       float cp_x2 = w*rndf();
+       float cp_y2 = h*rndf();
+
+       vkvg_curve_to(ctx, cp_x1, cp_y1, cp_x2, cp_y2, x2, y2);
+}
 /*void draw_random_shape (VkvgContext ctx, shape_t shape) {
        float w = (float)test_width;
        float h = (float)test_height;
@@ -549,4 +656,4 @@ void draw_random_shape (VkvgContext ctx, shape_t shape, float sizeFact) {
        float x = truncf((w-z)*rand()/RAND_MAX);
        float y = truncf((h-v)*rand()/RAND_MAX);
        vkvg_rectangle(ctx, x, y, z, v);
-}*/
+}*/
\ No newline at end of file
index 3716c2e44c55f0a7a6dc57b71aa05c79ba7a4538..58fe95fa01430729fc60f17b74d34115af957f82 100644 (file)
@@ -79,6 +79,7 @@ extern uint32_t test_size;
 extern uint32_t iterations;
 extern uint32_t test_width;
 extern uint32_t test_height;
+extern bool no_test_size;
 
 extern float panX;
 extern float panY;
@@ -90,12 +91,25 @@ extern bool mouseDown;
 extern VkvgDevice device;
 extern VkvgSurface surf;
 
+/* common context init for several tests */
+extern float dash_offset;
+extern float line_width;
+extern vkvg_fill_rule_t fill_rule;
+extern vkvg_line_cap_t line_cap;
+extern vkvg_line_join_t line_join;
+extern float dashes[];
+extern uint32_t dashes_count;
+
+VkvgContext _initCtx();
+/*******************************/
+
 //run test in one step
 void perform_test (void(*testfunc)(), const char* testName, int argc, char *argv[]);
 void perform_test_offscreen (void(*testfunc)(void), const char *testName, int argc, char* argv[]);
 
 void randomize_color   (VkvgContext ctx);
 void draw_random_shape (VkvgContext ctx, shape_t shape, float sizeFact);
+void draw_random_curve (VkvgContext ctx);
 
 //run test in 3 step: init, run, clear.
 void init_test (uint32_t width, uint32_t height);
index 288c3d632dc06e486d97ccf18f888753bb615b24..e1449733ee04e77704feafb3bd6a299f3c7dd2db 100644 (file)
@@ -16,6 +16,7 @@ void compositing(){
 }
 
 int main(int argc, char *argv[]) {
+       no_test_size = true;
        PERFORM_TEST (compositing, argc, argv);
        return 0;
 }
diff --git a/tests/context.c b/tests/context.c
new file mode 100644 (file)
index 0000000..641a357
--- /dev/null
@@ -0,0 +1,21 @@
+#include "test.h"
+
+void create_destroy_multi(){
+       VkvgContext ctxs[test_size];
+       for (uint32_t i = 0; i < test_size; i++)
+               ctxs[i] = vkvg_create(surf);
+       for (uint32_t i = 0; i < test_size; i++)        
+               vkvg_destroy(ctxs[i]);          
+}
+
+void create_destroy_single(){
+       VkvgContext ctx = vkvg_create(surf);
+       vkvg_destroy(ctx);
+}
+
+int main(int argc, char *argv[]) {
+       PERFORM_TEST (create_destroy_multi, argc, argv);
+       no_test_size = true;
+       PERFORM_TEST (create_destroy_single, argc, argv);
+       return 0;
+}
index 1367b6000f7a89b711f2ae2599e8b8e8f5726b90..b944c710f98e52d92aec003b25b68e7257eb474c 100644 (file)
@@ -108,37 +108,9 @@ void test2() {
        vkvg_destroy(ctx);
 }
 
-static float line_width = 1.f;
-static vkvg_line_cap_t line_cap = VKVG_LINE_CAP_ROUND;
-static vkvg_fill_rule_t fill_rule = VKVG_FILL_RULE_NON_ZERO;
-static float dashes[] = {30.0f, 10.0f};
-static uint32_t dashes_count = 0;
 static bool fillAndStroke = true;
 
-void _rnd_curve (VkvgContext ctx) {
-       float w = (float)test_width;
-       float h = (float)test_height;
-
-       float x2 = w*rand()/RAND_MAX;
-       float y2 = h*rand()/RAND_MAX;
-       float cp_x1 = w*rand()/RAND_MAX;
-       float cp_y1 = h*rand()/RAND_MAX;
-       float cp_x2 = w*rand()/RAND_MAX;
-       float cp_y2 = h*rand()/RAND_MAX;
-
-       vkvg_curve_to(ctx, cp_x1, cp_y1, cp_x2, cp_y2, x2, y2);
-}
-
-VkvgContext _initCtx() {
-       VkvgContext ctx = vkvg_create(surf);
-       vkvg_clear(ctx);
-       vkvg_set_line_width (ctx,line_width);
-       vkvg_set_line_cap(ctx, line_cap);
-       vkvg_set_dash (ctx, dashes, dashes_count, 0);
-       return ctx;
-}
-
-void random_curves () {
+void random_curves_stroke () {
        float w = (float)test_width;
        float h = (float)test_height;
 
@@ -150,13 +122,14 @@ void random_curves () {
                float y1 = h*rand()/RAND_MAX;
 
                vkvg_move_to (ctx, x1, y1);
-               _rnd_curve(ctx);
+               draw_random_curve(ctx);
 
                vkvg_stroke (ctx);
        }
        vkvg_destroy(ctx);
 }
-void single_long_line_curved () {
+
+void _long_curv () {
        float w = (float)test_width;
        float h = (float)test_height;
 
@@ -169,7 +142,7 @@ void single_long_line_curved () {
        vkvg_move_to (ctx, x1, y1);
 
        for (uint32_t i=0; i<test_size; i++) {
-               _rnd_curve(ctx);
+               draw_random_curve(ctx);
        }
 
        if (fillAndStroke) {
@@ -181,21 +154,37 @@ void single_long_line_curved () {
 
        vkvg_destroy(ctx);
 }
-int main(int argc, char *argv[]) {
-       PERFORM_TEST(test, argc, argv);
-       PERFORM_TEST(test2, argc, argv);
-       PERFORM_TEST(curved_rect, argc, argv);
+
+void long_curv_fill_nz () {
        fillAndStroke = false;
        fill_rule = VKVG_FILL_RULE_NON_ZERO;
-       PERFORM_TEST(single_long_line_curved, argc, argv);
+       _long_curv ();
+}
+void long_curv_fill_eo () {
+       fillAndStroke = false;
        fill_rule = VKVG_FILL_RULE_EVEN_ODD;
-       PERFORM_TEST(single_long_line_curved, argc, argv);
+       _long_curv ();
+}
+void long_curv_fill_stroke_nz () {
        fillAndStroke = true;
        fill_rule = VKVG_FILL_RULE_NON_ZERO;
-       PERFORM_TEST(single_long_line_curved, argc, argv);
+       _long_curv ();
+}
+void long_curv_fill_stroke_eo () {
+       fillAndStroke = true;
        fill_rule = VKVG_FILL_RULE_EVEN_ODD;
-       PERFORM_TEST(single_long_line_curved, argc, argv);
-
-       PERFORM_TEST(random_curves, argc, argv);
+       _long_curv ();
+}
+int main(int argc, char *argv[]) {
+       no_test_size = true;
+       PERFORM_TEST(test, argc, argv);
+       PERFORM_TEST(test2, argc, argv);
+       PERFORM_TEST(curved_rect, argc, argv);
+       //PERFORM_TEST(long_curv_fill_nz, argc, argv);
+       no_test_size = false;
+       PERFORM_TEST(long_curv_fill_eo, argc, argv);
+       //PERFORM_TEST(long_curv_fill_stroke_nz, argc, argv);
+       PERFORM_TEST(long_curv_fill_stroke_eo, argc, argv);
+       PERFORM_TEST(random_curves_stroke, argc, argv);
        return 0;
 }
index e3272ac5943d986d7b9eb75b44f7476935335a41..d0d6269e7f31abb0f073f40d4c2accf88857c02c 100644 (file)
@@ -1,7 +1,7 @@
 #include "test.h"
-static float offset = 0;
+
 void test(){
-       offset += 0.1f;
+       dash_offset += 0.1f;
 
        VkvgContext ctx = vkvg_create(surf);
        vkvg_clear(ctx);
@@ -9,7 +9,7 @@ void test(){
        float dashes[] = {700.0f, 30};
        //const float dashes[] = {50, 40};
        vkvg_set_line_cap(ctx, VKVG_LINE_CAP_ROUND);
-       vkvg_set_dash(ctx, dashes, 2, offset);
+       vkvg_set_dash(ctx, dashes, 2, dash_offset);
        vkvg_set_line_width(ctx, 20);
        vkvg_set_source_rgb(ctx, 0, 0, 1);
 
@@ -24,7 +24,7 @@ void test(){
 
        dashes[0] = 0;
        dashes[1] = 30;
-       vkvg_set_dash(ctx, dashes, 2, offset);
+       vkvg_set_dash(ctx, dashes, 2, dash_offset);
 
        vkvg_set_source_rgb(ctx, 0, 1, 0);
 
@@ -40,31 +40,61 @@ void test(){
        vkvg_destroy(ctx);
 }
 
-void test2() {
-       VkvgContext ctx = vkvg_create(surf);
 
-       const float dashes[] = { 0, 8 };
-       vkvg_set_line_cap(ctx, VKVG_LINE_CAP_ROUND);
-       vkvg_set_dash(ctx, dashes, 2, 0);
-       vkvg_set_line_width(ctx, 4);
+void _long_curve () {
+       float w = (float)test_width;
+       float h = (float)test_height;
 
-       vkvg_move_to(ctx, 100, 400);
-       vkvg_curve_to(ctx, 100, 100, 600, 700, 600, 400);
-       vkvg_curve_to(ctx, 1000, 100, 100, 800, 1000, 800);
-       vkvg_curve_to(ctx, 1000, 500, 700, 500, 700, 100);
-       //vkvg_close_path(ctx);
+       VkvgContext ctx = _initCtx();
 
-       //vkvg_set_source_rgba   (ctx, 0.5,0.0,1.0,0.5);
-       //vkvg_fill_preserve(ctx);
+       randomize_color(ctx);
+       float x1 = w*rand()/RAND_MAX;
+       float y1 = h*rand()/RAND_MAX;
+       vkvg_move_to (ctx, x1, y1);
 
-       vkvg_set_source_rgba(ctx, 1, 0, 0, 1);
-       vkvg_stroke(ctx);
+       for (uint32_t i=0; i<test_size; i++)
+               draw_random_curve(ctx);
 
+       vkvg_stroke (ctx);
        vkvg_destroy(ctx);
+
+}
+void _long_path() {
+    float w = (float)test_width-10;
+    float h = (float)test_height-10;
+
+    VkvgContext ctx = _initCtx();
+
+    randomize_color(ctx);
+    float x1 = w*rndf();
+    float y1 = h*rndf();
+    vkvg_move_to (ctx, x1, y1);
+    for (uint32_t i=0; i<test_size; i++) {
+        x1 = w*rndf();
+        y1 = h*rndf();
+        vkvg_line_to (ctx, x1, y1);
+    }
+    vkvg_stroke (ctx);
+    vkvg_destroy(ctx);
+}
+
+void path () {
+       _long_path ();
+}
+void curve () {
+       _long_curve ();
 }
 
-int main(int argc, char *argv[]) {
-       PERFORM_TEST(test, argc, argv);
-       PERFORM_TEST(test2, argc, argv);
+
+int main(int argc, char *argv[]) {     
+       //PERFORM_TEST(test, argc, argv);
+       //vkvg_log_level = VKVG_LOG_ERR|VKVG_LOG_DEBUG|VKVG_LOG_INFO|VKVG_LOG_INFO_PATH|VKVG_LOG_DBG_ARRAYS|VKVG_LOG_FULL;
+       dashes_count = 1;
+       dashes[0] = 50;
+       dashes[1] = 60;
+       line_width = 10;
+       line_cap = VKVG_LINE_CAP_ROUND;
+       PERFORM_TEST(path, argc, argv);
+       PERFORM_TEST(curve, argc, argv);
        return 0;
 }
index 5d499466d46ab600da9ceefcc33965fa7fc3d9be..71f4e0a50291de0cea060de3337262e2b411a2ed 100644 (file)
@@ -21,6 +21,7 @@ void test(){
 }
 
 int main(int argc, char *argv[]) {
+       no_test_size = true;
        PERFORM_TEST (test, argc, argv);
        return 0;
 }
index 1e2931f110e07b0d6ad87595500bdf0c13be4f54..92352d56639003bd19540e6e1904e0a7646365dd 100644 (file)
@@ -24,6 +24,7 @@ void test(){
 }
 
 int main(int argc, char *argv[]) {
+       no_test_size = true;
        PERFORM_TEST (test, argc, argv);
        return 0;
 }
index 151a9a4dbc5a9b989d82c2b04232350fc0dfa3e6..27d956b0a2da47ae58a0173e363e101f30534d63 100644 (file)
@@ -87,6 +87,7 @@ void gradient_transform() {
 }
 
 int main(int argc, char *argv[]) {
+       no_test_size = true;
        PERFORM_TEST(paint, argc, argv);
        PERFORM_TEST(paint_repeat, argc, argv);
        PERFORM_TEST(gradient_transform, argc, argv);
index fe9e9df5a41e17ad99a79e70132c82bf14374bd9..11557c0c675c44ccb0579da4d0b0d78b80e61f6e 100644 (file)
@@ -42,7 +42,7 @@ void paint_pattern () {
        vkvg_surface_destroy(imgSurf);
        vkvg_destroy(ctx);
 }
-void paint_pattern_repeat () {
+void paint_patt_repeat () {
        VkvgContext ctx = vkvg_create(surf);
        VkvgSurface imgSurf = vkvg_surface_create_from_image(device, "data/miroir.jpg");
        VkvgPattern pat = vkvg_pattern_create_for_surface(imgSurf);
@@ -53,7 +53,7 @@ void paint_pattern_repeat () {
        vkvg_surface_destroy(imgSurf);
        vkvg_destroy(ctx);
 }
-void paint_pattern_repeat_scalled () {
+void paint_patt_repeat_scalled () {
        VkvgContext ctx = vkvg_create(surf);
        vkvg_scale (ctx, 0.2f,0.2f);
        VkvgSurface imgSurf = vkvg_surface_create_from_image(device, "data/miroir.jpg");
@@ -65,7 +65,7 @@ void paint_pattern_repeat_scalled () {
        vkvg_surface_destroy(imgSurf);
        vkvg_destroy(ctx);
 }
-void paint_pattern_pad () {
+void paint_patt_pad () {
        VkvgContext ctx = vkvg_create(surf);
        VkvgSurface imgSurf = vkvg_surface_create_from_image(device, "data/miroir.jpg");
        VkvgPattern pat = vkvg_pattern_create_for_surface(imgSurf);
@@ -103,13 +103,14 @@ void test(){
 }
 
 int main(int argc, char *argv[]) {
+       no_test_size = true;
        PERFORM_TEST (paint, argc, argv);
        PERFORM_TEST (paint_offset, argc, argv);
        PERFORM_TEST (paint_with_scale, argc, argv);
        PERFORM_TEST (paint_pattern, argc, argv);
-       PERFORM_TEST (paint_pattern_repeat, argc, argv);
-       PERFORM_TEST (paint_pattern_repeat_scalled, argc, argv);
-       PERFORM_TEST (paint_pattern_pad, argc, argv);
+       PERFORM_TEST (paint_patt_repeat, argc, argv);
+       PERFORM_TEST (paint_patt_repeat_scalled, argc, argv);
+       PERFORM_TEST (paint_patt_pad, argc, argv);
        PERFORM_TEST (test, argc, argv);
 
        return 0;
index 6e12983922fdfa2ae2727cf9a78296e1f20c0eef..2ad012997dce1e7e379306d24192bc5d0cf1ab34 100644 (file)
@@ -52,6 +52,7 @@ void test(){
 }
 
 int main(int argc, char *argv[]) {
+       no_test_size = true;
        PERFORM_TEST (test, argc, argv);
        return 0;
 }
index 1502825f631a9b242ac064b60861b29f41970084..779b8cc3252d18f8bfaa13ab2b411b16e505eca9 100644 (file)
@@ -174,6 +174,7 @@ void test3() {
 
 
 int main(int argc, char *argv[]) {
+       no_test_size = true;
        PERFORM_TEST(test, argc, argv);
        PERFORM_TEST(test2, argc, argv);
        PERFORM_TEST(test3, argc, argv);
index 57bf035d3e0ddb63fcf474fd00d676b2cde4385c..ef26d85b0dde95144b712f1bca0638afaa20e7e7 100644 (file)
@@ -1,19 +1,5 @@
 #include "test.h"
 
-static float line_width = 1.f;
-static vkvg_line_cap_t line_cap = VKVG_LINE_CAP_ROUND;
-static float dashes[] = {1.0f, 5.0f};
-static uint32_t dashes_count = 0;
-
-VkvgContext _initCtx() {
-       VkvgContext ctx = vkvg_create(surf);
-       vkvg_clear(ctx);
-       vkvg_set_line_width (ctx,line_width);
-       vkvg_set_line_cap(ctx, line_cap);
-       vkvg_set_dash (ctx, dashes, dashes_count, 0);
-       return ctx;
-}
-
 void horizontal() {
        float w = (float)test_width;
        float h = (float)test_height;
@@ -22,9 +8,9 @@ void horizontal() {
 
        for (uint32_t i=0; i<test_size; i++) {
                randomize_color(ctx);
-               float x1 = w*rand()/RAND_MAX;
-               float y1 = h*rand()/RAND_MAX;
-               float v = 500.f*rand()/RAND_MAX;
+               float x1 = w*rndf();
+               float y1 = h*rndf();
+               float v = 500.f*rndf();
 
                vkvg_move_to (ctx, x1, y1);
                vkvg_line_to (ctx, x1 + v, y1);
@@ -40,9 +26,9 @@ void vertical() {
 
        for (uint32_t i=0; i<test_size; i++) {
                randomize_color(ctx);
-               float x1 = w*rand()/RAND_MAX;
-               float y1 = h*rand()/RAND_MAX;
-               float v = 500.f*rand()/RAND_MAX;
+               float x1 = w*rndf();
+               float y1 = h*rndf();
+               float v = 500.f*rndf();
 
                vkvg_move_to (ctx, x1, y1);
                vkvg_line_to (ctx, x1, y1 + v);
@@ -59,10 +45,10 @@ void horzAndVert(){
        for (uint32_t i=0; i<test_size; i++) {
                randomize_color(ctx);
 
-               float x1 = w*rand()/RAND_MAX;
-               float y1 = h*rand()/RAND_MAX;
-               float x2 = (w*rand()/RAND_MAX) + 1;
-               float y2 = (h*rand()/RAND_MAX) + 1;
+               float x1 = w*rndf();
+               float y1 = h*rndf();
+               float x2 = (w*rndf()) + 1;
+               float y2 = (h*rndf()) + 1;
 
                vkvg_move_to (ctx, x1, y1);
                vkvg_line_to (ctx, x2, y2);
@@ -80,10 +66,10 @@ void multilines(){
 
        for (uint32_t i=0; i<test_size; i++) {
 
-               float x1 = w*rand()/RAND_MAX;
-               float y1 = h*rand()/RAND_MAX;
-               float x2 = (w*rand()/RAND_MAX) + 1;
-               float y2 = (h*rand()/RAND_MAX) + 1;
+               float x1 = w*rndf();
+               float y1 = h*rndf();
+               float x2 = (w*rndf()) + 1;
+               float y2 = (h*rndf()) + 1;
 
                vkvg_move_to (ctx, x1, y1);
                vkvg_line_to (ctx, x2, y2);
@@ -98,12 +84,12 @@ void multi_segments() {
     VkvgContext ctx = _initCtx();
 
     randomize_color(ctx);
-    float x1 = w*rand()/RAND_MAX;
-    float y1 = h*rand()/RAND_MAX;
+    float x1 = w*rndf();
+    float y1 = h*rndf();
     vkvg_move_to (ctx, x1, y1);
     for (uint32_t i=0; i<test_size; i++) {
-        x1 = w*rand()/RAND_MAX;
-        y1 = h*rand()/RAND_MAX;
+        x1 = w*rndf();
+        y1 = h*rndf();
         vkvg_line_to (ctx, x1, y1);
     }
     vkvg_stroke (ctx);
index 31bad57bf9b5ca0ef5a24c8028499241de2572bf..c94530512322f71009447a7ee5f8adffc2adad72 100644 (file)
@@ -97,6 +97,7 @@ void paint_rect_with_scale(){
        vkvg_destroy(ctx);
 }
 int main(int argc, char *argv[]) {
+       no_test_size = true;
        PERFORM_TEST (paint, argc, argv);
        PERFORM_TEST (paint_with_offset, argc, argv);
        PERFORM_TEST (paint_multiple, argc, argv);
index d8bf7d6cab1a532858b8706997958e1d1123d4b4..f192206493e1610f79cfe0544dc8d688c7cf87de 100644 (file)
 
        vkvg_rectangle(ctx, x, y, z, v);
 }*/
-static vkvg_fill_rule_t fill_rule = VKVG_FILL_RULE_EVEN_ODD;
-static vkvg_line_cap_t line_cap = VKVG_LINE_CAP_BUTT;
-static vkvg_line_join_t line_join = VKVG_LINE_JOIN_MITER;
-static float line_width = 1.f;
 static float shape_size = 0.2f;
-static float dashes[] = {3.0f, 10.0f};
-static uint32_t dashes_count = 0;
-
 
 void _shape_fill(shape_t shape){
-       VkvgContext ctx = vkvg_create(surf);
-       vkvg_clear(ctx);
-       vkvg_set_fill_rule(ctx, fill_rule);
+       VkvgContext ctx = _initCtx ();
        for (uint32_t i=0; i<test_size; i++) {
                draw_random_shape(ctx, shape, shape_size);
                vkvg_fill(ctx);
@@ -32,13 +23,7 @@ void _shape_fill(shape_t shape){
        vkvg_destroy(ctx);
 }
 void _shape_stroke(shape_t shape){
-       VkvgContext ctx = vkvg_create(surf);
-       vkvg_clear(ctx);
-       vkvg_set_line_width (ctx, line_width);
-       vkvg_set_line_cap(ctx, line_cap);
-       vkvg_set_line_join (ctx, line_join);
-       vkvg_set_dash (ctx, dashes, dashes_count, 0);
-       vkvg_set_fill_rule(ctx, fill_rule);
+       VkvgContext ctx = _initCtx ();
        for (uint32_t i=0; i<test_size; i++) {
                draw_random_shape(ctx, shape, shape_size);
                vkvg_stroke (ctx);
@@ -46,14 +31,8 @@ void _shape_stroke(shape_t shape){
        vkvg_destroy(ctx);
 }
 void _shape_fill_stroke(shape_t shape){
-       VkvgContext ctx = vkvg_create(surf);
-       vkvg_clear(ctx);
-       vkvg_set_line_width (ctx, line_width);
-       vkvg_set_line_cap(ctx, line_cap);
-       vkvg_set_line_join (ctx, line_join);
+       VkvgContext ctx = _initCtx ();
 
-       vkvg_set_dash (ctx, dashes, dashes_count, 0);
-       vkvg_set_fill_rule(ctx, fill_rule);
        for (uint32_t i=0; i<test_size; i++) {
                draw_random_shape(ctx, shape, shape_size);
                vkvg_fill_preserve(ctx);
@@ -109,7 +88,7 @@ void random_fill_stroke () {
 }
 
 int main(int argc, char *argv[]) {
-       srand(0);
+       //vkvg_log_level = VKVG_LOG_ERR|VKVG_LOG_DEBUG|VKVG_LOG_INFO|VKVG_LOG_INFO_PATH|VKVG_LOG_DBG_ARRAYS|VKVG_LOG_FULL;
 
        PERFORM_TEST (rectangles_fill, argc, argv);
        PERFORM_TEST (rectangles_stroke, argc, argv);
index 5a6d244ceacb9872d479ec5305b0665b0e6a26d5..7959d34b908719b3c1a34026aaf943c863431ee4 100644 (file)
@@ -32,7 +32,7 @@ void test_evenodd(){
        vkvg_destroy(ctx);
 }
 int main(int argc, char *argv[]) {
-
+       no_test_size = true;
        PERFORM_TEST (test, argc, argv);
        PERFORM_TEST (test_evenodd, argc, argv);
        return 0;
index 834e88a6f66f38d4e806d67a80796951d5f2d766..dc7f2a6cbd7fe2d8911eab5c73766ad8fe4a280c 100644 (file)
@@ -28,6 +28,7 @@ void test(){
 }
 
 int main(int argc, char *argv[]) {
+       no_test_size = true;
        PERFORM_TEST (test, argc, argv);
        return 0;
 }
index 4f54578a7ce4a6dd4a70cae437bcf88050931fbd..f451c6b0ec85924c84fd8ea2ee530cf9683e643a 100644 (file)
@@ -53,6 +53,7 @@ void paint_rect_with_scale(){
        vkvg_destroy(ctx);
 }
 int main(int argc, char *argv[]) {
+       no_test_size = true;
        PERFORM_TEST (paint, argc, argv);
        PERFORM_TEST (paint_with_rotation, argc, argv);
        PERFORM_TEST (paint_with_scale, argc, argv);
index 648da832d70b7c00f18f2b5b9a3fd52316c559ce..5011881766278c7b65e5e4d945896a6fb7a6de26 100644 (file)
@@ -54,6 +54,7 @@ void test(){
 }
 
 int main(int argc, char *argv[]) {
+       no_test_size = true;
        PERFORM_TEST (test, argc, argv);
        return 0;
 }
diff --git a/tests/surface.c b/tests/surface.c
new file mode 100644 (file)
index 0000000..3309d4d
--- /dev/null
@@ -0,0 +1,21 @@
+#include "test.h"
+
+void create_destroy_multi_512(){
+       VkvgSurface surfs[test_size];
+       for (uint32_t i = 0; i < test_size; i++)
+               surfs[i] = vkvg_surface_create (device, 512, 512);
+       for (uint32_t i = 0; i < test_size; i++)        
+               vkvg_surface_destroy(surfs[i]);
+}
+
+void create_destroy_single_512(){
+       VkvgSurface s = vkvg_surface_create (device, 512, 512);
+       vkvg_surface_destroy (s);
+}
+
+int main(int argc, char *argv[]) {
+       PERFORM_TEST (create_destroy_multi_512, argc, argv);
+       no_test_size = true;
+       PERFORM_TEST (create_destroy_single_512, argc, argv);
+       return 0;
+}
index fce411390cbae285ee8c52c3169381f440c9d66d..dd4fa8ad52b5926d815b61188731163d79ea433c 100644 (file)
@@ -44,6 +44,7 @@ void test_nsvg() {
 }
 
 int main(int argc, char *argv[]) {
+       no_test_size = true;
        PERFORM_TEST (test_nsvg, argc, argv);
        return 0;
 }
index 5fb17bf73f4ca002c7c6321cfb732457984b778b..a689a2e2758965e5edc46e643a7cfab4ca42ec45 100644 (file)
@@ -372,6 +372,7 @@ void cairo_tests () {
 
 
 int main(int argc, char *argv[]) {
+       no_test_size = true;
        PERFORM_TEST (cairo_tests, argc, argv);
        return 0;
 }
index da4ee14f0ab8963c778d46936b8d479b8995e0ec..fa21ad8bf287278f35596e5d23b126f61ff1a0fc 100644 (file)
@@ -169,7 +169,7 @@ void random_text () {
        vkvg_destroy(ctx);
 }
 int main(int argc, char *argv[]) {
-
+       no_test_size = true;
        //vkvg_log_level = VKVG_LOG_INFO;
        PERFORM_TEST (random_text, argc, argv);
        PERFORM_TEST (test, argc, argv);