Fix equalities in scriptableResource tests

This commit is contained in:
Zach Pomerantz 2016-05-06 14:19:13 -07:00
parent aeebf7d9bf
commit 83fad4c52f

View file

@ -26,8 +26,8 @@ function getFrame(callback) {
} }
function makeFrame(state) { function makeFrame(state) {
if (state == Resource.State.FAILED) { throw "Failed to load frame"; } if (state === Resource.State.FAILED) { throw "Failed to load frame"; }
if (state != Resource.State.FINISHED) { return; } if (state !== Resource.State.FINISHED) { return; }
var pictureFrameProperties = { var pictureFrameProperties = {
name: 'scriptableResourceTest Picture Frame', name: 'scriptableResourceTest Picture Frame',
@ -50,7 +50,6 @@ function getFrame(callback) {
position.x += - 5 * Math.sin(rads); position.x += - 5 * Math.sin(rads);
position.z += - 5 * Math.cos(rads); position.z += - 5 * Math.cos(rads);
print(JSON.stringify(position));
return position; return position;
} }
} }
@ -67,10 +66,10 @@ function prefetch(callback) {
var filepath = MOVIE_URL + padded + '.jpg'; var filepath = MOVIE_URL + padded + '.jpg';
var texture = TextureCache.prefetch(filepath); var texture = TextureCache.prefetch(filepath);
frames.push(texture); frames.push(texture);
if (!texture.state == Resource.State.FINISHED) { if (texture.state !== Resource.State.FINISHED) {
numLoading++; numLoading++;
texture.stateChanged.connect(function(state) { texture.stateChanged.connect(function(state) {
if (state == Resource.State.FAILED || state == Resource.State.FINISHED) { if (state === Resource.State.FAILED || state === Resource.State.FINISHED) {
--numLoading; --numLoading;
if (!numLoading) { callback(frames); } if (!numLoading) { callback(frames); }
} }