Skip to content

Commit

Permalink
Merge branch 'release/7.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-alay committed Sep 16, 2016
2 parents cd26d56 + d321ea7 commit a304a94
Show file tree
Hide file tree
Showing 588 changed files with 22,005 additions and 7,782 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*.txt text eol=lf
*.xfdf text eol=lf
*.xml text eol=lf
port-hash text eol=lf

# Declare files that will always have CRLF line endings on checkout.
*.bat text eol=crlf
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*.user
*.userosscache
*.sln.docstates
*.sln.metaproj

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
Expand Down
7 changes: 4 additions & 3 deletions itext.tests/itext.barcodes.tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("iText.Barcodes.Tests")]
Expand All @@ -15,5 +14,7 @@

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

[assembly: AssemblyVersion("7.0.0.0")]
[assembly: AssemblyFileVersion("7.0.0.0")]
[assembly: AssemblyVersion("7.0.1.0")]
[assembly: AssemblyFileVersion("7.0.1.0")]

[assembly: NUnit.Framework.Timeout(300000)]
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="nunit.framework">
<HintPath>..\..\packages\NUnit.3.2.1\lib\net40\nunit.framework.dll</HintPath>
<HintPath>$(SolutionDir)\packages\NUnit.3.2.1\lib\net40\nunit.framework.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down
11 changes: 4 additions & 7 deletions itext.tests/itext.barcodes.tests/itext/barcodes/Barcode39Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ public static void BeforeClass() {
[NUnit.Framework.Test]
public virtual void Barcode01Test() {
String filename = "barcode39_01.pdf";
PdfWriter writer = new PdfWriter(destinationFolder + filename);
PdfDocument document = new PdfDocument(writer);
PdfDocument document = new PdfDocument(new PdfWriter(destinationFolder + filename));
PdfPage page = document.AddNewPage();
PdfCanvas canvas = new PdfCanvas(page);
Barcode1D barcode = new Barcode39(document);
Expand All @@ -43,9 +42,8 @@ public virtual void Barcode01Test() {
[NUnit.Framework.Test]
public virtual void Barcode02Test() {
String filename = "barcode39_02.pdf";
PdfWriter writer = new PdfWriter(destinationFolder + filename);
PdfReader reader = new PdfReader(sourceFolder + "DocumentWithTrueTypeFont1.pdf");
PdfDocument document = new PdfDocument(reader, writer);
PdfDocument document = new PdfDocument(new PdfReader(sourceFolder + "DocumentWithTrueTypeFont1.pdf"), new
PdfWriter(destinationFolder + filename));
PdfCanvas canvas = new PdfCanvas(document.GetLastPage());
Barcode1D barcode = new Barcode39(document);
barcode.SetCode("9781935182610");
Expand All @@ -58,8 +56,7 @@ public virtual void Barcode02Test() {

[NUnit.Framework.Test]
public virtual void Barcode03Test() {
PdfWriter writer = new PdfWriter(new ByteArrayOutputStream());
PdfDocument document = new PdfDocument(writer);
PdfDocument document = new PdfDocument(new PdfWriter(new ByteArrayOutputStream()));
Barcode39 barcode = new Barcode39(document);
try {
Barcode39.GetBarsCode39("9781935*182610");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,27 @@ public virtual void Barcode02Test() {
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
+ "cmp_" + filename, destinationFolder, "diff_"));
}

/// <exception cref="System.IO.IOException"/>
/// <exception cref="iText.Kernel.PdfException"/>
/// <exception cref="System.Exception"/>
[NUnit.Framework.Test]
public virtual void BarcodeVersioningTest() {
String filename = "barcodeQRCodeVersioning.pdf";
PdfWriter writer = new PdfWriter(destinationFolder + filename);
PdfDocument document = new PdfDocument(writer);
for (int i = -9; i < 42; i += 10) {
PdfPage page1 = document.AddNewPage();
PdfCanvas canvas = new PdfCanvas(page1);
IDictionary<EncodeHintType, Object> hints = new Dictionary<EncodeHintType, Object>();
hints[EncodeHintType.CHARACTER_SET] = "UTF-8";
hints[EncodeHintType.MIN_VERSION_NR] = i;
BarcodeQRCode barcode1 = new BarcodeQRCode("дима", hints);
barcode1.PlaceBarcode(canvas, Color.GRAY, 3);
}
document.Close();
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
+ "cmp_" + filename, destinationFolder, "diff_"));
}
}
}
Binary file not shown.
7 changes: 4 additions & 3 deletions itext.tests/itext.forms.tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("iText.Forms.Tests")]
Expand All @@ -15,5 +14,7 @@

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

