From dcda45d8ae46197d304d737c102b13643808203f Mon Sep 17 00:00:00 2001 From: skal Date: Thu, 5 Feb 2026 18:13:39 +0100 Subject: test(assets): Add tests for Texture Asset support - Added test_image.tga (generated via tools/gen_test_tga.cc). - Updated test_assets_list.txt to include the TGA. - Updated test_assets.cc to verify image decompression and pixel values. --- src/tests/test_assets.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/tests') diff --git a/src/tests/test_assets.cc b/src/tests/test_assets.cc index a1ae795..5ae266e 100644 --- a/src/tests/test_assets.cc +++ b/src/tests/test_assets.cc @@ -91,6 +91,25 @@ int main() { assert(non_zero_data); printf("Procedural asset DropAsset and re-generation test: SUCCESS\n"); + // Test Texture Asset (TGA loading) + printf("\nRunning Texture Asset test...\n"); + TextureAsset tex = GetTextureAsset(AssetId::ASSET_TEST_IMAGE); + assert(tex.pixels != nullptr); + assert(tex.width == 2); + assert(tex.height == 2); + + // Verify pixels (Expected RGBA) + // Pixel 0: Red (255, 0, 0, 255) + assert(tex.pixels[0] == 255 && tex.pixels[1] == 0 && tex.pixels[2] == 0 && tex.pixels[3] == 255); + // Pixel 1: Green (0, 255, 0, 255) + assert(tex.pixels[4] == 0 && tex.pixels[5] == 255 && tex.pixels[6] == 0 && tex.pixels[7] == 255); + // Pixel 2: Blue (0, 0, 255, 255) + assert(tex.pixels[8] == 0 && tex.pixels[9] == 0 && tex.pixels[10] == 255 && tex.pixels[11] == 255); + // Pixel 3: White (255, 255, 255, 255) + assert(tex.pixels[12] == 255 && tex.pixels[13] == 255 && tex.pixels[14] == 255 && tex.pixels[15] == 255); + + printf("Texture Asset content verification: SUCCESS\n"); + // Test Unknown Procedural Function printf("\nRunning Unknown Procedural Function test...\n"); size_t unknown_size = 0; -- cgit v1.2.3