@flighthq/surface 0.5.1-next.1629.669e7c5 → 0.5.1-next.1680.bdc44c6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/package.json +3 -3
- package/src/canvasSurface.test.ts +33 -5
package/README.md
CHANGED
|
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/surface`. The `@flig
|
|
|
13
13
|
This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
|
|
14
14
|
|
|
15
15
|
- [Flight project](https://github.com/flighthq/flight)
|
|
16
|
-
- [Source for @flighthq/surface@0.5.1-next.
|
|
17
|
-
- [License](https://github.com/flighthq/flight/blob/
|
|
16
|
+
- [Source for @flighthq/surface@0.5.1-next.1680.bdc44c6](https://github.com/flighthq/flight/tree/bdc44c63675b7c50301154e66b79e2d29d6262da/packages/surface)
|
|
17
|
+
- [License](https://github.com/flighthq/flight/blob/bdc44c63675b7c50301154e66b79e2d29d6262da/LICENSE.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/surface",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.1680.bdc44c6",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flighthq/entity": "0.5.1-next.
|
|
42
|
-
"@flighthq/types": "0.5.1-next.
|
|
41
|
+
"@flighthq/entity": "0.5.1-next.1680.bdc44c6",
|
|
42
|
+
"@flighthq/types": "0.5.1-next.1680.bdc44c6"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"typescript": "^5.3.0"
|
|
@@ -15,7 +15,12 @@ describe('createCanvasSurface', () => {
|
|
|
15
15
|
it('allocates a drawable in the window and acquires a 2D context on it', () => {
|
|
16
16
|
const create = vi.fn(() => 'canvas');
|
|
17
17
|
const acquire = vi.fn(() => context);
|
|
18
|
-
const surface = createCanvasSurface(
|
|
18
|
+
const surface = createCanvasSurface(
|
|
19
|
+
canvasCapability({ acquire, create, createSurface: () => null, destroySurface() {}, release() {} }),
|
|
20
|
+
appWindow,
|
|
21
|
+
320,
|
|
22
|
+
240,
|
|
23
|
+
);
|
|
19
24
|
|
|
20
25
|
expect(surface!.__brand).toBe('CanvasSurface');
|
|
21
26
|
expect(surface!.context).toBe(context);
|
|
@@ -26,7 +31,12 @@ describe('createCanvasSurface', () => {
|
|
|
26
31
|
it('returns null without acquiring when the window cannot yield a drawable', () => {
|
|
27
32
|
const acquire = vi.fn(() => context);
|
|
28
33
|
expect(
|
|
29
|
-
createCanvasSurface(
|
|
34
|
+
createCanvasSurface(
|
|
35
|
+
canvasCapability({ acquire, create: () => null, createSurface: () => null, destroySurface() {}, release() {} }),
|
|
36
|
+
appWindow,
|
|
37
|
+
8,
|
|
38
|
+
8,
|
|
39
|
+
),
|
|
30
40
|
).toBeNull();
|
|
31
41
|
expect(acquire).not.toHaveBeenCalled();
|
|
32
42
|
});
|
|
@@ -34,7 +44,13 @@ describe('createCanvasSurface', () => {
|
|
|
34
44
|
it('returns null when the drawable cannot rasterize 2D', () => {
|
|
35
45
|
expect(
|
|
36
46
|
createCanvasSurface(
|
|
37
|
-
canvasCapability({
|
|
47
|
+
canvasCapability({
|
|
48
|
+
acquire: () => null,
|
|
49
|
+
create: () => 'canvas',
|
|
50
|
+
createSurface: () => null,
|
|
51
|
+
destroySurface() {},
|
|
52
|
+
release() {},
|
|
53
|
+
}),
|
|
38
54
|
appWindow,
|
|
39
55
|
8,
|
|
40
56
|
8,
|
|
@@ -47,7 +63,13 @@ describe('createCanvasSurfaceFromNativeHandle', () => {
|
|
|
47
63
|
it('adopts a drawable the caller owns without allocating one', () => {
|
|
48
64
|
const create = vi.fn(() => 'unused');
|
|
49
65
|
const surface = createCanvasSurfaceFromNativeHandle(
|
|
50
|
-
canvasCapability({
|
|
66
|
+
canvasCapability({
|
|
67
|
+
acquire: () => context,
|
|
68
|
+
create,
|
|
69
|
+
createSurface: () => null,
|
|
70
|
+
destroySurface() {},
|
|
71
|
+
release() {},
|
|
72
|
+
}),
|
|
51
73
|
'adopted',
|
|
52
74
|
);
|
|
53
75
|
|
|
@@ -59,7 +81,13 @@ describe('createCanvasSurfaceFromNativeHandle', () => {
|
|
|
59
81
|
describe('destroyCanvasSurface', () => {
|
|
60
82
|
it('releases the surface through the capability', () => {
|
|
61
83
|
const release = vi.fn();
|
|
62
|
-
const capability = canvasCapability({
|
|
84
|
+
const capability = canvasCapability({
|
|
85
|
+
acquire: () => context,
|
|
86
|
+
create: () => 'canvas',
|
|
87
|
+
createSurface: () => null,
|
|
88
|
+
destroySurface() {},
|
|
89
|
+
release,
|
|
90
|
+
});
|
|
63
91
|
const surface = createCanvasSurface(capability, appWindow, 8, 8) as CanvasSurface;
|
|
64
92
|
destroyCanvasSurface(capability, surface);
|
|
65
93
|
|