Bug 1654918 - Improve prefers-contrast reftests with the `ui.useAccessibilityTheme` preference r=morgan

Differential Revision: https://phabricator.services.mozilla.com/D84765
This commit is contained in:
Zeke Medley 2020-07-29 20:27:42 +00:00
Родитель 28aa61be0a
Коммит d65fae1c28
4 изменённых файлов: 40 добавлений и 6 удалений

Просмотреть файл

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>high contrast mode should cause a black box to be drawn</title>
<style type="text/css">
div {
width: 100px;
height: 100px;
}
@media (prefers-contrast: high) {
div {
outline: 2px solid #000000;
}
}
</style>
</head>
<body>
<div></div>
</body>
</html>

Просмотреть файл

@ -45,13 +45,13 @@ pref(browser.display.document_color_use,2) == non-themed-button-002.html non-the
pref(browser.display.document_color_use,2) == background-transparent-form-control.html background-transparent-form-control-ref.html
# prefers-contrast media query:
# XXX: because we can't toggle an OS high contrast theme from a
# reftest we can't directly test whether or not that triggers the high
# contrast setting on the prefers-contrast media query. This is quite
# sad. Bug 1648807.
# a prefers-contrast value of forced should evaluate to true
# a prefers-contrast value of forced or high should evaluate to true
== prefers-contrast-001.html prefers-contrast-black-ref.html
test-pref(ui.windowForeground,"black") test-pref(ui.windowBackground,"white") test-pref(ui.useAccessibilityTheme,1) == prefers-contrast-001.html prefers-contrast-black-ref.html
# high should match when an accessibility theme is being used
test-pref(ui.windowForeground,"black") test-pref(ui.windowBackground,"white") test-pref(ui.useAccessibilityTheme,1) == prefers-contrast-002.html prefers-contrast-black-ref.html
# If RFP is on the media query stops evaluating contrast preferences
# and defaults to no-preference. The media query will still evaluate
@ -59,10 +59,12 @@ pref(browser.display.document_color_use,2) == background-transparent-form-contro
# ways to detect if forced colors are enabled so might as well not lie
# about it.
test-pref(privacy.resistFingerprinting,true) == prefers-contrast-003.html prefers-contrast-black-ref.html
# high should not match when RFP is enabled.
test-pref(ui.windowForeground,"black") test-pref(ui.windowBackground,"white") test-pref(privacy.resistFingerprinting,true) test-pref(ui.useAccessibilityTheme,1) != prefers-contrast-002.html prefers-contrast-black-ref.html
# Should only be enabled behind preference.
test-pref(layout.css.prefers-contrast.enabled,false) != prefers-contrast-001.html prefers-contrast-black-ref.html
# prefers-contrast forced matching forced
== prefers-contrast-003.html prefers-contrast-black-ref.html

Просмотреть файл

@ -97,6 +97,9 @@ user_pref("ui.caretBlinkTime", -1);
user_pref("ui.caretWidth", 1);
user_pref("ui.prefersReducedMotion", 0);
user_pref("ui.systemUsesDarkTheme", 0);
user_pref("ui.useAccessibilityTheme", 0);
user_pref("ui.windowForeground", "");
user_pref("ui.windowBackground", "");
// Turn off the Push service.
user_pref("dom.push.serverURL", "");
// Disable intermittent telemetry collection

Просмотреть файл

@ -36,6 +36,12 @@
using namespace mozilla;
// To make one of these prefs toggleable from a reftest add a user
// pref in testing/profiles/reftest/user.js. For example, to make
// ui.useAccessibilityTheme toggleable, add:
//
// user_pref("ui.useAccessibilityTheme", 0);
//
nsLookAndFeelIntPref nsXPLookAndFeel::sIntPrefs[] = {
{"ui.caretBlinkTime", IntID::CaretBlinkTime, false, 0},
{"ui.caretWidth", IntID::CaretWidth, false, 0},