mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-02-08 00:21:11 +01:00
The problem in the original code is that `getTextAt` is called too early and therefore returns unexpected text content. This can happen because we call `increaseScale` and then wait for the page's text layer to be visible, but it can take some time before the zoom actually occurs/completes in the viewer and in the meantime the old (pre-zoom) text layer may still be visible, causing us to continue too soon because we don't validate that we're dealing with the post-zoom text layer. This commit fixes the issue by simply waiting for the expected text to show up at the given origin coordinates, which makes the test work independent of viewer actions/timing.