diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/element-timing/multiple-background-images.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/element-timing/multiple-background-images.html')
-rw-r--r-- | testing/web-platform/tests/element-timing/multiple-background-images.html | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/testing/web-platform/tests/element-timing/multiple-background-images.html b/testing/web-platform/tests/element-timing/multiple-background-images.html new file mode 100644 index 0000000000..380e5e825e --- /dev/null +++ b/testing/web-platform/tests/element-timing/multiple-background-images.html @@ -0,0 +1,58 @@ +<!DOCTYPE HTML> +<meta charset=utf-8> +<title>Element Timing: observe element with multiple background images</title> +<body> +<style> +body { + margin: 0; +} +#target { + width: 200px; + height: 200px; + background-image: url('resources/circle.svg'), url('resources/square100.png'); +} +</style> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="resources/element-timing-helpers.js"></script> +<script> + let beforeRender = performance.now(); + async_test(function (t) { + assert_implements(window.PerformanceElementTiming, "PerformanceElementTiming is not implemented"); + let numObservedElements = 0; + let observedCircle = false; + let observedSquare = false; + const pathPrefix = window.location.origin + '/element-timing/resources/'; + let div = document.getElementById('target'); + const observer = new PerformanceObserver( + t.step_func(entryList => { + entryList.getEntries().forEach(entry => { + numObservedElements++; + if (entry.url.endsWith('square100.png')) { + observedSquare = true; + checkElement(entry, pathPrefix + 'square100.png', 'multi', 'target', beforeRender, div); + checkRect(entry, [0, 200, 0, 200]); + checkNaturalSize(entry, 100, 100); + } + else if (entry.url.endsWith('circle.svg')) { + observedCircle = true; + checkElement(entry, pathPrefix + 'circle.svg', 'multi', 'target', beforeRender, div); + checkRect(entry, [0, 200, 0, 200]); + checkNaturalSize(entry, 200, 200); + } + else { + assert_unreached("Should not have observed an entry with different url!"); + } + if (numObservedElements === 2) { + assert_true(observedCircle); + assert_true(observedSquare); + t.done(); + } + }); + }) + ); + observer.observe({entryTypes: ['element']}); + }, 'Element with two background images receives both.'); +</script> +<div id='target' elementtiming='multi'></div> +</body> |