diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2025-06-22 12:06:15 +0200 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2025-06-22 12:06:15 +0200 |
| commit | 0ca30a2d019ec31459a571dd82a36dad140df49b (patch) | |
| tree | 3bb6aad41a6d518f04b72e09b98f0ff7c7abfef0 /samples/tests/simple_paint.cpp | |
| parent | 86ff26b3787c09b2e9a321d944af312b49041f08 (diff) | |
unified samples app in c++, unit testing wip
Diffstat (limited to 'samples/tests/simple_paint.cpp')
| -rw-r--r-- | samples/tests/simple_paint.cpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/samples/tests/simple_paint.cpp b/samples/tests/simple_paint.cpp new file mode 100644 index 0000000..a1f1ca0 --- /dev/null +++ b/samples/tests/simple_paint.cpp @@ -0,0 +1,52 @@ +#include "VkvgTest.hpp" + +TEST(paint) { + VkvgContext ctx = vkvg_create(test->surf); + vkvg_clear(ctx); + vkvg_set_source_rgba(ctx, 1, 0, 0, 0.5f); + vkvg_paint(ctx); + vkvg_destroy(ctx); +} +TEST(paint_with_rotation) { + VkvgContext ctx = vkvg_create(test->surf); + vkvg_clear(ctx); + vkvg_rotate(ctx, 45); + vkvg_set_source_rgba(ctx, 1, 0, 0, 1); + vkvg_paint(ctx); + vkvg_destroy(ctx); +} +TEST(paint_with_scale) { + VkvgContext ctx = vkvg_create(test->surf); + vkvg_clear(ctx); + vkvg_scale(ctx, 0.2f, 0.2f); + vkvg_set_source_rgba(ctx, 1, 0, 0, 1); + vkvg_paint(ctx); + vkvg_destroy(ctx); +} +TEST(paint_rect) { + VkvgContext ctx = vkvg_create(test->surf); + vkvg_clear(ctx); + 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 +TEST(paint_rect_with_rotation) { + VkvgContext ctx = vkvg_create(test->surf); + vkvg_clear(ctx); + 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); +} +TEST(paint_rect_with_scale) { + VkvgContext ctx = vkvg_create(test->surf); + vkvg_clear(ctx); + 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); +} |