1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Remove unncessary CanvasFactory/CMapReaderFactory/FileReaderFactory duplication in unit-tests

Given that the API will now, after PR 12039, automatically pick the correct factories to use depending on the environment (browser vs. Node.js), we can utilize that in the unit-tests as well. This way we don't have to manually repeat the same initialization code in *multiple* unit-tests.
*Note:* The *official* PDF.js API is defined in `src/pdf.js`, hence the new exports in `src/display/api.js` will not affect that.

Also, updates the unit-test `FileReaderFactory` helpers similarily.

*Drive-by change:* Fix the `CMapReaderFactory` usage in the annotation unit-tests, since the cache should only contain raw data and not a Promise. While this obviously works as-is, having unit-tests that "abuse" the intended data format can easily lead to unnecessary failures if changes are made to the relevant `src/core/` code.
This commit is contained in:
Jonas Jenwald 2021-01-08 17:12:58 +01:00
parent 35845d1bbb
commit 941b65f683
6 changed files with 57 additions and 115 deletions

View file

@ -3060,4 +3060,6 @@ export {
setPDFNetworkStreamFactory,
version,
build,
DefaultCanvasFactory,
DefaultCMapReaderFactory,
};