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 /dom/svg/test/test_getPathSegListAtLength_with_d_property.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 'dom/svg/test/test_getPathSegListAtLength_with_d_property.html')
-rw-r--r-- | dom/svg/test/test_getPathSegListAtLength_with_d_property.html | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/dom/svg/test/test_getPathSegListAtLength_with_d_property.html b/dom/svg/test/test_getPathSegListAtLength_with_d_property.html new file mode 100644 index 0000000000..c16ad71adf --- /dev/null +++ b/dom/svg/test/test_getPathSegListAtLength_with_d_property.html @@ -0,0 +1,55 @@ +<!DOCTYPE html> +<title>Test for getPathSegAtLength for d property</title> +<meta charset=utf-8> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<style> +svg { + width: 10%; + height: 10%; + background: #eee; +} +svg path { + fill: none; + stroke: #000; +} +</style> + +<div id="log"></div> + +<svg viewBox="0 0 20 10"> + <path id='target1' d="M2,2 L8,8 L12,4"/> +</svg> +<svg viewBox="0 0 20 10"> + <path id='target2' style='d: path("M2,2 L8,8 L12,4")' /> +</svg> + +<script> +/* global test, assert_equals */ + +'use strict'; + +test(function() { + let target1 = document.getElementById('target1'); + let target2 = document.getElementById('target2'); + assert_equals(target1.getPathSegAtLength(5), 1); + assert_equals(target2.getPathSegAtLength(5), 1); + + assert_equals(target1.getPathSegAtLength(10), 2); + assert_equals(target2.getPathSegAtLength(10), 2); +}, "getPathSegAtLength works properly on both d attribute and d property"); + +test(function() { + let target = document.getElementById('target1'); + // Note: in order to make sure we flush style properly, we call + // getComputedStyle after setting an initial value first, so if + // getPathSegAtLength(5) doesn't flush style, it returns 0. + target.style.d = 'none'; + assert_equals(getComputedStyle(target).d, "none"); + + target.style.d = 'path("M2,2 h3 v5")'; + assert_equals(target.getPathSegAtLength(5), 2); +}, "getPathSegAtLength works properly after updating d property"); + +</script> |