@flighthq/application 0.5.1-next.903.f434bc2 → 0.5.1-next.905.5fbf787
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 +4 -4
- package/src/application.test.ts +7 -1
- package/src/applicationRenderView.test.ts +31 -25
- package/src/window.test.ts +7 -1
package/README.md
CHANGED
|
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/application`. The `@
|
|
|
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/application@0.5.1-next.
|
|
17
|
-
- [License](https://github.com/flighthq/flight/blob/
|
|
16
|
+
- [Source for @flighthq/application@0.5.1-next.905.5fbf787](https://github.com/flighthq/flight/tree/5fbf7874064c384307542d68b4dcb6a895ff0dcf/packages/application)
|
|
17
|
+
- [License](https://github.com/flighthq/flight/blob/5fbf7874064c384307542d68b4dcb6a895ff0dcf/LICENSE.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/application",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.905.5fbf787",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flighthq/entity": "0.5.1-next.
|
|
42
|
-
"@flighthq/signals": "0.5.1-next.
|
|
43
|
-
"@flighthq/types": "0.5.1-next.
|
|
41
|
+
"@flighthq/entity": "0.5.1-next.905.5fbf787",
|
|
42
|
+
"@flighthq/signals": "0.5.1-next.905.5fbf787",
|
|
43
|
+
"@flighthq/types": "0.5.1-next.905.5fbf787"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"typescript": "^5.3.0"
|
package/src/application.test.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
getApplicationFrameRate,
|
|
14
14
|
getApplicationMainWindow,
|
|
15
15
|
getApplicationWindows,
|
|
16
|
+
initializeApplication,
|
|
16
17
|
isApplicationRunning,
|
|
17
18
|
pauseApplicationLoop,
|
|
18
19
|
registerApplicationWindow,
|
|
@@ -342,6 +343,12 @@ describe('getApplicationWindows', () => {
|
|
|
342
343
|
});
|
|
343
344
|
});
|
|
344
345
|
|
|
346
|
+
describe('initializeApplication', () => {
|
|
347
|
+
it('is the construction initializer of createApplication', () => {
|
|
348
|
+
expect(typeof initializeApplication).toBe('function');
|
|
349
|
+
});
|
|
350
|
+
});
|
|
351
|
+
|
|
345
352
|
describe('isApplicationRunning', () => {
|
|
346
353
|
it('returns false before loop is started', () => {
|
|
347
354
|
const app = createApplication();
|
|
@@ -870,7 +877,6 @@ describe('stopApplicationLoop', () => {
|
|
|
870
877
|
expect(renders).toBe(1);
|
|
871
878
|
});
|
|
872
879
|
});
|
|
873
|
-
|
|
874
880
|
describe('unregisterApplicationWindow', () => {
|
|
875
881
|
it('removes a registered window', () => {
|
|
876
882
|
const app = createApplication();
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
attachApplicationRenderView,
|
|
7
7
|
createApplicationRenderView,
|
|
8
8
|
detachApplicationRenderView,
|
|
9
|
+
initializeApplicationRenderView,
|
|
9
10
|
synchronizeApplicationRenderView,
|
|
10
11
|
} from './applicationRenderView';
|
|
11
12
|
import { createApplicationWindow } from './window';
|
|
@@ -52,31 +53,9 @@ describe('detachApplicationRenderView', () => {
|
|
|
52
53
|
});
|
|
53
54
|
});
|
|
54
55
|
|
|
55
|
-
describe('
|
|
56
|
-
it('
|
|
57
|
-
|
|
58
|
-
window.width = 100;
|
|
59
|
-
window.height = 60;
|
|
60
|
-
window.devicePixelRatio = 1.5;
|
|
61
|
-
viewport.x = 8;
|
|
62
|
-
viewport.y = 9;
|
|
63
|
-
resize.mockClear();
|
|
64
|
-
|
|
65
|
-
synchronizeApplicationRenderView(view);
|
|
66
|
-
|
|
67
|
-
expect(resize).toHaveBeenCalledWith(state, target, 150, 90);
|
|
68
|
-
expect(viewport).toMatchObject({ devicePixelRatio: 1.5, height: 90, width: 150, x: 0, y: 0 });
|
|
69
|
-
expect(state.pixelRatio).toBe(1.5);
|
|
70
|
-
expect(state.renderTransform2D).toMatchObject({ a: 1.5, b: 0, c: 0, d: 1.5, tx: 0, ty: 0 });
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it('invokes the backend resize seam even when the requested extent is unchanged', () => {
|
|
74
|
-
const { resize, view } = makeView();
|
|
75
|
-
resize.mockClear();
|
|
76
|
-
|
|
77
|
-
synchronizeApplicationRenderView(view);
|
|
78
|
-
|
|
79
|
-
expect(resize).toHaveBeenCalledOnce();
|
|
56
|
+
describe('initializeApplicationRenderView', () => {
|
|
57
|
+
it('is the construction initializer of createApplicationRenderView', () => {
|
|
58
|
+
expect(typeof initializeApplicationRenderView).toBe('function');
|
|
80
59
|
});
|
|
81
60
|
});
|
|
82
61
|
|
|
@@ -108,3 +87,30 @@ function makeView() {
|
|
|
108
87
|
function makeMatrix(): Matrix {
|
|
109
88
|
return { a: 1, b: 0, c: 0, d: 1, tx: 0, ty: 0 } as Matrix;
|
|
110
89
|
}
|
|
90
|
+
describe('synchronizeApplicationRenderView', () => {
|
|
91
|
+
it('writes device-pixel target, viewport, and render-state values from the window authority', () => {
|
|
92
|
+
const { resize, state, target, view, viewport, window } = makeView();
|
|
93
|
+
window.width = 100;
|
|
94
|
+
window.height = 60;
|
|
95
|
+
window.devicePixelRatio = 1.5;
|
|
96
|
+
viewport.x = 8;
|
|
97
|
+
viewport.y = 9;
|
|
98
|
+
resize.mockClear();
|
|
99
|
+
|
|
100
|
+
synchronizeApplicationRenderView(view);
|
|
101
|
+
|
|
102
|
+
expect(resize).toHaveBeenCalledWith(state, target, 150, 90);
|
|
103
|
+
expect(viewport).toMatchObject({ devicePixelRatio: 1.5, height: 90, width: 150, x: 0, y: 0 });
|
|
104
|
+
expect(state.pixelRatio).toBe(1.5);
|
|
105
|
+
expect(state.renderTransform2D).toMatchObject({ a: 1.5, b: 0, c: 0, d: 1.5, tx: 0, ty: 0 });
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it('invokes the backend resize seam even when the requested extent is unchanged', () => {
|
|
109
|
+
const { resize, view } = makeView();
|
|
110
|
+
resize.mockClear();
|
|
111
|
+
|
|
112
|
+
synchronizeApplicationRenderView(view);
|
|
113
|
+
|
|
114
|
+
expect(resize).toHaveBeenCalledOnce();
|
|
115
|
+
});
|
|
116
|
+
});
|
package/src/window.test.ts
CHANGED
|
@@ -58,6 +58,7 @@ import {
|
|
|
58
58
|
focusWindow,
|
|
59
59
|
getWindowBounds,
|
|
60
60
|
hideWindow,
|
|
61
|
+
initializeApplicationWindow,
|
|
61
62
|
lockApplicationPointer,
|
|
62
63
|
maximizeWindow,
|
|
63
64
|
minimizeWindow,
|
|
@@ -1230,6 +1231,12 @@ describe('hideWindow', () => {
|
|
|
1230
1231
|
});
|
|
1231
1232
|
});
|
|
1232
1233
|
|
|
1234
|
+
describe('initializeApplicationWindow', () => {
|
|
1235
|
+
it('is the construction initializer of createApplicationWindow', () => {
|
|
1236
|
+
expect(typeof initializeApplicationWindow).toBe('function');
|
|
1237
|
+
});
|
|
1238
|
+
});
|
|
1239
|
+
|
|
1233
1240
|
describe('lockApplicationPointer', () => {
|
|
1234
1241
|
it('passes the opaque target to the pointer-lock command capability', async () => {
|
|
1235
1242
|
const target = createInputTarget();
|
|
@@ -1703,7 +1710,6 @@ describe('setWindowTitle', () => {
|
|
|
1703
1710
|
expect(backend.calls).toContain('setTitle:My App');
|
|
1704
1711
|
});
|
|
1705
1712
|
});
|
|
1706
|
-
|
|
1707
1713
|
describe('showWindow', () => {
|
|
1708
1714
|
it('marks visible and delegates to the backend', () => {
|
|
1709
1715
|
const backend = recordingWindowBackend();
|