summaryrefslogtreecommitdiffstats
path: root/toolkit/components/uniffi-bindgen-gecko-js/fixtures/tests/xpcshell/test_external_types.js
blob: 699dcfe6f3431db25a430d9801483ad7a25e2cd5 (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({
    start: await new ExternalTypes.Point({ coordX: 0, coordY: 0 }),
    end: await new ExternalTypes.Point({ coordX: 2, coordY: 1 }),
  });
  Assert.equal(await ExternalTypes.gradient(line), 0.5);

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