mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 12:04:18 +02:00
updated avatarUnitTests.js
This commit is contained in:
parent
700f548f44
commit
9ab3255285
1 changed files with 47 additions and 7 deletions
|
@ -2,17 +2,57 @@
|
|||
Script.include("../libraries/jasmine/jasmine.js");
|
||||
Script.include("../libraries/jasmine/hifi-boot.js");
|
||||
|
||||
describe("Avatar", function() {
|
||||
// Art3mis
|
||||
var DEFAULT_AVATAR_URL = "https://hifi-metaverse.s3-us-west-1.amazonaws.com/marketplace/contents/e76946cc-c272-4adf-9bb6-02cde0a4b57d/8fd984ea6fe1495147a3303f87fa6e23.fst?1460131758";
|
||||
|
||||
beforeEach(function() {
|
||||
print("beforeEach");
|
||||
var ORIGIN = {x: 0, y: 0, z: 0};
|
||||
var ONE_HUNDRED = {x: 100, y: 100, z: 100};
|
||||
var ROT_IDENT = {x: 0, y: 0, z: 0, w: 1};
|
||||
|
||||
describe("MyAvatar", function () {
|
||||
|
||||
// reload the avatar from scratch before each test.
|
||||
beforeEach(function (done) {
|
||||
MyAvatar.skeletonModelURL = DEFAULT_AVATAR_URL;
|
||||
|
||||
// wait until we are finished loading
|
||||
var id = Script.setInterval(function () {
|
||||
if (MyAvatar.jointNames.length == 72) {
|
||||
// assume we are finished loading.
|
||||
Script.clearInterval(id);
|
||||
MyAvatar.position = ORIGIN;
|
||||
MyAvatar.orientation = ROT_IDENT;
|
||||
// give the avatar 1/2 a second to settle on the ground in the idle pose.
|
||||
Script.setTimeout(function () {
|
||||
done();
|
||||
}, 500);
|
||||
}
|
||||
}, 500);
|
||||
});
|
||||
|
||||
it("test one", function() {
|
||||
print("test one!");
|
||||
expect(10).toEqual(11);
|
||||
throw "wtf";
|
||||
// makes the assumption that there is solid ground somewhat underneath the avatar.
|
||||
it("position and orientation getters", function () {
|
||||
var pos = MyAvatar.position;
|
||||
|
||||
expect(Math.abs(pos.x)).toBeLessThan(0.1);
|
||||
expect(Math.abs(pos.y)).toBeLessThan(1.0);
|
||||
expect(Math.abs(pos.z)).toBeLessThan(0.1);
|
||||
|
||||
var rot = MyAvatar.orientation;
|
||||
expect(Math.abs(rot.x)).toBeLessThan(0.01);
|
||||
expect(Math.abs(rot.y)).toBeLessThan(0.01);
|
||||
expect(Math.abs(rot.z)).toBeLessThan(0.01);
|
||||
expect(Math.abs(1 - rot.w)).toBeLessThan(0.01);
|
||||
});
|
||||
|
||||
it("position and orientation setters", function (done) {
|
||||
MyAvatar.position = ONE_HUNDRED;
|
||||
Script.setTimeout(function () {
|
||||
expect(Vec3.length(Vec3.subtract(MyAvatar.position, ONE_HUNDRED))).toBeLessThan(0.1);
|
||||
done();
|
||||
}, 100);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
jasmine.getEnv().execute();
|
||||
|
|
Loading…
Reference in a new issue