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> | 2026-09-04 11:03:52 +0200 |
| commit | db328d2a861f5aedec900e44fbe1fd542b307afb (patch) | |
| tree | 2997dcaad33d99b9cd79b6681ca0c679f2c34a1b /samples/tests/simple_paint.cpp | |
| parent | 0199cfcb86b384e888ddf01642b63f4a32e15894 (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); +} |