forked from RobotWebTools/ros3djs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/closecloud_adjustments
- Loading branch information
Showing
6 changed files
with
107 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,6 @@ | |
"trailing": true, | ||
"quotmark": "single", | ||
"proto": true, | ||
"laxbreak": true | ||
"laxbreak": true, | ||
"mocha": true | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Tests</title> | ||
<link rel="stylesheet" media="all" href="../node_modules/mocha/mocha.css"> | ||
</head> | ||
<body> | ||
<div id="mocha"><p>ros3d.js Tests</p></div> | ||
<div id="messages"></div> | ||
<div id="fixtures"></div> | ||
<script src="../node_modules/mocha/mocha.js"></script> | ||
<script src="../node_modules/chai/chai.js"></script> | ||
<script src="https://cdn.jsdelivr.net/lodash/4.17.4/lodash.core.min.js"></script> | ||
|
||
<script src="http://cdn.robotwebtools.org/threejs/current/three.js"></script> | ||
<script src="http://cdn.robotwebtools.org/EventEmitter2/current/eventemitter2.min.js"></script> | ||
<script src="http://cdn.robotwebtools.org/roslibjs/current/roslib.js"></script> | ||
<script src="../build/ros3d.js"></script> | ||
|
||
<script>mocha.setup('bdd')</script> | ||
<script src="tests.js"></script> | ||
<script>mocha.run();</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/*global describe, it, before, beforeEach, after, afterEach, chai, ROS3D, _ */ | ||
|
||
var assert = chai.assert; | ||
|
||
describe('Initialization', function() { | ||
|
||
|
||
describe('Arrow', function() { | ||
var arrow = new ROS3D.Arrow(); | ||
|
||
it('matrix should be equal to the proper Matrix4', function() { | ||
var a = new THREE.Vector3(0, 1, 0); | ||
arrow.setDirection(a); | ||
var b = new THREE.Matrix4(); | ||
b.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); | ||
assert.isTrue(_.isEqual(arrow.matrix.toArray(), b.toArray())); | ||
}); | ||
|
||
it('scale should be equal to THREE.Vector3(2, 2, 2)', function() { | ||
arrow.setLength(2); | ||
assert.isTrue(arrow.scale.equals(new THREE.Vector3(2, 2, 2))); | ||
}); | ||
|
||
it('material.color should be equal to THREE.Color(0xfff000)', function() { | ||
arrow.setColor(0xfff000); | ||
assert.equal(arrow.material.color.getHex(), new THREE.Color(0xfff000).getHex()); | ||
}); | ||
|
||
}); | ||
|
||
describe('depthCloud', function() { | ||
// Setup Kinect DepthCloud stream | ||
var depthCloud = new ROS3D.DepthCloud({ | ||
url : 'http://'+window.location.hostname+':9999/stream?topic=/depthcloud_encoded&type=vp8&bitrate=250000&quality=best', | ||
f : 525.0 | ||
}); | ||
|
||
it('should return 525.0 for value of f', function() { | ||
assert.equal(525.0, depthCloud.f); | ||
}); | ||
}); | ||
|
||
describe('Grid', function() { | ||
var grid = new ROS3D.Grid(); | ||
|
||
it('should default to 22 children', function() { | ||
assert.equal(grid.children.length, 22); | ||
}); | ||
|
||
it('each child\'s color is THREE.Color(\'#cccccc\') by default', function() { | ||
var sample = new THREE.Color('#cccccc').getHex(); | ||
function correctColor(element, index, array) { | ||
return element.material.color.getHex() === sample; | ||
} | ||
assert.isTrue(grid.children.every(correctColor)); | ||
}); | ||
|
||
it('each child\'s linewidth is 1 by default', function() { | ||
function isOne(element, index, array) { | ||
return element.material.linewidth === 1; | ||
} | ||
assert.isTrue(grid.children.every(isOne)); | ||
}); | ||
|
||
}); | ||
|
||
}); |