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

Generate test images at different output scales. #14545

Merged
merged 1 commit into from
Feb 24, 2022

Conversation

brendandahl
Copy link
Contributor

This will default to generating test images at the device pixel
ratio of the machine the tests are created on unless the
test explicitly defines and output scale using the
outputScale setting. This makes the test look visually
like they would on the machine they are running on. It
also allows us to test different output scales.

@brendandahl
Copy link
Contributor Author

As for performance locally,
DPR of 1 takes ~500s
DPR of 2 takes 680s

test/driver.js Outdated
this.canvas.height = viewport.height;
// Restrict the test from creating a canvas that is too big.
const MAX_CANVAS_PIXEL_DIMENSION = 4096;
const largetDimension = Math.max(viewport.width, viewport.height);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Spelling-nit: largetDimension -> largestDimension.

test/driver.js Outdated
MAX_CANVAS_PIXEL_DIMENSION
) {
const rescale = MAX_CANVAS_PIXEL_DIMENSION / largetDimension;
viewport = page.getViewport({
Copy link
Collaborator

@Snuffleupagus Snuffleupagus Feb 8, 2022

Choose a reason for hiding this comment

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

While it doesn't matter in this particular case, please note that you generally want to use viewport.clone({ ... }) instead to ensure that only the scale changes (while any other possible parameters stay the same).

test/test.js Outdated
@@ -970,7 +974,7 @@ async function startBrowser(browserName, startUrl = "") {
}

function startBrowsers(initSessionCallback, makeStartUrl = null) {
const browserNames = options.noChrome ? ["firefox"] : ["firefox", "chrome"];
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks like a left-over from debugging, please revert this.

@brendandahl
Copy link
Contributor Author

/botio test

@pdfjsbot
Copy link

pdfjsbot commented Feb 8, 2022

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.241.84.105:8877/c95d58933ce0345/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Feb 8, 2022

From: Bot.io (Windows)


Received

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

Live output at: http://54.193.163.58:8877/029a5f9097493fc/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Feb 8, 2022

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/c95d58933ce0345/output.txt

Total script time: 23.58 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 14

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

@pdfjsbot
Copy link

pdfjsbot commented Feb 8, 2022

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/029a5f9097493fc/output.txt

Total script time: 25.46 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 4

Image differences available at: http://54.193.163.58:8877/029a5f9097493fc/reftest-analyzer.html#web=eq.log

@brendandahl
Copy link
Contributor Author

Should note I expect a few changes because we will now be drawing the PDF's at a smaller size.

Also, we may want to add a scale option the reftest analyzer. Looking at the results from a lowdpi device on a highdpi device makes the images pretty small.

@timvandermeij
Copy link
Contributor

How does this relate to #14534? Does it supersede that one?

@Snuffleupagus
Copy link
Collaborator

How does this relate to #14534? Does it supersede that one?

Unless I'm misunderstanding something I don't believe that it does, since this PR is essentially just simulating differing window.devicePixelRatio values (i.e. normal vs hiDPI screens).
The other PR is basically simulating different zoom levels (in the viewer), hence the two PRs ought to implement complimentary functionality.

@brendandahl
Copy link
Contributor Author

@Snuffleupagus anything else you want me to address?

@Snuffleupagus
Copy link
Collaborator

/botio browsertest

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_browsertest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/e56abd3efa174a5/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_browsertest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/d890aedfb968fc6/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/e56abd3efa174a5/output.txt

Total script time: 19.28 mins

  • Regression tests: FAILED
  different ref/snapshot: 4

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

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/d890aedfb968fc6/output.txt

Total script time: 20.04 mins

  • Regression tests: FAILED
  different ref/snapshot: 17

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

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

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

r=me, with the one comment addressed; thank you!

@@ -228,10 +228,15 @@ window.onload = function () {
});
continue;
}
match = line.match(/^ {2}IMAGE[^:]*: (.*)$/);
match = line.match(/^ {2}IMAGE[^:]*\((\d+)x(\d+)x(\d)+\): (.*)$/);
Copy link
Collaborator

@Snuffleupagus Snuffleupagus Feb 23, 2022

Choose a reason for hiding this comment

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

Is there a typo in the last digit group, i.e. did you mean the following instead?

Suggested change
match = line.match(/^ {2}IMAGE[^:]*\((\d+)x(\d+)x(\d)+\): (.*)$/);
match = line.match(/^ {2}IMAGE[^:]*\((\d+)x(\d+)x(\d+)\): (.*)$/);

This will default to generating test images at the device pixel
ratio of the machine the tests are created on unless the
test explicitly defines and output scale using the
`outputScale` setting. This makes the test look visually
like they would on the machine they are running on. It
also allows us to test different output scales.
@brendandahl
Copy link
Contributor Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.241.84.105:8877/43574260aa2b895/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://54.193.163.58:8877/bdebea6e9049d99/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/43574260aa2b895/output.txt

Total script time: 23.89 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED
  different ref/snapshot: 18
  different first/second rendering: 1

Image differences available at: http://54.241.84.105:8877/43574260aa2b895/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/bdebea6e9049d99/output.txt

Total script time: 24.64 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED
  different ref/snapshot: 4

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

@Snuffleupagus Snuffleupagus merged commit 889b761 into mozilla:master Feb 24, 2022
@Snuffleupagus
Copy link
Collaborator

/botio makeref

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_makeref from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/d4b53f2147810c2/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_makeref from @Snuffleupagus received. Current queue size: 1

Live output at: http://54.193.163.58:8877/a4ab951443760d3/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/d4b53f2147810c2/output.txt

Total script time: 20.50 mins

  • Lint: Passed
  • Make references: Passed
  • Check references: Passed

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/a4ab951443760d3/output.txt

Total script time: 60.00 mins

  • Lint: Passed

@Snuffleupagus
Copy link
Collaborator

/botio-windows makeref

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_makeref from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/f5f6af7ce9c601e/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/f5f6af7ce9c601e/output.txt

Total script time: 20.15 mins

  • Lint: Passed
  • Make references: Passed
  • Check references: Passed

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.

4 participants