diff options
author | Mitya Selivanov <automainint@guattari.tech> | 2025-04-16 12:22:44 +0200 |
---|---|---|
committer | Mitya Selivanov <automainint@guattari.tech> | 2025-04-16 12:22:44 +0200 |
commit | 95933facfbc45f667f051440ceb374f16b051fcc (patch) | |
tree | 5ec8be4a73f000cf25035c8374eaa95a7ed6eb3b /graphics.c | |
parent | 24e30558d8b30d399a69dd99a510fd43ca075cfe (diff) | |
download | reduced_system_layer-95933facfbc45f667f051440ceb374f16b051fcc.zip |
Add test letter A
Diffstat (limited to 'graphics.c')
-rwxr-xr-x | graphics.c | 45 |
1 files changed, 44 insertions, 1 deletions
@@ -2252,6 +2252,49 @@ TEST("colors") { REQUIRE_EQ((purple.z + 2e-7) * 100, 100); } +TEST("text letter A") { + 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]) { 'A', } + ); + + b8 expect_bits[100] = { + 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, + 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, + 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, + 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, + 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, + 1, 0, 0, 0, 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, @@ -2260,7 +2303,7 @@ static Pixel_Buffer _test_pixels = { }; #ifndef EVERY_TEST_SUITE -void update_and_render_frame(void) {} +void update_and_render_frame(void) { } i32 main(i32 argc, c8 **argv) { return run_tests(argc, argv); |