]> O.S.I.I.S - jp/vkvg.git/commitdiff
add -L option to tests, enable LOG in debug with loglevel in hexadecimal
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Tue, 1 Mar 2022 15:55:30 +0000 (16:55 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Tue, 1 Mar 2022 15:55:30 +0000 (16:55 +0100)
tests/common/test.c
tests/dashes.c
tests/fill_non_zero.c
tests/perfs/random_rects.c
tests/perfs/randoms.c
tests/text.c

index c60e2c7ffeb805cb28c78a55a467e0f1a3b671d5..794e9bce24100ab5ea871c74713141e6ee51367a 100644 (file)
@@ -213,6 +213,11 @@ void _print_usage_and_exit () {
        printf("\t-vsync:\t\tEnable VSync, disabled by default.\n");
        printf("\t-o:\t\tPerform test offscreen.\n");
        printf("\t-w filepath:\twrite last image to png.\n");
+#ifdef DEBUG
+       printf("\t-L level:\tLog level in hexadecimal format (0xFF), 0 to disable.\n");
+       printf("\t\t\tsee vkvg.h for possible values.\n");
+#endif
+
        printf("\t-h:\t\tThis help message.\n");
        printf("\n");
        exit(-1);
@@ -306,6 +311,12 @@ void _parse_args (int argc, char* argv[]) {
                        if (argc -1 < ++i)
                                _print_usage_and_exit();
                        saveToPng = argv[i];
+#ifdef DEBUG
+               }else if (strcmp (argv[i], "-L\0") == 0) {
+                       if (argc -1 < ++i)
+                               _print_usage_and_exit();
+                       sscanf(argv[i], "%x", &vkvg_log_level);
+#endif
                }else
                        _print_usage_and_exit();
        }
index 42a36a12e0d39f5b73cc78748b4e60e12b1d42c6..3fc0734e6e344d2107ec318c2d877d052d5a9c64 100644 (file)
@@ -103,8 +103,6 @@ void curve () {
 
 
 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 = 2;
        dashes[0] = 0;
        dashes[1] = 10;
index 4f5f51bffffa14aae8955de921e89b8f4f2a4b40..b70c7eebe042b21edef6b79618be13d4bf600efc 100644 (file)
@@ -25,7 +25,6 @@ void test(){
 }
 
 int main(int argc, char *argv[]) {
-       //vkvg_log_level = VKVG_LOG_FULL;
        no_test_size = true;
        PERFORM_TEST (test, argc, argv);
        return 0;
index fc26077f4eed551bcd169b3c96d1b68ded6fb964..e5b1dc4062dff8b058ef2fbe88b03efc7fab821b 100644 (file)
@@ -5,23 +5,21 @@ void drawRandomRect (VkvgContext ctx, float s) {
        float h = (float)test_height;
        randomize_color(ctx);
 
-    float x = truncf(w*rndf());
-    float y = truncf(h*rndf());
+       float x = truncf(w*rndf());
+       float y = truncf(h*rndf());
 
-    vkvg_rectangle(ctx, x, y, s, s);
+       vkvg_rectangle(ctx, x, y, s, s);
 }
 void fixedSizeRects(){
        VkvgContext ctx = _initCtx ();
        for (uint32_t i=0; i<test_size; i++) {
-        drawRandomRect(ctx, 50.0f);
-        vkvg_fill (ctx);
-    }
-    vkvg_destroy(ctx);
+               drawRandomRect(ctx, 50.0f);
+               vkvg_fill (ctx);
+       }
+       vkvg_destroy(ctx);
 }
 
 int main(int argc, char *argv[]) {
-       //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 (fixedSizeRects, argc, argv);
        return 0;
 }
index f192206493e1610f79cfe0544dc8d688c7cf87de..a20f360ea89363b04429691bbd8c657bcca4e8f3 100644 (file)
@@ -88,8 +88,6 @@ void random_fill_stroke () {
 }
 
 int main(int argc, char *argv[]) {
-       //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);
        PERFORM_TEST (rectangles_fill_stroke, argc, argv);
index aa6b97ae84e3a66baf1923b75deefec3d38c6964..51e5a9f5a2c59ff3841153af38c4b4afd99c0bc2 100644 (file)
@@ -269,7 +269,6 @@ void proto_sinaitic () {
 }
 int main(int argc, char *argv[]) {
        no_test_size = true;
-       //vkvg_log_level = VKVG_LOG_INFO;
        PERFORM_TEST (simple_text, argc, argv);
        PERFORM_TEST (font_file_path, argc, argv);
        PERFORM_TEST (single_font_and_size, argc, argv);