Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[api-minor] Allow loading pdf fonts into another document. #12154

Merged
merged 1 commit into from
Aug 8, 2020
Merged

[api-minor] Allow loading pdf fonts into another document. #12154

merged 1 commit into from
Aug 8, 2020

Conversation

jsg2021
Copy link
Contributor

@jsg2021 jsg2021 commented Aug 1, 2020

Addresses PR #12131 browser test failures.
Fixes #12152

@timvandermeij
Copy link
Contributor

/botio test

@pdfjsbot
Copy link

pdfjsbot commented Aug 2, 2020

From: Bot.io (Linux m4)


Received

Command cmd_test from @timvandermeij received. Current queue size: 0

Live output at: http://54.67.70.0:8877/b96a294e5c3f3ff/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Aug 2, 2020

From: Bot.io (Windows)


Received

Command cmd_test from @timvandermeij received. Current queue size: 0

Live output at: http://54.215.176.217:8877/df07274dde84095/output.txt

test/unit/custom_spec.js Outdated Show resolved Hide resolved
test/unit/custom_spec.js Outdated Show resolved Hide resolved
test/unit/custom_spec.js Outdated Show resolved Hide resolved
test/unit/custom_spec.js Outdated Show resolved Hide resolved
test/unit/custom_spec.js Outdated Show resolved Hide resolved
test/unit/custom_spec.js Outdated Show resolved Hide resolved
@pdfjsbot
Copy link

pdfjsbot commented Aug 2, 2020

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/b96a294e5c3f3ff/output.txt

Total script time: 26.65 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://54.67.70.0:8877/b96a294e5c3f3ff/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

pdfjsbot commented Aug 2, 2020

From: Bot.io (Windows)


Failed

Full output at http://54.215.176.217:8877/df07274dde84095/output.txt

Total script time: 30.85 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://54.215.176.217:8877/df07274dde84095/reftest-analyzer.html#web=eq.log

@timvandermeij
Copy link
Contributor

/botio test

@pdfjsbot
Copy link

pdfjsbot commented Aug 3, 2020

From: Bot.io (Linux m4)


Received

Command cmd_test from @timvandermeij received. Current queue size: 0

Live output at: http://54.67.70.0:8877/eddab0368bc48bc/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Aug 3, 2020

From: Bot.io (Windows)


Received

Command cmd_test from @timvandermeij received. Current queue size: 0

Live output at: http://54.215.176.217:8877/0dc901d21f68b5a/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Aug 3, 2020

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/eddab0368bc48bc/output.txt

Total script time: 26.83 mins

  • Font tests: Passed
  • Unit tests: FAILED
  • Regression tests: FAILED

Image differences available at: http://54.67.70.0:8877/eddab0368bc48bc/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

pdfjsbot commented Aug 3, 2020

From: Bot.io (Windows)


Failed

Full output at http://54.215.176.217:8877/0dc901d21f68b5a/output.txt

Total script time: 29.47 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://54.215.176.217:8877/0dc901d21f68b5a/reftest-analyzer.html#web=eq.log

Copy link
Contributor

@timvandermeij timvandermeij left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me with these final comments addressed and a rebase. r? @Snuffleupagus for a final check to make sure all is fine now. Thanks!

src/display/api.js Show resolved Hide resolved
test/unit/custom_spec.js Show resolved Hide resolved
@jsg2021
Copy link
Contributor Author

jsg2021 commented Aug 5, 2020

rebased:)

@timvandermeij
Copy link
Contributor

timvandermeij commented Aug 6, 2020

Gentle ping @Snuffleupagus if you have time for a final check to make sure I didn't miss anything.

@Snuffleupagus
Copy link
Collaborator

Snuffleupagus commented Aug 7, 2020

Gentle ping @Snuffleupagus if you have time for a final check to make sure I didn't miss anything.

Sorry about the delay here, I've been swamped with other things!

