summaryrefslogtreecommitdiff
path: root/graphics.c
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2025-04-24 02:58:57 +0200
committerMitya Selivanov <automainint@guattari.tech>2025-04-24 02:58:57 +0200
commitf8bd7cfdb9ed7ec99d612dd03670e50aa0c60db2 (patch)
treea6b7df9d6e547262b86db964f11dd6b7e56cb403 /graphics.c
parent5dc100fde9e30f4424d77ced522df58ac03f82c6 (diff)
downloadreduced_system_layer-f8bd7cfdb9ed7ec99d612dd03670e50aa0c60db2.zip
Refactor testing
Diffstat (limited to 'graphics.c')
-rw-r--r--[-rwxr-xr-x]graphics.c70
1 files changed, 17 insertions, 53 deletions
diff --git a/graphics.c b/graphics.c
index 52c0432..f4bc699 100755..100644
--- a/graphics.c
+++ b/graphics.c
@@ -1,50 +1,18 @@
-#if 0 /*
-#/ ================================================================
-#/
-#/ graphics.c
-#/
-#/ ----------------------------------------------------------------
-#/
-#/ (C) 2025 Mitya Selivanov <guattari.tech>
-#/
-#/ Any use of this code is prohibited.
-#/
-#/ ================================================================
-#/
-#/ Self-testing shell script
-#/
-#/ ================================================================
-
-SRC=${0##*./}
-BIN=${SRC%.*}
-gcc \
- -Wall -Wextra -Werror -pedantic \
- -Wno-missing-braces \
- -Wno-old-style-declaration \
- -Wno-overlength-strings \
- -Wno-unused-parameter \
- -Wno-unused-variable \
- -Wno-unused-but-set-variable \
- -O3 -D NDEBUG \
- -D ENABLE_WAYLAND=0 \
- -D GRAPHICS_TEST_SUITE \
- -lX11 -lm -lasound \
- -o $BIN $SRC && \
- ./$BIN $@
-STATUS=$?
-rm -f $BIN
-exit $STATUS # */
-#endif
-
+// ================================================================
+//
+// graphics.c
+//
+// ----------------------------------------------------------------
+//
+// (C) 2025 Mitya Selivanov <guattari.tech>
+//
+// Any use of this code is prohibited.
+//
// ================================================================
#ifndef GRAPHICS_HEADER_GUARD_
#define GRAPHICS_HEADER_GUARD_
-#ifdef EVERY_TEST_SUITE
-#define GRAPHICS_TEST_SUITE
-#endif
-
#ifdef GRAPHICS_HEADER
#define RUNTIME_HEADER
#endif
@@ -853,6 +821,8 @@ void font_render_to_buffer_dispatch(Pixel_Buffer dst, i32 font, vec4_f32 color,
#endif // !defined(GRAPHICS_ENABLE_FONT_CUSTOM_DISPATCH)
void draw_text_area_to_buffer(Pixel_Buffer dst, i32 font, vec4_f32 color, Box area, vec2 max_size, i64 num_chars, c32 *text) {
+ (void) font;
+
if (text == NULL || num_chars <= 0 || max_size.x < EPSILON || max_size.y < EPSILON)
return;
@@ -878,6 +848,8 @@ void draw_text_area_to_buffer(Pixel_Buffer dst, i32 font, vec4_f32 color, Box ar
}
void draw_text_cursor_to_buffer(Pixel_Buffer dst, i32 font, vec4_f32 color, Box area, vec2 max_size, i64 num_chars, c32 *text, i64 cursor, i64 selection) {
+ (void) font;
+
if (max_size.x < EPSILON || max_size.y < EPSILON)
return;
@@ -2168,11 +2140,11 @@ void clean_graphics_requests_cache(i64 amount) {
// ================================================================
//
-// Test suite
+// Test suite
//
// ================================================================
-#ifdef GRAPHICS_TEST_SUITE
+#if ENABLE_TESTING
#define TEST_FILE graphics
#include "test.c"
@@ -2572,16 +2544,8 @@ TEST("text digits 42") {
REQUIRE(ok);
}
-#ifndef EVERY_TEST_SUITE
-void update_and_render_frame(void) { }
-
-i32 main(i32 argc, c8 **argv) {
- return run_tests(argc, argv);
-}
-#endif
-
#undef TEST_FILE
-#endif // GRAPHICS_TEST_SUITE
+#endif // ENABLE_TESTING
// ================================================================