예제 #1
0
        public void TestRotate180Degrees()
        {
            const string outputFilePath = "../../Output/Rotate-180_degrees.jpg";

            var thisImage = new NetImage();

            thisImage.LoadImage("../../Resources/1024x768.png");
            thisImage.Filename = outputFilePath;
            thisImage.RotateImage(180);
            thisImage.SaveImage();

            int width, height;

            thisImage.GetImageFileSize(outputFilePath, out width, out height);

            Assert.AreEqual(1024, width);
            Assert.AreEqual(768, height);
        }
예제 #2
0
        public void TestRotate90DegreesWithCrop()
        {
            const string outputFilePath = "../../Output/Rotate-90_degrees_with_crop.jpg";
            int          originalWidth  = 0;
            int          originalHeight = 0;

            var thisImage = new NetImage();

            thisImage.LoadImage("../../Resources/1024x768.png");
            thisImage.GetImageSize(out originalWidth, out originalHeight);
            thisImage.Filename = outputFilePath;
            thisImage.RotateImage(90);
            thisImage.ConstrainResize = true;
            thisImage.Resize(originalWidth, originalHeight);
            thisImage.SaveImage();

            int width, height;

            thisImage.GetImageFileSize(outputFilePath, out width, out height);

            Assert.AreEqual(originalWidth, width);
            Assert.AreEqual(originalHeight, height);
        }
예제 #3
0
        public void TestAutoClear()
        {
            const string outputFilePath = "../../Output/AutoClear.jpg";

            var thisImage = new NetImage();

            thisImage.LoadImage("../../Resources/1024x768.png");
            thisImage.AutoClear = true;
            thisImage.Filename  = outputFilePath;
            thisImage.SaveImage();

            try
            {
                // On SaveImage() call, the image data should be null and
                // generate an exception.  If it doesn't, we know the
                // data was not cleared.
                thisImage.RotateImage(90);
                Assert.Fail("Image data not cleared");
            }
            catch (Exception)
            {
                Assert.Pass();
            }
        }