summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfformfill_embeddertest.cpp
AgeCommit message (Collapse)Author
2017-08-29Convert some form fill tests to use CFX_PointF coordinates.Lei Zhang
Add helper function for commonly used coordinates and give coordinates used in tests semantic meaning. Also add more sanity checks to make sure the commonly used coordinates pass the FPDFPage_HasFormFieldAtPoint() hit test. Change-Id: If116ed5323b49bdbcbd4d857b5184f9fcd4eb908 Reviewed-on: https://pdfium-review.googlesource.com/12070 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-28Remove parameter to TypeTextIntoTextField().Lei Zhang
FPDFFormFillInteractiveEmbeddertest subclasses know the type to expect. Change-Id: I92c5fc75864330f5b1cbd392b9565b4323ce26b5 Reviewed-on: https://pdfium-review.googlesource.com/12052 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-08-28Put some form tests in FPDFFormFillEmbeddertest subclasses.Lei Zhang
This removes a lot of repeated code that can go in SetUp()/TearDown(). This also makes the assumption that there is only 1 page used for testing, so methods in the tests can refer to the page as a member variable, rather than having a method parameter. Change-Id: Ia77633ebe22f1184d2ee2fc78e88e7d33f48a86e Reviewed-on: https://pdfium-review.googlesource.com/12051 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-08-28Implicitly create CFX_WideString() in form tests.Lei Zhang
Change-Id: I042c5e843dcf535b2d6676d41c0037e87c59c219 Reviewed-on: https://pdfium-review.googlesource.com/12050 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-07-31Add FORM_ReplaceSelection() and embedder tests.Diana Gage
This method replaces the selected text in a user-editable form text area with another text string (which can be empty or non-empty). If there is no selected text, FORM_ReplaceSelection() will append the replacement text after the current caret position. BUG=chromium:59266 Change-Id: I76448ef757d107888c33ebd5656457ebac93b952 Reviewed-on: https://pdfium-review.googlesource.com/8812 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Diana Gage <drgage@google.com>
2017-07-26Add ClickOnFormFieldAtPoint() helper to FPDFFormFillEmbeddertest.Diana Gage
This helper method clicks on a text field or combobox at the point specified by the x and y coordinates passed in. Additionally, in several function calls in this file, the y coordinate has been changed from 63.0 to 62.0 to be more consistent with the other function calls in the file. BUG=chromium:59266 Change-Id: I96fb807445b812cbe45a5c1b0631b744727a6f6d Reviewed-on: https://pdfium-review.googlesource.com/9151 Commit-Queue: Diana Gage <drgage@google.com> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-07-24Add FORM_DeleteSelectedText() and embedder tests.Diana Gage
This method deletes the current text selection in a form text field or user-editable form combobox text field. If there is no selection, this method does nothing. BUG=chromium:59266 Change-Id: I3229ffad990c62beac1cf769cd366458b9ee5daa Reviewed-on: https://pdfium-review.googlesource.com/8370 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Diana Gage <drgage@google.com>
2017-07-10Roll FreeType to c56d8851ea987023cc73981a70d261b3f6427545chromium/3156chromium/3155chromium/3154Nicolas Pena
Bug: chromium:738919 Change-Id: I2ea99a47f45e2e68650bd1fa9ad7554d8df79874 Reviewed-on: https://pdfium-review.googlesource.com/7351 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-07-05Allow EmbedderTest to test savingNicolas Pena
This CL adds helper methods for EmbedderTest to save. This means that TestSaver is no longer needed and all the methods it uses are moved to the EmbedderTest. Change-Id: I740f29699bfd8c6b570cb1fd85e7aab9bc1d3f6f Reviewed-on: https://pdfium-review.googlesource.com/7171 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-06-30Add embedder tests for form combobox text selection.chromium/3149chromium/3148chromium/3147Diana Gage
These tests verify that CPWL_ComboBox::GetSelectedText() and FORM_GetSelectedText() behave as expected when selecting text in form combobox textfields. Text can be selected in both regular comboboxes and user-editable comboboxes. BUG=chromium:59266 Change-Id: I1a5e48baf8aa767283dc478b0872877a52c5b869 Reviewed-on: https://pdfium-review.googlesource.com/6971 Commit-Queue: Diana Gage <drgage@google.com> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-20Add FORM_GetSelectedText() function.Diana Gage
This function copies the selected text from a form text field or form combobox text field into the buffer parameter and returns the length of the selected text string. When buffer is a nullptr or buflen is less than the length of the selected text, this function does not modify the buffer and only returns the selected text length. BUG=chromium:59266 Change-Id: Ie77de38e45bbe6f9ea033826c961435304eedfc7 Reviewed-on: https://pdfium-review.googlesource.com/6413 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-06-01Be less trusting of MaybeLocal<> return types from V8 To* methods.Tom Sepez
Calling ToLocalChecked() will crash otherwise. Bug: 707673 Change-Id: I66a5b36d8cf1710a725e30c2d14a195d08ef25a4 Reviewed-on: https://pdfium-review.googlesource.com/6130 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-13Add embeddertest for form text rendering and savingNicolas Pena
This CL adds an embeddertest that adds text to a textfield and saves it. It also adds a new 'charcode' option for .evt files in pdfium_test. Change-Id: I14fbf50e2b1d5ae0bdc68d1dd25dc4f889c49bfb Reviewed-on: https://pdfium-review.googlesource.com/4150 Commit-Queue: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-01-12Don't put timers with ID == 0 into the global timer map.tsepez
A return of ID == 0 from the embedder means the timer was not created (see public/fpdf_formfill.h), although few embedders actually conform to this convention. Firing a timer with ID == 0 will thus do nothing since there can't be such a timer in the map. BUG=679649 Review-Url: https://codereview.chromium.org/2626863003
2016-08-23Fix page leaks in an embedder testweili
Embedder test's delegate function GetPage() calls FPDF_LoadPage() to load a page which may be already loaded by embedder test itself. Thus the page's ref count is increased unnecessarily. This causes the page to be leaked. Fix this by putting the page map in embedder test class and guarantee the page is loaded only once. Also, fix leaks in this embedder tests by unloading the loaded pages to properly release the resource. BUG=pdfium:242 Review-Url: https://codereview.chromium.org/2258333002
2016-08-05Remove another potential stale CJS_Timer usagetsepez
Fix memory ownership model for PDFium timers. The |app| class owns the CJS_Timer as part of its vector<unique_ptr> to them. The CJS_Timer "owns" its slot in the global ID to timer map, and removes itself when it is destroyed. Nothing else deletes from the global map. Deleting from the global map is accompanied by a callback to the embedder to clear its resources. Next, the proper way to remove a CJS_Timer is by going through the app, and having the app erase its unique ptr, which then deletes the CJS_Timer, which in turn cleans up the global map. Provide a CJS_Timer::Cancel static method to do this conveniently. There is a alternate path to the CJS_timer via JS and its CJS_TimerObj. CJS_TimerObj owns a TimerObj that currently points to the CJS_Timer. If the timer fires, and cleans itself up, this can go stale. Make the TimerObj maintain a weak reference via global timer ID rather than a direct pointer to the CJS_Timer, so that if the timer fires and is destroyed, future attempts to cancel find nothing. There is another path, where if the JS timer object is GC'd, then we just clean up its CJS_TimerObj without touching the actual CJS_Timers. We could make this match the spec by calling into the new cancel routine as described above, but it seems weird to have a timer depend on whether a gc happened or not. A subsequent CL will rename these objects to more closely match the conventions used by the other JS wrappers. BUG=634716 Review-Url: https://codereview.chromium.org/2221513002
2016-08-04Fix issue when firing TimerProc() destroys timerchromium/2820tsepez
We must look the timer up a second time since the callback may have released it. BUG=634394 Review-Url: https://codereview.chromium.org/2214003003
2016-08-04Beef up timer cancellation teststsepez
Adds more questionable invocations of ClearTimeOut(). Also, checking that nothing happened is fragile. Log at least one thing to show that the code ran. Review-Url: https://codereview.chromium.org/2218473002
2016-08-03Add test for bug 620428 (setinterval cancellation)tsepez
While we're at it, beef up existing test for non-cancellation. In turn, fix test harness to implement intervals properly. In turn, fix public documentation to be clearer about timers. Also rename a few identifiers that sounded "off". Review-Url: https://codereview.chromium.org/2211513002
2016-03-14Move fpdfsdk/src up to fpdfsdk/.Dan Sinclair
This CL moves the files in fpdfsdk/src/ up one level to fpdfsdk/ and fixes up the include paths, include guards and build files. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1799773002 .