From a775fc040344de65098875121853a5afcf39491a Mon Sep 17 00:00:00 2001 From: Lucas Dower Date: Mon, 10 Apr 2023 00:59:36 +0100 Subject: [PATCH] Removed old desktop tests --- jestconfig.full.json | 7 - jestconfig.json | 6 +- tests/__mocks__/fileMock.js | 1 + tests/normal-corrected-ray-voxeliser.test.ts | 75 ------- tests/obj_importer.test.ts | 205 ------------------- tests/objlitematic.test.ts | 57 ------ tests/objobj.test.ts | 56 ----- tests/objschem.test.ts | 56 ----- tests/objschematic.test.ts | 56 ----- tests/random-dither.test.ts | 23 --- tests/schematic-friendly.test.ts | 27 --- tests/status.test.ts | 36 ---- 12 files changed, 6 insertions(+), 599 deletions(-) delete mode 100644 jestconfig.full.json create mode 100644 tests/__mocks__/fileMock.js delete mode 100644 tests/normal-corrected-ray-voxeliser.test.ts delete mode 100644 tests/obj_importer.test.ts delete mode 100644 tests/objlitematic.test.ts delete mode 100644 tests/objobj.test.ts delete mode 100644 tests/objschem.test.ts delete mode 100644 tests/objschematic.test.ts delete mode 100644 tests/random-dither.test.ts delete mode 100644 tests/schematic-friendly.test.ts delete mode 100644 tests/status.test.ts diff --git a/jestconfig.full.json b/jestconfig.full.json deleted file mode 100644 index a7a636d..0000000 --- a/jestconfig.full.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "transform": { - "^.+\\.(t|j)sx?$": "ts-jest" - }, - "testRegex": "(/test/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$", - "moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"] - } \ No newline at end of file diff --git a/jestconfig.json b/jestconfig.json index 508dc36..a289c15 100644 --- a/jestconfig.json +++ b/jestconfig.json @@ -4,5 +4,9 @@ }, "testRegex": "(/test/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$", "moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"], - "modulePathIgnorePatterns": ["/tests/full/"] + "modulePathIgnorePatterns": ["/tests/full/"], + "moduleNameMapper": { + "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|vs|fs)$": "/tests/__mocks__/fileMock.js", + "\\.(css|less)$": "/tests/__mocks__/styleMock.js" + } } \ No newline at end of file diff --git a/tests/__mocks__/fileMock.js b/tests/__mocks__/fileMock.js new file mode 100644 index 0000000..f053ebf --- /dev/null +++ b/tests/__mocks__/fileMock.js @@ -0,0 +1 @@ +module.exports = {}; diff --git a/tests/normal-corrected-ray-voxeliser.test.ts b/tests/normal-corrected-ray-voxeliser.test.ts deleted file mode 100644 index 76d55a3..0000000 --- a/tests/normal-corrected-ray-voxeliser.test.ts +++ /dev/null @@ -1,75 +0,0 @@ -import fs from 'fs'; -import path from 'path'; - -import { RGBAColours } from '../src/colour'; -import { ObjImporter } from '../src/importers/obj_importer'; -import { ASSERT } from '../src/util/error_util'; -import { Vector3 } from '../src/vector'; -import { NormalCorrectedRayVoxeliser } from '../src/voxelisers/normal-corrected-ray-voxeliser'; -import { TEST_PREAMBLE } from './preamble'; - -test('Voxelise solid 2x2 cube', () => { - TEST_PREAMBLE(); - - const obj = fs.readFileSync(path.join(__dirname, './data/cube.obj'), 'utf-8'); - - const importer = new ObjImporter(); - importer.parse(obj); - const mesh = importer.toMesh(); - mesh.processMesh(0, 0, 0); - - const voxeliser = new NormalCorrectedRayVoxeliser(); - const voxelMesh = voxeliser.voxelise(mesh, { - constraintAxis: 'y', - size: 2, - useMultisampleColouring: false, - enableAmbientOcclusion: false, - voxelOverlapRule: 'average', - voxeliser: 'ncrb', - }); - - const expectedVoxels = [ - { - position: new Vector3(0, 1, 0), - colour: RGBAColours.BLUE, - }, - { - position: new Vector3(1, 1, 0), - colour: RGBAColours.GREEN, - }, - { - position: new Vector3(1, 1, 1), - colour: RGBAColours.RED, - }, - { - position: new Vector3(0, 1, 1), - colour: RGBAColours.WHITE, - }, - { - position: new Vector3(1, 0, 1), - colour: RGBAColours.YELLOW, - }, - { - position: new Vector3(1, 0, 0), - colour: RGBAColours.CYAN, - }, - { - position: new Vector3(0, 0, 1), - colour: RGBAColours.BLACK, - }, - { - position: new Vector3(0, 0, 0), - colour: RGBAColours.MAGENTA, - }, - ]; - - for (const expected of expectedVoxels) { - expect(voxelMesh.isVoxelAt(expected.position)).toBe(true); - const voxel = voxelMesh.getVoxelAt(expected.position); - expect(voxel).toBeDefined(); ASSERT(voxel); - expect(voxel.colour.r).toBeCloseTo(expected.colour.r); - expect(voxel.colour.g).toBeCloseTo(expected.colour.g); - expect(voxel.colour.b).toBeCloseTo(expected.colour.b); - expect(voxel.colour.a).toBeCloseTo(expected.colour.a); - } -}); diff --git a/tests/obj_importer.test.ts b/tests/obj_importer.test.ts deleted file mode 100644 index 5dd13d9..0000000 --- a/tests/obj_importer.test.ts +++ /dev/null @@ -1,205 +0,0 @@ -import { ObjImporter } from '../src/importers/obj_importer'; -import { ASSERT } from '../src/util/error_util'; -import { Vector3 } from '../src/vector'; -import { TEST_PREAMBLE } from './preamble'; - -test('Parse vertex #1', () => { - TEST_PREAMBLE(); - - const importer = new ObjImporter(); - importer.parseOBJLine('v 1.0 -2.0 3.0'); - const mesh = importer.toMesh(); - expect(mesh._vertices.length).toEqual(1); - expect(mesh._vertices[0].equals(new Vector3(1, -2, 3))).toBe(true); -}); - -test('Parse vertex #2', () => { - TEST_PREAMBLE(); - - const importer = new ObjImporter(); - importer.parseOBJLine('v 4.467e+000 9.243e+000 9.869e+000'); - const mesh = importer.toMesh(); - expect(mesh._vertices.length).toEqual(1); - expect(mesh._vertices[0].equals(new Vector3(4.467e+000, 9.243e+000, 9.869e+000))).toBe(true); -}); - -test('Parse normal #1', () => { - TEST_PREAMBLE(); - - const importer = new ObjImporter(); - importer.parseOBJLine('vn -1.0 -0.5 0.0'); - const mesh = importer.toMesh(); - expect(mesh._normals.length).toEqual(1); - expect(mesh._normals[0].equals(new Vector3(-1, -0.5, 0))).toBe(true); -}); - -test('Parse texcoord #1', () => { - TEST_PREAMBLE(); - - const importer = new ObjImporter(); - importer.parseOBJLine('vt 0.5 -0.8'); - const mesh = importer.toMesh(); - expect(mesh._uvs.length).toEqual(1); - expect(mesh._uvs[0].u === 0.5 && mesh._uvs[0].v === -0.8).toBe(true); -}); - -test('Parse face #1', () => { - TEST_PREAMBLE(); - - const importer = new ObjImporter(); - importer.parseOBJLine('f 12 24 36'); - const mesh = importer.toMesh(); - expect(mesh._tris.length).toEqual(1); - const tri = mesh._tris[0]; - expect(tri.texcoordIndices).toBeDefined(); ASSERT(tri.texcoordIndices); - expect(tri.normalIndices).toBeDefined(); ASSERT(tri.normalIndices); - expect(tri.positionIndices.x === 12 - 1 && tri.positionIndices.y === 24 - 1 && tri.positionIndices.z === 36 - 1).toBe(true); - expect(tri.texcoordIndices.x === 12 - 1 && tri.texcoordIndices.y === 24 - 1 && tri.texcoordIndices.z === 36 - 1).toBe(true); - expect(tri.normalIndices.x === 12 - 1 && tri.normalIndices.y === 24 - 1 && tri.normalIndices.z === 36 - 1).toBe(true); -}); - -test('Parse face #2', () => { - TEST_PREAMBLE(); - - const importer = new ObjImporter(); - importer.parseOBJLine('f 1/2 3/4 5/6'); - const mesh = importer.toMesh(); - expect(mesh._tris.length).toEqual(1); - const tri = mesh._tris[0]; - expect(tri.texcoordIndices).toBeDefined(); ASSERT(tri.texcoordIndices); - expect(tri.normalIndices).toBeUndefined(); - expect(tri.positionIndices.x === 1 - 1 && tri.positionIndices.y === 3 - 1 && tri.positionIndices.z === 5 - 1).toBe(true); - expect(tri.texcoordIndices.x === 2 - 1 && tri.texcoordIndices.y === 4 - 1 && tri.texcoordIndices.z === 6 - 1).toBe(true); -}); - -test('Parse face #3', () => { - TEST_PREAMBLE(); - - const importer = new ObjImporter(); - importer.parseOBJLine('f 11/2/3 4/55/6 7/8/99'); - const mesh = importer.toMesh(); - expect(mesh._tris.length).toEqual(1); - const tri = mesh._tris[0]; - expect(tri.texcoordIndices).toBeDefined(); ASSERT(tri.texcoordIndices); - expect(tri.normalIndices).toBeDefined(); ASSERT(tri.normalIndices); - expect(tri.positionIndices.x === 11 - 1 && tri.positionIndices.y === 4 - 1 && tri.positionIndices.z === 7 - 1).toBe(true); - expect(tri.texcoordIndices.x === 2 - 1 && tri.texcoordIndices.y === 55 - 1 && tri.texcoordIndices.z === 8 - 1).toBe(true); - expect(tri.normalIndices.x === 3 - 1 && tri.normalIndices.y === 6 - 1 && tri.normalIndices.z === 99 - 1).toBe(true); -}); - -test('Parse mini #1', () => { - TEST_PREAMBLE(); - - const importer = new ObjImporter(); - importer.parseOBJLine('v -1 2 3'); - importer.parseOBJLine('v 4 -5 6'); - importer.parseOBJLine('v 7 8 -9'); - importer.parseOBJLine('vn 0.0 0.1 0.2'); - importer.parseOBJLine('vn 0.3 0.4 0.5'); - importer.parseOBJLine('vn 0.6 0.7 0.8'); - importer.parseOBJLine('vt 0.0 0.5'); - importer.parseOBJLine('vt 0.5 1.0'); - importer.parseOBJLine('vt 1.0 0.0'); - importer.parseOBJLine('f 1 2 3'); - const mesh = importer.toMesh(); - - expect(mesh._vertices.length).toEqual(3); - expect(mesh._uvs.length).toEqual(3); - expect(mesh._normals.length).toEqual(3); - expect(mesh._tris.length).toEqual(1); - - const vertexData = mesh.getVertices(0); - expect(vertexData.v0.equals(new Vector3(-1, 2, 3))).toBe(true); - expect(vertexData.v1.equals(new Vector3(4, -5, 6))).toBe(true); - expect(vertexData.v2.equals(new Vector3(7, 8, -9))).toBe(true); - - const texcoordData = mesh.getUVs(0); - expect(texcoordData.uv0.u === 0.0 && texcoordData.uv0.v === 0.5).toBe(true); - expect(texcoordData.uv1.u === 0.5 && texcoordData.uv1.v === 1.0).toBe(true); - expect(texcoordData.uv2.u === 1.0 && texcoordData.uv2.v === 0.0).toBe(true); - - const normalData = mesh.getNormals(0); - expect(normalData.v0.equals(new Vector3(0.0, 0.1, 0.2))).toBe(true); - expect(normalData.v1.equals(new Vector3(0.3, 0.4, 0.5))).toBe(true); - expect(normalData.v2.equals(new Vector3(0.6, 0.7, 0.8))).toBe(true); -}); - - -test('Parse mini #2', () => { - TEST_PREAMBLE(); - - const importer = new ObjImporter(); - importer.parseOBJLine('v -1 2 3'); - importer.parseOBJLine('v 4 -5 6'); - importer.parseOBJLine('v 7 8 -9'); - importer.parseOBJLine('vn 0.0 0.1 0.2'); - importer.parseOBJLine('vn 0.3 0.4 0.5'); - importer.parseOBJLine('vn 0.6 0.7 0.8'); - importer.parseOBJLine('vt 0.0 0.5'); - importer.parseOBJLine('vt 0.5 1.0'); - importer.parseOBJLine('vt 1.0 0.0'); - importer.parseOBJLine('f 3/1/2 1/2/3 2/3/1'); - const mesh = importer.toMesh(); - - expect(mesh._vertices.length).toEqual(3); - expect(mesh._uvs.length).toEqual(3); - expect(mesh._normals.length).toEqual(3); - expect(mesh._tris.length).toEqual(1); - - const vertexData = mesh.getVertices(0); - expect(vertexData.v0.equals(new Vector3(7, 8, -9))).toBe(true); - expect(vertexData.v1.equals(new Vector3(-1, 2, 3))).toBe(true); - expect(vertexData.v2.equals(new Vector3(4, -5, 6))).toBe(true); - - const texcoordData = mesh.getUVs(0); - expect(texcoordData.uv0.u === 0.0 && texcoordData.uv0.v === 0.5).toBe(true); - expect(texcoordData.uv1.u === 0.5 && texcoordData.uv1.v === 1.0).toBe(true); - expect(texcoordData.uv2.u === 1.0 && texcoordData.uv2.v === 0.0).toBe(true); - - const normalData = mesh.getNormals(0); - expect(normalData.v0.equals(new Vector3(0.3, 0.4, 0.5))).toBe(true); - expect(normalData.v1.equals(new Vector3(0.6, 0.7, 0.8))).toBe(true); - expect(normalData.v2.equals(new Vector3(0.0, 0.1, 0.2))).toBe(true); -}); - -test('Parse mini #3', () => { - TEST_PREAMBLE(); - - const importer = new ObjImporter(); - importer.parseOBJLine('v 0 0 0'); - importer.parseOBJLine('v 1 0 0'); - importer.parseOBJLine('v 0 1 0'); - importer.parseOBJLine('f 1 2 3'); - const mesh = importer.toMesh(); - - expect(mesh._vertices.length).toEqual(3); - expect(mesh._uvs.length).toEqual(0); - expect(mesh._normals.length).toEqual(0); - expect(mesh._tris.length).toEqual(1); - - const texcoordData = mesh.getUVs(0); - expect(texcoordData.uv0.u === 0.0 && texcoordData.uv0.v === 0.0).toBe(true); - expect(texcoordData.uv1.u === 0.0 && texcoordData.uv1.v === 0.0).toBe(true); - expect(texcoordData.uv2.u === 0.0 && texcoordData.uv2.v === 0.0).toBe(true); - - const normalData = mesh.getNormals(0); - expect(normalData.v0.equals(new Vector3(0.0, 0.0, 1.0))).toBe(true); - expect(normalData.v1.equals(new Vector3(0.0, 0.0, 1.0))).toBe(true); - expect(normalData.v2.equals(new Vector3(0.0, 0.0, 1.0))).toBe(true); -}); - -test('Parse comments', () => { - TEST_PREAMBLE(); - - const importer = new ObjImporter(); - importer.parseOBJLine('# v -1 2 3'); - importer.parseOBJLine('# vn 0.0 0.1 0.2'); - importer.parseOBJLine('# vt 0.0 0.5'); - importer.parseOBJLine('# f 1 1 1'); - const mesh = importer.toMesh(); - - expect(mesh._vertices.length).toEqual(0); - expect(mesh._uvs.length).toEqual(0); - expect(mesh._normals.length).toEqual(0); - expect(mesh._tris.length).toEqual(0); -}); diff --git a/tests/objlitematic.test.ts b/tests/objlitematic.test.ts deleted file mode 100644 index 00daaf5..0000000 --- a/tests/objlitematic.test.ts +++ /dev/null @@ -1,57 +0,0 @@ -import fs from 'fs'; -import path from 'path'; - -import { ColourSpace } from '../src/util'; -import { AppPaths, PathUtil } from '../src/util/path_util'; -import { Vector3 } from '../src/vector'; -import { runHeadless, THeadlessConfig } from '../tools/headless'; -import { TEST_PREAMBLE } from './preamble'; - -const baseConfig: THeadlessConfig = { - import: { - importer: 'obj', - fileSource: '', // Must be an absolute path - rotation: new Vector3(0, 0, 0), - }, - voxelise: { - voxeliser: 'bvh-ray', - constraintAxis: 'y', - size: 80, - useMultisampleColouring: false, - voxelOverlapRule: 'average', - enableAmbientOcclusion: false, // Only want true if exporting to .obj - }, - assign: { - textureAtlas: 'vanilla', // Must be an atlas name that exists in /resources/atlases - blockPalette: 'all', // Must be a palette name that exists in /resources/palettes - dithering: 'ordered', - colourSpace: ColourSpace.RGB, - fallable: 'replace-falling', - resolution: 32, - calculateLighting: false, - lightThreshold: 0, - contextualAveraging: true, - errorWeight: 0.0, - }, - export: { - filepath: '', // Must be an absolute path to the file (can be anywhere) - exporter: 'obj', // 'schematic' / 'litematic', - }, - debug: { - showLogs: false, - showWarnings: false, - showTimings: false, - }, -}; - -test('FULL Obj->Obj', () => { - TEST_PREAMBLE(); - - const config: THeadlessConfig = baseConfig; - - config.import.fileSource = fs.readFileSync(PathUtil.join(AppPaths.Get.resources, './samples/skull.obj'), 'utf-8'); - config.export.exporter = 'litematic'; - config.export.filepath = PathUtil.join(AppPaths.Get.testData, '../out/out.litematic'); - - runHeadless(config); -}); diff --git a/tests/objobj.test.ts b/tests/objobj.test.ts deleted file mode 100644 index a8f1607..0000000 --- a/tests/objobj.test.ts +++ /dev/null @@ -1,56 +0,0 @@ -import fs from 'fs'; - -import { ColourSpace } from '../src/util'; -import { AppPaths, PathUtil } from '../src/util/path_util'; -import { Vector3 } from '../src/vector'; -import { runHeadless, THeadlessConfig } from '../tools/headless'; -import { TEST_PREAMBLE } from './preamble'; - -const baseConfig: THeadlessConfig = { - import: { - importer: 'obj', - fileSource: '', // Must be an absolute path // Must be an absolute path - rotation: new Vector3(0, 0, 0), - }, - voxelise: { - voxeliser: 'bvh-ray', - constraintAxis: 'y', - size: 80, - useMultisampleColouring: false, - voxelOverlapRule: 'average', - enableAmbientOcclusion: false, // Only want true if exporting to .obj - }, - assign: { - textureAtlas: 'vanilla', // Must be an atlas name that exists in /resources/atlases - blockPalette: 'all', // Must be a palette name that exists in /resources/palettes - dithering: 'ordered', - colourSpace: ColourSpace.RGB, - fallable: 'replace-falling', - resolution: 32, - calculateLighting: false, - lightThreshold: 0, - contextualAveraging: true, - errorWeight: 0.0, - }, - export: { - filepath: '', // Must be an absolute path to the file (can be anywhere) - exporter: 'obj', // 'schematic' / 'litematic', - }, - debug: { - showLogs: false, - showWarnings: false, - showTimings: false, - }, -}; - -test('FULL Obj->Obj', () => { - TEST_PREAMBLE(); - - const config: THeadlessConfig = baseConfig; - - config.import.fileSource = PathUtil.join(AppPaths.Get.resources, './samples/skull.obj'); - config.export.exporter = 'obj'; - config.export.filepath = PathUtil.join(AppPaths.Get.testData, '../out/out.obj'); - - runHeadless(config); -}); diff --git a/tests/objschem.test.ts b/tests/objschem.test.ts deleted file mode 100644 index 916f7c1..0000000 --- a/tests/objschem.test.ts +++ /dev/null @@ -1,56 +0,0 @@ -import fs from 'fs'; - -import { ColourSpace } from '../src/util'; -import { AppPaths, PathUtil } from '../src/util/path_util'; -import { Vector3 } from '../src/vector'; -import { runHeadless, THeadlessConfig } from '../tools/headless'; -import { TEST_PREAMBLE } from './preamble'; - -const baseConfig: THeadlessConfig = { - import: { - importer: 'obj', - fileSource: '', // Must be an absolute path - rotation: new Vector3(0, 0, 0), - }, - voxelise: { - voxeliser: 'bvh-ray', - constraintAxis: 'y', - size: 80, - useMultisampleColouring: false, - voxelOverlapRule: 'average', - enableAmbientOcclusion: false, // Only want true if exporting to .obj - }, - assign: { - textureAtlas: 'vanilla', // Must be an atlas name that exists in /resources/atlases - blockPalette: 'all', // Must be a palette name that exists in /resources/palettes - dithering: 'ordered', - colourSpace: ColourSpace.RGB, - fallable: 'replace-falling', - resolution: 32, - calculateLighting: false, - lightThreshold: 0, - contextualAveraging: true, - errorWeight: 0.0, - }, - export: { - filepath: '', // Must be an absolute path to the file (can be anywhere) - exporter: 'obj', // 'schematic' / 'litematic', - }, - debug: { - showLogs: false, - showWarnings: false, - showTimings: false, - }, -}; - -test('FULL Obj->Obj', () => { - TEST_PREAMBLE(); - - const config: THeadlessConfig = baseConfig; - - config.import.fileSource = fs.readFileSync(PathUtil.join(AppPaths.Get.resources, './samples/skull.obj'), 'utf-8'); - config.export.exporter = 'schem'; - config.export.filepath = PathUtil.join(AppPaths.Get.testData, '../out/out.schem'); - - runHeadless(config); -}); diff --git a/tests/objschematic.test.ts b/tests/objschematic.test.ts deleted file mode 100644 index 0177500..0000000 --- a/tests/objschematic.test.ts +++ /dev/null @@ -1,56 +0,0 @@ -import fs from 'fs'; - -import { ColourSpace } from '../src/util'; -import { AppPaths, PathUtil } from '../src/util/path_util'; -import { Vector3 } from '../src/vector'; -import { runHeadless, THeadlessConfig } from '../tools/headless'; -import { TEST_PREAMBLE } from './preamble'; - -const baseConfig: THeadlessConfig = { - import: { - importer: 'obj', - fileSource: '', // Must be an absolute path - rotation: new Vector3(0, 0, 0), - }, - voxelise: { - voxeliser: 'bvh-ray', - constraintAxis: 'y', - size: 80, - useMultisampleColouring: false, - voxelOverlapRule: 'average', - enableAmbientOcclusion: false, // Only want true if exporting to .obj - }, - assign: { - textureAtlas: 'vanilla', // Must be an atlas name that exists in /resources/atlases - blockPalette: 'all', // Must be a palette name that exists in /resources/palettes - dithering: 'ordered', - colourSpace: ColourSpace.RGB, - fallable: 'replace-falling', - resolution: 32, - calculateLighting: false, - lightThreshold: 0, - contextualAveraging: true, - errorWeight: 0.0, - }, - export: { - filepath: '', // Must be an absolute path to the file (can be anywhere) - exporter: 'obj', // 'schematic' / 'litematic', - }, - debug: { - showLogs: false, - showWarnings: false, - showTimings: false, - }, -}; - -test('FULL Obj->Schematic', () => { - TEST_PREAMBLE(); - - const config: THeadlessConfig = baseConfig; - - config.import.fileSource = fs.readFileSync(PathUtil.join(AppPaths.Get.resources, './samples/skull.obj'), 'utf-8'); - config.export.exporter = 'schematic'; - config.export.filepath = PathUtil.join(AppPaths.Get.testData, '../out/out.schematic'); - - runHeadless(config); -}); diff --git a/tests/random-dither.test.ts b/tests/random-dither.test.ts deleted file mode 100644 index a61f080..0000000 --- a/tests/random-dither.test.ts +++ /dev/null @@ -1,23 +0,0 @@ -import fs from 'fs'; - -import { StatusHandler, StatusID } from '../src/status'; -import { AppPaths, PathUtil } from '../src/util/path_util'; -import { WorkerClient } from '../src/worker_client'; -import { headlessConfig } from '../tools/headless-config'; -import { TEST_PREAMBLE } from './preamble'; - -test('Random-dither', () => { - TEST_PREAMBLE(); - - const config = headlessConfig; - - config.import.fileSource = fs.readFileSync(PathUtil.join(AppPaths.Get.resources, './samples/skull.obj'), 'utf-8'); - config.assign.dithering = 'random'; - - const worker = WorkerClient.Get; - worker.import(headlessConfig.import); - worker.voxelise(headlessConfig.voxelise); - worker.assign(headlessConfig.assign); - - expect(StatusHandler.Get.hasId(StatusID.SchematicUnsupportedBlocks)).toBe(false); -}); diff --git a/tests/schematic-friendly.test.ts b/tests/schematic-friendly.test.ts deleted file mode 100644 index b28e8f8..0000000 --- a/tests/schematic-friendly.test.ts +++ /dev/null @@ -1,27 +0,0 @@ -import fs from 'fs'; - -import { StatusHandler, StatusID } from '../src/status'; -import { AppPaths, PathUtil } from '../src/util/path_util'; -import { WorkerClient } from '../src/worker_client'; -import { headlessConfig } from '../tools/headless-config'; -import { TEST_PREAMBLE } from './preamble'; - -test('Schematic-friendly Palette', () => { - TEST_PREAMBLE(); - - const config = headlessConfig; - - config.import.fileSource = fs.readFileSync(PathUtil.join(AppPaths.Get.resources, './samples/skull.obj'), 'utf-8'); - - config.assign.blockPalette = 'schematic-friendly'; - config.export.exporter = 'schematic'; - config.export.filepath = PathUtil.join(AppPaths.Get.testData, '../out/friendly.schematic'); - - const worker = WorkerClient.Get; - worker.import(headlessConfig.import); - worker.voxelise(headlessConfig.voxelise); - worker.assign(headlessConfig.assign); - worker.export(headlessConfig.export); - - expect(StatusHandler.Get.hasId(StatusID.SchematicUnsupportedBlocks)).toBe(false); -}); diff --git a/tests/status.test.ts b/tests/status.test.ts deleted file mode 100644 index 6b20349..0000000 --- a/tests/status.test.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { StatusHandler } from '../src/status'; -import { TEST_PREAMBLE } from './preamble'; - -test('Status', () => { - TEST_PREAMBLE(); - - StatusHandler.Get.add( - 'warning', - 'This is a warning', - ); - expect(StatusHandler.Get.getStatusMessages('warning').length).toBe(1); - StatusHandler.Get.clear(); - expect(StatusHandler.Get.getStatusMessages('warning').length).toBe(0); -}); - -test('Status', () => { - TEST_PREAMBLE(); - - StatusHandler.Get.add( - 'warning', - 'This is a warning', - ); - StatusHandler.Get.add( - 'info', - 'This is some info', - ); - StatusHandler.Get.add( - 'info', - 'This is some more info', - ); - expect(StatusHandler.Get.getStatusMessages('info').length).toBe(2); - expect(StatusHandler.Get.getStatusMessages('warning').length).toBe(1); - StatusHandler.Get.clear(); - expect(StatusHandler.Get.getStatusMessages('info').length).toBe(0); - expect(StatusHandler.Get.getStatusMessages('warning').length).toBe(0); -});