public void RGBLuminanceSource_Should_Work_With_BitmapImage()
        {
            var pixelFormats = new []
            {
                PixelFormats.Bgr24,
                PixelFormats.Bgr32,
                PixelFormats.Bgra32,
                PixelFormats.Rgb24,
                //PixelFormats.Bgr565, // conversion isn't accurate to compare it directly to RGB24
                //PixelFormats.Bgr555, // conversion isn't accurate to compare it directly to RGB24
                PixelFormats.Gray8,
            };

            foreach (var pixelFormat in pixelFormats)
            {
                BitmapSource bitmapImage = new BitmapImage(new Uri(samplePicRelPath, UriKind.RelativeOrAbsolute));
                if (bitmapImage.Format != pixelFormat)
                {
                    bitmapImage = new FormatConvertedBitmap(bitmapImage, pixelFormat, null, 0);
                }
                var rgbLuminanceSource       = new RGBLuminanceSource(bitmapImage);
                var rgbLuminanceSourceResult = rgbLuminanceSource.ToString();
                Assert.That(samplePicRelResult.Equals(rgbLuminanceSourceResult));
            }
        }
Ejemplo n.º 2
0
        public void testToString()
        {
            // java and .Net differs, not sure, why
            //var expectedInJava = "#+ \n#+#\n#+#\n";
            var expected = "#+ \n+.#\n#.+\n";

            Assert.AreEqual(expected, SOURCE.ToString());
        }