[assembly: AssemblyVersion("7.0.0.0")]
[assembly: AssemblyFileVersion("7.0.0.0")]
[assembly: AssemblyVersion("7.0.1.0")]
[assembly: AssemblyFileVersion("7.0.1.0")]

[assembly: NUnit.Framework.Timeout(300000)]
2 changes: 1 addition & 1 deletion itext.tests/itext.forms.tests/itext.forms.tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="nunit.framework">
<HintPath>..\..\packages\NUnit.3.2.1\lib\net40\nunit.framework.dll</HintPath>
<HintPath>$(SolutionDir)\packages\NUnit.3.2.1\lib\net40\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System.XML" />
<Reference Include="System.Xml.Linq" />
Expand Down
105 changes: 102 additions & 3 deletions itext.tests/itext.forms.tests/itext/forms/FormFieldFlatteningTest.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System;
using System.IO;
using iText.Forms.Fields;
using iText.Kernel.Pdf;
using iText.Kernel.Utils;
using iText.Test;
Expand All @@ -22,8 +22,7 @@ public static void BeforeClass() {
public virtual void FormFlatteningTest01() {
String srcFilename = sourceFolder + "formFlatteningSource.pdf";
String filename = destinationFolder + "formFlatteningTest01.pdf";
PdfDocument doc = new PdfDocument(new PdfReader(new FileStream(srcFilename, FileMode.Open, FileAccess.Read
)), new PdfWriter(new FileStream(filename, FileMode.Create)));
PdfDocument doc = new PdfDocument(new PdfReader(srcFilename), new PdfWriter(filename));
PdfAcroForm form = PdfAcroForm.GetAcroForm(doc, true);
form.FlattenFields();
doc.Close();
Expand All @@ -34,5 +33,105 @@ public virtual void FormFlatteningTest01() {
NUnit.Framework.Assert.Fail(errorMessage);
}
}

/// <exception cref="System.IO.IOException"/>
/// <exception cref="System.Exception"/>
[NUnit.Framework.Test]
public virtual void FormFlatteningTest_DefaultAppearanceGeneration_Rot0() {
String srcFilePattern = "FormFlatteningDefaultAppearance_0_";
String destPattern = "FormFlatteningDefaultAppearance_0_";
for (int i = 0; i < 360; i += 90) {
String src = sourceFolder + srcFilePattern + i + ".pdf";
String dest = destinationFolder + destPattern + i + "_flattened.pdf";
String cmp = sourceFolder + "cmp_" + srcFilePattern + i + ".pdf";
PdfDocument doc = new PdfDocument(new PdfReader(src), new PdfWriter(dest));
PdfAcroForm form = PdfAcroForm.GetAcroForm(doc, true);
foreach (PdfFormField field in form.GetFormFields().Values) {
field.SetValue("Test");
}
form.FlattenFields();
doc.Close();
CompareTool compareTool = new CompareTool();
String errorMessage = compareTool.CompareByContent(dest, cmp, destinationFolder, "diff_");
if (errorMessage != null) {
NUnit.Framework.Assert.Fail(errorMessage);
}
}
}

/// <exception cref="System.IO.IOException"/>
/// <exception cref="System.Exception"/>
[NUnit.Framework.Test]
public virtual void FormFlatteningTest_DefaultAppearanceGeneration_Rot90() {
String srcFilePattern = "FormFlatteningDefaultAppearance_90_";
String destPattern = "FormFlatteningDefaultAppearance_90_";
for (int i = 0; i < 360; i += 90) {
String src = sourceFolder + srcFilePattern + i + ".pdf";
String dest = destinationFolder + destPattern + i + "_flattened.pdf";
String cmp = sourceFolder + "cmp_" + srcFilePattern + i + ".pdf";
PdfDocument doc = new PdfDocument(new PdfReader(src), new PdfWriter(dest));
PdfAcroForm form = PdfAcroForm.GetAcroForm(doc, true);
foreach (PdfFormField field in form.GetFormFields().Values) {
field.SetValue("Test");
}
form.FlattenFields();
doc.Close();
CompareTool compareTool = new CompareTool();
String errorMessage = compareTool.CompareByContent(dest, cmp, destinationFolder, "diff_");
if (errorMessage != null) {
NUnit.Framework.Assert.Fail(errorMessage);
}
}
}

/// <exception cref="System.IO.IOException"/>
/// <exception cref="System.Exception"/>
[NUnit.Framework.Test]
public virtual void FormFlatteningTest_DefaultAppearanceGeneration_Rot180() {
String srcFilePattern = "FormFlatteningDefaultAppearance_180_";
String destPattern = "FormFlatteningDefaultAppearance_180_";
for (int i = 0; i < 360; i += 90) {
String src = sourceFolder + srcFilePattern + i + ".pdf";
String dest = destinationFolder + destPattern + i + "_flattened.pdf";
String cmp = sourceFolder + "cmp_" + srcFilePattern + i + ".pdf";
PdfDocument doc = new PdfDocument(new PdfReader(src), new PdfWriter(dest));
PdfAcroForm form = PdfAcroForm.GetAcroForm(doc, true);
foreach (PdfFormField field in form.GetFormFields().Values) {
field.SetValue("Test");
}
form.FlattenFields();
doc.Close();
CompareTool compareTool = new CompareTool();
String errorMessage = compareTool.CompareByContent(dest, cmp, destinationFolder, "diff_");
if (errorMessage != null) {
NUnit.Framework.Assert.Fail(errorMessage);
}
}
}

/// <exception cref="System.IO.IOException"/>
/// <exception cref="System.Exception"/>
[NUnit.Framework.Test]
public virtual void FormFlatteningTest_DefaultAppearanceGeneration_Rot270() {
String srcFilePattern = "FormFlatteningDefaultAppearance_270_";
String destPattern = "FormFlatteningDefaultAppearance_270_";
for (int i = 0; i < 360; i += 90) {
String src = sourceFolder + srcFilePattern + i + ".pdf";
String dest = destinationFolder + destPattern + i + "_flattened.pdf";
String cmp = sourceFolder + "cmp_" + srcFilePattern + i + ".pdf";
PdfDocument doc = new PdfDocument(new PdfReader(src), new PdfWriter(dest));
PdfAcroForm form = PdfAcroForm.GetAcroForm(doc, true);
foreach (PdfFormField field in form.GetFormFields().Values) {
field.SetValue("Test");
}
form.FlattenFields();
doc.Close();
CompareTool compareTool = new CompareTool();
String errorMessage = compareTool.CompareByContent(dest, cmp, destinationFolder, "diff_");
if (errorMessage != null) {
NUnit.Framework.Assert.Fail(errorMessage);
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.IO;
using iText.Kernel.Pdf;

namespace iText.Forms {
Expand All @@ -9,8 +8,8 @@ public class PdfEncryptionTest {
/// <exception cref="System.IO.IOException"/>
[NUnit.Framework.Test]
public virtual void EncryptedDocumentWithFormFields() {
PdfReader reader = new PdfReader(new FileStream(sourceFolder + "encryptedDocumentWithFormFields.pdf", FileMode.Open
, FileAccess.Read), new ReaderProperties().SetPassword("12345".GetBytes()));
PdfReader reader = new PdfReader(sourceFolder + "encryptedDocumentWithFormFields.pdf", new ReaderProperties
().SetPassword("12345".GetBytes(iText.IO.Util.EncodingUtil.ISO_8859_1)));
PdfDocument pdfDocument = new PdfDocument(reader);
PdfAcroForm acroForm = PdfAcroForm.GetAcroForm(pdfDocument, false);
acroForm.GetField("personal.name").GetPdfObject();
Expand Down
Loading

0 comments on commit a304a94

Please sign in to comment.