blob: cdb552e4ef5122c08e600560f18026a661a26953 (
plain)
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
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
const Geometry = ChromeUtils.importESModule(
"resource://gre/modules/RustGeometry.sys.mjs"
);
add_task(async function () {
const ln1 = new Geometry.Line(
new Geometry.Point({ coord_x: 0, coord_y: 0 }),
new Geometry.Point({ coord_x: 1, coord_y: 2 })
);
const ln2 = new Geometry.Line(
new Geometry.Point({ coord_x: 1, coord_y: 1 }),
new Geometry.Point({ coord_x: 2, coord_y: 2 })
);
const origin = new Geometry.Point({ coord_x: 0, coord_y: 0 });
Assert.ok(
(await Geometry.intersection({ start: ln1, end: ln2 })).equals(origin)
);
Assert.deepEqual(
await Geometry.intersection({ start: ln1, end: ln2 }),
origin
);
Assert.strictEqual(
await Geometry.intersection({ start: ln1, end: ln1 }),
null
);
});
|