summaryrefslogtreecommitdiffstatsci
path: root/samples/tests/circles.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>2026-09-04 11:03:52 +0200
commitdb328d2a861f5aedec900e44fbe1fd542b307afb (patch)
tree2997dcaad33d99b9cd79b6681ca0c679f2c34a1b /samples/tests/circles.cpp
parent0199cfcb86b384e888ddf01642b63f4a32e15894 (diff)
unified samples app in c++, unit testing wip
Diffstat (limited to 'samples/tests/circles.cpp')
-rw-r--r--samples/tests/circles.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/samples/tests/circles.cpp b/samples/tests/circles.cpp
new file mode 100644
index 0000000..a302ec8
--- /dev/null
+++ b/samples/tests/circles.cpp
@@ -0,0 +1,46 @@
+#include "VkvgTest.hpp"
+
+TEST(circles_scaled_up) {
+ VkvgContext ctx = vkvg_create(test->surf);
+ vkvg_clear(ctx);
+
+ vkvg_set_source_rgb(ctx, 1, 1, 1);
+
+ vkvg_scale(ctx, 100, 100);
+ vkvg_arc(ctx, 2, 2, 0.5f, 0, M_PIF * 2);
+ vkvg_stroke(ctx);
+
+ vkvg_destroy(ctx);
+}
+TEST(circles_fill_and_stroke) {
+ VkvgContext ctx = vkvg_create(test->surf);
+ vkvg_clear(ctx);
+ vkvg_set_source_rgba(ctx, 0, 0.1f, 0.8f, 0.5f);
+ vkvg_set_line_width(ctx, 10);
+
+ vkvg_arc(ctx, 300, 300, 150.f, 0, M_PIF * 2);
+ vkvg_fill_preserve(ctx);
+ vkvg_stroke(ctx);
+
+ vkvg_destroy(ctx);
+}
+TEST(circles_sizes) {
+ VkvgContext ctx = vkvg_create(test->surf);
+ vkvg_clear(ctx);
+
+ vkvg_set_source_rgb(ctx, 1, 1, 1);
+
+ draw_growing_circles(ctx, 100, 40);
+ vkvg_fill(ctx);
+
+ draw_growing_circles(ctx, 200, 40);
+ vkvg_stroke(ctx);
+
+ vkvg_set_source_rgba(ctx, 0, 0, 1, 0.4F);
+ draw_growing_circles(ctx, 300, 40);
+ vkvg_fill_preserve(ctx);
+ vkvg_set_line_width(ctx, 5);
+ vkvg_stroke(ctx);
+
+ vkvg_destroy(ctx);
+}