Skip to content

Commit 237d129

Browse files
committed
Update Tests
Signed-off-by: 舰队的偶像-岛风酱! <[email protected]>
1 parent bad83f9 commit 237d129

File tree

4 files changed

+110
-14
lines changed

4 files changed

+110
-14
lines changed

tests/ImageSharp.Tests/Formats/Icon/Cur/CurDecoderTests.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,16 @@ public void CurDecoder_Decode(TestImageProvider<Rgba32> provider)
2121

2222
// TODO: Assert metadata, frame count, etc
2323
}
24+
25+
[Theory]
26+
[WithFile(CurFake, PixelTypes.Rgba32)]
27+
[WithFile(CurReal, PixelTypes.Rgba32)]
28+
public void CurDecoder_Decode2(TestImageProvider<Rgba32> provider)
29+
{
30+
using Image<Rgba32> image = provider.GetImage(CurDecoder.Instance);
31+
32+
image.DebugSaveMultiFrame(provider, extension: "png");
33+
34+
// TODO: Assert metadata, frame count, etc
35+
}
2436
}

tests/ImageSharp.Tests/Formats/Icon/Cur/CurEncoderTests.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) Six Labors.
22
// Licensed under the Six Labors Split License.
33

4-
using System.Diagnostics;
54
using SixLabors.ImageSharp.Formats.Cur;
65
using SixLabors.ImageSharp.PixelFormats;
76
using static SixLabors.ImageSharp.Tests.TestImages.Cur;
@@ -30,12 +29,4 @@ public void Encode(string imagePath)
3029
memStream.Seek(0, SeekOrigin.Begin);
3130
CurDecoder.Instance.Decode(new(), memStream);
3231
}
33-
34-
[Theory]
35-
[WithFile(CurFake, PixelTypes.Rgba32)]
36-
[WithFile(CurReal, PixelTypes.Rgba32)]
37-
public void CurDecoder_Decode2(TestImageProvider<Rgba32> provider)
38-
{
39-
Debug.Assert(false);
40-
}
4132
}

tests/ImageSharp.Tests/Formats/Icon/Ico/IcoDecoderTests.cs

Lines changed: 97 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) Six Labors.
22
// Licensed under the Six Labors Split License.
33

