diff options
Diffstat (limited to 'tests/simple_paint.c')
| -rw-r--r-- | tests/simple_paint.c | 71 |
1 files changed, 50 insertions, 21 deletions
diff --git a/tests/simple_paint.c b/tests/simple_paint.c index 4f56a50..abc66ef 100644 --- a/tests/simple_paint.c +++ b/tests/simple_paint.c @@ -1,26 +1,55 @@ #include "test.h" -void test(){ - VkvgContext ctx = vkvg_create(surf); - vkvg_set_source_rgba(ctx,1,0,0,1); - vkvg_paint(ctx); - - /*vkvg_set_line_width(ctx, 5); - vkvg_set_source_rgba(ctx,0,1,0,1); - vkvg_rectangle(ctx,100,100,300,200); - vkvg_fill(ctx); - - vkvg_translate(ctx,300,100); - - vkvg_set_source_rgba(ctx,1,0,0,1); - vkvg_rectangle(ctx,100,100,300,200); - vkvg_stroke(ctx);*/ - vkvg_destroy(ctx); +void paint(){ + VkvgContext ctx = vkvg_create(surf); + vkvg_set_source_rgba(ctx,1,0,0,1); + vkvg_paint(ctx); + vkvg_destroy(ctx); +} +void paint_with_rotation(){ + VkvgContext ctx = vkvg_create(surf); + vkvg_rotate(ctx, 45); + vkvg_set_source_rgba(ctx,1,0,0,1); + vkvg_paint(ctx); + vkvg_destroy(ctx); +} +void paint_with_scale(){ + VkvgContext ctx = vkvg_create(surf); + vkvg_scale (ctx, 0.2f,0.2f); + vkvg_set_source_rgba(ctx,1,0,0,1); + vkvg_paint(ctx); + vkvg_destroy(ctx); +} +void paint_rect(){ + VkvgContext ctx = vkvg_create(surf); + vkvg_set_source_rgba(ctx,1,0,0,1); + vkvg_rectangle(ctx,100,100,300,200); + vkvg_paint(ctx); + vkvg_destroy(ctx); +} +//TODO:test failed: full screen paint instead of rotated rect +void paint_rect_with_rotation(){ + VkvgContext ctx = vkvg_create(surf); + vkvg_rotate(ctx, 45); + vkvg_set_source_rgba(ctx,1,0,0,1); + vkvg_rectangle(ctx,100,100,300,200); + vkvg_paint(ctx); + vkvg_destroy(ctx); +} +void paint_rect_with_scale(){ + VkvgContext ctx = vkvg_create(surf); + vkvg_scale (ctx, 0.2f,0.2f); + vkvg_set_source_rgba(ctx,1,0,0,1); + vkvg_rectangle(ctx,100,100,300,200); + vkvg_paint(ctx); + vkvg_destroy(ctx); } - int main(int argc, char *argv[]) { - - perform_test (test, 1024, 768); - - return 0; + PERFORM_TEST (paint, argc, argv); + PERFORM_TEST (paint_with_rotation, argc, argv); + PERFORM_TEST (paint_with_scale, argc, argv); + PERFORM_TEST (paint_rect, argc, argv); + PERFORM_TEST (paint_rect_with_rotation, argc, argv); + PERFORM_TEST (paint_rect_with_scale, argc, argv); + return 0; } |