Ejemplo n.º 1
0
        public void AddOverlayImage_SourceDrawnCompletelyOverTarget_TargetShouldBeTheSameAsSource()
        {
            // Setup
            var rect2By2 = new RectangleF(0f, 0f, 2f, 2f);
            const PixelFormat imageFormat = PixelFormat.Format32bppArgb;

            using (Bitmap image = Resources.TestImage2x2.Clone(rect2By2, imageFormat))
                using (Bitmap target = Resources.Black2x2.Clone(rect2By2, imageFormat))
                {
                    // Call
                    using (Bitmap result = target.AddOverlayImage(image, 0, 0, 2, 2))
                    {
                        // Assert
                        TestHelper.AssertImagesAreEqual(image, result);
                    }
                }
        }
Ejemplo n.º 2
0
        public void AddOverlayImage_SourceDrawnPartiallyOverTarget_TargetPartiallyChanged()
        {
            // Setup
            var rect2By2 = new RectangleF(0f, 0f, 2f, 2f);
            const PixelFormat imageFormat = PixelFormat.Format32bppArgb;

            using (Bitmap target = Resources.TestImage2x2.Clone(rect2By2, imageFormat))
                using (Bitmap image = Resources.Black2x2.Clone(rect2By2, imageFormat))
                    using (Bitmap expectedImage = Resources.TestImageWithBlack2x2.Clone(rect2By2, imageFormat))
                    {
                        // Call
                        using (Bitmap result = target.AddOverlayImage(image, 1, 1, 2, 2))
                        {
                            // Assert
                            TestHelper.AssertImagesAreEqual(expectedImage, result);
                        }

                        // 'target' should be unchanged! A new image should have been created.
                        TestHelper.AssertImagesAreEqual(Resources.TestImage2x2, target);
                    }
        }