<!doctype html>
<meta charset="utf-8">
<title>Geometry Interfaces: DOMPointReadOnly</title>
<link rel="help" href="https://drafts.fxtf.org/geometry/#DOMPoint">
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="./resources/geometry-interfaces-test-helpers.js"></script>
<script>
'use strict';
test(() => {
var point = new DOMPointReadOnly();
assert_dom_point_equals(point, [0, 0, 0, 1]);
}, 'DOMPointReadOnly constructor without parameter');
test(() => {
var point = new DOMPointReadOnly(10);
assert_dom_point_equals(point, [10, 0, 0, 1]);
}, 'DOMPointReadOnly constructor with x parameter');
test(() => {
var point = new DOMPointReadOnly(10, 20);
assert_dom_point_equals(point, [10, 20, 0, 1]);
}, 'DOMPointReadOnly constructor with x, y parameters');
test(() => {
var point = new DOMPointReadOnly(10, 20, 30);
assert_dom_point_equals(point, [10, 20, 30, 1]);
}, 'DOMPointReadOnly constructor with x, y, z parameters');
test(() => {
var point = new DOMPointReadOnly(10, 20, 30, 40);
assert_dom_point_equals(point, [10, 20, 30, 40]);
}, 'DOMPointReadOnly constructor with x, y, z, w parameters');
test(() => {
var point = new DOMPointReadOnly(1, 2, 3, 4);
assert_readonly(point, 'x');
assert_readonly(point, 'y');
assert_readonly(point, 'z');
assert_readonly(point, 'w');
}, 'DOMPointReadOnly readonly test');
test(() => {
var point = new DOMPointReadOnly(1, 2, 3, 4);
assert_object_equals(point.toJSON(), {x: 1, y: 2, z: 3, w: 4});
}, 'DOMPointReadOnly toJSON');
test(() => {
var point = DOMPointReadOnly.fromPoint({x: 1, y: 2, z: 3, w: 4});
assert_dom_point_equals(point, [1, 2, 3, 4]);
}, 'DOMPointReadOnly.fromPoint({x: 1, y: 2, z: 3, w: 4}) should create a DOMPointReadOnly');
test(() => {
var point = DOMPointReadOnly.fromPoint();
assert_dom_point_equals(point, [0, 0, 0, 1]);
}, 'DOMPointReadOnly.fromPoint() should create a DOMPointReadOnly');
test(() => {
var point1 = DOMPointReadOnly.fromPoint();
var point2 = DOMPointReadOnly.fromPoint();
assert_false(point1 == point2);
assert_dom_point_equals(point1, point2);
}, 'DOMPointReadOnly.fromPoint() should create a new DOMPointReadOnly');
test(() => {
var point = new DOMPointReadOnly(5, 4);
var transformed_point = point.matrixTransform(new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]));
assert_dom_point_equals(transformed_point, new DOMPoint(22, 32));
}, 'DOMMatrixReadOnly.matrixTransform() - 2d matrixTransform');
test(() => {
var point = new DOMPointReadOnly(5, 4);
var transformed_point = point.matrixTransform(new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]));
assert_dom_point_equals(transformed_point, new DOMPoint(38, 48, 58, 68));
}, 'DOMMatrixReadOnly.matrixTransform() - 3d matrixTransform');
</script>