From e30f07a3278669c6d62c4e857c3d5402cb7a04d3 Mon Sep 17 00:00:00 2001 From: Nicolas Pena Date: Thu, 18 May 2017 18:37:46 -0400 Subject: Add pixel test for bug 113910 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: chromium:113910 Change-Id: I52d712828a0adde02b1e867421ee06f1ca8be1e2 Reviewed-on: https://pdfium-review.googlesource.com/5636 Reviewed-by: Tom Sepez Commit-Queue: Nicolás Peña --- samples/pdfium_test.cc | 9 ++- testing/resources/pixel/bug_113910.evt | 8 +++ testing/resources/pixel/bug_113910.in | 66 +++++++++++++++++++++ .../resources/pixel/bug_113910_expected.pdf.0.png | Bin 0 -> 1610 bytes .../pixel/bug_113910_expected_mac.pdf.0.png | Bin 0 -> 1564 bytes 5 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 testing/resources/pixel/bug_113910.evt create mode 100644 testing/resources/pixel/bug_113910.in create mode 100644 testing/resources/pixel/bug_113910_expected.pdf.0.png create mode 100644 testing/resources/pixel/bug_113910_expected_mac.pdf.0.png diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc index fa57d65b9e..e33ceadabf 100644 --- a/samples/pdfium_test.cc +++ b/samples/pdfium_test.cc @@ -607,7 +607,14 @@ void SendPageEvents(const FPDF_FORMHANDLE& form, if (command[0].empty()) continue; auto tokens = StringSplit(command[0], ','); - if (tokens[0] == "keycode") { + if (tokens[0] == "charcode") { + if (tokens.size() == 2) { + int keycode = atoi(tokens[1].c_str()); + FORM_OnChar(form, page, keycode, 0); + } else { + fprintf(stderr, "charcode: bad args\n"); + } + } else if (tokens[0] == "keycode") { if (tokens.size() == 2) { int keycode = atoi(tokens[1].c_str()); FORM_OnKeyDown(form, page, keycode, 0); diff --git a/testing/resources/pixel/bug_113910.evt b/testing/resources/pixel/bug_113910.evt new file mode 100644 index 0000000000..ca8821f006 --- /dev/null +++ b/testing/resources/pixel/bug_113910.evt @@ -0,0 +1,8 @@ +mousemove,150,120 +mousedown,left,150,120 +mouseup,left,150,120 +charcode,49 +charcode,50 +charcode,51 +charcode,52 +charcode,13 diff --git a/testing/resources/pixel/bug_113910.in b/testing/resources/pixel/bug_113910.in new file mode 100644 index 0000000000..fdfcc54364 --- /dev/null +++ b/testing/resources/pixel/bug_113910.in @@ -0,0 +1,66 @@ +{{header}} +{{object 1 0}} +<< + /Type /Catalog + /Pages 2 0 R + /AcroForm << /Fields [ 4 0 R 10 0 R ] /DR 5 0 R >> +>> +endobj +{{object 2 0}} +<< /Count 1 /Kids [ 3 0 R ] /Type /Pages >> +endobj +{{object 3 0}} +<< + /Type /Page + /Parent 2 0 R + /Resources 5 0 R + /MediaBox [ 0 0 300 200 ] + /Contents 8 0 R + /Annots [ 4 0 R 10 0 R ] +>> +endobj +{{object 4 0}} +<< + /Type /Annot + /FT /Tx + /T (Text Box) + /DA (0 0 0 rg /F1 12 Tf) + /Rect [ 100 100 200 130 ] + /Subtype /Widget + /AA << /F 9 0 R >> +>> +endobj +{{object 5 0}} +<< /Font 6 0 R >> +endobj +{{object 6 0}} +<< /F1 7 0 R >> +endobj +{{object 7 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Helvetica +>> +endobj +{{object 8 0}}<< +>> +stream +endstream +endobj +{{object 9 0}} +<< /JS (AFNumber_Format\(0, 1, 0, 0, "", false\);) /S /JavaScript >> +endobj +{{object 10 0}} +<< + /Type /Annot + /FT /Tx + /T (Text2) + /DA (0 0 0 rg /F1 12 Tf) + /Rect [ 100 40 200 70 ] + /Subtype /Widget +>> +endobj +{{xref}} +trailer<< /Root 1 0 R >> +{{startxref}} +%%EOF diff --git a/testing/resources/pixel/bug_113910_expected.pdf.0.png b/testing/resources/pixel/bug_113910_expected.pdf.0.png new file mode 100644 index 0000000000..3804347825 Binary files /dev/null and b/testing/resources/pixel/bug_113910_expected.pdf.0.png differ diff --git a/testing/resources/pixel/bug_113910_expected_mac.pdf.0.png b/testing/resources/pixel/bug_113910_expected_mac.pdf.0.png new file mode 100644 index 0000000000..5b21f5ab78 Binary files /dev/null and b/testing/resources/pixel/bug_113910_expected_mac.pdf.0.png differ -- cgit v1.2.3