Skip to content

Commit 948a132

Browse files
committed
add test file
1 parent 28af38c commit 948a132

4 files changed

Lines changed: 59 additions & 8 deletions

File tree

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ obj23dtiles -i ./bin/barrel/barrel.obj
2929
* Convert `.obj` to `.glb`
3030

3131
```
32-
obj23dtiles -i ./bin/barrel/barrel.obj -b
32+
obj23dtiles -i ./bin/barrel/barrel.obj -b
3333
// Export barrel.glb at obj folder.
3434
```
3535

@@ -93,7 +93,7 @@ obj23dtiles -i ./bin/barrel/barrel.obj --tileset
9393
* Create a single tileset with `.b3dm` tile and custom tileset options, custom BatchTable.
9494

9595
```
96-
obj23dtiles -i ./bin/barrel/barrel.obj --tileset
96+
obj23dtiles -i ./bin/barrel/barrel.obj --tileset
9797
-p ./bin/barrel/customTilesetOptions.json -c ./bin/barrel/customBatchTable.json
9898
// Export ./Batchedbarrel folder at obj folder which is a tileset with custom tileset options.
9999
```
@@ -143,6 +143,11 @@ obj23dtiles combine -i ./bin/barrel/output
143143
## Using as node module
144144
If you want to use this tool in node or debug, check out [how to use as node module](NODEUSAGE.md).
145145

146+
## Test
147+
Navigate to this project folder and run
148+
```
149+
npm run test
150+
```
146151

147152
## Troubleshooting
148153
First, make sure your `.obj` file is complete, normally include `.obj`, `.mtl` and textures like `.jpg` or `.png`.
@@ -157,7 +162,7 @@ Second, export `.glb` and check if it display correctly. You can use
157162
In the end, just export `.b3dm` or tileset and load in Cesium.
158163

159164
## Sample Data
160-
Sample data under the `.bin\barrel\` folder.
165+
Sample data under the `.bin\barrel\` folder.
161166

162167
```
163168
barrel\

README_CN.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ npm install -g obj23dtiles
2121

2222
```
2323
obj23dtiles -i ./bin/barrel/barrel.obj
24-
// 在模型目录导出 barrel.gltf
24+
// 在模型目录导出 barrel.gltf
2525
```
2626

2727
* 转换 `.obj``.glb`
2828

2929
```
30-
obj23dtiles -i ./bin/barrel/barrel.obj -b
31-
// 在模型目录导出 barrel.glb
30+
obj23dtiles -i ./bin/barrel/barrel.obj -b
31+
// 在模型目录导出 barrel.glb
3232
```
3333

3434
>注意: 更多 `.gltf``.glb` 的转换信息可以在 [obj2gltf](https://github.com/AnalyticalGraphicsInc/obj2gltf) 查看。
@@ -45,7 +45,7 @@ obj23dtiles -i ./bin/barrel/barrel.obj -b
4545

4646
```
4747
obj23dtiles -i ./bin/barrel/barrel.obj --b3dm
48-
// 在模型目录导出 barrel.b3dm
48+
// 在模型目录导出 barrel.b3dm
4949
```
5050

5151
* 转换 `.obj``.b3dm`,同时导出默认的[属性表](https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/TileFormats/BatchTable/README.md) (一个 JSON 文件)。可以从这个表中获取相关信息以便制作自定义属性表。
@@ -92,7 +92,7 @@ obj23dtiles -i ./bin/barrel/barrel.obj --tileset
9292
* 创建一个 `.b3dm` 瓦片,并自定义瓦片参数和属性表。
9393

9494
```
95-
obj23dtiles -i ./bin/barrel/barrel.obj --tileset
95+
obj23dtiles -i ./bin/barrel/barrel.obj --tileset
9696
-p ./bin/barrel/customTilesetOptions.json -c ./bin/barrel/customBatchTable.json
9797
// 在模型目录导出 Batchedbarrel 文件夹
9898
```
@@ -140,6 +140,11 @@ obj23dtiles combine -i ./bin/barrel/output/
140140
## 作为 Node 模块使用
141141
如果你想调试此工具或者在node中使用,可以看看[如何作为Node模块使用](NODEUSAGE.md)
142142

143+
## 测试
144+
导航到项目文件夹下,运行
145+
```
146+
npm run test
147+
```
143148

144149
## 问题定位
145150
首先,确保你的 `.obj` 文件是完整的,通常情况下包含 `.obj``.mtl` 和纹理文件比如 `.jpg``.png`

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"lib": "lib"
88
},
99
"scripts": {
10+
"test": "node ./tools/test.js"
1011
},
1112
"repository": {
1213
"type": "git",

tools/test.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
'use strict';
2+
3+
var util = require('util');
4+
var exec = util.promisify(require('child_process').exec);
5+
6+
var commands = [
7+
'node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj',
8+
'node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj -b',
9+
'node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj --b3dm',
10+
'node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj --b3dm --outputBatchTable',
11+
'node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj -c ./bin/barrel/customBatchTable.json --b3dm',
12+
'node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj -f ./bin/barrel/customFeatureTable.json --i3dm',
13+
'node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj -f ./bin/barrel/customFeatureTable.json -c ./bin/barrel/customI3dmBatchTable.json --i3dm',
14+
'node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj --tileset',
15+
'node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj --tileset -p ./bin/barrel/customTilesetOptions.json -c ./bin/barrel/customBatchTable.json',
16+
'node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj --tileset --i3dm -f ./bin/barrel/customFeatureTable.json',
17+
'node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj --tileset --i3dm -f ./bin/barrel/customFeatureTable.json -p ./bin/barrel/customTilesetOptions.json -c ./bin/barrel/customI3dmBatchTable.json',
18+
];
19+
20+
var errcount = 0;
21+
var finished = 0;
22+
function logout(stdout, error, command) {
23+
if(error || stdout.stderr) {
24+
console.error(command , error, stdout.stderr);
25+
errcount ++;
26+
} else {
27+
console.log(command, stdout.stdout);
28+
}
29+
30+
finished ++;
31+
if(finished === commands.length) {console.log('all down! ' + (errcount ? ('error: ' + error) : 'passed.'));}
32+
}
33+
34+
function test() {
35+
commands.forEach( function(command) {
36+
exec(command).then( function(out, err) { logout(out, err, command); });
37+
});
38+
}
39+
40+
test();

0 commit comments

Comments
 (0)