@jscad/x3d-deserializer 3.0.0-alpha.0 → 3.0.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/LICENSE +1 -1
- package/dist/jscad-x3d-deserializer.es.js +5 -5
- package/dist/jscad-x3d-deserializer.min.js +5 -6
- package/package.json +5 -4
- package/rollup.config.js +1 -1
- package/src/index.js +2 -0
- package/src/objects.js +45 -38
- package/src/parse.js +17 -19
- package/tests/IndexedTriangleSets_CommaMF.x3d +82 -0
- package/tests/TriangleSets_CommaMF.x3d +54 -0
- package/tests/instantiate.test.js +28 -0
- package/tests/translate.test.js +24 -0
package/tests/translate.test.js
CHANGED
|
@@ -85,6 +85,18 @@ test('deserialize X3D 3D triangle sets to JSCAD script', (t) => {
|
|
|
85
85
|
t.is(countOf('transform', observed), 0)
|
|
86
86
|
})
|
|
87
87
|
|
|
88
|
+
test('deserialize X3D 3D triangle sets with comma delimiters to JSCAD script', (t) => {
|
|
89
|
+
const inputPath = path.resolve(samplesPath, 'tests/TriangleSets_CommaMF.x3d')
|
|
90
|
+
const inputFile = fs.readFileSync(inputPath)
|
|
91
|
+
|
|
92
|
+
const observed = deserialize({ output: 'script', addMetaData: false }, inputFile)
|
|
93
|
+
t.is(countOf('createObjects', observed), 18)
|
|
94
|
+
t.is(countOf('points', observed), 12)
|
|
95
|
+
t.is(countOf('faces', observed), 12)
|
|
96
|
+
t.is(countOf('orientation', observed), 8)
|
|
97
|
+
t.is(countOf('polyhedron', observed), 4)
|
|
98
|
+
})
|
|
99
|
+
|
|
88
100
|
test('deserialize X3D 3D transforms to JSCAD script', (t) => {
|
|
89
101
|
const inputPath = path.resolve(samplesPath, 'tests/Transforms.x3d')
|
|
90
102
|
const inputFile = fs.readFileSync(inputPath)
|
|
@@ -109,6 +121,18 @@ test('deserialize X3D 3D indexed triangle sets to JSCAD script', (t) => {
|
|
|
109
121
|
t.is(countOf('transform', observed), 0)
|
|
110
122
|
})
|
|
111
123
|
|
|
124
|
+
test('deserialize X3D 3D indexed triangle sets with comma delimiters to JSCAD script', (t) => {
|
|
125
|
+
const inputPath = path.resolve(samplesPath, 'tests/IndexedTriangleSets_CommaMF.x3d')
|
|
126
|
+
const inputFile = fs.readFileSync(inputPath)
|
|
127
|
+
|
|
128
|
+
const observed = deserialize({ output: 'script', addMetaData: false }, inputFile)
|
|
129
|
+
t.is(countOf('createObjects', observed), 24)
|
|
130
|
+
t.is(countOf('points', observed), 18)
|
|
131
|
+
t.is(countOf('faces', observed), 20)
|
|
132
|
+
t.is(countOf('orientation', observed), 12)
|
|
133
|
+
t.is(countOf('polyhedron', observed), 6)
|
|
134
|
+
})
|
|
135
|
+
|
|
112
136
|
test('deserialize X3D 3D groups to JSCAD script', (t) => {
|
|
113
137
|
const inputPath = path.resolve(samplesPath, 'tests/Groups.x3d')
|
|
114
138
|
const inputFile = fs.readFileSync(inputPath)
|