Skip to content

Commit

Permalink
Added Issue17 test
Browse files Browse the repository at this point in the history
  • Loading branch information
VahidN committed Nov 23, 2017
1 parent 0b348fb commit de3fc1e
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions src/iTextSharp.LGPLv2.Core.FunctionalTests/Issues/Issue17.cs
Original file line number Diff line number Diff line change
@@ -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
{
/// <summary>
/// https://github.com/VahidN/iTextSharp.LGPLv2.Core/issues/17
/// </summary>
[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);
}
}
}

0 comments on commit de3fc1e

Please sign in to comment.