public void TakingScreehShotsOfElementInIFrameTest() { var internetPage = new InternetPage(this.DriverContext).OpenHomePage(); internetPage.GoToIFramePage(); IFramePage page = new IFramePage(this.DriverContext); var path = page.TakeScreenShotsOfTextInIFrame(folder + FilesHelper.Separator + BaseConfiguration.ScreenShotFolder, "TextWithinIFrame" + BaseConfiguration.TestBrowser); var path2 = folder + FilesHelper.Separator + BaseConfiguration.ScreenShotFolder + FilesHelper.Separator + "TextWithinIFrameChromeError.png"; bool flag = true; using (var img1 = new MagickImage(path)) { using (var img2 = new MagickImage(path2)) { using (var imgDiff = new MagickImage()) { img1.Compose = CompositeOperator.Src; img1.Compare(img2, new ErrorMetric(), imgDiff); flag = img1.Equals(img2); imgDiff.Write(folder + FilesHelper.Separator + BaseConfiguration.ScreenShotFolder + FilesHelper.Separator + BaseConfiguration.TestBrowser + "TextWithinIFrameDIFF.png"); } } } Assert.IsFalse(flag); }
public void Test_Image_Read_FrameIndex() { using (var image = new MagickImage(Files.RoseSparkleGIF)) { var imageA = new MagickImage(); var imageB = new MagickImage(); MagickReadSettings settings = new MagickReadSettings(); imageA.Read(Files.RoseSparkleGIF, settings); Assert.Equal(image, imageA); settings = new MagickReadSettings(); settings.FrameIndex = 1; imageA.Read(Files.RoseSparkleGIF, settings); Assert.False(image.Equals(imageA)); imageB.Read(Files.RoseSparkleGIF + "[1]"); Assert.True(imageA.Equals(imageB)); settings = new MagickReadSettings(); settings.FrameIndex = 2; imageA.Read(Files.RoseSparkleGIF, settings); Assert.False(image.Equals(imageA)); imageB.Read(Files.RoseSparkleGIF + "[2]"); Assert.True(imageA.Equals(imageB)); Assert.Throws <MagickOptionErrorException>(() => { settings = new MagickReadSettings(); settings.FrameIndex = 3; imageA.Read(Files.RoseSparkleGIF, settings); }); imageA.Dispose(); imageB.Dispose(); } }
public void Test_IEquatable() { MagickImage first = new MagickImage(Color.Red, 10, 10); Assert.IsFalse(first == null); Assert.IsFalse(first.Equals(null)); Assert.IsTrue(first.Equals(first)); Assert.IsTrue(first.Equals((object)first)); MagickImage second = new MagickImage(Color.Red, 10, 10); Assert.IsTrue(first == second); Assert.IsTrue(first.Equals(second)); Assert.IsTrue(first.Equals((object)second)); second = new MagickImage(Color.Green, 10, 10); Assert.IsTrue(first != second); Assert.IsFalse(first.Equals(second)); first.Dispose(); second.Dispose(); first = null; Assert.IsTrue(first == null); Assert.IsFalse(first != null); }
public void ShouldUseTheRandomSeed() { MagickNET.SetRandomSeed(1337); using (var first = new MagickImage(Files.Builtin.Logo)) { first.AddNoise(NoiseType.Laplacian); ColorAssert.NotEqual(MagickColors.White, first, 46, 62); using (var second = new MagickImage(Files.Builtin.Logo)) { second.AddNoise(NoiseType.Laplacian, 2.0); ColorAssert.NotEqual(MagickColors.White, first, 46, 62); Assert.False(first.Equals(second)); } } MagickNET.ResetRandomSeed(); }