diff --git a/Microsoft.DotNet.Wpf.Test.sln b/Microsoft.DotNet.Wpf.Test.sln index c8b128934..0ed939cbf 100644 --- a/Microsoft.DotNet.Wpf.Test.sln +++ b/Microsoft.DotNet.Wpf.Test.sln @@ -27,6 +27,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DrtStartupUriXamlNavigation EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommonData", "src\Test\BranchCommon\data\CommonData.csproj", "{D5F8FF19-BE50-49D3-9343-EEF2182611B7}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DrtBitmapDecoder", "src\Test\AppModel\DRT\Imaging\BitmapDecoder\DrtBitmapDecoder.csproj", "{2D51BB8E-29D7-4CB7-8AB4-DA37FE14A99F}" +EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestServices", "src\Test\Common\DRT\TestServices\TestServices.csproj", "{12B6B1C0-A834-4223-B5F4-5813F2D73FAA}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DrtTools", "src\Test\Common\DRT\Tools\DrtTools.csproj", "{AB52B060-FE86-4630-937D-368C7945F0F0}" diff --git a/src/Test/AppModel/DRT/Imaging/BitmapDecoder/DrtBitmapDecoder.cs b/src/Test/AppModel/DRT/Imaging/BitmapDecoder/DrtBitmapDecoder.cs new file mode 100644 index 000000000..fbb7b5677 --- /dev/null +++ b/src/Test/AppModel/DRT/Imaging/BitmapDecoder/DrtBitmapDecoder.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Imaging; + +namespace DRT +{ + public class DrtBitmapDecoder + { + static int Main(string[] args) + { + var logger = new Logger("DrtBitmapDecoder", "Microsoft", + "Testing decode the image file that created with Asynchronous"); + + var imageFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Image.png"); + + using var fileStream = new FileStream(imageFile, + FileMode.Open, + FileAccess.Read, + FileShare.Read, + 4096, + FileOptions.Asynchronous); + + var passed = false; + + try + { + // See https://github.com/dotnet/wpf/issues/4355 + _ = BitmapDecoder.Create(fileStream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.None); + passed = true; + } + catch (ArgumentException) + { + passed = false; + } + + if (passed) + { + logger.Log("Passed"); + return 0; + } + else + { + logger.Log("ERROR: - DrtBitmapDecoder. Can not decode the async file stream."); + return 1; + } + } + } +} diff --git a/src/Test/AppModel/DRT/Imaging/BitmapDecoder/DrtBitmapDecoder.csproj b/src/Test/AppModel/DRT/Imaging/BitmapDecoder/DrtBitmapDecoder.csproj new file mode 100644 index 000000000..c7221984a --- /dev/null +++ b/src/Test/AppModel/DRT/Imaging/BitmapDecoder/DrtBitmapDecoder.csproj @@ -0,0 +1,20 @@ + + + DrtBitmapDecoder + console + WCP + EXE + false + true + DRT + + + + + + + + PreserveNewest + + + diff --git a/src/Test/AppModel/DRT/Imaging/BitmapDecoder/Image.png b/src/Test/AppModel/DRT/Imaging/BitmapDecoder/Image.png new file mode 100644 index 000000000..2e0516385 Binary files /dev/null and b/src/Test/AppModel/DRT/Imaging/BitmapDecoder/Image.png differ diff --git a/src/Test/BranchCommon/data/DrtList.xml b/src/Test/BranchCommon/data/DrtList.xml index 12ca957b9..66dc4d654 100644 --- a/src/Test/BranchCommon/data/DrtList.xml +++ b/src/Test/BranchCommon/data/DrtList.xml @@ -43,6 +43,7 @@ Rundrtlist +