Skip to content

Commit

Permalink
Merge branch 'release/7.0.6' into 7.0-master
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-alay committed Jan 20, 2018
2 parents c90df04 + 913fed6 commit 7bfe237
Show file tree
Hide file tree
Showing 108 changed files with 4,036 additions and 1,688 deletions.
8 changes: 4 additions & 4 deletions itext.tests/itext.barcodes.tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("iText Group NV")]
[assembly: AssemblyProduct ("iText")]
[assembly: AssemblyCopyright ("Copyright (c) 1998-2017 iText Group NV")]
[assembly: AssemblyCopyright ("Copyright (c) 1998-2018 iText Group NV")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: ComVisible(false)]

[assembly: Guid("d015a3aa-613c-45d9-b908-7d47c4b613af")]

[assembly: AssemblyVersion("7.0.5.0")]
[assembly: AssemblyFileVersion("7.0.5.0")]
[assembly: AssemblyInformationalVersion("7.0.5")]
[assembly: AssemblyVersion("7.0.6.0")]
[assembly: AssemblyFileVersion("7.0.6.0")]
[assembly: AssemblyInformationalVersion("7.0.6")]

#if !NETSTANDARD1_6
[assembly: NUnit.Framework.Timeout(300000)]
Expand Down
8 changes: 4 additions & 4 deletions itext.tests/itext.forms.tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("iText Group NV")]
[assembly: AssemblyProduct ("iText")]
[assembly: AssemblyCopyright ("Copyright (c) 1998-2017 iText Group NV")]
[assembly: AssemblyCopyright ("Copyright (c) 1998-2018 iText Group NV")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: ComVisible(false)]

[assembly: Guid("6fe2f714-6b3e-4b20-8c70-28bfce084ed2")]

[assembly: AssemblyVersion("7.0.5.0")]
[assembly: AssemblyFileVersion("7.0.5.0")]
[assembly: AssemblyInformationalVersion("7.0.5")]
[assembly: AssemblyVersion("7.0.6.0")]
[assembly: AssemblyFileVersion("7.0.6.0")]
[assembly: AssemblyInformationalVersion("7.0.6")]

#if !NETSTANDARD1_6
[assembly: NUnit.Framework.Timeout(300000)]
Expand Down
38 changes: 38 additions & 0 deletions itext.tests/itext.forms.tests/itext/forms/PdfFormFieldTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,5 +322,43 @@ public virtual void AcroFieldDictionaryNoFields() {
NUnit.Framework.Assert.Fail(errorMessage);
}
}

/// <exception cref="System.IO.IOException"/>
/// <exception cref="System.Exception"/>
[NUnit.Framework.Test]
public virtual void RegenerateAppearance() {
String input = "regenerateAppearance.pdf";
String output = "regenerateAppearance.pdf";
PdfDocument document = new PdfDocument(new PdfReader(sourceFolder + input), new PdfWriter(destinationFolder
+ output), new StampingProperties().UseAppendMode());
PdfAcroForm acro = PdfAcroForm.GetAcroForm(document, false);
int i = 1;
foreach (KeyValuePair<String, PdfFormField> entry in acro.GetFormFields()) {
if (entry.Key.Contains("field")) {
PdfFormField field = entry.Value;
field.SetValue("test" + i++, false);
}
}
document.Close();
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + output, sourceFolder
+ "cmp_" + output, destinationFolder, "diff"));
}

/// <exception cref="System.IO.IOException"/>
/// <exception cref="System.Exception"/>
[NUnit.Framework.Test]
public virtual void RegenerateAppearance2() {
String input = "regenerateAppearance2.pdf";
String output = "regenerateAppearance2.pdf";
PdfDocument document = new PdfDocument(new PdfReader(sourceFolder + input), new PdfWriter(destinationFolder
+ output), new StampingProperties().UseAppendMode());
PdfAcroForm acro = PdfAcroForm.GetAcroForm(document, false);
acro.SetNeedAppearances(true);
PdfFormField field = acro.GetField("number");
field.SetValue("20150044DR");
document.Close();
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + output, sourceFolder
+ "cmp_" + output, destinationFolder, "diff"));
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
8 changes: 4 additions & 4 deletions itext.tests/itext.io.tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("iText Group NV")]
[assembly: AssemblyProduct ("iText")]
[assembly: AssemblyCopyright ("Copyright (c) 1998-2017 iText Group NV")]
[assembly: AssemblyCopyright ("Copyright (c) 1998-2018 iText Group NV")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: ComVisible(false)]

