You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
WebCAD/__test__/BBS/seal_width.test.ts

78 lines
3.5 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import { lookOverBoardInfosTool } from "../../src/Add-on/LookOverBoardInfos/LookOverBoardInfosTool";
import { HostApplicationServices } from "../../src/ApplicationServices/HostApplicationServices";
import { Board } from "../../src/DatabaseServices/Entity/Board";
import { LoadEntityFromFileData } from "../Utils/LoadEntity.util";
//只填写拆单厚的板板厚18拆单厚30
let data1 = [1, "Board", 10, 2, 15582, 0, 1, 11, 71, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 9061.163081999983, 0, 120.81939073568778, 1], 15581, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 9061.163081999983, 0, 120.81939073568778, 1], 0, 0, 1, 3, 2000, 600, 18, true, "Polyline", 10, 2, 0, 0, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 1, 2, 4, [0, 0], 0, [600, 0], 0, [600, 2000], 0, [0, 2000], 0, true, 0, 3, 0, 0, 0, 0, 0, 13, 1, "左侧板", "主卧", "下柜", "", "", "", 0, 0, "三合一", 2, 0, "1", "1", "1", "1", "", "", "30", 4, "三合一", "三合一", "三合一", "三合一", true, true, 0, 0, 0, 0, 0, 0, 0, 0, true, 0, 0, null, 0, 0];
let br1 = LoadEntityFromFileData(data1)[0] as Board;
//填写所有拆单值的板板厚18拆单厚20
let data2 = [1, "Board", 10, 2, 15583, 0, 1, 11, 71, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 10243.163081999983, 0, 120.81939073568778, 1], 15581, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 9061.163081999983, 0, 120.81939073568778, 1], 0, 0, 1, 3, 2000, 600, 18, true, "Polyline", 10, 2, 0, 0, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 1, 2, 4, [0, 0], 0, [600, 0], 0, [600, 2000], 0, [0, 2000], 0, true, 0, 3, 0, 0, 0, 0, 0, 13, 1, "右侧板", "主卧", "下柜", "", "", "", 0, 1, "三合一", 2, 0, "1", "1", "1", "1", "H", "W", "20", 4, "三合一", "三合一", "三合一", "三合一", true, true, 0, 0, 0, 0, 0, 0, 0, 0, true, 0, 0, null, 0, 0];
let br2 = LoadEntityFromFileData(data2)[0] as Board;
const partialSplitValueCanTakesEffect = HostApplicationServices.chaidanOption.partialSplitValueCanTakesEffect;
const regex = /-(\d+)-/;
describe('局部拆单值可生效', () =>
{
beforeEach(() =>
{
HostApplicationServices.chaidanOption.partialSplitValueCanTakesEffect = true;
});
test('板封边宽值', () =>
{
const { sealCount } = lookOverBoardInfosTool.GetCount([br1, br2]);
const match1 = sealCount[0].name.match(regex);
if (match1)
{
expect(match1[1]).toBe("30");
}
const match2 = sealCount[1].name.match(regex);
if (match2)
{
expect(match2[1]).toBe("20");
}
});
afterEach(() =>
{
HostApplicationServices.chaidanOption.partialSplitValueCanTakesEffect = partialSplitValueCanTakesEffect;
});
});
describe('局部拆单值不生效', () =>
{
beforeEach(() =>
{
HostApplicationServices.chaidanOption.partialSplitValueCanTakesEffect = false;
});
test('板封边宽值', () =>
{
const { sealCount } = lookOverBoardInfosTool.GetCount([br1, br2]);
const match1 = sealCount[0].name.match(regex);
if (match1)
{
expect(match1[1]).toBe("18");
}
const match2 = sealCount[1].name.match(regex);
if (match2)
{
expect(match2[1]).toBe("20");
}
});
afterEach(() =>
{
HostApplicationServices.chaidanOption.partialSplitValueCanTakesEffect = partialSplitValueCanTakesEffect;
});
});