File: DOMPoint-001.html

package info (click to toggle)
thunderbird 1%3A91.13.0-1~deb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,953,400 kB
  • sloc: cpp: 6,084,049; javascript: 4,790,441; ansic: 3,341,496; python: 862,958; asm: 366,542; xml: 204,277; java: 152,477; sh: 111,436; makefile: 21,388; perl: 15,312; yacc: 4,583; objc: 3,026; lex: 1,720; exp: 762; pascal: 635; awk: 564; sql: 453; php: 436; lisp: 432; ruby: 99; sed: 69; csh: 45
file content (83 lines) | stat: -rw-r--r-- 3,598 bytes parent folder | download | duplicates (26)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<!DOCTYPE html>
<html>
<head>
    <title>Geometry Interfaces: DOMPoint and DOMPointReadOnly interface tests</title>
    <link rel="author" title="Dirk Schulze" href="mailto:dschulze@adobe.com" />
    <link rel="help" href="https://www.w3.org/TR/geometry-1/#dictdef-dompointinit">
    <link rel="help" href="https://www.w3.org/TR/geometry-1/#dom-dompoint-dompoint">
    <link rel="help" href="https://www.w3.org/TR/geometry-1/#DOMPoint">
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
</head>
<body>
    <p>Test DOMPoint and DOMPointReadOnly interfaces</p>
    <div id="log"></div>
    <script>
        test(function() {
            checkDOMPoint(new DOMPoint(), {x:0, y:0, z:0, w:1});
        },'testConstructor0');
        test(function() {
            checkDOMPoint(new DOMPoint(1), {x:1, y:0, z:0, w:1});
        },'testConstructor1');
        test(function() {
            checkDOMPoint(new DOMPoint(1, 2), {x:1, y:2, z:0, w:1});
        },'testConstructor2');
        test(function() {
            checkDOMPoint(new DOMPoint(1, 2, 3), {x:1, y:2, z:3, w:1});
        },'testConstructor3');
        test(function() {
            checkDOMPoint(new DOMPoint(1, 2, 3, 4), {x:1, y:2, z:3, w:4});
        },'testConstructor4');
        test(function() {
            checkDOMPoint(new DOMPoint(1, 2, 3, 4, 5), {x:1, y:2, z:3, w:4});
        },'testConstructor5');
        test(function() {
            checkDOMPoint(new DOMPoint({}), {x:NaN, y:0, z:0, w:1});
        },'testConstructorDictionary0');
        test(function() {
            checkDOMPoint(new DOMPoint({x:1}), {x:NaN, y:0, z:0, w:1});
        },'testConstructorDictionary1');
        test(function() {
            checkDOMPoint(new DOMPoint({x:1, y:2}), {x:NaN, y:0, z:0, w:1});
        },'testConstructorDictionary2');
        test(function() {
            checkDOMPoint(new DOMPoint(1, undefined), {x:1, y:0, z:0, w:1});
        },'testConstructor2undefined');
        test(function() {
            checkDOMPoint(new DOMPoint("a", "b"), {x:NaN, y:NaN, z:0, w:1});
        },'testConstructorUndefined1');
        test(function() {
            checkDOMPoint(new DOMPoint({x:"a", y:"b"}), {x:NaN, y:0, z:0, w:1});
        },'testConstructorUndefined2');
        test(function() {
            checkDOMPoint(new DOMPointReadOnly(), {x:0, y:0, z:0, w:1});
        },'DOMPointReadOnly constructor with no values');
        test(function() {
            checkDOMPoint(new DOMPointReadOnly(1, 2, 3, 4), {x:1, y:2, z:3, w:4});
        },'DOMPointReadOnly constructor with 4 values');
        test(function() {
            var p = new DOMPoint(0, 0, 0, 1);
            p.x = undefined;
            p.y = undefined;
            p.z = undefined;
            p.w = undefined;
            checkDOMPoint(p, {x:NaN, y:NaN, z:NaN, w:NaN});
        },'testAttributesUndefined');
        test(function() {
            var p = new DOMPoint(0, 0, 0, 1);
            p.x = NaN;
            p.y = Number.POSITIVE_INFINITY;
            p.z = Number.NEGATIVE_INFINITY;
            p.w = Infinity;
            checkDOMPoint(p, {x:NaN, y:Infinity, z:-Infinity, w:Infinity});
        },'testAttributesNaNInfinity');

        function checkDOMPoint(p, exp) {
            assert_equals(p.x, exp.x, "Expected value for x is " + exp.x);
            assert_equals(p.y, exp.y, "Expected value for y is " + exp.y);
            assert_equals(p.z, exp.z, "Expected value for z is " + exp.z);
            assert_equals(p.w, exp.w, "Expected value for w is " + exp.w);
        }
    </script>
</body>
</html>