summaryrefslogtreecommitdiffstats
path: root/toolkit/components/uniffi-bindgen-gecko-js/fixtures/tests/xpcshell/test_external_types.js
blob: e2f985cde734a1c073030364a2b7e9337cbf9be5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

const ExternalTypes = ChromeUtils.importESModule(
  "resource://gre/modules/RustExternalTypes.sys.mjs"
);

add_task(async function () {
  const line = new ExternalTypes.Line(
    new ExternalTypes.Point(0, 0, "p1"),
    new ExternalTypes.Point(2, 1, "p2")
  );
  Assert.equal(await ExternalTypes.gradient(line), 0.5);

  Assert.equal(await ExternalTypes.gradient(null), 0.0);
});