Stabilize darkmode mathml test
This commit is contained in:
parent
861ee80371
commit
54d2ca2a07
|
|
@ -4,11 +4,20 @@
|
|||
<meta charset="utf-8">
|
||||
<title>MathML-like SVG</title>
|
||||
</head>
|
||||
<body style="margin: 0">
|
||||
<body style="margin: 0; background-color: #ffff99">
|
||||
<!--
|
||||
Image based on: https://en.wikipedia.org/wiki/Pythagorean_theorem
|
||||
with a black square added for testing.
|
||||
|
||||
onload based on:
|
||||
https://stackoverflow.com/questions/53423742/waiting-for-an-image-to-finish-rendering
|
||||
-->
|
||||
<img class="mwe-math-fallback-image-inline" src="mathml.svg" alt="Pythagorean theorem">
|
||||
<img
|
||||
class="mwe-math-fallback-image-inline"
|
||||
src="mathml.svg"
|
||||
alt="Pythagorean theorem"
|
||||
onload="requestAnimationFrame(() => requestAnimationFrame(() => console.log('Image loaded')));"
|
||||
>
|
||||
<!-- -->
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -645,8 +645,6 @@ def test_cookies_store(quteproc_new, request, short_tmpdir, store):
|
|||
),
|
||||
('yellow', 'lightness-hsl', {None: testutils.Color(204, 204, 0)}),
|
||||
('yellow', 'brightness-rgb', {None: testutils.Color(0, 0, 204)}),
|
||||
|
||||
('mathml', None, {None: testutils.Color(255, 255, 255)}),
|
||||
])
|
||||
def test_dark_mode(webengine_versions, quteproc_new, request,
|
||||
filename, algorithm, colors):
|
||||
|
|
@ -656,9 +654,8 @@ def test_dark_mode(webengine_versions, quteproc_new, request,
|
|||
args = _base_args(request.config) + [
|
||||
'--temp-basedir',
|
||||
'-s', 'colors.webpage.darkmode.enabled', 'true',
|
||||
'-s', 'colors.webpage.darkmode.algorithm', algorithm,
|
||||
]
|
||||
if algorithm is not None:
|
||||
args += ['-s', 'colors.webpage.darkmode.algorithm', algorithm]
|
||||
quteproc_new.start(args)
|
||||
|
||||
ver = webengine_versions.webengine
|
||||
|
|
@ -677,6 +674,31 @@ def test_dark_mode(webengine_versions, quteproc_new, request,
|
|||
assert color == expected
|
||||
|
||||
|
||||
def test_dark_mode_mathml(quteproc_new, request, qtbot):
|
||||
if not request.config.webengine:
|
||||
pytest.skip("Skipped with QtWebKit")
|
||||
|
||||
args = _base_args(request.config) + [
|
||||
'--temp-basedir',
|
||||
'-s', 'colors.webpage.darkmode.enabled', 'true',
|
||||
'-s', 'colors.webpage.darkmode.algorithm', 'brightness-rgb',
|
||||
]
|
||||
quteproc_new.start(args)
|
||||
|
||||
quteproc_new.open_path('data/darkmode/mathml.html')
|
||||
quteproc_new.wait_for_js('Image loaded')
|
||||
|
||||
# First make sure loading finished by looking outside of the image
|
||||
img = quteproc_new.get_screenshot(
|
||||
probe_pos=QPoint(105, 0),
|
||||
probe_color=testutils.Color(0, 0, 204),
|
||||
)
|
||||
|
||||
# Then get the actual formula color
|
||||
color = testutils.Color(img.pixelColor(QPoint(4, 4)))
|
||||
assert color == testutils.Color(255, 255, 255)
|
||||
|
||||
|
||||
def test_unavailable_backend(request, quteproc_new):
|
||||
"""Test starting with a backend which isn't available.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue