diff --git a/index.html b/index.html index 5789357319..83427a5dce 100644 --- a/index.html +++ b/index.html @@ -4,5 +4,6 @@ luma.gl tests + diff --git a/modules/core-tests/package.json b/modules/core-tests/package.json deleted file mode 100644 index 2263195f17..0000000000 --- a/modules/core-tests/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "@luma.gl/core-tests", - "version": "9.0.13", - "description": "luma.gl internal test module", - "license": "MIT", - "type": "module", - "private": true, - "repository": { - "type": "git", - "url": "https://github.com/visgl/luma.gl" - }, - "keywords": [ - "webgl", - "visualization", - "animation", - "3d" - ], - "types": "dist/index.d.ts", - "main": "dist/index.cjs", - "module": "dist/index.js", - "exports": { - ".": { - "types": "./dist/index.d.ts", - "import": "./dist/index.js", - "require": "./dist/index.cjs" - } - }, - "files": [ - "src", - "dist", - "dist.min.js", - "README.md" - ], - "sideEffects": false, - "scripts": { - "pre-build": "echo test utils has no bundle" - }, - "devDependencies": { - "@luma.gl/core": "9.0.13", - "@luma.gl/engine": "9.0.13", - "@luma.gl/shadertools": "9.0.13", - "@luma.gl/test-utils": "9.0.13", - "@luma.gl/webgl": "9.0.13", - "@luma.gl/webgpu": "9.0.13" - }, - "gitHead": "c636c34b8f1581eed163e94543a8eb1f4382ba8e" -} diff --git a/modules/core-tests/src/index.ts b/modules/core-tests/src/index.ts deleted file mode 100644 index 35104cd8e9..0000000000 --- a/modules/core-tests/src/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -// luma.gl -// SPDX-License-Identifier: MIT -// Copyright (c) vis.gl contributors - -// intentionally empty, this is a test-only module diff --git a/modules/core-tests/test/adapter/canvas-context.spec.ts b/modules/core-tests/test/adapter/canvas-context.spec.ts deleted file mode 100644 index 1139cff6fb..0000000000 --- a/modules/core-tests/test/adapter/canvas-context.spec.ts +++ /dev/null @@ -1,58 +0,0 @@ -// luma.gl -// SPDX-License-Identifier: MIT -// Copyright (c) vis.gl contributors - -import test from 'tape-promise/tape'; -import {getTestDevices} from '@luma.gl/test-utils'; - -import {CanvasContext} from '@luma.gl/core'; - -test('CanvasContext#defined', t => { - t.ok(CanvasContext, 'CanvasContext defined'); - // t.ok(new WEBGLCanvasContext()), 'Context creation ok'); - t.end(); -}); - -test('CanvasContext#getDevicePixelRatio', async t => { - const windowPixelRatio = (typeof window !== 'undefined' && window.devicePixelRatio) || 1; - const TEST_CASES = [ - { - name: 'useDevicePixels: true: should use window.devicePixelRatio or 1', - useDevicePixels: true, - expected: windowPixelRatio - }, - { - name: 'useDevicePixels: false: should use 1', - useDevicePixels: false, - expected: 1 - }, - { - name: 'Non Finite useDevicePixels null: should use 1', - useDevicePixels: null, - expected: 1 - }, - { - name: 'Non valid useDevicePixels 0: should use 1', - useDevicePixels: 0, - expected: 1 - }, - { - name: 'Non valid useDevicePixels negative: should use 1', - useDevicePixels: -3.2, - expected: 1 - }, - { - name: 'Valid useDevicePixels, should use it', - useDevicePixels: 1.5, - expected: 1.5 - } - ]; - - for (const device of await getTestDevices()) { - TEST_CASES.forEach(tc => { - const result = device.canvasContext?.getDevicePixelRatio(tc.useDevicePixels); - t.equal(result, tc.expected, tc.name); - }); - } - t.end(); -}); diff --git a/modules/core-tests/test/index.ts b/modules/core-tests/test/index.ts deleted file mode 100644 index 7306805598..0000000000 --- a/modules/core-tests/test/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// luma.gl -// SPDX-License-Identifier: MIT -// Copyright (c) vis.gl contributors - -// ADAPTER - -// WebGLDevice, features & limits -import './adapter/device-helpers/device-info.spec'; -import './adapter/device-helpers/device-features.spec'; -import './adapter/device-helpers/device-limits.spec'; -import './adapter/device-helpers/set-device-parameters.spec'; - -import './adapter/helpers/parse-shader-compiler-log.spec'; -// import './adapter/helpers/get-shader-layout.spec'; - -import './adapter/device.spec'; -import './adapter/canvas-context.spec'; - -// Resources -import './adapter/texture-formats.spec'; - -// Resources - TODO these tests only depend on Device and could move to API... -import './adapter/resources/buffer.spec'; -import './adapter/resources/command-buffer.spec'; -import './adapter/resources/shader.spec'; -import './adapter/resources/render-pipeline.spec'; -import './adapter/resources/compute-pipeline.spec'; -import './adapter/resources/sampler.spec'; -import './adapter/resources/texture.spec'; -import './adapter/resources/framebuffer.spec'; -import './adapter/resources/vertex-array.spec'; -import './adapter/resources/query-set.spec'; diff --git a/modules/core-tests/tsconfig.json b/modules/core-tests/tsconfig.json deleted file mode 100644 index 8c00d4f7b7..0000000000 --- a/modules/core-tests/tsconfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": "../../tsconfig.module.json", - "include": ["src/**/*"], - "exclude": ["node_modules"], - "compilerOptions": { - "strict": true, - "noImplicitAny": true, - "composite": true, - "rootDir": "src", - "outDir": "dist" - }, - "references": [ - {"path": "../core"}, - {"path": "../test-utils"}, - {"path": "../webgl"}, - {"path": "../webgpu"} - ] -} diff --git a/modules/core/test/adapter/canvas-context.spec.ts b/modules/core/test/adapter/canvas-context.spec.ts index 9db1f188f4..cc0d6950d0 100644 --- a/modules/core/test/adapter/canvas-context.spec.ts +++ b/modules/core/test/adapter/canvas-context.spec.ts @@ -5,6 +5,57 @@ import test from 'tape-promise/tape'; import {CanvasContext, Framebuffer} from '@luma.gl/core'; import {isBrowser} from '@probe.gl/env'; +import {getTestDevices} from '@luma.gl/test-utils'; + +test('CanvasContext#defined', t => { + t.ok(CanvasContext, 'CanvasContext defined'); + // t.ok(new WEBGLCanvasContext()), 'Context creation ok'); + t.end(); +}); + +test('CanvasContext#getDevicePixelRatio', async t => { + const windowPixelRatio = (typeof window !== 'undefined' && window.devicePixelRatio) || 1; + const TEST_CASES = [ + { + name: 'useDevicePixels: true: should use window.devicePixelRatio or 1', + useDevicePixels: true, + expected: windowPixelRatio + }, + { + name: 'useDevicePixels: false: should use 1', + useDevicePixels: false, + expected: 1 + }, + { + name: 'Non Finite useDevicePixels null: should use 1', + useDevicePixels: null, + expected: 1 + }, + { + name: 'Non valid useDevicePixels 0: should use 1', + useDevicePixels: 0, + expected: 1 + }, + { + name: 'Non valid useDevicePixels negative: should use 1', + useDevicePixels: -3.2, + expected: 1 + }, + { + name: 'Valid useDevicePixels, should use it', + useDevicePixels: 1.5, + expected: 1.5 + } + ]; + + for (const device of await getTestDevices()) { + TEST_CASES.forEach(tc => { + const result = device.canvasContext?.getDevicePixelRatio(tc.useDevicePixels); + t.equal(result, tc.expected, tc.name); + }); + } + t.end(); +}); // @ts-expect-error class TestCanvasContext extends CanvasContext { diff --git a/modules/core-tests/test/adapter/device-helpers/device-features.spec.ts b/modules/core/test/adapter/device-helpers/device-features.spec.ts similarity index 100% rename from modules/core-tests/test/adapter/device-helpers/device-features.spec.ts rename to modules/core/test/adapter/device-helpers/device-features.spec.ts diff --git a/modules/core-tests/test/adapter/device-helpers/device-info.spec.ts b/modules/core/test/adapter/device-helpers/device-info.spec.ts similarity index 100% rename from modules/core-tests/test/adapter/device-helpers/device-info.spec.ts rename to modules/core/test/adapter/device-helpers/device-info.spec.ts diff --git a/modules/core-tests/test/adapter/device-helpers/device-limits.spec.ts b/modules/core/test/adapter/device-helpers/device-limits.spec.ts similarity index 100% rename from modules/core-tests/test/adapter/device-helpers/device-limits.spec.ts rename to modules/core/test/adapter/device-helpers/device-limits.spec.ts diff --git a/modules/core-tests/test/adapter/device-helpers/set-device-parameters.spec.ts b/modules/core/test/adapter/device-helpers/set-device-parameters.spec.ts similarity index 100% rename from modules/core-tests/test/adapter/device-helpers/set-device-parameters.spec.ts rename to modules/core/test/adapter/device-helpers/set-device-parameters.spec.ts diff --git a/modules/core-tests/test/adapter/device.spec.ts b/modules/core/test/adapter/device.spec.ts similarity index 100% rename from modules/core-tests/test/adapter/device.spec.ts rename to modules/core/test/adapter/device.spec.ts diff --git a/modules/core-tests/test/adapter/helpers/parse-shader-compiler-log.spec.ts b/modules/core/test/adapter/helpers/parse-shader-compiler-log.spec.ts similarity index 100% rename from modules/core-tests/test/adapter/helpers/parse-shader-compiler-log.spec.ts rename to modules/core/test/adapter/helpers/parse-shader-compiler-log.spec.ts diff --git a/modules/core-tests/test/adapter/resources/buffer.spec.ts b/modules/core/test/adapter/resources/buffer.spec.ts similarity index 100% rename from modules/core-tests/test/adapter/resources/buffer.spec.ts rename to modules/core/test/adapter/resources/buffer.spec.ts diff --git a/modules/core-tests/test/adapter/resources/command-buffer.spec.ts b/modules/core/test/adapter/resources/command-buffer.spec.ts similarity index 100% rename from modules/core-tests/test/adapter/resources/command-buffer.spec.ts rename to modules/core/test/adapter/resources/command-buffer.spec.ts diff --git a/modules/core-tests/test/adapter/resources/compute-pipeline.spec.ts b/modules/core/test/adapter/resources/compute-pipeline.spec.ts similarity index 100% rename from modules/core-tests/test/adapter/resources/compute-pipeline.spec.ts rename to modules/core/test/adapter/resources/compute-pipeline.spec.ts diff --git a/modules/core-tests/test/adapter/resources/framebuffer.spec.ts b/modules/core/test/adapter/resources/framebuffer.spec.ts similarity index 100% rename from modules/core-tests/test/adapter/resources/framebuffer.spec.ts rename to modules/core/test/adapter/resources/framebuffer.spec.ts diff --git a/modules/core-tests/test/adapter/resources/query-set.spec.ts b/modules/core/test/adapter/resources/query-set.spec.ts similarity index 100% rename from modules/core-tests/test/adapter/resources/query-set.spec.ts rename to modules/core/test/adapter/resources/query-set.spec.ts diff --git a/modules/core-tests/test/adapter/resources/render-pipeline.spec.ts b/modules/core/test/adapter/resources/render-pipeline.spec.ts similarity index 100% rename from modules/core-tests/test/adapter/resources/render-pipeline.spec.ts rename to modules/core/test/adapter/resources/render-pipeline.spec.ts diff --git a/modules/core-tests/test/adapter/resources/sampler.spec.ts b/modules/core/test/adapter/resources/sampler.spec.ts similarity index 100% rename from modules/core-tests/test/adapter/resources/sampler.spec.ts rename to modules/core/test/adapter/resources/sampler.spec.ts diff --git a/modules/core-tests/test/adapter/resources/shader.spec.ts b/modules/core/test/adapter/resources/shader.spec.ts similarity index 100% rename from modules/core-tests/test/adapter/resources/shader.spec.ts rename to modules/core/test/adapter/resources/shader.spec.ts diff --git a/modules/core-tests/test/adapter/resources/texture.spec.ts b/modules/core/test/adapter/resources/texture.spec.ts similarity index 100% rename from modules/core-tests/test/adapter/resources/texture.spec.ts rename to modules/core/test/adapter/resources/texture.spec.ts diff --git a/modules/core-tests/test/adapter/resources/vertex-array.spec.ts b/modules/core/test/adapter/resources/vertex-array.spec.ts similarity index 100% rename from modules/core-tests/test/adapter/resources/vertex-array.spec.ts rename to modules/core/test/adapter/resources/vertex-array.spec.ts diff --git a/modules/core-tests/test/adapter/texture-formats.spec.ts b/modules/core/test/adapter/texture-formats.spec.ts similarity index 100% rename from modules/core-tests/test/adapter/texture-formats.spec.ts rename to modules/core/test/adapter/texture-formats.spec.ts diff --git a/modules/core/test/index.ts b/modules/core/test/index.ts index 320a2c6fe7..cbe8fa246c 100644 --- a/modules/core/test/index.ts +++ b/modules/core/test/index.ts @@ -15,6 +15,17 @@ import './adapter/type-utils/decode-texture-format.spec'; import './adapter/type-utils/vertex-format-from-attribute.spec'; // adapter + +// WebGLDevice, features & limits +import './adapter/device-helpers/device-info.spec'; +import './adapter/device-helpers/device-features.spec'; +import './adapter/device-helpers/device-limits.spec'; +import './adapter/device-helpers/set-device-parameters.spec'; + +import './adapter/helpers/parse-shader-compiler-log.spec'; +// import './adapter/helpers/get-shader-layout.spec'; + +import './adapter/device.spec'; import './adapter/canvas-context.spec'; import './adapter/luma.spec'; @@ -23,3 +34,18 @@ import './lib/uniforms/uniform-buffer-layout.spec'; // compiler logs import './lib/compiler-log/format-compiler-log.spec'; + +// Resources +import './adapter/texture-formats.spec'; + +// Resources - TODO these tests only depend on Device and could move to API... +import './adapter/resources/buffer.spec'; +import './adapter/resources/command-buffer.spec'; +import './adapter/resources/shader.spec'; +import './adapter/resources/render-pipeline.spec'; +import './adapter/resources/compute-pipeline.spec'; +import './adapter/resources/sampler.spec'; +import './adapter/resources/texture.spec'; +import './adapter/resources/framebuffer.spec'; +import './adapter/resources/vertex-array.spec'; +import './adapter/resources/query-set.spec'; diff --git a/test/modules.ts b/test/modules.ts index fbf171ae3a..30d2112ae1 100644 --- a/test/modules.ts +++ b/test/modules.ts @@ -10,7 +10,6 @@ import '@luma.gl/shadertools/test'; // DEVICE INDEPENDENT TESTS import '@luma.gl/core/test'; -import '@luma.gl/core-tests/test'; // WEBGL ADAPTER TESTS import '@luma.gl/webgl/test'; diff --git a/tsconfig.build.json b/tsconfig.build.json index 15e3648c57..40a5f579f7 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -8,13 +8,11 @@ "references": [ {"path": "modules/constants"}, {"path": "modules/core"}, - {"path": "modules/core-tests"}, {"path": "modules/engine"}, {"path": "modules/gltf"}, {"path": "modules/shadertools"}, {"path": "modules/test-utils"}, {"path": "modules/webgl"}, {"path": "modules/webgpu"} - // {"path": "modules/experimental"} ] } diff --git a/tsconfig.json b/tsconfig.json index c1d84b660b..1d07248a8e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -43,7 +43,6 @@ "paths": { "@luma.gl/core/*": ["modules/core/src/*"], "@luma.gl/core/test/*": ["modules/core/test/*"], - "@luma.gl/core-tests/test/*": ["modules/core-tests/test/*"], "@luma.gl/constants/*": ["modules/constants/src/*"], "@luma.gl/constants/test/*": ["modules/constants/test/*"], "@luma.gl/engine/*": ["modules/engine/src/*"],