public virtual void ImageRendererAddByIDTest() { DocumentRenderer documentRenderer = new DocumentRenderer(null); ImageRenderer imageRenderer = new ImageRenderer(new Image(ImageDataFactory.CreateRawImage(new byte[] { 50, 21 }))); imageRenderer.SetParent(documentRenderer); String id = "id6"; imageRenderer.SetProperty(Property.ID, id); LayoutContext layoutContext = new LayoutContext(new LayoutArea(4, new Rectangle(50, 50))); imageRenderer.Layout(layoutContext); documentRenderer.GetTargetCounterHandler().PrepareHandlerToRelayout(); NUnit.Framework.Assert.AreEqual((int?)4, TargetCounterHandler.GetPageByID(imageRenderer, id)); }
public virtual void AdjustChildrenYLineImageChildHtmlModeTest() { Document document = CreateDocument(); LineRenderer lineRenderer = new LineRenderer(); lineRenderer.SetParent(document.GetRenderer()); lineRenderer.occupiedArea = new LayoutArea(1, new Rectangle(50, 50, 200, 200)); lineRenderer.maxAscent = 100; PdfFormXObject xObject = new PdfFormXObject(new Rectangle(200, 200)); Image img = new Image(xObject); ImageRenderer childImageRenderer = new ImageRenderer(img); childImageRenderer.SetProperty(Property.RENDERING_MODE, RenderingMode.HTML_MODE); childImageRenderer.occupiedArea = new LayoutArea(1, new Rectangle(50, 50, 200, 200)); lineRenderer.AddChild(childImageRenderer); lineRenderer.AdjustChildrenYLine(); NUnit.Framework.Assert.AreEqual(50f, lineRenderer.GetOccupiedAreaBBox().GetBottom(), EPS); NUnit.Framework.Assert.AreEqual(150.0, childImageRenderer.GetOccupiedAreaBBox().GetBottom(), EPS); }