public void ShouldApplyImageDataFromSource() { // Given var image = Resources.ImageRotate0; dynamic elementMetadata = new DynamicWrapper(); elementMetadata.Source = "$"; // When var element = BuildTestHelper.BuildImage((object) elementMetadata, c => { c.PrintViewSource = ImageTestHelper.BitmapToBase64(image); }); // Then Assert.IsNotNull(element); Assert.IsNull(element.Size); ImageTestHelper.AssertImagesAreEqual(image, element); }
public void ShouldApplyImageData() { // Given var image = Resources.ImageRotate0; dynamic elementMetadata = new DynamicWrapper(); elementMetadata.Data = ImageTestHelper.BitmapToBase64(image); // When PrintElementImage element = BuildTestHelper.BuildImage(elementMetadata); // Then Assert.IsNotNull(element); Assert.IsInstanceOf<PrintElementImage>(element); Assert.IsNull(element.Size); ImageTestHelper.AssertImagesAreEqual(image, element); }
public void ShouldApplyRotation180() { // Given var original = Resources.ImageRotate0; var expected = Resources.ImageRotate180; dynamic elementMetadata = new DynamicWrapper(); elementMetadata.Data = ImageTestHelper.BitmapToBase64(original); elementMetadata.Rotation = "Rotate180"; // When PrintElementImage element = BuildTestHelper.BuildImage(elementMetadata); // Then Assert.IsNotNull(element); Assert.IsNull(element.Size); ImageTestHelper.AssertImagesAreEqual(expected, element); }
public void ShouldApplyText() { // Given var expectedImage = Resources.BarcodeEan13Rotate0; dynamic elementMetadata = new DynamicWrapper(); elementMetadata.Text = BarcodeEan13Text; elementMetadata.ShowText = false; // When PrintElementImage element = BuildTestHelper.BuildBarcodeEan13(elementMetadata); // Then Assert.IsNotNull(element); Assert.AreEqual(expectedImage.Width, element.Size.Width, 0.1); Assert.AreEqual(expectedImage.Height, element.Size.Height, 0.1); ImageTestHelper.AssertImagesAreEqual(expectedImage, element); }
public void ShouldApplyTextFromSource() { // Given var expectedImage = Resources.BarcodeQrRotate0; dynamic elementMetadata = new DynamicWrapper(); elementMetadata.Source = "$"; elementMetadata.ShowText = false; // When var element = BuildTestHelper.BuildBarcodeQr((object)elementMetadata, c => { c.PrintViewSource = BarcodeQrText; }); // Then Assert.IsNotNull(element); Assert.AreEqual(expectedImage.Width, element.Size.Width, 0.1); Assert.AreEqual(expectedImage.Height, element.Size.Height, 0.1); ImageTestHelper.AssertImagesAreEqual(expectedImage, element); }
public void ShouldApplyErrorCorrectionHigh() { // Given var expectedImage = Resources.BarcodeQrErrorCorrectionHigh; dynamic elementMetadata = new DynamicWrapper(); elementMetadata.Text = BarcodeQrText; elementMetadata.ShowText = false; elementMetadata.ErrorCorrection = "High"; // When PrintElementImage element = BuildTestHelper.BuildBarcodeQr(elementMetadata); // Then Assert.IsNotNull(element); Assert.AreEqual(expectedImage.Width, element.Size.Width, 0.1); Assert.AreEqual(expectedImage.Height, element.Size.Height, 0.1); ImageTestHelper.AssertImagesAreEqual(expectedImage, element); }