切换vitest-browser
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import { describe, it, expect, test } from 'vitest';
|
||||
import { test, it, expect } from 'vitest';
|
||||
import { DemoParser } from '../samples/demoParser';
|
||||
import { ProcessorModule, StepControllerProcessor } from '../src/device';
|
||||
import { ProcessorManager } from '../src/device';
|
||||
import { demoHandleGroupCutting } from '../samples/demoDatahandle/demoDataHandle1';
|
||||
import testJson from "./test.json"
|
||||
import { Worker, parentPort } from 'worker_threads';
|
||||
import { UniversalWorker } from '../samples/WorkerHelper';
|
||||
describe('demoParser', () => {
|
||||
// import { ProcessorModule, StepControllerProcessor } from '../src/device';
|
||||
// import { ProcessorManager } from '../src/device';
|
||||
// import { demoHandleGroupCutting } from '../samples/demoDatahandle/demoDataHandle1';
|
||||
// import testJson from "./test.json"
|
||||
// import { Worker, parentPort } from 'worker_threads';
|
||||
// import { UniversalWorker } from '../samples/WorkerHelper';
|
||||
test('demoParser', () => {
|
||||
const text = `FSTART
|
||||
TD 5
|
||||
G0 X100 Y100 Z10 F8000
|
||||
@@ -23,163 +23,163 @@ FEND
|
||||
|
||||
})
|
||||
|
||||
describe('data', async () => {
|
||||
const sysConfig = {
|
||||
placeStyle: 1,
|
||||
boardWidth: 2440,
|
||||
boardLength: 1220,
|
||||
// 测试刀库数据
|
||||
knifeList: [knifeData, knifeData1, knifeData2]
|
||||
}
|
||||
const json = testJson
|
||||
// 创建处理器集合
|
||||
const processorManager = new ProcessorManager<any, any>();
|
||||
// 这里省略了 选择处理器的环节 --这里选了demo开料机
|
||||
const cuttingHandle = new demoHandleGroupCutting()
|
||||
// 注册处理器
|
||||
processorManager.registerProcessor(cuttingHandle.processorName, cuttingHandle.processor)
|
||||
// 使用XX处理器 会返回激活【正在使用】的 处理器
|
||||
let processor = processorManager.useProcessor(cuttingHandle.processorName)
|
||||
// 或者 这样 获取 正在使用的处理器 注:若未执行useProcessor 将会返回 undefind
|
||||
// processor = processorManager.getCurrentProcessor()
|
||||
/** 处理器配置加载 */
|
||||
processor.updateModuleConfig(sysConfig)
|
||||
const res = await processor.process(json)
|
||||
// console.log('处理器所有流程都结束了', res);
|
||||
})
|
||||
|
||||
/** demo 刀具数据 */
|
||||
export const knifeData = {
|
||||
"isEnabled": true,
|
||||
"axleId": 2,
|
||||
"knifeId": 2,
|
||||
"processFace": "",
|
||||
"knifeName": "T1",
|
||||
"knifeType": 3,
|
||||
"ability": [
|
||||
5
|
||||
],
|
||||
"diameter": 5,
|
||||
"length": 20,
|
||||
"sawThiness": 7,
|
||||
"sawDirection": 2,
|
||||
"processDirection": 4,
|
||||
"speed": 0,
|
||||
"stepDepth": 0,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"offsetZ": 0,
|
||||
"baseX": 0,
|
||||
"baseY": 0,
|
||||
"isModularDrill": false,
|
||||
"isPreStartEnabled": false,
|
||||
"preStartAheadActionCount": 5,
|
||||
"isPreStartToolChangeDelay": false,
|
||||
"preStartToolChangeDelayCode": "",
|
||||
"isAxisStartCodePostpost": false,
|
||||
"isAxisStopCodePrepose": false,
|
||||
"drillGroupCode": "",
|
||||
"axisStartCode": "M03 S18000\n",
|
||||
"knifeStartCode": `M06 T1\nG43 H1\n`,
|
||||
"drillGroupStartCode": "T1",
|
||||
"drillGroupEndCode": "",
|
||||
"knifeStopCode": "",
|
||||
"axisStopCode": "M05\n",
|
||||
"preStartActionDeferCode": "",
|
||||
"useHolesGroupKnife": false,
|
||||
"preStartActionStepsLimit": "",
|
||||
"knifeNo": "",
|
||||
"editable": true,
|
||||
"isDefaultCutKnife": false,
|
||||
"isPreStartChangeKnifeDefer": false
|
||||
}
|
||||
export const knifeData1 = {
|
||||
"isEnabled": true,
|
||||
"axleId": 2,
|
||||
"knifeId": 2,
|
||||
"processFace": "",
|
||||
"knifeName": "T2",
|
||||
"knifeType": 3,
|
||||
"ability": [
|
||||
5
|
||||
],
|
||||
"diameter": 6,
|
||||
"length": 20,
|
||||
"sawThiness": 7,
|
||||
"sawDirection": 2,
|
||||
"processDirection": 4,
|
||||
"speed": 0,
|
||||
"stepDepth": 0,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"offsetZ": 0,
|
||||
"baseX": 0,
|
||||
"baseY": 0,
|
||||
"isModularDrill": false,
|
||||
"isPreStartEnabled": false,
|
||||
"preStartAheadActionCount": 5,
|
||||
"isPreStartToolChangeDelay": false,
|
||||
"preStartToolChangeDelayCode": "",
|
||||
"isAxisStartCodePostpost": false,
|
||||
"isAxisStopCodePrepose": false,
|
||||
"drillGroupCode": "",
|
||||
"axisStartCode": "M03 S18000\n",
|
||||
"knifeStartCode": `M06 T2\nG43 H2\n`,
|
||||
"drillGroupStartCode": "T2",
|
||||
"drillGroupEndCode": "",
|
||||
"knifeStopCode": "",
|
||||
"axisStopCode": "M05\n",
|
||||
"preStartActionDeferCode": "",
|
||||
"useHolesGroupKnife": false,
|
||||
"preStartActionStepsLimit": "",
|
||||
"knifeNo": "",
|
||||
"editable": true,
|
||||
"isDefaultCutKnife": false,
|
||||
"isPreStartChangeKnifeDefer": false
|
||||
}
|
||||
export const knifeData2 = {
|
||||
"isEnabled": true,
|
||||
"axleId": 2,
|
||||
"knifeId": 2,
|
||||
"processFace": "",
|
||||
"knifeName": "T3",
|
||||
"knifeType": 3,
|
||||
"ability": [
|
||||
5
|
||||
],
|
||||
"diameter": 6,
|
||||
"length": 20,
|
||||
"sawThiness": 7,
|
||||
"sawDirection": 2,
|
||||
"processDirection": 4,
|
||||
"speed": 0,
|
||||
"stepDepth": 0,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"offsetZ": 0,
|
||||
"baseX": 0,
|
||||
"baseY": 0,
|
||||
"isModularDrill": false,
|
||||
"isPreStartEnabled": false,
|
||||
"preStartAheadActionCount": 5,
|
||||
"isPreStartToolChangeDelay": false,
|
||||
"preStartToolChangeDelayCode": "",
|
||||
"isAxisStartCodePostpost": false,
|
||||
"isAxisStopCodePrepose": false,
|
||||
"drillGroupCode": "",
|
||||
|
||||
"axisStartCode": "M03 S18000\n",
|
||||
"knifeStartCode": `M06 T2\nG43 H2\n`,
|
||||
"drillGroupStartCode": "T3",
|
||||
"drillGroupEndCode": "",
|
||||
"knifeStopCode": "",
|
||||
"axisStopCode": "M05\n",
|
||||
|
||||
"preStartActionDeferCode": "",
|
||||
"useHolesGroupKnife": false,
|
||||
"preStartActionStepsLimit": "",
|
||||
"knifeNo": "",
|
||||
"editable": true,
|
||||
"isDefaultCutKnife": false,
|
||||
"isPreStartChangeKnifeDefer": false
|
||||
}
|
||||
// describe('data', async () => {
|
||||
// const sysConfig = {
|
||||
// placeStyle: 1,
|
||||
// boardWidth: 2440,
|
||||
// boardLength: 1220,
|
||||
// // 测试刀库数据
|
||||
// knifeList: [knifeData, knifeData1, knifeData2]
|
||||
// }
|
||||
// const json = testJson
|
||||
// // 创建处理器集合
|
||||
// const processorManager = new ProcessorManager<any, any>();
|
||||
// // 这里省略了 选择处理器的环节 --这里选了demo开料机
|
||||
// const cuttingHandle = new demoHandleGroupCutting()
|
||||
// // 注册处理器
|
||||
// processorManager.registerProcessor(cuttingHandle.processorName, cuttingHandle.processor)
|
||||
// // 使用XX处理器 会返回激活【正在使用】的 处理器
|
||||
// let processor = processorManager.useProcessor(cuttingHandle.processorName)
|
||||
// // 或者 这样 获取 正在使用的处理器 注:若未执行useProcessor 将会返回 undefind
|
||||
// // processor = processorManager.getCurrentProcessor()
|
||||
// /** 处理器配置加载 */
|
||||
// processor.updateModuleConfig(sysConfig)
|
||||
// const res = await processor.process(json)
|
||||
// // console.log('处理器所有流程都结束了', res);
|
||||
// })
|
||||
//
|
||||
// /** demo 刀具数据 */
|
||||
// export const knifeData = {
|
||||
// "isEnabled": true,
|
||||
// "axleId": 2,
|
||||
// "knifeId": 2,
|
||||
// "processFace": "",
|
||||
// "knifeName": "T1",
|
||||
// "knifeType": 3,
|
||||
// "ability": [
|
||||
// 5
|
||||
// ],
|
||||
// "diameter": 5,
|
||||
// "length": 20,
|
||||
// "sawThiness": 7,
|
||||
// "sawDirection": 2,
|
||||
// "processDirection": 4,
|
||||
// "speed": 0,
|
||||
// "stepDepth": 0,
|
||||
// "offsetX": 0,
|
||||
// "offsetY": 0,
|
||||
// "offsetZ": 0,
|
||||
// "baseX": 0,
|
||||
// "baseY": 0,
|
||||
// "isModularDrill": false,
|
||||
// "isPreStartEnabled": false,
|
||||
// "preStartAheadActionCount": 5,
|
||||
// "isPreStartToolChangeDelay": false,
|
||||
// "preStartToolChangeDelayCode": "",
|
||||
// "isAxisStartCodePostpost": false,
|
||||
// "isAxisStopCodePrepose": false,
|
||||
// "drillGroupCode": "",
|
||||
// "axisStartCode": "M03 S18000\n",
|
||||
// "knifeStartCode": `M06 T1\nG43 H1\n`,
|
||||
// "drillGroupStartCode": "T1",
|
||||
// "drillGroupEndCode": "",
|
||||
// "knifeStopCode": "",
|
||||
// "axisStopCode": "M05\n",
|
||||
// "preStartActionDeferCode": "",
|
||||
// "useHolesGroupKnife": false,
|
||||
// "preStartActionStepsLimit": "",
|
||||
// "knifeNo": "",
|
||||
// "editable": true,
|
||||
// "isDefaultCutKnife": false,
|
||||
// "isPreStartChangeKnifeDefer": false
|
||||
// }
|
||||
// export const knifeData1 = {
|
||||
// "isEnabled": true,
|
||||
// "axleId": 2,
|
||||
// "knifeId": 2,
|
||||
// "processFace": "",
|
||||
// "knifeName": "T2",
|
||||
// "knifeType": 3,
|
||||
// "ability": [
|
||||
// 5
|
||||
// ],
|
||||
// "diameter": 6,
|
||||
// "length": 20,
|
||||
// "sawThiness": 7,
|
||||
// "sawDirection": 2,
|
||||
// "processDirection": 4,
|
||||
// "speed": 0,
|
||||
// "stepDepth": 0,
|
||||
// "offsetX": 0,
|
||||
// "offsetY": 0,
|
||||
// "offsetZ": 0,
|
||||
// "baseX": 0,
|
||||
// "baseY": 0,
|
||||
// "isModularDrill": false,
|
||||
// "isPreStartEnabled": false,
|
||||
// "preStartAheadActionCount": 5,
|
||||
// "isPreStartToolChangeDelay": false,
|
||||
// "preStartToolChangeDelayCode": "",
|
||||
// "isAxisStartCodePostpost": false,
|
||||
// "isAxisStopCodePrepose": false,
|
||||
// "drillGroupCode": "",
|
||||
// "axisStartCode": "M03 S18000\n",
|
||||
// "knifeStartCode": `M06 T2\nG43 H2\n`,
|
||||
// "drillGroupStartCode": "T2",
|
||||
// "drillGroupEndCode": "",
|
||||
// "knifeStopCode": "",
|
||||
// "axisStopCode": "M05\n",
|
||||
// "preStartActionDeferCode": "",
|
||||
// "useHolesGroupKnife": false,
|
||||
// "preStartActionStepsLimit": "",
|
||||
// "knifeNo": "",
|
||||
// "editable": true,
|
||||
// "isDefaultCutKnife": false,
|
||||
// "isPreStartChangeKnifeDefer": false
|
||||
// }
|
||||
// export const knifeData2 = {
|
||||
// "isEnabled": true,
|
||||
// "axleId": 2,
|
||||
// "knifeId": 2,
|
||||
// "processFace": "",
|
||||
// "knifeName": "T3",
|
||||
// "knifeType": 3,
|
||||
// "ability": [
|
||||
// 5
|
||||
// ],
|
||||
// "diameter": 6,
|
||||
// "length": 20,
|
||||
// "sawThiness": 7,
|
||||
// "sawDirection": 2,
|
||||
// "processDirection": 4,
|
||||
// "speed": 0,
|
||||
// "stepDepth": 0,
|
||||
// "offsetX": 0,
|
||||
// "offsetY": 0,
|
||||
// "offsetZ": 0,
|
||||
// "baseX": 0,
|
||||
// "baseY": 0,
|
||||
// "isModularDrill": false,
|
||||
// "isPreStartEnabled": false,
|
||||
// "preStartAheadActionCount": 5,
|
||||
// "isPreStartToolChangeDelay": false,
|
||||
// "preStartToolChangeDelayCode": "",
|
||||
// "isAxisStartCodePostpost": false,
|
||||
// "isAxisStopCodePrepose": false,
|
||||
// "drillGroupCode": "",
|
||||
//
|
||||
// "axisStartCode": "M03 S18000\n",
|
||||
// "knifeStartCode": `M06 T2\nG43 H2\n`,
|
||||
// "drillGroupStartCode": "T3",
|
||||
// "drillGroupEndCode": "",
|
||||
// "knifeStopCode": "",
|
||||
// "axisStopCode": "M05\n",
|
||||
//
|
||||
// "preStartActionDeferCode": "",
|
||||
// "useHolesGroupKnife": false,
|
||||
// "preStartActionStepsLimit": "",
|
||||
// "knifeNo": "",
|
||||
// "editable": true,
|
||||
// "isDefaultCutKnife": false,
|
||||
// "isPreStartChangeKnifeDefer": false
|
||||
// }
|
||||
|
Reference in New Issue
Block a user