-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Support changing the DPI in tests #7140
Comments
Is this issue for adding support for changing DPI in web platform tests? I just ran into this when trying to write a WPT test for a chromium bug. Our rendering is different with different DPI values and we had a bug that was only present at non-1.0 DPIs (https://crbug.com/925676). I wanted to add a WPT test for this but was not able to because we don't have an API for that yet. Blink's test runner has SetBackingScaleFactor(double) which is roughly the API we'd need to add. In blink we have 45 tests that use |
Yes. Essentially we have undocumented support in
The current support we have relies on |
In the review of my chromium bug fix, a reviewer pointed out that chromium has two ways to write DPI web tests: the testRunner.SetBackingScaleFactor API and a chromium test feature called "virtual test suites". Virtual test suites are where certain test directories re-run with different flags such as gpu acceleration enabled/disabled, directwrite fonts enabled/disabled, threaded compositing enabled/disabled, various scale factors, etc. To avoid running all tests many times, virtual suites are limited to certain directories (see: VirtualTestSuites). These approaches are chromium-specific though, so we need a way to write upstreamed WPT tests. I would support either of these approaches in WPT tests: special directories that are declared to depend on DPI, or an explicit DPI flag used in the test itself. I looked through chromium's existing tests that use SetBackingScaleFactor and it would not be an issue to switch these to use a static, declarative API such as Image srcset is an example of a web feature that needs DPI control to test. I didn't find existing srcset WPT tests that cover srcset resolutions (there are some DPR header tests but I didn't see any that test the rendering of 2x images). (@yoavweiss , do you know if this is tested and I just missed it?) I think we need DPI control to write WPT srcset tests. Do you mind if we change the title of this issue to "Add DPI support to WPT tests"? |
cc::EffectNode tracks a raster surface contents scale, and this is updated in EffectTree::UpdateSurfaceContentsScale. If perspective is present in the to-screen transform, a fallback codepath is used which uses cc::TransformTree::device_scale_factor, and this value was not set when BlinkGenPropertyTrees was enabled. This patch updates cc::TransformTree::device_scale_factor and adds a test. This could not be a WPT test due to missing APIs for changing DPI, and web-platform-tests/wpt#7140 has been updated asking for this API. Bug: 925676 Change-Id: Ifa037d1412de37f196885f4cbf69148f37e512d5 Reviewed-on: https://chromium-review.googlesource.com/c/1476264 Commit-Queue: Philip Rogers <[email protected]> Reviewed-by: Xianzhu Wang <[email protected]> Cr-Commit-Position: refs/heads/master@{#633275}
On Tue, Feb 19, 2019, 16:48 Philip Rogers ***@***.***> wrote:
In the review of my chromium bug fix, a reviewer pointed out that chromium
has two ways to write DPI web tests: the testRunner.SetBackingScaleFactor
<https://cs.chromium.org/chromium/src/content/shell/test_runner/test_runner.cc?type=cs&l=222>
API and a chromium test feature called "virtual test suites". Virtual test
suites are where certain test directories re-run with different flags such
as gpu acceleration enabled/disabled, directwrite fonts enabled/disabled,
threaded compositing enabled/disabled, various scale factors, etc. To avoid
running all tests many times, virtual suites are limited to certain
directories (see: VirtualTestSuites
<https://cs.chromium.org/chromium/src/third_party/blink/web_tests/VirtualTestSuites>).
These approaches are chromium-specific though, so we need a way to write
upstreamed WPT tests.
I would support either of these approaches in WPT tests: special
directories that are declared to depend on DPI, or an explicit DPI flag
used in the test itself. I looked through chromium's existing tests that
use SetBackingScaleFactor
<https://cs.chromium.org/chromium/src/content/shell/test_runner/test_runner.cc?type=cs&l=222>
and it would not be an issue to switch these to use a static, declarative
API such as <meta name=wpt-device-pixel-ratio contents=[double]> (in
other words, the existing tests are not testing changing DPIs).
Image srcset is an example of a web feature that needs DPI control to
test. I didn't find existing srcset WPT tests that cover srcset resolutions
(there are some DPR header tests but I didn't see any that test the
rendering of 2x images). ***@***.*** <https://github.com/yoavweiss> , do
you know if this is tested and I just missed it?) I think we need DPI
control to write WPT srcset tests.
I believe we tested those with internal layout tests. Since the actual
selection algorithm is not strictly defined, that seems OKish. (E.g. the
browser can intervene and request a lower resolution image)
It would still be better to have baseline WPTs that make sure the
non-intervention case is working as expected.
Regardless of srcset, being able to set DPR for wpt tests seems valuable
(e.g. for client hint, for the devicePixelRatio interface, etc)
… Do you mind if we change the title of this issue to "Add DPI support to
WPT tests"?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7140 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAv_C2MGY2IPbW3C2YUMSDy7-yhW80jeks5vPBzlgaJpZM4PJKOU>
.
|
I've added tests for image-set, and encountered the same need.... src selection in image-set can only be effectively tested when diffrent DPRs are allowed |
I'm currently writing tests that truly need this: #23789, otherwise they don't test a lot of the functionality. I tried to fix this myself but got lost in the complexities of the python infrastructure... any help with this would be appreciated. |
So today, Edge (the Chromium-base one), Chrome, and Safari have their reftest-support in tools/wptrunner/wptrunner/executors/executorwebdriver.py, and Firefox has it in tools/wptrunner/wptrunner/executors/executormarionette.py. As you can see, we currently assert that Options for adding dpi support that I can think of:
cc @jgraham @Hexcles who may have thoughts (also gsnedders, but they're already on this issue) |
There are a couple of hooks here to help. If the pref can be changed at runtime without a restart, it can form part of the test "environment" [3], which is basically a mechanism to do some stateful things before a test, but only if necessary. So if this can be done in terms of prefs, I think it's pretty easy to do in wptrunner. In gecko it can be controlled using the I independently think that this makes sense as a WebDriver feature, and would certainly support a PR against that spec to make it an option. That may be needed to support WebKit (I have no idea how settings in WebKit works, so it may also not be needed). [1] https://searchfox.org/mozilla-central/source/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox.py#725 |
WebKit internal tests can modify the dpr before loading a page using Javascript ( |
I think the following issue in WebDriver is about this: w3c/webdriver#1378 |
I suspect that feature is likely not exposed in main Safari though, I presume? (Similar to Chromium's internals testing API, which only exists in our |
When wpt is imported to webkit it uses the internal testing API rather than what's exposed to Safari. I'm not sure what's exposed in Safari, I don't know the Safari WebDriver code. |
Originally posted as w3c/wptrunner#240 by @gsnedders on 21 Mar 2017, 17:50 UTC:
[edit: see #7140 (comment) for the current status]
The text was updated successfully, but these errors were encountered: