Skip to content

Commit

Permalink
Added test for useGlobePicking flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Fili committed Aug 6, 2015
1 parent 312fecc commit 66a9da1
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Specs/Scene/SceneSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,41 @@ defineSuite([
expect(position).toBeDefined();
});

it('pickPosition returns undefined when useDepthPicking is false', function() {
if (!scene.pickPositionSupported) {
return;
}

var rectangle = Rectangle.fromDegrees(-100.0, 30.0, -90.0, 40.0);
scene.camera.viewRectangle(rectangle);

var canvas = scene.canvas;
var windowPosition = new Cartesian2(canvas.clientWidth / 2, canvas.clientHeight / 2);

var rectanglePrimitive = new RectanglePrimitive({
rectangle : rectangle,
asynchronous : false
});
rectanglePrimitive.material.uniforms.color = new Color(1.0, 0.0, 0.0, 1.0);

var primitives = scene.primitives;
primitives.add(rectanglePrimitive);

scene.useDepthPicking = false;

scene.renderForSpecs();

var position = scene.pickPosition(windowPosition);
expect(position).not.toBeDefined();

scene.useDepthPicking = true;

scene.renderForSpecs();

position = scene.pickPosition(windowPosition);
expect(position).toBeDefined();
});

it('pickPosition throws without windowPosition', function() {
expect(function() {
scene.pickPosition();
Expand Down

0 comments on commit 66a9da1

Please sign in to comment.