summaryrefslogtreecommitdiffstatsci
path: root/samples/tests/compositing.cpp
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2025-06-22 12:06:15 +0200
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2025-06-22 12:06:15 +0200
commit0ca30a2d019ec31459a571dd82a36dad140df49b (patch)
tree3bb6aad41a6d518f04b72e09b98f0ff7c7abfef0 /samples/tests/compositing.cpp
parent86ff26b3787c09b2e9a321d944af312b49041f08 (diff)
unified samples app in c++, unit testing wip
Diffstat (limited to 'samples/tests/compositing.cpp')
-rw-r--r--samples/tests/compositing.cpp31
1 files changed, 31 insertions, 0 deletions
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);
+}