From de3fc1e0044b9325ecbfe861edac9c87f8d82f8c Mon Sep 17 00:00:00 2001 From: VahidN Date: Thu, 23 Nov 2017 19:18:47 +0330 Subject: [PATCH] Added Issue17 test --- .../Issues/Issue17.cs | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/iTextSharp.LGPLv2.Core.FunctionalTests/Issues/Issue17.cs diff --git a/src/iTextSharp.LGPLv2.Core.FunctionalTests/Issues/Issue17.cs b/src/iTextSharp.LGPLv2.Core.FunctionalTests/Issues/Issue17.cs new file mode 100644 index 0000000..e736632 --- /dev/null +++ b/src/iTextSharp.LGPLv2.Core.FunctionalTests/Issues/Issue17.cs @@ -0,0 +1,49 @@ +using System.IO; +using iTextSharp.text; +using iTextSharp.text.pdf; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace iTextSharp.LGPLv2.Core.FunctionalTests.Issues +{ + /// + /// https://github.com/VahidN/iTextSharp.LGPLv2.Core/issues/17 + /// + [TestClass] + public class Issue17 + { + [TestMethod] + public void Verify_Issue17_CanBe_Processed() + { + var pdfDoc = new Document(PageSize.A4); + + var pdfFilePath = TestUtils.GetOutputFileName(); + var fileStream = new FileStream(pdfFilePath, FileMode.Create); + PdfWriter.GetInstance(pdfDoc, fileStream); + + pdfDoc.AddAuthor(TestUtils.Author); + pdfDoc.Open(); + + var image = Image.GetInstance(TestUtils.GetImagePath("loa.jpg")); + image.WidthPercentage = 60; + image.Alignment = Element.ALIGN_RIGHT; + + var table = new PdfPTable(numColumns: 3); + var cell = new PdfPCell(/*image: image, fit: false*/) + { + Colspan = 2, + //Border = 0, + HorizontalAlignment = Element.ALIGN_RIGHT + }; + cell.AddElement(image); + table.AddCell(cell); + table.AddCell(new PdfPCell(new Phrase("Test..."))); + + pdfDoc.Add(table); + + pdfDoc.Close(); + fileStream.Dispose(); + + TestUtils.VerifyPdfFileIsReadable(pdfFilePath); + } + } +} \ No newline at end of file