summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2025-04-16 12:30:00 +0200
committerMitya Selivanov <automainint@guattari.tech>2025-04-16 12:30:00 +0200
commit736b3c0ed01c7dbddd4977fd2c8cf274cdcc77bd (patch)
tree8da852f33029f8885be5c62fdaab6c394b1a9f0d
parent95933facfbc45f667f051440ceb374f16b051fcc (diff)
downloadreduced_system_layer-736b3c0ed01c7dbddd4977fd2c8cf274cdcc77bd.zip
Add test letter z
-rwxr-xr-xgraphics.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/graphics.c b/graphics.c
index 02cbb86..4212e45 100755
--- a/graphics.c
+++ b/graphics.c
@@ -2295,6 +2295,49 @@ TEST("text letter A") {
}
}
+TEST("text letter z") {
+ i64 w = 10;
+ i64 h = 10;
+
+ vec4_f32 pixels[100] = {0};
+
+ draw_text_area_to_buffer(
+ (Pixel_Buffer) {
+ .width = 10,
+ .height = 10,
+ .stride = 10,
+ .pixels = pixels,
+ },
+ 0,
+ (vec4_f32) { 1.0f, 1.0f, 1.0f, 1.0f, },
+ (Box) { .x = 0, .y = 0, .width = 10, .height = 10, },
+ (vec2) { .x = 10.0, .y = 10.0, },
+ 1,
+ (c32[1]) { 'z', }
+ );
+
+ b8 expect_bits[100] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0,
+ 0, 1, 1, 1, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ };
+
+ for (i64 i = 0; i < w * h; ++i) {
+ b8 bit = pixels[i].x > 0.5;
+ if (expect_bits[i] != bit) {
+ REQUIRE(0);
+ break;
+ }
+ }
+}
+
static Pixel_Buffer _test_pixels = {
.width = 1280,
.height = 720,