diff --git a/Specs/Scene/SceneSpec.js b/Specs/Scene/SceneSpec.js index 94ad8f5240b5..c5d7ff2b3251 100644 --- a/Specs/Scene/SceneSpec.js +++ b/Specs/Scene/SceneSpec.js @@ -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();