diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-05 18:13:39 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-05 18:13:39 +0100 |
| commit | dcda45d8ae46197d304d737c102b13643808203f (patch) | |
| tree | fa8b19907d56a054fcc8f35dd4f1c6ec1a713387 /src | |
| parent | e44c71ffb3b9d25cc8341d25bf3e63d6224dfbe6 (diff) | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/tests/test_assets.cc | 19 |
1 files changed, 19 insertions, 0 deletions
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; |
