コード例 #1
0
        public void Use_WithSolidFilledImagesAttribute <TColor, TPacked>(TestImageFactory <TColor, TPacked> factory)
            where TColor : struct, IPackedPixel <TPacked> where TPacked : struct, IEquatable <TPacked>
        {
            var img = factory.Create();

            Assert.Equal(img.Width, 10);
            Assert.Equal(img.Height, 20);

            byte[] colors = new byte[4];

            using (var pixels = img.Lock())
            {
                for (int y = 0; y < pixels.Height; y++)
                {
                    for (int x = 0; x < pixels.Width; x++)
                    {
                        pixels[x, y].ToBytes(colors, 0, ComponentOrder.XYZW);

                        Assert.Equal(colors[0], 255);
                        Assert.Equal(colors[1], 100);
                        Assert.Equal(colors[2], 50);
                        Assert.Equal(colors[3], 200);
                    }
                }
            }
        }
コード例 #2
0
        public void Blank_MemberData <TColor, TPacked>(TestImageFactory <TColor, TPacked> factory)
            where TColor : struct, IPackedPixel <TPacked> where TPacked : struct, IEquatable <TPacked>
        {
            var img = factory.Create();

            Assert.True(img.Width * img.Height > 0);
        }
コード例 #3
0
        public void Use_WithMemberFactoryAttribute <TColor, TPacked>(TestImageFactory <TColor, TPacked> factory)
            where TColor : struct, IPackedPixel <TPacked> where TPacked : struct, IEquatable <TPacked>
        {
            var img = factory.Create();

            Assert.Equal(img.Width, 3);
        }
コード例 #4
0
        public void Use_WithFileCollection <TColor, TPacked>(TestImageFactory <TColor, TPacked> factory)
            where TColor : struct, IPackedPixel <TPacked> where TPacked : struct, IEquatable <TPacked>
        {
            Assert.NotNull(factory.Utility.SourceFileOrDescription);
            var image = factory.Create();

            factory.Utility.SaveTestOutputFile(image, "png");
        }
コード例 #5
0
        public void IsEquivalentTo_WhenTrue <TColor, TPacked>(TestImageFactory <TColor, TPacked> factory)
            where TColor : struct, IPackedPixel <TPacked> where TPacked : struct, IEquatable <TPacked>
        {
            var a = factory.Create();
            var b = factory.Create();

            Assert.True(a.IsEquivalentTo(b));
        }
コード例 #6
0
        public void File_MemberData <TColor, TPacked>(TestImageFactory <TColor, TPacked> factory)
            where TColor : struct, IPackedPixel <TPacked> where TPacked : struct, IEquatable <TPacked>
        {
            this.Output.WriteLine("SRC: " + factory.Utility.SourceFileOrDescription);
            this.Output.WriteLine("OUT: " + factory.Utility.GetTestOutputFileName());

            var img = factory.Create();

            Assert.True(img.Width * img.Height > 0);
        }
コード例 #7
0
        public void Use_WithBlankImagesAttribute_WithAllPixelTypes <TColor, TPacked>(
            TestImageFactory <TColor, TPacked> factory,
            string message)
            where TColor : struct, IPackedPixel <TPacked> where TPacked : struct, IEquatable <TPacked>
        {
            var img = factory.Create();

            Assert.Equal(42, img.Width);
            Assert.Equal(666, img.Height);
            Assert.Equal("hello", message);
        }
コード例 #8
0
        public void Use_WithFileAttribute <TColor, TPacked>(TestImageFactory <TColor, TPacked> factory, int yo)
            where TColor : struct, IPackedPixel <TPacked> where TPacked : struct, IEquatable <TPacked>
        {
            Assert.NotNull(factory.Utility.SourceFileOrDescription);
            var img = factory.Create();

            Assert.True(img.Width * img.Height > 0);

            Assert.Equal(88, yo);

            string fn = factory.Utility.GetTestOutputFileName("jpg");

            this.Output.WriteLine(fn);
        }