IDLGenerators: Handle restricted/unrestricted floating point types

This commit is contained in:
Matthew Olsson 2024-05-27 08:04:58 -07:00 committed by Andreas Kling
commit 3e221fbb2d
Notes: sideshowbarker 2024-07-17 07:09:53 +09:00
8 changed files with 108 additions and 15 deletions

View file

@ -0,0 +1,28 @@
<!DOCTYPE html>
<script src="../../include.js"></script>
<script>
test(() => {
function checkException(name, cb) {
try {
cb();
println(`${name}: did not throw an exception`);
} catch (e) {
println(`${name}: threw an exception`);
}
}
// Test invalid values
checkException('KeyframeEffect with NaN options value', () => new KeyframeEffect(null, null, NaN));
checkException('KeyframeEffect with infinite delay value', () => new KeyframeEffect(null, null, { delay: -Infinity }));;
checkException('KeyframeEffect with NaN delay value', () => new KeyframeEffect(null, null, { delay: NaN }));
checkException('KeyframeEffect with infinite endDelay value', () => new KeyframeEffect(null, null, { endDelay: Infinity }));
checkException('KeyframeEffect with NaN endDelay value', () => new KeyframeEffect(null, null, { endDelay: NaN }));
checkException('KeyframeEffect with NaN iterations', () => new KeyframeEffect(null, null, { iterations: NaN }));
// Test valid values
checkException('KeyframeEffect with infinite options value', () => new KeyframeEffect(null, null, Infinity));
checkException('KeyframeEffect with finite options value', () => new KeyframeEffect(null, null, 1234.5));
checkException('KeyframeEffect with infinite iterations', () => new KeyframeEffect(null, null, { iterations: Infinity }));
checkException('KeyframeEffect with infinite duration', () => new KeyframeEffect(null, null, { duration: Infinity }));
});
</script>