From 0ca30a2d019ec31459a571dd82a36dad140df49b Mon Sep 17 00:00:00 2001 From: Jean-Philippe Bruyère Date: Sun, 22 Jun 2025 12:06:15 +0200 Subject: unified samples app in c++, unit testing wip --- samples/tests/compositing.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 samples/tests/compositing.cpp (limited to 'samples/tests/compositing.cpp') diff --git a/samples/tests/compositing.cpp b/samples/tests/compositing.cpp new file mode 100644 index 0000000..6ef062e --- /dev/null +++ b/samples/tests/compositing.cpp @@ -0,0 +1,31 @@ +#include "VkvgTest.hpp" + +TEST(compositing) { + VkvgContext ctx = vkvg_create(test->surf); + + vkvg_set_source_rgba(ctx, 1, 0, 0, 0.5f); + vkvg_rectangle(ctx, 100, 100, 200, 200); + vkvg_fill(ctx); + + vkvg_set_source_rgba(ctx, 0, 0, 1, 0.5f); + vkvg_rectangle(ctx, 200, 200, 200, 200); + vkvg_fill(ctx); + + vkvg_destroy(ctx); +} + +TEST(opacity) { + VkvgContext ctx = vkvg_create(test->surf); + + vkvg_set_source_rgba(ctx, 1, 0, 0, 1.0f); + vkvg_rectangle(ctx, 100, 100, 200, 200); + vkvg_fill(ctx); + + vkvg_set_opacity(ctx, 0.5f); + + vkvg_set_source_rgba(ctx, 0, 0, 1, 1.0f); + vkvg_rectangle(ctx, 200, 200, 200, 200); + vkvg_fill(ctx); + + vkvg_destroy(ctx); +} -- cgit v1.3.1-4-g156e