Skip to content

Commit

Permalink
Updates for sensor portion to display tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
fstoner committed Jan 17, 2014
1 parent 89bced4 commit 82f05bb
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 13 deletions.
34 changes: 29 additions & 5 deletions Specs/Scene/CustomSensorVolumeSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ defineSuite([

beforeAll(function() {
scene = createScene();
var camera = scene.getCamera();
camera.direction = Cartesian3.clone(Cartesian3.UNIT_Z);
camera.up = Cartesian3.clone(Cartesian3.UNIT_Y);
var z = -(Ellipsoid.WGS84.getRadii().z + 10000000.0);
camera.position = new Cartesian3(0.0, 0.0, z);
});

afterAll(function() {
Expand Down Expand Up @@ -81,6 +76,11 @@ defineSuite([
}

beforeEach(function() {
var camera = scene.getCamera();
camera.direction = Cartesian3.clone(Cartesian3.UNIT_Z);
camera.up = Cartesian3.clone(Cartesian3.UNIT_Y);
var z = -(Ellipsoid.WGS84.getRadii().z + 10000000.0);
camera.position = new Cartesian3(0.0, 0.0, z);
scene.initializeFrame();
});

Expand Down Expand Up @@ -159,6 +159,14 @@ defineSuite([
});

it('renders using complete (default) option', function() {
var camera = scene.getCamera();
camera.direction = Cartesian3.clone(Cartesian3.UNIT_Z, camera.direction);
camera.up = Cartesian3.clone(Cartesian3.UNIT_Y, camera.up);
var x = 1000000.0;
var y = 1000000.0;
var z = -(Ellipsoid.WGS84.getRadii().z + 10000000.0);
camera.position = new Cartesian3(x, y, z);

scene.render();
expect(scene.getContext().readPixels()).toEqual([0, 0, 0, 255]);
var sensor = addSensor({
Expand All @@ -171,6 +179,14 @@ defineSuite([
});

it('renders using below ellipsoid horizon option', function() {
var camera = scene.getCamera();
camera.direction = Cartesian3.clone(Cartesian3.UNIT_Z, camera.direction);
camera.up = Cartesian3.clone(Cartesian3.UNIT_Y, camera.up);
var x = 1000000.0;
var y = 1000000.0;
var z = -(Ellipsoid.WGS84.getRadii().z + 10000000.0);
camera.position = new Cartesian3(x, y, z);

scene.render();
expect(scene.getContext().readPixels()).toEqual([0, 0, 0, 255]);
var sensor = addSensor({
Expand All @@ -183,6 +199,14 @@ defineSuite([
});

it('renders using above ellipsoid horizon option', function() {
var camera = scene.getCamera();
camera.direction = Cartesian3.clone(Cartesian3.UNIT_Z, camera.direction);
camera.up = Cartesian3.clone(Cartesian3.UNIT_Y, camera.up);
var x = 1000000.0;
var y = 1000000.0;
var z = -(Ellipsoid.WGS84.getRadii().z + 10000000.0);
camera.position = new Cartesian3(x, y, z);

scene.render();
expect(scene.getContext().readPixels()).toEqual([0, 0, 0, 255]);
var sensor = addSensor({
Expand Down
40 changes: 32 additions & 8 deletions Specs/Scene/RectangularPyramidSensorVolumeSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ defineSuite([

beforeAll(function() {
scene = createScene();
var camera = scene.getCamera();
camera.direction = Cartesian3.clone(Cartesian3.UNIT_Z, camera.direction);
camera.up = Cartesian3.clone(Cartesian3.UNIT_Y, camera.up);
var z = -(Ellipsoid.WGS84.getRadii().z + 10000000.0);
camera.position = new Cartesian3(0.0, 0.0, z);
});

afterAll(function() {
Expand Down Expand Up @@ -75,6 +70,11 @@ defineSuite([
}

beforeEach(function() {
var camera = scene.getCamera();
camera.direction = Cartesian3.clone(Cartesian3.UNIT_Z, camera.direction);
camera.up = Cartesian3.clone(Cartesian3.UNIT_Y, camera.up);
var z = -(Ellipsoid.WGS84.getRadii().z + 10000000.0);
camera.position = new Cartesian3(0.0, 0.0, z);
scene.initializeFrame();
});

Expand Down Expand Up @@ -159,35 +159,59 @@ defineSuite([
});

it('renders using complete (default) option', function() {
var camera = scene.getCamera();
camera.direction = Cartesian3.clone(Cartesian3.UNIT_Z, camera.direction);
camera.up = Cartesian3.clone(Cartesian3.UNIT_Y, camera.up);
var x = 1000000.0;
var y = 1000000.0;
var z = -(Ellipsoid.WGS84.getRadii().z + 10000000.0);
camera.position = new Cartesian3(x, y, z);

scene.render();
expect(scene.getContext().readPixels()).toEqual([0, 0, 0, 255]);
var sensor = addSensor({
latitude : -90.0,
altitude : 3000000.0
altitude : 2500000.0
});
sensor.portionToDisplay = SensorVolumePortionToDisplay.COMPLETE;
scene.render();
expect(scene.getContext().readPixels()).not.toEqual([0, 0, 0, 255]);
});

it('renders using below ellipsoid horizon option', function() {
var camera = scene.getCamera();
camera.direction = Cartesian3.clone(Cartesian3.UNIT_Z, camera.direction);
camera.up = Cartesian3.clone(Cartesian3.UNIT_Y, camera.up);
var x = 1000000.0;
var y = 1000000.0;
var z = -(Ellipsoid.WGS84.getRadii().z + 10000000.0);
camera.position = new Cartesian3(x, y, z);

scene.render();
expect(scene.getContext().readPixels()).toEqual([0, 0, 0, 255]);
var sensor = addSensor({
latitude : -90.0,
altitude : 3000000.0
altitude : 2500000.0
});
sensor.portionToDisplay = SensorVolumePortionToDisplay.BELOW_ELLIPSOID_HORIZON;
scene.render();
expect(scene.getContext().readPixels()).not.toEqual([0, 0, 0, 255]);
});

it('renders using above ellipsoid horizon option', function() {
var camera = scene.getCamera();
camera.direction = Cartesian3.clone(Cartesian3.UNIT_Z, camera.direction);
camera.up = Cartesian3.clone(Cartesian3.UNIT_Y, camera.up);
var x = 1000000.0;
var y = 1000000.0;
var z = -(Ellipsoid.WGS84.getRadii().z + 10000000.0);
camera.position = new Cartesian3(x, y, z);

scene.render();
expect(scene.getContext().readPixels()).toEqual([0, 0, 0, 255]);
var sensor = addSensor({
latitude : -90.0,
altitude : 3000000.0
altitude : 2500000.0
});
sensor.portionToDisplay = SensorVolumePortionToDisplay.ABOVE_ELLIPSOID_HORIZON;
scene.render();
Expand Down

0 comments on commit 82f05bb

Please sign in to comment.