Skip to content

Commit 2591c10

Browse files
authored
Merge pull request #646 from Devesh21700Kumar/Listener_tests
Add Listener 3d tests
2 parents 83297b9 + 123a9b7 commit 2591c10

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

test/tests/p5.Listener3d.js

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,37 @@ describe('p5.Listener3D', function () {
7777
expect(listener3d.upZ()).to.equal(0);
7878
expect(listener3d.upZ(-100)).to.equal(-100);
7979
});
80-
it('can set upX, forwardY, upZ with a delay', function () {
81-
//TODO
80+
it('can set upX, forwardY, upZ with a delay', function (done) {
81+
expect(listener3d.upX()).to.equal(0);
82+
expect(listener3d.upY()).to.equal(1);
83+
expect(listener3d.upZ()).to.equal(0);
84+
85+
listener3d.upX(900, 0.2);
86+
setTimeout(() => {
87+
expect(listener3d.upX()).to.not.be.approximately(900, 1);
88+
setTimeout(() => {
89+
expect(listener3d.upX()).to.be.approximately(900, 1);
90+
done();
91+
}, 200);
92+
}, 50);
93+
94+
listener3d.upY(900, 0.2);
95+
setTimeout(() => {
96+
expect(listener3d.upY()).to.not.be.approximately(900, 1);
97+
setTimeout(() => {
98+
expect(listener3d.upY()).to.be.approximately(900, 1);
99+
done();
100+
}, 200);
101+
}, 50);
102+
103+
listener3d.upZ(900, 0.2);
104+
setTimeout(() => {
105+
expect(listener3d.upZ()).to.not.be.approximately(900, 1);
106+
setTimeout(() => {
107+
expect(listener3d.upZ()).to.be.approximately(900, 1);
108+
done();
109+
}, 200);
110+
}, 50);
82111
});
83112
it('can set upX, forwardY, upZ using orientup function without a delay', function () {
84113
listener3d = new p5.Listener3D();

0 commit comments

Comments
 (0)