[assembly: Guid("a53a5dd3-787b-4563-8778-1d76bdad57ba")]

[assembly: AssemblyVersion("7.0.5.0")]
[assembly: AssemblyFileVersion("7.0.5.0")]
[assembly: AssemblyInformationalVersion("7.0.5")]
[assembly: AssemblyVersion("7.0.6.0")]
[assembly: AssemblyFileVersion("7.0.6.0")]
[assembly: AssemblyInformationalVersion("7.0.6")]

#if !NETSTANDARD1_6
[assembly: NUnit.Framework.Timeout(300000)]
Expand Down
13 changes: 6 additions & 7 deletions itext.tests/itext.io.tests/itext/io/font/FontProgramTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,16 @@ source product.

namespace iText.IO.Font {
public class FontProgramTest {
private const String notExistingFont = "some-font.ttf";

/// <exception cref="System.IO.IOException"/>
[NUnit.Framework.Test]
public virtual void ExceptionMessageTest() {
String font = "some-font.ttf";
try {
FontProgramFactory.CreateFont(font);
}
catch (iText.IO.IOException ex) {
NUnit.Framework.Assert.AreEqual(MessageFormatUtil.Format(iText.IO.IOException.FontFile1NotFound, font), ex
.Message);
NUnit.Framework.Assert.That(() => {
FontProgramFactory.CreateFont(notExistingFont);
}
, NUnit.Framework.Throws.TypeOf<System.IO.IOException>().With.Message.EqualTo(MessageFormatUtil.Format(iText.IO.IOException._1NotFoundAsFileOrResource, notExistingFont)));
;
}

/// <exception cref="System.IO.IOException"/>
Expand Down
8 changes: 4 additions & 4 deletions itext.tests/itext.kernel.tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("iText Group NV")]
[assembly: AssemblyProduct ("iText")]
[assembly: AssemblyCopyright ("Copyright (c) 1998-2017 iText Group NV")]
[assembly: AssemblyCopyright ("Copyright (c) 1998-2018 iText Group NV")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: ComVisible(false)]

[assembly: Guid("02e54061-eb72-409d-b2c0-307ce66b57e9")]

[assembly: AssemblyVersion("7.0.5.0")]
[assembly: AssemblyFileVersion("7.0.5.0")]
[assembly: AssemblyInformationalVersion("7.0.5")]
[assembly: AssemblyVersion("7.0.6.0")]
[assembly: AssemblyFileVersion("7.0.6.0")]
[assembly: AssemblyInformationalVersion("7.0.6")]

#if !NETSTANDARD1_6
[assembly: NUnit.Framework.Timeout(300000)]
Expand Down
11 changes: 10 additions & 1 deletion itext.tests/itext.kernel.tests/itext/kernel/pdf/PdfPagesTest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
This file is part of the iText (R) project.
Copyright (c) 1998-2017 iText Group NV
Copyright (c) 1998-2018 iText Group NV
Authors: iText Software.
This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -384,5 +384,14 @@ public virtual void GetPageSizeWithInheritedMediaBox() {
NUnit.Framework.Assert.AreEqual(842, pdfDoc.GetPage(1).GetPageSize().GetTop(), eps);
pdfDoc.Close();
}

/// <exception cref="System.IO.IOException"/>
[NUnit.Framework.Test]
public virtual void RotationPagesRotationTest() {
String filename = "singlePageDocumentWithRotation.pdf";
PdfDocument pdfDoc = new PdfDocument(new PdfReader(sourceFolder + filename));
PdfPage page = pdfDoc.GetPage(1);
NUnit.Framework.Assert.AreEqual(90, page.GetRotation(), "Inherited value is invalid");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System;
using iText.Kernel.Pdf;
using iText.Kernel.Pdf.Canvas.Parser.Listener;
using iText.Test;

namespace iText.Kernel.Pdf.Canvas.Parser {
public class SimpleFontToUnicodeExtractionTest : ExtendedITextTest {
private static readonly String sourceFolder = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
.CurrentContext.TestDirectory) + "/resources/itext/kernel/parser/SimpleFontToUnicodeExtractionTest/";

/// <exception cref="System.IO.IOException"/>
[NUnit.Framework.Test]
public virtual void Test01() {
PdfDocument pdfDocument = new PdfDocument(new PdfReader(sourceFolder + "simpleFontToUnicode01.pdf"));
String expected = "Information plays a central role in soci-\n" + "ety today, and it is becoming more and \n"
+ "more common for that information to \n" + "be offered in digital form alone. The re-\n" + "liable, user-friendly Portable Document \n"
+ "Format (PDF) has become the world’s \n" + "file type of choice for providing infor-\n" + "mation as a digital document. \n"
+ "Tags can be added to a PDF in order \n" + "to structure the content of a document. \n" + "These tags are a critical requirement if \n"
+ "any form of assistive technology (such \n" + "as screen readers, specialist mice, and \n" + "speech recognition and text-to-speech \n"
+ "software) is to gain access to this con-\n" + "tent. To date, PDF documents have rare-\n" + "ly been tagged, and not all software can \n"
+ "make use of PDF tags. In practical terms, \n" + "this particularly reduces information‘s \n" + "accessibility for people with disabilities \n"
+ "who rely on assistive technology.";
String actualText = PdfTextExtractor.GetTextFromPage(pdfDocument.GetPage(1), new LocationTextExtractionStrategy
());
NUnit.Framework.Assert.AreEqual(expected, actualText);
}

/// <exception cref="System.IO.IOException"/>
[NUnit.Framework.Test]
public virtual void Test02() {
PdfDocument pdfDocument = new PdfDocument(new PdfReader(sourceFolder + "simpleFontToUnicode02.pdf"));
String expected = "ffaast";
String actualText = PdfTextExtractor.GetTextFromPage(pdfDocument.GetPage(1), new LocationTextExtractionStrategy
());
NUnit.Framework.Assert.AreEqual(expected, actualText);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public virtual void TestCharacterRenderInfos() {
/// </remarks>
/// <exception cref="System.Exception"/>
[NUnit.Framework.Test]
[LogMessage(iText.IO.LogMessageConstant.COULD_NOT_FIND_GLYPH_WITH_CODE)]
[LogMessage(iText.IO.LogMessageConstant.COULD_NOT_FIND_GLYPH_WITH_CODE, Count = 2)]
public virtual void TestUnicodeEmptyString() {
StringBuilder sb = new StringBuilder();
String inFile = "japanese_text.pdf";
Expand Down
20 changes: 20 additions & 0 deletions itext.tests/itext.kernel.tests/itext/kernel/utils/PdfMergerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,26 @@ public virtual void MergeDocumentTest01() {
}
}

/// <exception cref="System.IO.IOException"/>
/// <exception cref="System.Exception"/>
[NUnit.Framework.Test]
[LogMessage(iText.IO.LogMessageConstant.SOURCE_DOCUMENT_HAS_ACROFORM_DICTIONARY)]
public virtual void MergeDocumentOutlinesWithNullDestinationTest01() {
String resultFile = destinationFolder + "mergeDocumentOutlinesWithNullDestinationTest01.pdf";
String filename = sourceFolder + "null_dest_outline.pdf";
PdfDocument sourceDocument = new PdfDocument(new PdfReader(filename));
PdfMerger resultDocument = new PdfMerger(new PdfDocument(new PdfWriter(resultFile)));
resultDocument.Merge(sourceDocument, 1, 1);
resultDocument.Close();
sourceDocument.Close();
CompareTool compareTool = new CompareTool();
String errorMessage = compareTool.CompareByContent(resultFile, sourceFolder + "cmp_mergeDocumentOutlinesWithNullDestinationTest01.pdf"
, destinationFolder, "diff_");
if (errorMessage != null) {
NUnit.Framework.Assert.Fail(errorMessage);
}
}

/// <exception cref="System.IO.IOException"/>
/// <exception cref="System.Exception"/>
[NUnit.Framework.Test]
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 7bfe237

Please sign in to comment.