|
2 | 2 | // Licensed under the Apache License, Version 2.0. |
3 | 3 |
|
4 | 4 | // ReSharper disable InconsistentNaming |
| 5 | +using System.Diagnostics; |
5 | 6 | using System.IO; |
6 | 7 | using System.Linq; |
7 | | - |
| 8 | +#if SUPPORTS_RUNTIME_INTRINSICS |
| 9 | +using System.Runtime.Intrinsics.X86; |
| 10 | +#endif |
| 11 | +using Microsoft.DotNet.RemoteExecutor; |
8 | 12 | using SixLabors.ImageSharp.Formats; |
9 | 13 | using SixLabors.ImageSharp.Formats.Png; |
10 | 14 | using SixLabors.ImageSharp.Metadata; |
11 | 15 | using SixLabors.ImageSharp.PixelFormats; |
12 | 16 | using SixLabors.ImageSharp.Processing.Processors.Quantization; |
| 17 | +using SixLabors.ImageSharp.Tests.TestUtilities; |
13 | 18 | using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; |
14 | 19 |
|
15 | 20 | using Xunit; |
@@ -529,6 +534,47 @@ public void Encode_WorksWithDiscontiguousBuffers<TPixel>(TestImageProvider<TPixe |
529 | 534 | } |
530 | 535 | } |
531 | 536 |
|
| 537 | + [Theory] |
| 538 | + [WithTestPatternImages(100, 100, PixelTypes.Rgba32)] |
| 539 | + public void EncodeWorksWithoutSsse3Intrinsics<TPixel>(TestImageProvider<TPixel> provider) |
| 540 | + where TPixel : unmanaged, IPixel<TPixel> |
| 541 | + { |
| 542 | + static void RunTest(string providerDump) |
| 543 | + { |
| 544 | + TestImageProvider<TPixel> provider = |
| 545 | + BasicSerializer.Deserialize<TestImageProvider<TPixel>>(providerDump); |
| 546 | +#if SUPPORTS_RUNTIME_INTRINSICS |
| 547 | + Assert.False(Ssse3.IsSupported); |
| 548 | +#endif |
| 549 | + |
| 550 | + foreach (PngInterlaceMode interlaceMode in InterlaceMode) |
| 551 | + { |
| 552 | + TestPngEncoderCore( |
| 553 | + provider, |
| 554 | + PngColorType.Rgb, |
| 555 | + PngFilterMethod.Adaptive, |
| 556 | + PngBitDepth.Bit8, |
| 557 | + interlaceMode, |
| 558 | + appendPixelType: true, |
| 559 | + appendPngColorType: true); |
| 560 | + } |
| 561 | + } |
| 562 | + |
| 563 | + string providerDump = BasicSerializer.Serialize(provider); |
| 564 | + |
| 565 | + var processStartInfo = new ProcessStartInfo(); |
| 566 | + processStartInfo.Environment[TestEnvironment.Features.EnableSSE3] = TestEnvironment.Features.Off; |
| 567 | + |
| 568 | + RemoteExecutor.Invoke( |
| 569 | + RunTest, |
| 570 | + providerDump, |
| 571 | + new RemoteInvokeOptions |
| 572 | + { |
| 573 | + StartInfo = processStartInfo |
| 574 | + }) |
| 575 | + .Dispose(); |
| 576 | + } |
| 577 | + |
532 | 578 | private static void TestPngEncoderCore<TPixel>( |
533 | 579 | TestImageProvider<TPixel> provider, |
534 | 580 | PngColorType pngColorType, |
|
0 commit comments