Files
cocos-engine/tests/primitive/transform.test.ts
Leslie Leigh (李的序) db3a56fa1e Fix primitive.scale (#12836)
* Fix primitive.scale

* Test

* Tweak
2022-09-21 14:49:41 +08:00

21 lines
767 B
TypeScript

import { IGeometry } from '../../cocos/primitive/define';
import { scale } from '../../cocos/primitive/transform';
import '../utils/matcher-deep-close-to';
test('Scaling', () => {
expect(scale({ positions: [2.0, 3.0, 4.0] }, { x: 1.2, })).toBeDeepCloseTo({
positions: [2.4, 3.0, 4.0],
});
expect(scale({
positions: [2.0, 3.0, 4.0],
minPos: { x: -1.0, y: -2.0, z: -3.0 },
maxPos: { x: 2.0, y: 3.2, z: 4.4 },
boundingRadius: 6.6,
}, { x: 1.2, y: 1.3, z: -3.0 })).toBeDeepCloseTo({
positions: [2.0 * 1.2, 3.0 * 1.3, 4.0 * -3.0],
minPos: { x: -1.0 * 1.2, y: -2.0 * 1.3, z: 4.4 * -3.0 },
maxPos: { x: 2.0 * 1.2, y: 3.2 * 1.3, z: -3.0 * -3.0 },
boundingRadius: 6.6 * 3.0,
});
});