diff options
Diffstat (limited to 'toolkit/components/uniffi-bindgen-gecko-js/fixtures/tests/xpcshell/test_geometry.js')
-rw-r--r-- | toolkit/components/uniffi-bindgen-gecko-js/fixtures/tests/xpcshell/test_geometry.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/tests/xpcshell/test_geometry.js b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/tests/xpcshell/test_geometry.js new file mode 100644 index 0000000000..f06ecd46aa --- /dev/null +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/tests/xpcshell/test_geometry.js @@ -0,0 +1,21 @@ +/* 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(0, 0, "p1"), + new Geometry.Point(1, 2, "p2") + ); + const ln2 = new Geometry.Line( + new Geometry.Point(1, 1, "p3"), + new Geometry.Point(2, 2, "p4") + ); + const origin = new Geometry.Point(0, 0); + Assert.ok((await Geometry.intersection(ln1, ln2)).equals(origin)); + Assert.deepEqual(await Geometry.intersection(ln1, ln2), origin); + Assert.strictEqual(await Geometry.intersection(ln1, ln1), null); +}); |