Skip to content

Commit

Permalink
Changes per @pjcozzi's comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
kristiancalhoun committed May 21, 2012
1 parent aa53444 commit 4bd6c4e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 21 deletions.
8 changes: 6 additions & 2 deletions Specs/Renderer/ContextSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ defineSuite([
});

it("gets maximum texture filter anisotropy", function() {
expect(context.getMaximumTextureFilterAnisotropy()).toBeDefined();
if(context.getTextureFilterAnisotropic()) {
expect(context.getMaximumTextureFilterAnisotropy()).toBeGreaterThan(1.0);

This comment has been minimized.

Copy link
@pjcozzi

pjcozzi May 21, 2012

Contributor

= 2.0 is not the same as > 1.0 with floating-point, right?

This comment has been minimized.

Copy link
@pjcozzi

pjcozzi May 21, 2012

Contributor

That should be => 2.0.

} else {
expect(context.getMaximumTextureFilterAnisotropy()).toEqual(1.0);
}
});

it("sets shader program validation", function() {
Expand Down Expand Up @@ -278,7 +282,7 @@ defineSuite([

it("continueDraw throws without arguments", function() {
expect(function() {
context.continueDraw(undefined);
context.continueDraw();
}).toThrow();
});

Expand Down
32 changes: 16 additions & 16 deletions Specs/Scene/Camera2DControllerSpec.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*global defineSuite*/
defineSuite([
'Scene/Camera2DController',
'Scene/Camera',
Expand Down Expand Up @@ -44,12 +45,12 @@ defineSuite([
right = dir.cross(up);

frustum = new OrthographicFrustum();
frustum.near = 1;
frustum.far = 2;
frustum.left = -2;
frustum.right = 2;
frustum.top = 1;
frustum.bottom = -1;
frustum.near = 1.0;
frustum.far = 2.0;
frustum.left = -2.0;
frustum.right = 2.0;
frustum.top = 1.0;
frustum.bottom = -1.0;

camera = new Camera(document);
camera.position = position;
Expand Down Expand Up @@ -81,22 +82,22 @@ defineSuite([

it("moveUp", function() {
controller.moveUp(moverate);
expect(camera.position.equalsEpsilon(new Cartesian3(0, moverate, 0), CesiumMath.EPSILON10)).toEqual(true);
expect(camera.position.equalsEpsilon(new Cartesian3(0.0, moverate, 0.0), CesiumMath.EPSILON10)).toEqual(true);
});

it("moveDown", function() {
controller.moveDown(moverate);
expect(camera.position.equalsEpsilon(new Cartesian3(0, -moverate, 0), CesiumMath.EPSILON10)).toEqual(true);
expect(camera.position.equalsEpsilon(new Cartesian3(0.0, -moverate, 0.0), CesiumMath.EPSILON10)).toEqual(true);
});

it("moveRight", function() {
controller.moveRight(moverate);
expect(camera.position.equalsEpsilon(new Cartesian3(moverate, 0, 0), CesiumMath.EPSILON10)).toEqual(true);
expect(camera.position.equalsEpsilon(new Cartesian3(moverate, 0.0, 0.0), CesiumMath.EPSILON10)).toEqual(true);
});

it("moveLeft", function() {
controller.moveLeft(moverate);
expect(camera.position.equalsEpsilon(new Cartesian3(-moverate, 0, 0), CesiumMath.EPSILON10)).toEqual(true);
expect(camera.position.equalsEpsilon(new Cartesian3(-moverate, 0.0, 0.0), CesiumMath.EPSILON10)).toEqual(true);
});

it("translate", function() {
Expand All @@ -122,24 +123,23 @@ defineSuite([

it("zoomOut", function() {
controller.zoomOut(zoomrate);
expect(frustum.right).toEqualEpsilon(3, CesiumMath.EPSILON10);
expect(frustum.left).toEqual(-3, CesiumMath.EPSILON10);
expect(frustum.right).toEqualEpsilon(3.0, CesiumMath.EPSILON10);
expect(frustum.left).toEqual(-3.0, CesiumMath.EPSILON10);
expect(frustum.top).toEqual(1.5, CesiumMath.EPSILON10);
expect(frustum.bottom).toEqual(-1.5, CesiumMath.EPSILON10);
});

it("zoomIn", function() {
controller.zoomIn(zoomrate);
expect(frustum.right).toEqualEpsilon(1, CesiumMath.EPSILON10);
expect(frustum.left).toEqual(-1, CesiumMath.EPSILON10);
expect(frustum.right).toEqualEpsilon(1.0, CesiumMath.EPSILON10);
expect(frustum.left).toEqual(-1.0, CesiumMath.EPSILON10);
expect(frustum.top).toEqual(0.5, CesiumMath.EPSILON10);
expect(frustum.bottom).toEqual(-0.5, CesiumMath.EPSILON10);
});

it("zoomIn throws with null OrthogrphicFrustum properties", function() {
var camera = new Camera(document);
var frustum = new OrthographicFrustum();
camera.frustum = frustum;
camera.frustum = new OrthographicFrustum();
var c2dc = new Camera2DController(document, camera, ellipsoid);
expect(function () {
c2dc.zoomIn(moverate);
Expand Down
3 changes: 2 additions & 1 deletion Specs/Scene/CameraEventHandlerSpec.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*global defineSuite*/
defineSuite([
'Scene/CameraEventHandler',
'Scene/CameraEventType',
Expand All @@ -21,7 +22,7 @@ defineSuite([
}).toThrow();
});

it("thrwos without a moveType", function() {
it("throws without a moveType", function() {
expect(function() {
return new CameraEventHandler(document);
}).toThrow();
Expand Down
4 changes: 2 additions & 2 deletions Specs/Scene/PolylineSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ defineSuite([
});

afterEach(function() {
us = null;
destroyContext(context);
try {
polyline = polyline && polyline.destroy();
us = null;
destroyContext(context);
} catch(e) {}
});

Expand Down

0 comments on commit 4bd6c4e

Please sign in to comment.