@holoscript/core 2.0.0 → 2.0.2
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/LICENSE +21 -0
- package/dist/chunk-3N67RLQP.cjs +1298 -0
- package/dist/chunk-3N67RLQP.cjs.map +1 -0
- package/dist/chunk-3X2EGU7Z.cjs +52 -0
- package/dist/chunk-3X2EGU7Z.cjs.map +1 -0
- package/dist/chunk-4CV4JOE5.js +24 -0
- package/dist/chunk-4CV4JOE5.js.map +1 -0
- package/dist/chunk-4OHVW4XR.cjs +1027 -0
- package/dist/chunk-4OHVW4XR.cjs.map +1 -0
- package/dist/chunk-CZLDE2OZ.cjs +28 -0
- package/dist/chunk-CZLDE2OZ.cjs.map +1 -0
- package/{src/HoloScriptRuntime.ts → dist/chunk-EU6CZMGJ.js} +437 -794
- package/dist/chunk-EU6CZMGJ.js.map +1 -0
- package/dist/chunk-KWYIVRIH.js +344 -0
- package/dist/chunk-KWYIVRIH.js.map +1 -0
- package/dist/chunk-MCP6D4LT.js +1025 -0
- package/dist/chunk-MCP6D4LT.js.map +1 -0
- package/dist/chunk-SATNCODL.js +45 -0
- package/dist/chunk-SATNCODL.js.map +1 -0
- package/dist/chunk-VMZN4EVR.cjs +347 -0
- package/dist/chunk-VMZN4EVR.cjs.map +1 -0
- package/{src/HoloScriptDebugger.ts → dist/chunk-VYIDLUCV.js} +118 -257
- package/dist/chunk-VYIDLUCV.js.map +1 -0
- package/dist/chunk-WFI4T3XB.cjs +424 -0
- package/dist/chunk-WFI4T3XB.cjs.map +1 -0
- package/dist/debugger.cjs +20 -0
- package/dist/debugger.cjs.map +1 -0
- package/dist/debugger.d.cts +171 -0
- package/dist/debugger.d.ts +171 -0
- package/dist/debugger.js +7 -0
- package/dist/debugger.js.map +1 -0
- package/dist/index.cjs +6006 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2482 -0
- package/dist/index.d.ts +2482 -0
- package/dist/index.js +5926 -0
- package/dist/index.js.map +1 -0
- package/dist/parser.cjs +14 -0
- package/dist/parser.cjs.map +1 -0
- package/dist/parser.d.cts +139 -0
- package/dist/parser.d.ts +139 -0
- package/dist/parser.js +5 -0
- package/dist/parser.js.map +1 -0
- package/dist/runtime.cjs +14 -0
- package/dist/runtime.cjs.map +1 -0
- package/dist/runtime.d.cts +180 -0
- package/dist/runtime.d.ts +180 -0
- package/dist/runtime.js +5 -0
- package/dist/runtime.js.map +1 -0
- package/dist/type-checker.cjs +17 -0
- package/dist/type-checker.cjs.map +1 -0
- package/dist/type-checker.d.cts +105 -0
- package/dist/type-checker.d.ts +105 -0
- package/dist/type-checker.js +4 -0
- package/dist/type-checker.js.map +1 -0
- package/dist/types-D6g4ACjP.d.cts +262 -0
- package/dist/types-D6g4ACjP.d.ts +262 -0
- package/package.json +11 -8
- package/src/HoloScript2DParser.js +0 -227
- package/src/HoloScript2DParser.ts +0 -261
- package/src/HoloScriptCodeParser.js +0 -1102
- package/src/HoloScriptCodeParser.ts +0 -1188
- package/src/HoloScriptDebugger.js +0 -458
- package/src/HoloScriptParser.js +0 -338
- package/src/HoloScriptParser.ts +0 -397
- package/src/HoloScriptPlusParser.js +0 -371
- package/src/HoloScriptPlusParser.ts +0 -543
- package/src/HoloScriptRuntime.js +0 -1399
- package/src/HoloScriptRuntime.test.js +0 -351
- package/src/HoloScriptRuntime.test.ts +0 -436
- package/src/HoloScriptTypeChecker.js +0 -356
- package/src/HoloScriptTypeChecker.ts +0 -475
- package/src/__tests__/GraphicsServices.test.js +0 -357
- package/src/__tests__/GraphicsServices.test.ts +0 -427
- package/src/__tests__/HoloScriptPlusParser.test.js +0 -317
- package/src/__tests__/HoloScriptPlusParser.test.ts +0 -392
- package/src/__tests__/integration.test.js +0 -336
- package/src/__tests__/integration.test.ts +0 -416
- package/src/__tests__/performance.bench.js +0 -218
- package/src/__tests__/performance.bench.ts +0 -262
- package/src/__tests__/type-checker.test.js +0 -60
- package/src/__tests__/type-checker.test.ts +0 -73
- package/src/index.js +0 -217
- package/src/index.ts +0 -426
- package/src/interop/Interoperability.js +0 -413
- package/src/interop/Interoperability.ts +0 -494
- package/src/logger.js +0 -42
- package/src/logger.ts +0 -57
- package/src/parser/EnhancedParser.js +0 -205
- package/src/parser/EnhancedParser.ts +0 -251
- package/src/parser/HoloScriptPlusParser.js +0 -928
- package/src/parser/HoloScriptPlusParser.ts +0 -1089
- package/src/runtime/HoloScriptPlusRuntime.js +0 -674
- package/src/runtime/HoloScriptPlusRuntime.ts +0 -861
- package/src/runtime/PerformanceTelemetry.js +0 -323
- package/src/runtime/PerformanceTelemetry.ts +0 -467
- package/src/runtime/RuntimeOptimization.js +0 -361
- package/src/runtime/RuntimeOptimization.ts +0 -416
- package/src/services/HololandGraphicsPipelineService.js +0 -506
- package/src/services/HololandGraphicsPipelineService.ts +0 -662
- package/src/services/PlatformPerformanceOptimizer.js +0 -356
- package/src/services/PlatformPerformanceOptimizer.ts +0 -503
- package/src/state/ReactiveState.js +0 -427
- package/src/state/ReactiveState.ts +0 -572
- package/src/tools/DeveloperExperience.js +0 -376
- package/src/tools/DeveloperExperience.ts +0 -438
- package/src/traits/AIDriverTrait.js +0 -322
- package/src/traits/AIDriverTrait.test.js +0 -329
- package/src/traits/AIDriverTrait.test.ts +0 -357
- package/src/traits/AIDriverTrait.ts +0 -474
- package/src/traits/LightingTrait.js +0 -313
- package/src/traits/LightingTrait.test.js +0 -410
- package/src/traits/LightingTrait.test.ts +0 -462
- package/src/traits/LightingTrait.ts +0 -505
- package/src/traits/MaterialTrait.js +0 -194
- package/src/traits/MaterialTrait.test.js +0 -286
- package/src/traits/MaterialTrait.test.ts +0 -329
- package/src/traits/MaterialTrait.ts +0 -324
- package/src/traits/RenderingTrait.js +0 -356
- package/src/traits/RenderingTrait.test.js +0 -363
- package/src/traits/RenderingTrait.test.ts +0 -427
- package/src/traits/RenderingTrait.ts +0 -555
- package/src/traits/VRTraitSystem.js +0 -740
- package/src/traits/VRTraitSystem.ts +0 -1040
- package/src/traits/VoiceInputTrait.js +0 -284
- package/src/traits/VoiceInputTrait.test.js +0 -226
- package/src/traits/VoiceInputTrait.test.ts +0 -252
- package/src/traits/VoiceInputTrait.ts +0 -401
- package/src/types/AdvancedTypeSystem.js +0 -226
- package/src/types/AdvancedTypeSystem.ts +0 -494
- package/src/types/HoloScriptPlus.d.ts +0 -853
- package/src/types.js +0 -6
- package/src/types.ts +0 -369
- package/tsconfig.json +0 -23
- package/tsup.config.d.ts +0 -2
- package/tsup.config.js +0 -18
- package/tsup.config.ts +0 -19
|
@@ -1,427 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Graphics Services Tests
|
|
3
|
-
*
|
|
4
|
-
* Tests for HololandGraphicsPipelineService and PlatformPerformanceOptimizer
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { describe, it, expect, beforeEach } from 'vitest';
|
|
8
|
-
import { HololandGraphicsPipelineService } from '../services/HololandGraphicsPipelineService';
|
|
9
|
-
import { PlatformPerformanceOptimizer } from '../services/PlatformPerformanceOptimizer';
|
|
10
|
-
|
|
11
|
-
// ============================================================================
|
|
12
|
-
// Hololand Graphics Pipeline Service Tests
|
|
13
|
-
// ============================================================================
|
|
14
|
-
|
|
15
|
-
describe('HololandGraphicsPipelineService', () => {
|
|
16
|
-
describe('Initialization', () => {
|
|
17
|
-
it('should create instance with default settings', () => {
|
|
18
|
-
const service = new HololandGraphicsPipelineService('desktop');
|
|
19
|
-
expect(service).toBeDefined();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should initialize for mobile platform', () => {
|
|
23
|
-
const service = new HololandGraphicsPipelineService('mobile');
|
|
24
|
-
const estimate = service.getGPUMemoryEstimate();
|
|
25
|
-
expect(estimate.budget).toBe(256); // Mobile budget
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('should initialize for VR platform', () => {
|
|
29
|
-
const service = new HololandGraphicsPipelineService('vr');
|
|
30
|
-
const estimate = service.getGPUMemoryEstimate();
|
|
31
|
-
expect(estimate.budget).toBe(512); // VR budget
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('should initialize for desktop platform', () => {
|
|
35
|
-
const service = new HololandGraphicsPipelineService('desktop');
|
|
36
|
-
const estimate = service.getGPUMemoryEstimate();
|
|
37
|
-
expect(estimate.budget).toBe(2048); // Desktop budget
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
describe('GPU Memory Management', () => {
|
|
42
|
-
it('should estimate GPU memory correctly', () => {
|
|
43
|
-
const service = new HololandGraphicsPipelineService('desktop');
|
|
44
|
-
const estimate = service.getGPUMemoryEstimate();
|
|
45
|
-
|
|
46
|
-
expect(estimate.textureMemory).toBeGreaterThanOrEqual(0);
|
|
47
|
-
expect(estimate.geometryMemory).toBeGreaterThanOrEqual(0);
|
|
48
|
-
expect(estimate.estimatedTotal).toBeGreaterThanOrEqual(0);
|
|
49
|
-
expect(estimate.utilization).toBeGreaterThanOrEqual(0);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('should track memory utilization', () => {
|
|
53
|
-
const service = new HololandGraphicsPipelineService('mobile');
|
|
54
|
-
const estimate = service.getGPUMemoryEstimate();
|
|
55
|
-
|
|
56
|
-
// Should not exceed budget
|
|
57
|
-
expect(estimate.utilization).toBeLessThanOrEqual(100);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('should allow setting memory budget', () => {
|
|
61
|
-
const service = new HololandGraphicsPipelineService('desktop');
|
|
62
|
-
service.setMemoryBudget(1024);
|
|
63
|
-
|
|
64
|
-
const estimate = service.getGPUMemoryEstimate();
|
|
65
|
-
expect(estimate.budget).toBe(1024);
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
describe('Platform Optimization', () => {
|
|
70
|
-
it('should optimize for mobile', () => {
|
|
71
|
-
const service = new HololandGraphicsPipelineService('desktop');
|
|
72
|
-
service.optimizePlatform('mobile');
|
|
73
|
-
|
|
74
|
-
const estimate = service.getGPUMemoryEstimate();
|
|
75
|
-
expect(estimate.budget).toBe(256);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('should optimize for VR', () => {
|
|
79
|
-
const service = new HololandGraphicsPipelineService('desktop');
|
|
80
|
-
service.optimizePlatform('vr');
|
|
81
|
-
|
|
82
|
-
const estimate = service.getGPUMemoryEstimate();
|
|
83
|
-
expect(estimate.budget).toBe(512);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it('should optimize for desktop', () => {
|
|
87
|
-
const service = new HololandGraphicsPipelineService('mobile');
|
|
88
|
-
service.optimizePlatform('desktop');
|
|
89
|
-
|
|
90
|
-
const estimate = service.getGPUMemoryEstimate();
|
|
91
|
-
expect(estimate.budget).toBe(2048);
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
describe('Performance Metrics', () => {
|
|
96
|
-
it('should return performance metrics', () => {
|
|
97
|
-
const service = new HololandGraphicsPipelineService('desktop');
|
|
98
|
-
const metrics = service.getPerformanceMetrics();
|
|
99
|
-
|
|
100
|
-
expect(metrics).toBeDefined();
|
|
101
|
-
expect(metrics.drawCalls).toBeGreaterThanOrEqual(0);
|
|
102
|
-
expect(metrics.fps).toBeGreaterThanOrEqual(0);
|
|
103
|
-
expect(metrics.gpuMemoryUsed).toBeGreaterThanOrEqual(0);
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
describe('Graphics Configuration', () => {
|
|
108
|
-
it('should initialize from graphics configuration', () => {
|
|
109
|
-
const service = new HololandGraphicsPipelineService('desktop');
|
|
110
|
-
const config = {
|
|
111
|
-
material: { type: 'pbr', pbr: { metallic: 0.5 } },
|
|
112
|
-
lighting: { preset: 'studio' },
|
|
113
|
-
rendering: { quality: 'high' },
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
service.initialize(config);
|
|
117
|
-
|
|
118
|
-
const estimate = service.getGPUMemoryEstimate();
|
|
119
|
-
expect(estimate.estimatedTotal).toBeGreaterThanOrEqual(0);
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
// ============================================================================
|
|
125
|
-
// Platform Performance Optimizer Tests
|
|
126
|
-
// ============================================================================
|
|
127
|
-
|
|
128
|
-
describe('PlatformPerformanceOptimizer', () => {
|
|
129
|
-
describe('Device Capabilities Detection', () => {
|
|
130
|
-
it('should detect mobile device capabilities', () => {
|
|
131
|
-
const device = {
|
|
132
|
-
platform: 'mobile' as const,
|
|
133
|
-
gpuVendor: 'Qualcomm',
|
|
134
|
-
gpuModel: 'Adreno 640',
|
|
135
|
-
gpuMemory: 1024,
|
|
136
|
-
cpuCores: 4,
|
|
137
|
-
ramTotal: 4096,
|
|
138
|
-
screenResolution: { width: 1080, height: 2220 },
|
|
139
|
-
refreshRate: 90,
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
const optimizer = new PlatformPerformanceOptimizer(device);
|
|
143
|
-
const profile = optimizer.getProfile();
|
|
144
|
-
|
|
145
|
-
expect(profile.qualityLevel).toBe('low');
|
|
146
|
-
expect(profile.fpsTarget).toBe(30);
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
it('should detect VR device capabilities', () => {
|
|
150
|
-
const device = {
|
|
151
|
-
platform: 'vr' as const,
|
|
152
|
-
gpuVendor: 'NVIDIA',
|
|
153
|
-
gpuModel: 'RTX 2070',
|
|
154
|
-
gpuMemory: 8192,
|
|
155
|
-
cpuCores: 8,
|
|
156
|
-
ramTotal: 16384,
|
|
157
|
-
screenResolution: { width: 1832, height: 1920 },
|
|
158
|
-
refreshRate: 90,
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
const optimizer = new PlatformPerformanceOptimizer(device);
|
|
162
|
-
const profile = optimizer.getProfile();
|
|
163
|
-
|
|
164
|
-
expect(profile.fpsTarget).toBe(90);
|
|
165
|
-
expect(profile.qualityLevel).toBe('high');
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
it('should detect desktop device capabilities', () => {
|
|
169
|
-
const device = {
|
|
170
|
-
platform: 'desktop' as const,
|
|
171
|
-
gpuVendor: 'NVIDIA',
|
|
172
|
-
gpuModel: 'RTX 3090',
|
|
173
|
-
gpuMemory: 24576,
|
|
174
|
-
cpuCores: 16,
|
|
175
|
-
ramTotal: 32768,
|
|
176
|
-
screenResolution: { width: 3440, height: 1440 },
|
|
177
|
-
refreshRate: 165,
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
const optimizer = new PlatformPerformanceOptimizer(device);
|
|
181
|
-
const profile = optimizer.getProfile();
|
|
182
|
-
|
|
183
|
-
expect(profile.qualityLevel).toBe('ultra');
|
|
184
|
-
expect(profile.fpsTarget).toBe(165);
|
|
185
|
-
});
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
describe('Device Optimization', () => {
|
|
189
|
-
it('should generate mobile optimization settings', () => {
|
|
190
|
-
const device = {
|
|
191
|
-
platform: 'mobile' as const,
|
|
192
|
-
gpuVendor: 'Qualcomm',
|
|
193
|
-
gpuModel: 'Adreno 640',
|
|
194
|
-
gpuMemory: 1024,
|
|
195
|
-
cpuCores: 4,
|
|
196
|
-
ramTotal: 4096,
|
|
197
|
-
screenResolution: { width: 1080, height: 2220 },
|
|
198
|
-
refreshRate: 90,
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
const optimizer = new PlatformPerformanceOptimizer(device);
|
|
202
|
-
const settings = optimizer.optimizeForDevice();
|
|
203
|
-
|
|
204
|
-
expect(settings.platform).toBe('mobile');
|
|
205
|
-
expect(settings.quality).toBe('low');
|
|
206
|
-
expect(settings.textureResolution).toBeLessThanOrEqual(512);
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
it('should generate VR optimization settings', () => {
|
|
210
|
-
const device = {
|
|
211
|
-
platform: 'vr' as const,
|
|
212
|
-
gpuVendor: 'NVIDIA',
|
|
213
|
-
gpuModel: 'RTX 2070',
|
|
214
|
-
gpuMemory: 8192,
|
|
215
|
-
cpuCores: 8,
|
|
216
|
-
ramTotal: 16384,
|
|
217
|
-
screenResolution: { width: 1832, height: 1920 },
|
|
218
|
-
refreshRate: 90,
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
const optimizer = new PlatformPerformanceOptimizer(device);
|
|
222
|
-
const settings = optimizer.optimizeForDevice();
|
|
223
|
-
|
|
224
|
-
expect(settings.platform).toBe('vr');
|
|
225
|
-
expect(settings.quality).toBe('high');
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
it('should generate desktop optimization settings', () => {
|
|
229
|
-
const device = {
|
|
230
|
-
platform: 'desktop' as const,
|
|
231
|
-
gpuVendor: 'NVIDIA',
|
|
232
|
-
gpuModel: 'RTX 3090',
|
|
233
|
-
gpuMemory: 24576,
|
|
234
|
-
cpuCores: 16,
|
|
235
|
-
ramTotal: 32768,
|
|
236
|
-
screenResolution: { width: 3440, height: 1440 },
|
|
237
|
-
refreshRate: 165,
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
const optimizer = new PlatformPerformanceOptimizer(device);
|
|
241
|
-
const settings = optimizer.optimizeForDevice();
|
|
242
|
-
|
|
243
|
-
expect(settings.platform).toBe('desktop');
|
|
244
|
-
expect(settings.quality).toBe('ultra');
|
|
245
|
-
expect(settings.textureResolution).toBe(4096);
|
|
246
|
-
});
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
describe('Adaptive Quality', () => {
|
|
250
|
-
it('should track frame metrics', () => {
|
|
251
|
-
const device = {
|
|
252
|
-
platform: 'mobile' as const,
|
|
253
|
-
gpuVendor: 'Qualcomm',
|
|
254
|
-
gpuModel: 'Adreno 640',
|
|
255
|
-
gpuMemory: 1024,
|
|
256
|
-
cpuCores: 4,
|
|
257
|
-
ramTotal: 4096,
|
|
258
|
-
screenResolution: { width: 1080, height: 2220 },
|
|
259
|
-
refreshRate: 90,
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
const optimizer = new PlatformPerformanceOptimizer(device);
|
|
263
|
-
|
|
264
|
-
// Simulate frame updates
|
|
265
|
-
optimizer.updateFrameMetrics(30, 500, 16.67);
|
|
266
|
-
optimizer.updateFrameMetrics(28, 520, 17.5);
|
|
267
|
-
optimizer.updateFrameMetrics(25, 550, 20);
|
|
268
|
-
|
|
269
|
-
// Should track without errors
|
|
270
|
-
expect(true).toBe(true);
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
it('should provide recommendations for low FPS', () => {
|
|
274
|
-
const device = {
|
|
275
|
-
platform: 'mobile' as const,
|
|
276
|
-
gpuVendor: 'Qualcomm',
|
|
277
|
-
gpuModel: 'Adreno 640',
|
|
278
|
-
gpuMemory: 1024,
|
|
279
|
-
cpuCores: 4,
|
|
280
|
-
ramTotal: 4096,
|
|
281
|
-
screenResolution: { width: 1080, height: 2220 },
|
|
282
|
-
refreshRate: 90,
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
const optimizer = new PlatformPerformanceOptimizer(device);
|
|
286
|
-
|
|
287
|
-
// Simulate low FPS frames
|
|
288
|
-
for (let i = 0; i < 10; i++) {
|
|
289
|
-
optimizer.updateFrameMetrics(20, 600, 50);
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
const recommendations = optimizer.getRecommendations();
|
|
293
|
-
expect(recommendations.length).toBeGreaterThan(0);
|
|
294
|
-
});
|
|
295
|
-
|
|
296
|
-
it('should provide recommendations for low power mode', () => {
|
|
297
|
-
const device = {
|
|
298
|
-
platform: 'mobile' as const,
|
|
299
|
-
gpuVendor: 'Qualcomm',
|
|
300
|
-
gpuModel: 'Adreno 640',
|
|
301
|
-
gpuMemory: 1024,
|
|
302
|
-
cpuCores: 4,
|
|
303
|
-
ramTotal: 4096,
|
|
304
|
-
screenResolution: { width: 1080, height: 2220 },
|
|
305
|
-
refreshRate: 90,
|
|
306
|
-
isLowPowerMode: true,
|
|
307
|
-
};
|
|
308
|
-
|
|
309
|
-
const optimizer = new PlatformPerformanceOptimizer(device);
|
|
310
|
-
const recommendations = optimizer.getRecommendations();
|
|
311
|
-
|
|
312
|
-
expect(recommendations.length).toBeGreaterThan(0);
|
|
313
|
-
expect(recommendations.some((r) => r.includes('low power'))).toBe(true);
|
|
314
|
-
});
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
describe('Performance Profiling', () => {
|
|
318
|
-
it('should create performance profile for device', () => {
|
|
319
|
-
const device = {
|
|
320
|
-
platform: 'desktop' as const,
|
|
321
|
-
gpuVendor: 'NVIDIA',
|
|
322
|
-
gpuModel: 'RTX 3090',
|
|
323
|
-
gpuMemory: 24576,
|
|
324
|
-
cpuCores: 16,
|
|
325
|
-
ramTotal: 32768,
|
|
326
|
-
screenResolution: { width: 3440, height: 1440 },
|
|
327
|
-
refreshRate: 165,
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
const optimizer = new PlatformPerformanceOptimizer(device);
|
|
331
|
-
const profile = optimizer.getProfile();
|
|
332
|
-
|
|
333
|
-
expect(profile.device).toEqual(device);
|
|
334
|
-
expect(profile.capabilities).toBeDefined();
|
|
335
|
-
expect(profile.qualityLevel).toBe('ultra');
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
it('should have appropriate CPU budget for platform', () => {
|
|
339
|
-
const mobileDevice = {
|
|
340
|
-
platform: 'mobile' as const,
|
|
341
|
-
gpuVendor: 'Qualcomm',
|
|
342
|
-
gpuModel: 'Adreno 640',
|
|
343
|
-
gpuMemory: 1024,
|
|
344
|
-
cpuCores: 4,
|
|
345
|
-
ramTotal: 4096,
|
|
346
|
-
screenResolution: { width: 1080, height: 2220 },
|
|
347
|
-
refreshRate: 90,
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
const vrDevice = {
|
|
351
|
-
platform: 'vr' as const,
|
|
352
|
-
gpuVendor: 'NVIDIA',
|
|
353
|
-
gpuModel: 'RTX 2070',
|
|
354
|
-
gpuMemory: 8192,
|
|
355
|
-
cpuCores: 8,
|
|
356
|
-
ramTotal: 16384,
|
|
357
|
-
screenResolution: { width: 1832, height: 1920 },
|
|
358
|
-
refreshRate: 90,
|
|
359
|
-
};
|
|
360
|
-
|
|
361
|
-
const mobileOptimizer = new PlatformPerformanceOptimizer(mobileDevice);
|
|
362
|
-
const vrOptimizer = new PlatformPerformanceOptimizer(vrDevice);
|
|
363
|
-
|
|
364
|
-
const mobileProfile = mobileOptimizer.getProfile();
|
|
365
|
-
const vrProfile = vrOptimizer.getProfile();
|
|
366
|
-
|
|
367
|
-
// VR should have tighter budget (90 FPS)
|
|
368
|
-
expect(vrProfile.cpuBudget).toBeLessThan(mobileProfile.cpuBudget);
|
|
369
|
-
});
|
|
370
|
-
});
|
|
371
|
-
|
|
372
|
-
describe('Compression Selection', () => {
|
|
373
|
-
it('should select ASTC for mobile', () => {
|
|
374
|
-
const device = {
|
|
375
|
-
platform: 'mobile' as const,
|
|
376
|
-
gpuVendor: 'Qualcomm',
|
|
377
|
-
gpuModel: 'Adreno 640',
|
|
378
|
-
gpuMemory: 1024,
|
|
379
|
-
cpuCores: 4,
|
|
380
|
-
ramTotal: 4096,
|
|
381
|
-
screenResolution: { width: 1080, height: 2220 },
|
|
382
|
-
refreshRate: 90,
|
|
383
|
-
};
|
|
384
|
-
|
|
385
|
-
const optimizer = new PlatformPerformanceOptimizer(device);
|
|
386
|
-
const settings = optimizer.optimizeForDevice();
|
|
387
|
-
|
|
388
|
-
expect(settings.compression).toMatch(/astc|pvrtc/);
|
|
389
|
-
});
|
|
390
|
-
|
|
391
|
-
it('should select Basis for VR', () => {
|
|
392
|
-
const device = {
|
|
393
|
-
platform: 'vr' as const,
|
|
394
|
-
gpuVendor: 'NVIDIA',
|
|
395
|
-
gpuModel: 'RTX 2070',
|
|
396
|
-
gpuMemory: 8192,
|
|
397
|
-
cpuCores: 8,
|
|
398
|
-
ramTotal: 16384,
|
|
399
|
-
screenResolution: { width: 1832, height: 1920 },
|
|
400
|
-
refreshRate: 90,
|
|
401
|
-
};
|
|
402
|
-
|
|
403
|
-
const optimizer = new PlatformPerformanceOptimizer(device);
|
|
404
|
-
const settings = optimizer.optimizeForDevice();
|
|
405
|
-
|
|
406
|
-
expect(settings.compression).toBe('basis');
|
|
407
|
-
});
|
|
408
|
-
|
|
409
|
-
it('should select no compression for desktop', () => {
|
|
410
|
-
const device = {
|
|
411
|
-
platform: 'desktop' as const,
|
|
412
|
-
gpuVendor: 'NVIDIA',
|
|
413
|
-
gpuModel: 'RTX 3090',
|
|
414
|
-
gpuMemory: 24576,
|
|
415
|
-
cpuCores: 16,
|
|
416
|
-
ramTotal: 32768,
|
|
417
|
-
screenResolution: { width: 3440, height: 1440 },
|
|
418
|
-
refreshRate: 165,
|
|
419
|
-
};
|
|
420
|
-
|
|
421
|
-
const optimizer = new PlatformPerformanceOptimizer(device);
|
|
422
|
-
const settings = optimizer.optimizeForDevice();
|
|
423
|
-
|
|
424
|
-
expect(settings.compression).toBe('none');
|
|
425
|
-
});
|
|
426
|
-
});
|
|
427
|
-
});
|