public virtual void SetMarginTest() { float expectedMargin = 90; Style style = new Style(); NUnit.Framework.Assert.IsNull(style.GetMarginTop()); NUnit.Framework.Assert.IsNull(style.GetMarginRight()); NUnit.Framework.Assert.IsNull(style.GetMarginBottom()); NUnit.Framework.Assert.IsNull(style.GetMarginLeft()); style.SetMargin(expectedMargin); NUnit.Framework.Assert.AreEqual(UnitValue.CreatePointValue(expectedMargin), style.GetMarginTop()); NUnit.Framework.Assert.AreEqual(UnitValue.CreatePointValue(expectedMargin), style.GetMarginRight()); NUnit.Framework.Assert.AreEqual(UnitValue.CreatePointValue(expectedMargin), style.GetMarginBottom()); NUnit.Framework.Assert.AreEqual(UnitValue.CreatePointValue(expectedMargin), style.GetMarginLeft()); }
public virtual void LineSeparatorBackgroundTest01() { String outFileName = destinationFolder + "lineSeparatorBackgroundTest01.pdf"; String cmpFileName = sourceFolder + "cmp_lineSeparatorBackgroundTest01.pdf"; PdfDocument pdf = new PdfDocument(new PdfWriter(outFileName)); Document document = new Document(pdf); Style style = new Style(); style.SetBackgroundColor(ColorConstants.YELLOW); style.SetMargin(10); document.Add(new LineSeparator(new SolidLine()).AddStyle(style)); document.Add(new LineSeparator(new DashedLine()).SetBackgroundColor(ColorConstants.RED)); document.Close(); NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder , "diff")); }
public virtual void ListItemTest02() { String outFileName = destinationFolder + "listItemTest02.pdf"; String cmpFileName = sourceFolder + "cmp_listItemTest02.pdf"; PdfDocument pdf = new PdfDocument(new PdfWriter(outFileName)); Document document = new Document(pdf); document.SetFontColor(ColorConstants.WHITE); List list = new List(); Style liStyle = new Style().SetMargins(20, 0, 20, 0).SetBackgroundColor(ColorConstants.BLACK); list.Add((ListItem) new ListItem("").AddStyle(liStyle)).Add((ListItem) new ListItem("fox").AddStyle(liStyle) ).Add((ListItem) new ListItem("").AddStyle(liStyle)).Add((ListItem) new ListItem("dog").AddStyle(liStyle )); document.Add(list.SetBackgroundColor(ColorConstants.BLUE)); document.Add(new Paragraph("separation between lists")); liStyle.SetMargin(0); document.Add(list); document.Close(); NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder , "diff")); }