summaryrefslogtreecommitdiff
path: root/installed-tests/js/testCairoModule.js
blob: 17c0b47cdfe3b361808241e9372a8725e89599df (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
// SPDX-License-Identifier: MIT OR LGPL-2.0-or-later
// SPDX-FileCopyrightText: 2021 Philip Chimento <philip.chimento@gmail.com>

import Cairo from 'cairo';
import giCairo from 'gi://cairo';

describe('Cairo imported as ES module', function () {
    it('cairo default import', function () {
        // one from cairoNative, one from cairo JS.
        expect(typeof Cairo.Context).toBe('function');
        expect(typeof Cairo.Format).toBe('object');
    });

    // cairo doesn't have named exports
});

describe('Cairo imported via GI', function () {
    it('has the same functionality as imports.cairo', function () {
        const surface = new giCairo.ImageSurface(Cairo.Format.ARGB32, 1, 1);
        void new giCairo.Context(surface);
    });

    it('has boxed types from the GIR file', function () {
        void new giCairo.RectangleInt();
    });
});