Make progressive JPEGs return a proper error

Add progressive JPEG file to test suite and test that loading it returns the expected `Unsupported_Frame_Type` error.

This JPEG variant will hopefully be supported in the future, but we should at least return an error rather than use `unsupported()`.
This commit is contained in:
Jeroen van Rijn
2025-09-09 13:53:43 +02:00
parent 9abc3f67b5
commit dd9fceaae1
3 changed files with 277 additions and 270 deletions
+1 -1
View File
@@ -637,7 +637,7 @@ load_from_context :: proc(ctx: ^$C, options := Options{}, allocator := context.a
color_components[id].h_sampling_factor = cast(int)horizontal_sampling color_components[id].h_sampling_factor = cast(int)horizontal_sampling
} }
case .SOF2: // Progressive DCT case .SOF2: // Progressive DCT
unimplemented("SOF2") fallthrough
case .SOF3: // Lossless (sequential) case .SOF3: // Lossless (sequential)
fallthrough fallthrough
case .SOF5: // Differential sequential DCT case .SOF5: // Differential sequential DCT
+1
View File
@@ -281,6 +281,7 @@ HMAC_DIGESTS = {
'shortfile.bmp': "be3ffade7999304f00f9b7d152b5b27811ad1166d0fd43004392467a28f44b6a4ec02a23c0296bacd4f02f8041cd824b9ca6c9fc31fed27e36e572113bb47d73", 'shortfile.bmp': "be3ffade7999304f00f9b7d152b5b27811ad1166d0fd43004392467a28f44b6a4ec02a23c0296bacd4f02f8041cd824b9ca6c9fc31fed27e36e572113bb47d73",
'emblem-1024.jpg': "d7b7e3ffaa5cda04c667e3742752091d78e02aa2d3c7a63406af679ce810a0a86666b10fcab12cc7ead2fadf2f6c2e1237bc94f892a62a4c218e18a20f96dbe4", 'emblem-1024.jpg': "d7b7e3ffaa5cda04c667e3742752091d78e02aa2d3c7a63406af679ce810a0a86666b10fcab12cc7ead2fadf2f6c2e1237bc94f892a62a4c218e18a20f96dbe4",
'emblem-1024-progressive.jpg': "7a6f4b112bd7189320c58dcddb9129968bcf268798c1e0c4f2243c10b3e3d9a6962c9f142d9fd65f8fb31e9a1e899008cae22b3ffde713250d315499b412e160",
'unicode.xml': "e0cdc94f07fdbb15eea811ed2ae6dcf494a83d197dafe6580c740270feb0d8f5f7146d4a7d4c2d2ea25f8bd9678bc986123484b39399819a6b7262687959d1ae", 'unicode.xml': "e0cdc94f07fdbb15eea811ed2ae6dcf494a83d197dafe6580c740270feb0d8f5f7146d4a7d4c2d2ea25f8bd9678bc986123484b39399819a6b7262687959d1ae",
} }
+7 -1
View File
@@ -5,7 +5,7 @@
List of contributors: List of contributors:
Jeroen van Rijn: Initial implementation. Jeroen van Rijn: Initial implementation.
A test suite for PNG, TGA, NetPBM, QOI and BMP. A test suite for PNG, TGA, NetPBM, QOI, BMP, and JPEG.
*/ */
#+feature dynamic-literals #+feature dynamic-literals
package test_core_image package test_core_image
@@ -2367,6 +2367,12 @@ Basic_JPG_Tests := []Test{
{ {
"emblem-1024", { "emblem-1024", {
{Default, nil, {1024, 1024, 3, 8}, 0x_46a29e0f}, {Default, nil, {1024, 1024, 3, 8}, 0x_46a29e0f},
// {Alpha_Add, nil, {1024, 1024, 4, 8}, 0x_46a29e0f},
},
},
{
"emblem-1024-progressive", {
{Default, .Unsupported_Frame_Type, {1024, 1024, 3, 8}, 0x_46a29e0f},
}, },
}, },
} }