4-
using System.Diagnostics;
54
using SixLabors.ImageSharp.Formats.Ico;
65
using SixLabors.ImageSharp.PixelFormats;
76
using static SixLabors.ImageSharp.Tests.TestImages.Ico;
@@ -42,6 +41,16 @@ public void IcoDecoder_Decode(TestImageProvider<Rgba32> provider)
4241
[WithFile(Bpp1Size9x9, PixelTypes.Rgba32)]
4342
[WithFile(Bpp1TranspNotSquare, PixelTypes.Rgba32)]
4443
[WithFile(Bpp1TranspPartial, PixelTypes.Rgba32)]
44+
public void Bpp1Test(TestImageProvider<Rgba32> provider)
45+
{
46+
using Image<Rgba32> image = provider.GetImage(IcoDecoder.Instance);
47+
48+
image.DebugSaveMultiFrame(provider, extension: "png");
49+
50+
// TODO: Assert metadata, frame count, etc
51+
}
52+
53+
[Theory]
4554
[WithFile(Bpp24Size15x15, PixelTypes.Rgba32)]
4655
[WithFile(Bpp24Size16x16, PixelTypes.Rgba32)]
4756
[WithFile(Bpp24Size17x17, PixelTypes.Rgba32)]
@@ -61,6 +70,16 @@ public void IcoDecoder_Decode(TestImageProvider<Rgba32> provider)
6170
[WithFile(Bpp24TranspNotSquare, PixelTypes.Rgba32)]
6271
[WithFile(Bpp24TranspPartial, PixelTypes.Rgba32)]
6372
[WithFile(Bpp24Transp, PixelTypes.Rgba32)]
73+
public void Bpp24Test(TestImageProvider<Rgba32> provider)
74+
{
75+
using Image<Rgba32> image = provider.GetImage(IcoDecoder.Instance);
76+
77+
image.DebugSaveMultiFrame(provider, extension: "png");
78+
79+
// TODO: Assert metadata, frame count, etc
80+
}
81+
82+
[Theory]
6483
[WithFile(Bpp32Size15x15, PixelTypes.Rgba32)]
6584
[WithFile(Bpp32Size16x16, PixelTypes.Rgba32)]
6685
[WithFile(Bpp32Size17x17, PixelTypes.Rgba32)]
@@ -80,6 +99,16 @@ public void IcoDecoder_Decode(TestImageProvider<Rgba32> provider)
8099
[WithFile(Bpp32TranspNotSquare, PixelTypes.Rgba32)]
81100
[WithFile(Bpp32TranspPartial, PixelTypes.Rgba32)]
82101
[WithFile(Bpp32Transp, PixelTypes.Rgba32)]
102+
public void Bpp32Test(TestImageProvider<Rgba32> provider)
103+
{
104+
using Image<Rgba32> image = provider.GetImage(IcoDecoder.Instance);
105+
106+
image.DebugSaveMultiFrame(provider, extension: "png");
107+
108+
// TODO: Assert metadata, frame count, etc
109+
}
110+
111+
[Theory]
83112
[WithFile(Bpp4Size15x15, PixelTypes.Rgba32)]
84113
[WithFile(Bpp4Size16x16, PixelTypes.Rgba32)]
85114
[WithFile(Bpp4Size17x17, PixelTypes.Rgba32)]
@@ -98,6 +127,16 @@ public void IcoDecoder_Decode(TestImageProvider<Rgba32> provider)
98127
[WithFile(Bpp4Size9x9, PixelTypes.Rgba32)]
99128
[WithFile(Bpp4TranspNotSquare, PixelTypes.Rgba32)]
100129
[WithFile(Bpp4TranspPartial, PixelTypes.Rgba32)]
130+
public void Bpp4Test(TestImageProvider<Rgba32> provider)
131+
{
132+
using Image<Rgba32> image = provider.GetImage(IcoDecoder.Instance);
133+
134+
image.DebugSaveMultiFrame(provider, extension: "png");
135+
136+
// TODO: Assert metadata, frame count, etc
137+
}
138+
139+
[Theory]
101140
[WithFile(Bpp8Size15x15, PixelTypes.Rgba32)]
102141
[WithFile(Bpp8Size16x16, PixelTypes.Rgba32)]
103142
[WithFile(Bpp8Size17x17, PixelTypes.Rgba32)]
@@ -116,28 +155,82 @@ public void IcoDecoder_Decode(TestImageProvider<Rgba32> provider)
116155
[WithFile(Bpp8Size9x9, PixelTypes.Rgba32)]
117156
[WithFile(Bpp8TranspNotSquare, PixelTypes.Rgba32)]
118157
[WithFile(Bpp8TranspPartial, PixelTypes.Rgba32)]
158+
public void Bpp8Test(TestImageProvider<Rgba32> provider)
159+
{
160+
using Image<Rgba32> image = provider.GetImage(IcoDecoder.Instance);
161+
162+
image.DebugSaveMultiFrame(provider, extension: "png");
163+
164+
// TODO: Assert metadata, frame count, etc
165+
}
166+
167+
[Theory]
119168
[WithFile(InvalidAll, PixelTypes.Rgba32)]
120-
[WithFile(IcoFake, PixelTypes.Rgba32)]
121169
[WithFile(InvalidBpp, PixelTypes.Rgba32)]
122170
[WithFile(InvalidCompression, PixelTypes.Rgba32)]
123171
[WithFile(InvalidPng, PixelTypes.Rgba32)]
124172
[WithFile(InvalidRLE4, PixelTypes.Rgba32)]
125173
[WithFile(InvalidRLE8, PixelTypes.Rgba32)]
174+
public void InvalidTest(TestImageProvider<Rgba32> provider)
175+
{
176+
using Image<Rgba32> image = provider.GetImage(IcoDecoder.Instance);
177+
178+
image.DebugSaveMultiFrame(provider, extension: "png");
179+
180+
// TODO: Assert metadata, frame count, etc
181+
}
182+
183+
[Theory]
126184
[WithFile(MixedBmpPngA, PixelTypes.Rgba32)]
127185
[WithFile(MixedBmpPngB, PixelTypes.Rgba32)]
128186
[WithFile(MixedBmpPngC, PixelTypes.Rgba32)]
187+
public void MixedBmpPngTest(TestImageProvider<Rgba32> provider)
188+
{
189+
using Image<Rgba32> image = provider.GetImage(IcoDecoder.Instance);
190+
191+
image.DebugSaveMultiFrame(provider, extension: "png");
192+
193+
// TODO: Assert metadata, frame count, etc
194+
}
195+
196+
[Theory]
129197
[WithFile(MultiSizeA, PixelTypes.Rgba32)]
130198
[WithFile(MultiSizeB, PixelTypes.Rgba32)]
131199
[WithFile(MultiSizeC, PixelTypes.Rgba32)]
132200
[WithFile(MultiSizeD, PixelTypes.Rgba32)]
133201
[WithFile(MultiSizeE, PixelTypes.Rgba32)]
134202
[WithFile(MultiSizeF, PixelTypes.Rgba32)]
203+
public void MultiSizeTest(TestImageProvider<Rgba32> provider)
204+
{
205+
using Image<Rgba32> image = provider.GetImage(IcoDecoder.Instance);
206+
207+
image.DebugSaveMultiFrame(provider, extension: "png");
208+
209+
// TODO: Assert metadata, frame count, etc
210+
}
211+
212+
[Theory]
135213
[WithFile(MultiSizeMultiBitsA, PixelTypes.Rgba32)]
136214
[WithFile(MultiSizeMultiBitsB, PixelTypes.Rgba32)]
137215
[WithFile(MultiSizeMultiBitsC, PixelTypes.Rgba32)]
138216
[WithFile(MultiSizeMultiBitsD, PixelTypes.Rgba32)]
139-
public void IcoDecoder_Decode2(TestImageProvider<Rgba32> provider)
217+
public void MultiSizeMultiBitsTest(TestImageProvider<Rgba32> provider)
218+
{
219+
using Image<Rgba32> image = provider.GetImage(IcoDecoder.Instance);
220+
221+
image.DebugSaveMultiFrame(provider, extension: "png");
222+
223+
// TODO: Assert metadata, frame count, etc
224+
}
225+
226+
[Theory]
227+
[WithFile(IcoFake, PixelTypes.Rgba32)]
228+
public void IcoFakeTest(TestImageProvider<Rgba32> provider)
140229
{
141-
Debug.Assert(false);
230+
using Image<Rgba32> image = provider.GetImage(IcoDecoder.Instance);
231+
232+
image.DebugSaveMultiFrame(provider, extension: "png");
233+
234+
// TODO: Assert metadata, frame count, etc
142235
}
143236
}

tests/ImageSharp.Tests/TestImages.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,6 @@ public static class Ico
12191219
public const string Bpp8TranspNotSquare = "Icon/8bpp_transp_not_square.ico";
12201220
public const string Bpp8TranspPartial = "Icon/8bpp_transp_partial.ico";
12211221
public const string InvalidAll = "Icon/invalid_all.ico";
1222-
public const string IcoFake = "Icon/ico_fake.cur";
12231222
public const string InvalidBpp = "Icon/invalid_bpp.ico";
12241223
public const string InvalidCompression = "Icon/invalid_compression.ico";
12251224
public const string InvalidPng = "Icon/invalid_png.ico";
@@ -1238,6 +1237,7 @@ public static class Ico
12381237
public const string MultiSizeMultiBitsB = "Icon/multi_size_multi_bits_b.ico";
12391238
public const string MultiSizeMultiBitsC = "Icon/multi_size_multi_bits_c.ico";
12401239
public const string MultiSizeMultiBitsD = "Icon/multi_size_multi_bits_d.ico";
1240+
public const string IcoFake = "Icon/ico_fake.cur";
12411241
}
12421242

12431243
public static class Cur

0 commit comments

Comments
 (0)