summaryrefslogtreecommitdiff
path: root/testing
AgeCommit message (Collapse)Author
2018-08-22Properly handle language markers in decoded textRyan Harrison
In text like document title 0x001B is used as a marker for the beginning/end of a language metadata section. Currently PDFium does nothing with this data, but when returning the 'decoded' text it needs to be stripped out. The existing code assumed that the two bytes following a marker would be the data to be removed and did nothing to track if it was in/out of one of these regions. This led to a situation where it would always strip the two bytes following the region, since it assumed the end marker was the beginning of a new region. This CL corrects the detection and handling of these regions, and adds a regression test for the reported bug. BUG=pdfium:182 Change-Id: I92ddba5666274a8986fed03f502a0331f150f7ac Reviewed-on: https://pdfium-review.googlesource.com/41070 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-08-21Remove excessive padding above and below PDF417 barcodes.Henrique Nakashima
Bug: pdfium:1135 Change-Id: Iea16a65a5eebcb914192eb49de17a2c4eda83320 Reviewed-on: https://pdfium-review.googlesource.com/40690 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-21Optimize rendering of two dimensional barcodes: defer upscale.Henrique Nakashima
Defer upscaling as late as possible so that intermediary data structures are smaller. Made a couple of changes along the way to preserve the barcode correctness and fix some padding issues. For my example, this is a ~21x improvement in rendering time, down from ~190ms per barcode to ~9ms. Bug: 872907, pdfium:1135 Change-Id: If532e0f168f02fea9c31d473f34c0009da4f4612 Reviewed-on: https://pdfium-review.googlesource.com/40010 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-08-16Add a way to save a barcode generated bitmap to a .png.Henrique Nakashima
This is useful for debugging and validation purposes. The hashes that are in BarcodeTest are not necessarily for valid outputs. This CL refactors the code in embedder_test.png that already does this, moving it to testing/utils where unit tests can access it too. Bug: pdfium:1135 Change-Id: I6f1d70a4e133f8f04dbe52646087f99c448e95f8 Reviewed-on: https://pdfium-review.googlesource.com/40152 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-08-16Optimize rendering of two dimensional barcodes: deduplicate regions.Henrique Nakashima
Reduce the logical size of the barcode by removing unnecessary region duplication. As far as I can tell, the line thickness is useless and the aspect ratio causes arbitrary changes in rounding, but ultimately the dimensions of a barcode are defined by its width and height, rather than by this ratio. The improvement with this CL is from ~580ms to ~390ms per barcode, so about 1.5x. Combined with https://pdfium-review.googlesource.com/c/pdfium/+/40010 the improvement is to ~15ms, which is about 39x. This also fixes the rendering of the barcode in the pixel and corpus tests. You can verify this pointing a barcode reader app at the screen. It does not however fix every case, as the unit test is still unreadable. Bug: 872907, pdfium:1135 Change-Id: Ic28e60f54719552cfe69ace7ebc3f730c338a129 Reviewed-on: https://pdfium-review.googlesource.com/40030 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-08-14Remove CFX_BufferSeekableReadStream.Lei Zhang
Replace it with CFX_ReadOnlyMemoryStream, which does the same thing. Take some checks from CFX_BufferSeekableReadStream and add them CFX_ReadOnlyMemoryStream. Change-Id: I25554c3aec3ec96967f8df16ca68a64dba121b6f Reviewed-on: https://pdfium-review.googlesource.com/40070 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-14Remove more default arg = nullptr cases.Tom Sepez
Bring in line with standards. Remove argument entirely for mac code that is always nullptr. Change-Id: I0710bdbd51fc0bc2e1d428ef44976be39a631147 Reviewed-on: https://pdfium-review.googlesource.com/40091 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-13Make CFX_ReadOnlyMemoryStream take a span.Lei Zhang
Change-Id: Id097320ab2d9b5d1579582e5797e29c701499501 Reviewed-on: https://pdfium-review.googlesource.com/39991 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-08-13Use CFX_ReadOnlyMemoryStream in more places.Lei Zhang
More const pointers, less const_casts. BUG=pdfium:263 Change-Id: I47fc6d8f2f837390e40ad22d8b67946065294eaa Reviewed-on: https://pdfium-review.googlesource.com/39879 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-13Run pdfium_test in only one place in make_expected.sh.Lei Zhang
Change-Id: I91c55632627bb9cc0d6b61ae1004db1343d6bff2 Reviewed-on: https://pdfium-review.googlesource.com/39910 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-08-10Add proxy for syscall timeRyan Harrison
This CL adds a proxy, FXSYS_time, for the time syscall, so that a testing mechanism can be implemented. Specically there is now a flag for pdfium_test, --time=, that allows setting the time since the epoch that will be returned. This plumbed all the way down into the proxy and allows for stable results for tests that depend on getting the current time. There are other places in the code base that will need to be patched like this, that will be dealt with in follow on CLs. BUG=pdfium:1104 Change-Id: I2de185f8d47abe46704dd579c13a54948b7f81e0 Reviewed-on: https://pdfium-review.googlesource.com/39750 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-08-10Remove const_cast<> from CFX_LZWDecompressor::Decode() caller.Tom Sepez
Because the argument to Decode() can be const. Part of the ongoing war against const_cast<>. Change-Id: I3a8402277dbfc4fd80b1dd60225de57b732713f8 Reviewed-on: https://pdfium-review.googlesource.com/39832 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-01Bounds check lineSrc in JBig2_Image.cpp.Tom Sepez
No matter how the dimensions might be determined, we know the hard end of the source line, and can use it for a bounds check. We expect the size is quantized to a multiple of m_stride, so as long as each block operates within an m_stride, the initial check should be sufficient. Bug: 867501 Change-Id: Iaf9936557b856f3eb09fef522f3e6738aa4f38f0 Reviewed-on: https://pdfium-review.googlesource.com/39310 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-01Add in support for using .evt in make_expected.shRyan Harrison
BUG=pdfium:1024 Change-Id: If7e00eb4f6ebf6499be20e88bfc9b2ac35f2d797 Reviewed-on: https://pdfium-review.googlesource.com/39390 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-08-01Add FPDFText_GetFontName() APIMiklos Vajna
This follows the same pattern as DefaultGetFaceName(), so the client has to call this function twice, but allocation of the string buffer happens outside pdfium. Change-Id: I06b7dcd00aca9b9b94799dad3f139617d7f5451e Reviewed-on: https://pdfium-review.googlesource.com/38870 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-07-27Make pixel_tests pass on Windows 10.Lei Zhang
BUG=chromium:828177 NOTRY=true Change-Id: I94de26cf74b27b7c71795a2ee189c9c6b4c56ac6 Reviewed-on: https://pdfium-review.googlesource.com/38903 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-07-25Change CFX_BufferSeekableReadStream to take a span.Lei Zhang
Change-Id: Ib9e20fdfc637b2ba0358586e23ad72454b0b8ad1 Reviewed-on: https://pdfium-review.googlesource.com/38851 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-07-25Fix hint tables parsing.Artem Strygin
Sample PDF: https://yadi.sk/d/oWLtAEfy3YbEb3 For offsets, equal to the hint stream offset, added hint stream length to determine the actual offset, because linearization inserted the hint stream at the original location of the object. Also the number of bits needed to represent the numerator of the fractional position for each shared object reference may be zero, if each shared group contains only one object with obj num, incremented on 1. Change-Id: I4754d603f388354821e8d0cac97ad99a7578fe4b Reviewed-on: https://pdfium-review.googlesource.com/36610 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-07-19Fix unbalanced endobj keyword in rectangles_multi_pages.pdf.Lei Zhang
Also add stream lengths. Change-Id: I7a1f565f941f9100058fab0f1ddde5471318f4d3 Reviewed-on: https://pdfium-review.googlesource.com/38350 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-07-16Use UnownedPtr<> to v8::Isolates.Tom Sepez
Isolates are long-lived, but this may catch a few things. Introduce CFX_V8IsolateDeleter for unique_ptr<v8::Isolate> usage. Fix Dispose()/SetIsolate(nullptr) ordering in cjs_runtime.cpp Remove one unused isolate member. Flip protected -> private in one place. Change-Id: I26cdd120f799192e93b0d9d04dcde8f348dc21f3 Reviewed-on: https://pdfium-review.googlesource.com/37931 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-07-12Reland "Avoid duplicate data buffering in CPDF_SyntaxParser::ReadStream()."Artem Strygin
This is a reland of 77f15f7883638a4ced131d74c053af10a5970ce9 Original change's description: > Avoid duplicate data buffering in CPDF_SyntaxParser::ReadStream(). > > Allow sub-streams created from an IFX_SeekableReadStream to provide > stream data without copying memory. > The data will only reside in the top-level stream. > > For example: > For file > http://www.major-landrover.ru/upload/attachments/f/9/f96aab07dab04ae89c8a509ec1ef2b31.pdf > (18 Mb) > > The memory usage is reduced by ~13 Mb. > > Change-Id: I2595c014d0fbe1fdd181cc04965cfd7d901c2d88 > Reviewed-on: https://pdfium-review.googlesource.com/35930 > Commit-Queue: Art Snake <art-snake@yandex-team.ru> > Reviewed-by: dsinclair <dsinclair@chromium.org> Change-Id: I4c4d5dcf42ff44784468ac7a7c302df509fc804d Reviewed-on: https://pdfium-review.googlesource.com/37313 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2018-07-11Add FPDFFormObj_CountObjects() APIMiklos Vajna
To find out the number of sub-objects a form object has, similar to how FPDFPage_CountObjects() does it for page objects. Change-Id: I7e5775dece42b74fd5b71b1d9622a1aa37bf64ac Reviewed-on: https://pdfium-review.googlesource.com/37316 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
2018-07-10Add test for reading marked content with an indirect dict.Henrique Nakashima
Bug: pdfium:1118 Change-Id: I2e9adaae64cba5b3915c19f3c99743cddbe58736 Reviewed-on: https://pdfium-review.googlesource.com/37371 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-07-06Revert "Avoid duplicate data buffering in CPDF_SyntaxParser::ReadStream()."Henrique Nakashima
This reverts commit 77f15f7883638a4ced131d74c053af10a5970ce9. Reason for revert: Causes crbug.com/860210 Bug: chromium:860210 Original change's description: > Avoid duplicate data buffering in CPDF_SyntaxParser::ReadStream(). > > Allow sub-streams created from an IFX_SeekableReadStream to provide > stream data without copying memory. > The data will only reside in the top-level stream. > > For example: > For file > http://www.major-landrover.ru/upload/attachments/f/9/f96aab07dab04ae89c8a509ec1ef2b31.pdf > (18 Mb) > > The memory usage is reduced by ~13 Mb. > > Change-Id: I2595c014d0fbe1fdd181cc04965cfd7d901c2d88 > Reviewed-on: https://pdfium-review.googlesource.com/35930 > Commit-Queue: Art Snake <art-snake@yandex-team.ru> > Reviewed-by: dsinclair <dsinclair@chromium.org> TBR=tsepez@chromium.org,dsinclair@chromium.org,art-snake@yandex-team.ru # Not skipping CQ checks because original CL landed > 1 day ago. Change-Id: I947fca17052765935a952a4f25ca48f6599c4af9 Reviewed-on: https://pdfium-review.googlesource.com/37210 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-07-03Avoid duplicate data buffering in CPDF_SyntaxParser::ReadStream().Artem Strygin
Allow sub-streams created from an IFX_SeekableReadStream to provide stream data without copying memory. The data will only reside in the top-level stream. For example: For file http://www.major-landrover.ru/upload/attachments/f/9/f96aab07dab04ae89c8a509ec1ef2b31.pdf (18 Mb) The memory usage is reduced by ~13 Mb. Change-Id: I2595c014d0fbe1fdd181cc04965cfd7d901c2d88 Reviewed-on: https://pdfium-review.googlesource.com/35930 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-07-03Add FPDFText_GetTextRenderMode() APIMiklos Vajna
This allows deciding if FPDFPageObj_GetFillColor() or FPDFPageObj_GetStrokeColor() should be used to get the effective color of a text object. Change-Id: Ic6e99a9eb8512b164756da8b5fcd8cd7771271ae Reviewed-on: https://pdfium-review.googlesource.com/36750 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-06-29Use pdfium::span with CPDF_IccProfile and friends.Lei Zhang
Change-Id: I88d3e86a1dad75ef9c6bfb3401af6606479031a7 Reviewed-on: https://pdfium-review.googlesource.com/36634 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-06-29Remove out param from CCodec_IccModule::CreateTransform_sRGB().Lei Zhang
Its return value contains the same data. Change-Id: I2bf4e72faf978e5d491bec573babc8099cda4e5a Reviewed-on: https://pdfium-review.googlesource.com/36633 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-06-26Write pixel .evt test for dynamic_list_box_allow_multiple_selection.Henrique Nakashima
Improve the .evt mechanism to accept mouse clicks with modifiers (such as shift). Bug: pdfium:1105 Change-Id: I6e9c2c1f66b7fde250b55b41ccdf115a311f44f7 Reviewed-on: https://pdfium-review.googlesource.com/36091 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-06-23Fix some nits from commit 27cf78d8.chromium/3472chromium/3471Lei Zhang
Change-Id: I52d7b9692c19af1aafab7d572d0a274726bd37f5 Reviewed-on: https://pdfium-review.googlesource.com/35911 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-06-22Fix some nits in gold.py.chromium/3470Lei Zhang
Change-Id: Idfc1c2282cc9318d1135f360ff03d99e27105127 Reviewed-on: https://pdfium-review.googlesource.com/35910 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-06-21Add pass/fail Gold summary to outputchromium/3469Stephan Altmueller
- Changes the URL to retrieve baselines which returns the baselines based on the issue number (if available) - Compare against a single baseline (instead of multiple) - Writes the results of comparing to the baselines to a separate output file that can then be parsed by the recipe code. See complementary CLs: https://skia-review.googlesource.com/c/buildbot/+/131923 https://chromium-review.googlesource.com/c/chromium/tools/build/+/1085853 Change-Id: I90cdd77d0d26e63a5e686f4862fc68dc9c4429d3 Reviewed-on: https://pdfium-review.googlesource.com/33772 Commit-Queue: Stephan Altmueller <stephana@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-06-20Re-work some more c_str() usage.Tom Sepez
Many of these are converting ByteString => c_str => ByteStringView, since the ByteStringView ctor is implicit. This is unfortunate, since that involves a strlen() which the ByteString already knows if we use AsStringView() instead. This changed one test result where we can now return the string "\0" instead of "" -- since strlen no longer eats the NUL. This seems consistent, say, with String.fromCharCode(). Change-Id: I17f68d1a1f4b352960208f9148e68ab4c4d78bd2 Reviewed-on: https://pdfium-review.googlesource.com/35590 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-06-20Add in a size guard to JPX fuzzerRyan Harrison
Setting an upper limit to the size of images being processed in the JPX fuzzer to reduce timeouts due to images just being really big. Also cleaned the types for passing pitch down to reduce the signedness conversions. BUG=chromium:834561 Change-Id: I28b7a2537a922ed7a9ca2f8ed049ae78dd471f49 Reviewed-on: https://pdfium-review.googlesource.com/35570 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-06-14Rewrite content stream regeneration.Henrique Nakashima
Loop through the dirty page objects and streams and regenerate all streams that are dirty. Bug: pdfium:1051 Change-Id: I837b5a7cd9542b7777e7c7ae7ac9cc75f69f30b5 Reviewed-on: https://pdfium-review.googlesource.com/34330 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-06-12Fill m_ContentStream field in CPDF_PageObject.Henrique Nakashima
From the comment of CPDF_PageObject::GetContentStream(): """ Get what content stream the object was parsed from in its page. This number is the index of the content stream in the "Contents" array, or 0 if there is a single content stream. If the object is newly created, -1 is returned. If the object is spread among more than one content stream, this is the index of the last one. """ Bug: pdfium:1051 Change-Id: I9f7804af4f263dda0422e9542e025e3320ff7c31 Reviewed-on: https://pdfium-review.googlesource.com/34250 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-06-08Ensure CJS_Return() with error always includes a message.Tom Sepez
Change the signature of the constructors to make it impossible to do this otherwise. Change-Id: I14e88d98a1128f2d599459ce9337cd6d079469fe Reviewed-on: https://pdfium-review.googlesource.com/34531 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-06-08Use FPDFText_GetBoundedText() to get the visible text in a test.Lei Zhang
Add a test PDF with multiple pages, each with a different media box and crop box. Demonstrate how FPDFText_GetText() gets all the text on the page, and how FPDFText_GetBoundedText() with the right bounding boxes gets only the visible text on the page. Also fix a small nit in CPDF_TextPage::GetTextByRect() found while writing this CL. BUG=pdfium:387 Change-Id: I9ce4bb181e2ba5b454ea1341bbccef9ba94c9cd8 Reviewed-on: https://pdfium-review.googlesource.com/34550 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-06-08Update comments in SUPPRESSIONS for xfa_specificRyan Harrison
This adds comments for the specific bug associated with each suppression, and a comment to remove the suppression line once the bug is fixed. BUG=pdfium:1020 Change-Id: I8002fe1711c55e39b2ef79c395980c89f6440853 Reviewed-on: https://pdfium-review.googlesource.com/34510 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-06-07Add expectations for xfa_node_caption.pdfchromium/3453Ryan Harrison
This test appears to just be confirming that caption layout and content can be controlled via JS. Specifically there is a bunch of listeners for the initialize event that run and setup the page by inspecting and changing values. Clicking and such does nothing interesting, so there is no .evt. BUG=pdfium:1020 Change-Id: I1a24dc6fab058c17362506cce1f184e62dd82500 Reviewed-on: https://pdfium-review.googlesource.com/34491 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-06-07Convert resolve_nodes.pdf into 3 test casesRyan Harrison
There are 3 elements in the PDF that can be interacted with that cause testable output. This CL creates test cases for each of these elements. 2 of them work correctly, and a new bug, pdfium:1106, has been filed for the third. BUG=pdfium:1020 Change-Id: I524911d03927a0eeeee1d1479e1a855f90269e8e Reviewed-on: https://pdfium-review.googlesource.com/34370 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-06-06Unsuppress dynamic_password_field_background_fill.pdfRyan Harrison
This CL creates a .evt and expectation image for this test. This test has a variety of password entry fields with different backgrounds and enters text into them. BUG=pdfium:1020 Change-Id: Icaa695670e8a773e066aec2251658a11c3e8ca3b Reviewed-on: https://pdfium-review.googlesource.com/34214 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-06-06Embedder tests can write saved PDFs to a file for debugging.Henrique Nakashima
Before calling a method that use EmbedderTest as FPDF_FILEWRITE (usually calling FPDF_SaveAsCopy()), call: OpenPDFFileForWrite("Filename.pdf"); After the write, close the stream with: ClosePDFFileForWrite(); Change-Id: Id1e7f778a9ff2b2b5bf976d49b485d5cb15f94bd Reviewed-on: https://pdfium-review.googlesource.com/34150 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-06-06Create events and expectation for barcode_test.pdfRyan Harrison
This adds a test where a known value is used as a seed for generating a barcode and confirming that the generated barcode is consistent. BUG=pdfium:1020 Change-Id: I61ed37a8591f0efe40a8d4ab1d6024bb1489ef25 Reviewed-on: https://pdfium-review.googlesource.com/34030 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-06-05Revert "Convert (void) to static_cast<void> in C++ code"Ryan Harrison
This reverts commit 80c6ab7b99bcbd7b940f78dc0cac52c30249f59c. Reason for revert: (void) idiom is prevalent through out C++ code. Original change's description: > Convert (void) to static_cast<void> in C++ code > > Converting instances of old C-style void casts to suppress return > values to use C++ style static cases. There are a few examples of > (void) that remain, since they are in C code, and the third_party/ > instances are not touched at all. > > Change-Id: I72b3fc0e1d713db669b76135e03d1cf87873a2fe > Reviewed-on: https://pdfium-review.googlesource.com/33790 > Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> > Commit-Queue: Ryan Harrison <rharrison@chromium.org> TBR=thestig@chromium.org,tsepez@chromium.org,dsinclair@chromium.org,hnakashima@chromium.org,rharrison@chromium.org Change-Id: Ib6cc021c97cb1ea7c71b90346fa9b500659f565d No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://pdfium-review.googlesource.com/33890 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-06-04Convert (void) to static_cast<void> in C++ codechromium/3450Ryan Harrison
Converting instances of old C-style void casts to suppress return values to use C++ style static cases. There are a few examples of (void) that remain, since they are in C code, and the third_party/ instances are not touched at all. Change-Id: I72b3fc0e1d713db669b76135e03d1cf87873a2fe Reviewed-on: https://pdfium-review.googlesource.com/33790 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-06-01Fix XFA guardsRyan Harrison
These guards are using #if, when they should be using #ifdef. Caught using Clang's static analyzer. Change-Id: I86e99c5e4142cf84fff5f2365ad534f09ae40511 Reviewed-on: https://pdfium-review.googlesource.com/33510 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-06-01Fix V8 guardsRyan Harrison
These guards are using #if, when they should be using #ifdef. Caught using Clang's static analyzer. Change-Id: I9bb7a4c2b817e752c04b21a8321595f9676d6381 Reviewed-on: https://pdfium-review.googlesource.com/33511 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-05-31Make XFA pixel tests more stablechromium/3447Ryan Harrison
When generating PDFs using the fixup script and a .in, specify them to to use Ahem.ttf as the text font. Ahem is a font designed to reduce flakiness in pixel tests due to font rendering differences between platforms. Specifically the glyphs in the font are standard size black boxes, so though the specific text content cannot be easily compared, things like layout and high level changes to the content can still be tested. Testing things like specific text changes should be done via an embedder test, where the strings in the elements can be extracted and inspected. The font itself is is CID type 2 font, which is relatively complex to correctly embed in a PDF due to subsetting and other features. Instead of embedding it in the generated PDFs, which was originally attempted, it is being supplied to pdfium_test via the --font-dir flag. This flag overrides where the binary looks for system fonts. This works correctly on Mac and Linux, but not on Windows, which is why that platform remains suppressed. BUG=pdfium:1008,pdfium:1020 Change-Id: I00811536de98f736fc599d96b397194ccf8db0cd Reviewed-on: https://pdfium-review.googlesource.com/27790 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-05-31Handle image mask continuous loading correctlyWei Li
When image mask doesn't need multi-steps to load, ContinueLoadMaskDIB() will return LoadState::kFail as result. For this case, the loading should continue as usual instead of aborting. BUG=pdfium:1087 Change-Id: I5c43a67e43469ac7febca4c0cf1faa96ee105206 Reviewed-on: https://pdfium-review.googlesource.com/33310 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Wei Li <weili@chromium.org>