summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-02-13 16:54:48 -0800
committerTom Sepez <tsepez@chromium.org>2015-02-13 16:54:48 -0800
commitb7cb36aba7d32c506ee921cb7558b8effd4b2fa1 (patch)
treeaec88bf31f8c449cf289f1d2aa11ce326a79e9bc /samples
parent92e856b09dd2fcf6cf46b07b1496053eb0e67851 (diff)
downloadpdfium-b7cb36aba7d32c506ee921cb7558b8effd4b2fa1.tar.xz
Merge to XFA: Run javascript/pixel tests via automated script.
This pulls in: 7435e8e Run pixel tests via automated script. 83c87e5 run_javascript_tests.py: Be more flexible about directory layout. 5898509 Test top-level Document JS properties. 9f93baf Create run_javascript_tests.py TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/923293002
Diffstat (limited to 'samples')
-rw-r--r--samples/pdfium_test.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index 4f6e832e0c..10515946b3 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -262,8 +262,8 @@ void WriteEmf(FPDF_PAGE page, const char* pdf_name, int num) {
}
#endif
-int Form_Alert(IPDF_JSPLATFORM*, FPDF_WIDESTRING msg, FPDF_WIDESTRING,
- int, int) {
+int ExampleAppAlert(IPDF_JSPLATFORM*, FPDF_WIDESTRING msg, FPDF_WIDESTRING,
+ int, int) {
// Deal with differences between UTF16LE and wchar_t on this platform.
size_t characters = 0;
while (msg[characters]) {
@@ -280,7 +280,11 @@ int Form_Alert(IPDF_JSPLATFORM*, FPDF_WIDESTRING msg, FPDF_WIDESTRING,
return 0;
}
-void Unsupported_Handler(UNSUPPORT_INFO*, int type) {
+void ExampleDocGotoPage(IPDF_JSPLATFORM*, int pageNumber) {
+ printf("Goto Page: %d\n", pageNumber);
+}
+
+void ExampleUnsupportedHandler(UNSUPPORT_INFO*, int type) {
std::string feature = "Unknown";
switch (type) {
case FPDF_UNSP_DOC_XFAFORM:
@@ -425,7 +429,8 @@ void RenderPdf(const std::string& name, const char* pBuf, size_t len,
IPDF_JSPLATFORM platform_callbacks;
memset(&platform_callbacks, '\0', sizeof(platform_callbacks));
platform_callbacks.version = 1;
- platform_callbacks.app_alert = Form_Alert;
+ platform_callbacks.app_alert = ExampleAppAlert;
+ platform_callbacks.Doc_gotoPage = ExampleDocGotoPage;
FPDF_FORMFILLINFO form_callbacks;
memset(&form_callbacks, '\0', sizeof(form_callbacks));
@@ -468,7 +473,7 @@ void RenderPdf(const std::string& name, const char* pBuf, size_t len,
FPDF_FORMHANDLE form = FPDFDOC_InitFormFillEnvironment(doc, &form_callbacks);
if (!FPDF_LoadXFA(doc)) {
- printf("LoadXFA unsuccessful, continuing anyway.\n");
+ fprintf(stderr, "LoadXFA unsuccessful, continuing anyway.\n");
}
FPDF_SetFormFieldHighlightColor(form, 0, 0xFFE4DD);
FPDF_SetFormFieldHighlightAlpha(form, 100);
@@ -595,7 +600,7 @@ int main(int argc, const char* argv[]) {
UNSUPPORT_INFO unsuppored_info;
memset(&unsuppored_info, '\0', sizeof(unsuppored_info));
unsuppored_info.version = 1;
- unsuppored_info.FSDK_UnSupport_Handler = Unsupported_Handler;
+ unsuppored_info.FSDK_UnSupport_Handler = ExampleUnsupportedHandler;
FSDK_SetUnSpObjProcessHandler(&unsuppored_info);