-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #523 from chinapandaman/PPF-522
PPF-522: bring back simple fill
- Loading branch information
Showing
42 changed files
with
817 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 added
BIN
+28.7 KB
pdf_samples/simple/max_length_text_field_related/max_length_text_field_all_chars.pdf
Binary file not shown.
Binary file added
BIN
+28.7 KB
pdf_samples/simple/max_length_text_field_related/max_length_text_field_even_chars.pdf
Binary file not shown.
Binary file added
BIN
+28.7 KB
pdf_samples/simple/max_length_text_field_related/max_length_text_field_odd_chars.pdf
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+640 KB
pdf_samples/simple/scenario/existed/DS82_expected_all_chars_lowercase.pdf
Binary file not shown.
Binary file added
BIN
+640 KB
pdf_samples/simple/scenario/existed/DS82_expected_all_chars_uppercase.pdf
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+27.4 KB
pdf_samples/simple/scenario/existed/illinois-real-estate-power-of-attorney-form_expected.pdf
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.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import os | ||
|
||
from PyPDFForm import FormWrapper | ||
|
||
|
||
def test_ds82(existed_pdf_directory, pdf_samples, request): | ||
expected_path = os.path.join(pdf_samples, "simple", "scenario", "existed", "DS82_expected.pdf") | ||
with open(expected_path, "rb+") as f: | ||
obj = FormWrapper(os.path.join(existed_pdf_directory, "DS82.pdf")).fill( | ||
{ | ||
"LastName": "Smith", | ||
} | ||
) | ||
|
||
request.config.results["expected_path"] = expected_path | ||
request.config.results["stream"] = obj.read() | ||
|
||
expected = f.read() | ||
|
||
assert len(obj.read()) == len(expected) | ||
assert obj.stream == expected | ||
|
||
|
||
def test_ds82_all_chars_lowercase(existed_pdf_directory, pdf_samples, request): | ||
expected_path = os.path.join(pdf_samples, "simple", "scenario", "existed", "DS82_expected_all_chars_lowercase.pdf") | ||
with open(expected_path, "rb+") as f: | ||
obj = FormWrapper(os.path.join(existed_pdf_directory, "DS82.pdf")).fill( | ||
{ | ||
"LastName": "x" * 30, | ||
} | ||
) | ||
|
||
request.config.results["expected_path"] = expected_path | ||
request.config.results["stream"] = obj.read() | ||
|
||
expected = f.read() | ||
|
||
assert len(obj.read()) == len(expected) | ||
assert obj.stream == expected | ||
|
||
|
||
def test_ds82_all_chars_uppercase(existed_pdf_directory, pdf_samples, request): | ||
expected_path = os.path.join(pdf_samples, "simple", "scenario", "existed", "DS82_expected_all_chars_uppercase.pdf") | ||
with open(expected_path, "rb+") as f: | ||
obj = FormWrapper(os.path.join(existed_pdf_directory, "DS82.pdf")).fill( | ||
{ | ||
"LastName": "X" * 30, | ||
} | ||
) | ||
|
||
request.config.results["expected_path"] = expected_path | ||
request.config.results["stream"] = obj.read() | ||
|
||
expected = f.read() | ||
|
||
assert len(obj.read()) == len(expected) | ||
assert obj.stream == expected | ||
|
||
|
||
def test_ds82_mixed_case(existed_pdf_directory, pdf_samples, request): | ||
expected_path = os.path.join(pdf_samples, "simple", "scenario", "existed", "DS82_expected_mixed_case.pdf") | ||
with open(expected_path, "rb+") as f: | ||
obj = FormWrapper(os.path.join(existed_pdf_directory, "DS82.pdf")).fill( | ||
{ | ||
"LastName": "xX" * 10, | ||
} | ||
) | ||
|
||
request.config.results["expected_path"] = expected_path | ||
request.config.results["stream"] = obj.read() | ||
|
||
expected = f.read() | ||
|
||
assert len(obj.read()) == len(expected) | ||
assert obj.stream == expected | ||
|
||
|
||
def test_illinois_real_estate_power_of_attorney_form(existed_pdf_directory, pdf_samples, request): | ||
expected_path = os.path.join(pdf_samples, "simple", "scenario", "existed", | ||
"illinois-real-estate-power-of-attorney-form_expected.pdf") | ||
with open(expected_path, "rb+") as f: | ||
obj = FormWrapper(os.path.join(existed_pdf_directory, "illinois-real-estate-power-of-attorney-form.pdf")).fill( | ||
{ | ||
"undefined": "John Doe", | ||
"State of": "Chicago", | ||
"undefined_2": "Illinois", | ||
"of": "Michael Smith", | ||
"Illinois as my Attorneyin": "Chicago", | ||
"with full power and": "Random", | ||
"is as": "Not Random", | ||
"Address of Principal": "1 N Central, Chicago, IL 60000", | ||
"Phone number where Principal can be contacted": "(000)000-0000", | ||
"Email address of Principal": "[email protected]", | ||
"Text3": "Someone", | ||
"Dated": "2018-01-01", | ||
"Text4": "Sometwo", | ||
"Text5": "Somethree", | ||
"Text6": "Somefour", | ||
"Dated 1": "2019-01-01", | ||
"My commission expires": "NOW", | ||
} | ||
) | ||
|
||
request.config.results["expected_path"] = expected_path | ||
request.config.results["stream"] = obj.read() | ||
|
||
expected = f.read() | ||
|
||
assert len(obj.read()) == len(expected) | ||
assert obj.stream == expected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# -*- coding: utf-8 -*- | ||
# pylint: disable=line-too-long | ||
|
||
import os | ||
|
||
from PyPDFForm import FormWrapper | ||
|
||
|
||
def test_pdf_form_with_central_aligned_text_fields(issue_pdf_directory, pdf_samples, request): | ||
expected_path = os.path.join(pdf_samples, "simple", "scenario", "issues", "PPF-285-expected.pdf") | ||
with open(expected_path, "rb+") as f: | ||
obj = FormWrapper(os.path.join(issue_pdf_directory, "PPF-285.pdf")).fill( | ||
{ | ||
"name": "Hans Mustermann", | ||
"fulladdress": "Musterstr. 12, 82903 Musterdorf, Musterland", | ||
"advisorname": "Karl Test", | ||
} | ||
) | ||
|
||
request.config.results["expected_path"] = expected_path | ||
request.config.results["stream"] = obj.read() | ||
|
||
expected = f.read() | ||
|
||
assert len(obj.read()) == len(expected) | ||
assert obj.stream == expected | ||
|
||
|
||
def test_pdf_form_with_paragraph_fields_new_line_symbol_text_overflow(issue_pdf_directory, pdf_samples, request): | ||
expected_path = os.path.join(pdf_samples, "simple", "scenario", "issues", "PPF-415-2-expected.pdf") | ||
with open(expected_path, "rb+") as f: | ||
obj = FormWrapper(os.path.join(issue_pdf_directory, "PPF-415-2.pdf")).fill( | ||
{ | ||
"multiline-text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Malesuada proin libero nunc consequat interdum varius sit amet mattis. Nec tincidunt praesent semper feugiat nibh sed.\nSed libero enim sed faucibus turpis. Cursus in hac habitasse platea dictumst quisque sagittis. Placerat in egestas erat imperdiet sed euismod. Id aliquet risus feugiat in ante metus dictum at. Proin fermentum leo vel orci porta non pulvinar. Consequat semper viverra nam libero justo.\nPellentesque massa placerat duis ultricies lacus sed. Amet est placerat in egestas erat imperdiet sed euismod nisi. Id cursus metus aliquam eleifend mi. Massa massa ultricies mi quis. Volutpat consequat mauris nunc congue nisi vitae suscipit tellus. Ut tellus elementum sagittis vitae.\n\nEtiam sit amet nisl purus in mollis nunc. Vel turpis nunc eget lorem dolor sed. Ultrices dui sapien eget mi proin sed libero enim. Condimentum id venenatis a condimentum vitae sapien pellentesque habitant. Libero volutpat sed cras ornare arcu. Commodo quis imperdiet massa tincidunt nunc pulvinar sapien et ligula. Nisi est sit amet facilisis magna etiam. In iaculis nunc sed augue.\nSapien pellentesque habitant morbi tristique.\nCondimentum mattis pellentesque id nibh tortor id aliquet. Porttitor massa id neque aliquam vestibulum. Feugiat in fermentum posuere urna nec tincidunt praesent semper. Malesuada fames ac turpis egestas integer. Aenean vel elit scelerisque mauris pellentesque. Vel turpis nunc eget lorem dolor sed viverra. Nec feugiat nisl pretium fusce id velit ut tortor." # noqa | ||
} | ||
) | ||
|
||
request.config.results["expected_path"] = expected_path | ||
request.config.results["stream"] = obj.read() | ||
|
||
expected = f.read() | ||
|
||
assert len(obj.read()) == len(expected) | ||
assert obj.stream == expected | ||
|
||
|
||
def test_521(issue_pdf_directory, pdf_samples, request): | ||
expected_path = os.path.join(pdf_samples, "simple", "scenario", "issues", "521-expected.pdf") | ||
with open(expected_path, "rb+") as f: | ||
obj = FormWrapper(os.path.join(issue_pdf_directory, "521.pdf")).fill( | ||
{ | ||
"Text1": "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?", # noqa | ||
"Text2": "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. NEMO ENIM IPSAM VOLUPTATEM QUIA VOLUPTAS SIT ASPERNATUR AUT ODIT AUT FUGIT, SED QUIA CONSEQUUNTUR MAGNI DOLORES EOS QUI RATIONE VOLUPTATEM SEQUI NESCIUNT. NEQUE PORRO QUISQUAM EST, QUI DOLOREM IPSUM QUIA DOLOR SIT AMET, CONSECTETUR, ADIPISCI VELIT, SED QUIA NON NUMQUAM EIUS MODI TEMPORA INCIDUNT UT LABORE ET DOLORE MAGNAM ALIQUAM QUAERAT VOLUPTATEM. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?", # noqa | ||
"Text3": "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?", # noqa | ||
}, | ||
) | ||
|
||
request.config.results["expected_path"] = expected_path | ||
request.config.results["stream"] = obj.read() | ||
|
||
expected = f.read() | ||
|
||
assert len(obj.read()) == len(expected) | ||
assert obj.stream == expected |
Oops, something went wrong.