Unfortunately I still believe that #12154 (comment) applies here, even in the latest version of the patch, since https://github.com/mozilla/pdf.js/pull/12154/files#diff-348626e82475ec3536e620f4e5508f75R117-R118 looks quite cryptic and it's not (at least to me) immediately obvious what's actually happing there without very careful reading of the code.

@timvandermeij What's your opinion on this specific part of the unit-tests, since I worry that this admittedly clever but very terse checker function may hurt maintainability of these tests?

@jsg2021
Copy link
Contributor Author

jsg2021 commented Aug 7, 2020

@Snuffleupagus I'm struggling to understand. Is there a builtin assertion I could use? How is this cryptic? We just want to verify the set or list has the item matching our pattern?

@jsg2021
Copy link
Contributor Author

jsg2021 commented Aug 7, 2020

@Snuffleupagus I've updated to add a custom matcher which makes the callsite look like this:
a32ec02#diff-348626e82475ec3536e620f4e5508f75R230

expect(ownerDocument.fonts).toContainElementMatching(checkFont);

The custom matcher is here: a32ec02#diff-348626e82475ec3536e620f4e5508f75R22-R54
and it replaces:

const collectionMatches = (iterable, matcherFunction) =>
    Array.from(iterable).find(matcherFunction) !== undefined;

@timvandermeij
Copy link
Contributor

timvandermeij commented Aug 7, 2020

Oof, that's indeed a lot more code for something that's not that difficult. Compared to what it was in the first iteration I think

const collectionMatches = (iterable, matcherFunction) =>
    Array.from(iterable).find(matcherFunction) !== undefined;

was the most clear. Maybe it would help to not make it a variable like this but just inline the check? So:

Array.from(ownerDocument.fonts).find(checkFont) !== undefined

Even then I don't really see anything wrong with collectionMatches since it consolidates the check in one place. I at least don't see a shorter/more clear alternative here.

@jsg2021
Copy link
Contributor Author

jsg2021 commented Aug 8, 2020

Suggestion incorporated and rebased.

@timvandermeij
Copy link
Contributor

/botio test

@pdfjsbot
Copy link

pdfjsbot commented Aug 8, 2020

From: Bot.io (Linux m4)


Received

Command cmd_test from @timvandermeij received. Current queue size: 0

Live output at: http://54.67.70.0:8877/6bacf6d11ac635d/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Aug 8, 2020

From: Bot.io (Windows)


Received

Command cmd_test from @timvandermeij received. Current queue size: 0

Live output at: http://54.215.176.217:8877/285a1d5c7c98dc8/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Aug 8, 2020

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/6bacf6d11ac635d/output.txt

Total script time: 26.74 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://54.67.70.0:8877/6bacf6d11ac635d/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

pdfjsbot commented Aug 8, 2020

From: Bot.io (Windows)


Failed

Full output at http://54.215.176.217:8877/285a1d5c7c98dc8/output.txt

Total script time: 31.66 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://54.215.176.217:8877/285a1d5c7c98dc8/reftest-analyzer.html#web=eq.log

@timvandermeij timvandermeij merged commit 1f8b54b into mozilla:master Aug 8, 2020
@timvandermeij
Copy link
Contributor

Thank you!

@jsg2021
Copy link
Contributor Author

jsg2021 commented Aug 9, 2020

@timvandermeij What does the release schedule look like?

@jsg2021 jsg2021 deleted the issue-8271 branch August 9, 2020 18:03
@timvandermeij
Copy link
Contributor

timvandermeij commented Aug 9, 2020

We don't have a fixed release schedule. I believe every week or so the code is merged into Firefox Nightly so the builds get tested by users, and NPM releases are usually made when a number of [api-minor] patches have landed or when lots of community members request a release. We're currently in the process of implementing support for AcroForms and layers, two big features, so I'm sure we'll make a release after that's done.

@jsg2021
Copy link
Contributor Author

jsg2021 commented Aug 9, 2020

I look forward for the next npm release of pdfjs-dist 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix pull request #12131 so it can be merged again
4 participants