Browse Source
Merge branch 'master' into tkp1n/avx2-color-converter
js/color-alpha-handling
Anton Firszov
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
23 additions and
8 deletions
-
tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs
|
|
@ -141,17 +141,32 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg |
|
|
TestEnvironment.InputImagesDirectoryFullPath, |
|
|
TestEnvironment.InputImagesDirectoryFullPath, |
|
|
fileName); |
|
|
fileName); |
|
|
|
|
|
|
|
|
var cts = new CancellationTokenSource(); |
|
|
const int NumberOfRuns = 5; |
|
|
if (cancellationDelayMs == 0) |
|
|
|
|
|
{ |
|
|
for (int i = 0; i < NumberOfRuns; i++) |
|
|
cts.Cancel(); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
{ |
|
|
cts.CancelAfter(cancellationDelayMs); |
|
|
var cts = new CancellationTokenSource(); |
|
|
|
|
|
if (cancellationDelayMs == 0) |
|
|
|
|
|
{ |
|
|
|
|
|
cts.Cancel(); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
cts.CancelAfter(cancellationDelayMs); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
using var image = await Image.LoadAsync(hugeFile, cts.Token); |
|
|
|
|
|
} |
|
|
|
|
|
catch (TaskCanceledException) |
|
|
|
|
|
{ |
|
|
|
|
|
// Succesfully observed a cancellation
|
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
await Assert.ThrowsAsync<TaskCanceledException>(() => Image.LoadAsync(hugeFile, cts.Token)); |
|
|
throw new Exception($"No cancellation happened out of {NumberOfRuns} runs!"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Theory(Skip = "Identify is too fast, doesn't work reliably.")] |
|
|
[Theory(Skip = "Identify is too fast, doesn't work reliably.")] |
|
|
|