11// Copyright (c) Six Labors.
22// Licensed under the Six Labors Split License.
33
4+ using SixLabors . ImageSharp . Formats . Qoi ;
45using SixLabors . ImageSharp . PixelFormats ;
56
67namespace SixLabors . ImageSharp . Tests . Formats . Qoi ;
@@ -10,40 +11,46 @@ namespace SixLabors.ImageSharp.Tests.Formats.Qoi;
1011public class QoiDecoderTests
1112{
1213 [ Theory ]
13- [ InlineData ( TestImages . Qoi . Dice ) ]
14- [ InlineData ( TestImages . Qoi . EdgeCase ) ]
15- [ InlineData ( TestImages . Qoi . Kodim10 ) ]
16- [ InlineData ( TestImages . Qoi . Kodim23 ) ]
17- [ InlineData ( TestImages . Qoi . QoiLogo ) ]
18- [ InlineData ( TestImages . Qoi . TestCard ) ]
19- [ InlineData ( TestImages . Qoi . TestCardRGBA ) ]
20- [ InlineData ( TestImages . Qoi . Wikipedia008 ) ]
21- public void Identify ( string imagePath )
14+ [ InlineData ( TestImages . Qoi . Dice , QoiChannels . Rgba , QoiColorSpace . SrgbWithLinearAlpha ) ]
15+ [ InlineData ( TestImages . Qoi . EdgeCase , QoiChannels . Rgba , QoiColorSpace . SrgbWithLinearAlpha ) ]
16+ [ InlineData ( TestImages . Qoi . Kodim10 , QoiChannels . Rgb , QoiColorSpace . SrgbWithLinearAlpha ) ]
17+ [ InlineData ( TestImages . Qoi . Kodim23 , QoiChannels . Rgb , QoiColorSpace . SrgbWithLinearAlpha ) ]
18+ [ InlineData ( TestImages . Qoi . QoiLogo , QoiChannels . Rgba , QoiColorSpace . SrgbWithLinearAlpha ) ]
19+ [ InlineData ( TestImages . Qoi . TestCard , QoiChannels . Rgba , QoiColorSpace . SrgbWithLinearAlpha ) ]
20+ [ InlineData ( TestImages . Qoi . TestCardRGBA , QoiChannels . Rgba , QoiColorSpace . SrgbWithLinearAlpha ) ]
21+ [ InlineData ( TestImages . Qoi . Wikipedia008 , QoiChannels . Rgb , QoiColorSpace . SrgbWithLinearAlpha ) ]
22+ public void Identify ( string imagePath , QoiChannels channels , QoiColorSpace colorSpace )
2223 {
2324 TestFile testFile = TestFile . Create ( imagePath ) ;
2425 using MemoryStream stream = new ( testFile . Bytes , false ) ;
2526
2627 ImageInfo imageInfo = Image . Identify ( stream ) ;
28+ QoiMetadata qoiMetadata = imageInfo . Metadata . GetQoiMetadata ( ) ;
2729
2830 Assert . NotNull ( imageInfo ) ;
29- Assert . Equal ( imageInfo . Metadata . DecodedImageFormat , ImageSharp . Formats . Qoi . QoiFormat . Instance ) ;
31+ Assert . Equal ( imageInfo . Metadata . DecodedImageFormat , QoiFormat . Instance ) ;
32+ Assert . Equal ( qoiMetadata . Channels , channels ) ;
33+ Assert . Equal ( qoiMetadata . ColorSpace , colorSpace ) ;
3034 }
3135
3236 [ Theory ]
33- [ WithFile ( TestImages . Qoi . Dice , PixelTypes . Rgba32 ) ]
34- [ WithFile ( TestImages . Qoi . EdgeCase , PixelTypes . Rgba32 ) ]
35- [ WithFile ( TestImages . Qoi . Kodim10 , PixelTypes . Rgba32 ) ]
36- [ WithFile ( TestImages . Qoi . Kodim23 , PixelTypes . Rgba32 ) ]
37- [ WithFile ( TestImages . Qoi . QoiLogo , PixelTypes . Rgba32 ) ]
38- [ WithFile ( TestImages . Qoi . TestCard , PixelTypes . Rgba32 ) ]
39- [ WithFile ( TestImages . Qoi . TestCardRGBA , PixelTypes . Rgba32 ) ]
40- [ WithFile ( TestImages . Qoi . Wikipedia008 , PixelTypes . Rgba32 ) ]
41- public void Decode < TPixel > ( TestImageProvider < TPixel > provider )
37+ [ WithFile ( TestImages . Qoi . Dice , PixelTypes . Rgba32 , QoiChannels . Rgba , QoiColorSpace . SrgbWithLinearAlpha ) ]
38+ [ WithFile ( TestImages . Qoi . EdgeCase , PixelTypes . Rgba32 , QoiChannels . Rgba , QoiColorSpace . SrgbWithLinearAlpha ) ]
39+ [ WithFile ( TestImages . Qoi . Kodim10 , PixelTypes . Rgba32 , QoiChannels . Rgb , QoiColorSpace . SrgbWithLinearAlpha ) ]
40+ [ WithFile ( TestImages . Qoi . Kodim23 , PixelTypes . Rgba32 , QoiChannels . Rgb , QoiColorSpace . SrgbWithLinearAlpha ) ]
41+ [ WithFile ( TestImages . Qoi . QoiLogo , PixelTypes . Rgba32 , QoiChannels . Rgba , QoiColorSpace . SrgbWithLinearAlpha ) ]
42+ [ WithFile ( TestImages . Qoi . TestCard , PixelTypes . Rgba32 , QoiChannels . Rgba , QoiColorSpace . SrgbWithLinearAlpha ) ]
43+ [ WithFile ( TestImages . Qoi . TestCardRGBA , PixelTypes . Rgba32 , QoiChannels . Rgba , QoiColorSpace . SrgbWithLinearAlpha ) ]
44+ [ WithFile ( TestImages . Qoi . Wikipedia008 , PixelTypes . Rgba32 , QoiChannels . Rgb , QoiColorSpace . SrgbWithLinearAlpha ) ]
45+ public void Decode < TPixel > ( TestImageProvider < TPixel > provider , QoiChannels channels , QoiColorSpace colorSpace )
4246 where TPixel : unmanaged, IPixel < TPixel >
4347 {
4448 using Image < TPixel > image = provider . GetImage ( ) ;
49+ QoiMetadata qoiMetadata = image . Metadata . GetQoiMetadata ( ) ;
4550 image . DebugSave ( provider ) ;
4651
4752 image . CompareToReferenceOutput ( provider ) ;
53+ Assert . Equal ( qoiMetadata . Channels , channels ) ;
54+ Assert . Equal ( qoiMetadata . ColorSpace , colorSpace ) ;
4855 }
4956}
0 commit comments