summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-05-04 12:52:42 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-04 12:52:43 -0700
commit10b01bf44695ce9a354660b16f607da70727a846 (patch)
tree722ab90129af298e6567bcf99eefaa45d5187ad2
parentab522f9e05291d6d915a40174e3cb5f7509c449b (diff)
downloadpdfium-10b01bf44695ce9a354660b16f607da70727a846.tar.xz
Fix event sending in pdfium_test.
Passing bad args in pdfium_test -- all void* pointers look alike. Make output less verbose while we're here. Turn on event sending mode for corups tests. No effect until .evt files added to corpus. Review-Url: https://codereview.chromium.org/1946873004
-rw-r--r--samples/pdfium_test.cc15
-rwxr-xr-xtesting/tools/run_corpus_tests.py3
-rw-r--r--testing/tools/test_runner.py3
3 files changed, 9 insertions, 12 deletions
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index aa119c97e6..47c8d5fe3f 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -498,7 +498,7 @@ bool RenderPage(const std::string& name,
FORM_DoPageAAction(page, form, FPDFPAGE_AACTION_OPEN);
if (options.send_events)
- SendPageEvents(doc, form, events);
+ SendPageEvents(form, page, events);
double scale = 1.0;
if (!options.scale_factor_as_string.empty()) {
@@ -564,8 +564,6 @@ void RenderPdf(const std::string& name,
size_t len,
const Options& options,
const std::string& events) {
- fprintf(stderr, "Rendering PDF file %s.\n", name.c_str());
-
IPDF_JSPLATFORM platform_callbacks;
memset(&platform_callbacks, '\0', sizeof(platform_callbacks));
platform_callbacks.version = 3;
@@ -606,7 +604,6 @@ void RenderPdf(const std::string& name,
FPDF_AVAIL pdf_avail = FPDFAvail_Create(&file_avail, &file_access);
if (FPDFAvail_IsLinearized(pdf_avail) == PDF_LINEARIZED) {
- fprintf(stderr, "Linearized path...\n");
doc = FPDFAvail_GetDocument(pdf_avail, nullptr);
if (doc) {
while (nRet == PDF_DATA_NOTAVAIL) {
@@ -626,7 +623,6 @@ void RenderPdf(const std::string& name,
bIsLinearized = true;
}
} else {
- fprintf(stderr, "Non-linearized path...\n");
doc = FPDF_LoadCustomDocument(&file_access, nullptr);
}
@@ -718,7 +714,8 @@ void RenderPdf(const std::string& name,
FPDFAvail_Destroy(pdf_avail);
fprintf(stderr, "Rendered %d pages.\n", rendered_pages);
- fprintf(stderr, "Skipped %d bad pages.\n", bad_pages);
+ if (bad_pages)
+ fprintf(stderr, "Skipped %d bad pages.\n", bad_pages);
}
static void ShowConfig() {
@@ -745,6 +742,7 @@ static void ShowConfig() {
static const char usage_string[] =
"Usage: pdfium_test [OPTION] [FILE]...\n"
" --show-config - print build options and exit\n"
+ " --send-events - send input described by .evt file\n"
" --bin-dir=<path> - override path to v8 external data\n"
" --font-dir=<path> - override path to external fonts\n"
" --scale=<number> - scale output size by number (e.g. 0.5)\n"
@@ -818,6 +816,7 @@ int main(int argc, const char* argv[]) {
GetFileContents(filename.c_str(), &file_length);
if (!file_contents)
continue;
+ fprintf(stderr, "Rendering PDF file %s.\n", filename.c_str());
std::string events;
if (options.send_events) {
std::string event_filename = filename;
@@ -828,10 +827,8 @@ int main(int argc, const char* argv[]) {
std::unique_ptr<char, pdfium::FreeDeleter> event_contents =
GetFileContents(event_filename.c_str(), &event_length);
if (event_contents) {
+ fprintf(stderr, "Sending events from: %s\n", event_filename.c_str());
events = std::string(event_contents.get(), event_length);
- } else {
- fprintf(stderr, "Warning: no event file: %s\n",
- event_filename.c_str());
}
}
}
diff --git a/testing/tools/run_corpus_tests.py b/testing/tools/run_corpus_tests.py
index 2c3c191c88..41d3c12a3b 100755
--- a/testing/tools/run_corpus_tests.py
+++ b/testing/tools/run_corpus_tests.py
@@ -42,8 +42,7 @@ def test_one_file(input_filename, source_dir, working_dir,
# remove .pdf suffix
cmd_to_run = common.DrMemoryWrapper(drmem_wrapper,
os.path.splitext(input_filename)[0])
- cmd_to_run.extend([pdfium_test_path, '--png', pdf_path])
- # run test
+ cmd_to_run.extend([pdfium_test_path, '--send-events', '--png', pdf_path])
error = common.RunCommand(cmd_to_run)
if error:
print "FAILURE: " + input_filename + "; " + str(error)
diff --git a/testing/tools/test_runner.py b/testing/tools/test_runner.py
index 6bd2d72474..bc4ad053e8 100644
--- a/testing/tools/test_runner.py
+++ b/testing/tools/test_runner.py
@@ -91,7 +91,8 @@ class TestRunner:
def TestPixel(self, input_root, pdf_path):
cmd_to_run = common.DrMemoryWrapper(self.drmem_wrapper, input_root)
- cmd_to_run.extend([self.pdfium_test_path, '--png', pdf_path])
+ cmd_to_run.extend([self.pdfium_test_path, '--send-events', '--png',
+ pdf_path])
return common.RunCommand(cmd_to_run)