Skip to content

Commit

Permalink
Merge pull request #2380 from AnalyticalGraphicsInc/selectionIndicato…
Browse files Browse the repository at this point in the history
…r-crash

Fix Viewer crash
  • Loading branch information
pjcozzi committed Jan 6, 2015
2 parents 23720cf + ff1a3e9 commit f4b785c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Source/Widgets/Viewer/Viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to
var time = clock.currentTime;
var entityView = this._entityView;
var infoBoxViewModel = defined(this._infoBox) ? this._infoBox.viewModel : undefined;
var selectionIndicatorViewModel = this._selectionIndicator.viewModel;
var selectionIndicatorViewModel = defined(this._selectionIndicator) ? this._selectionIndicator.viewModel : undefined;

var isUpdated = this._dataSourceDisplay.update(time);
if (this._allowDataSourcesToSuspendAnimation) {
Expand Down
30 changes: 30 additions & 0 deletions Specs/Widgets/Viewer/ViewerSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ defineSuite([
'Widgets/Geocoder/Geocoder',
'Widgets/HomeButton/HomeButton',
'Widgets/SceneModePicker/SceneModePicker',
'Widgets/SelectionIndicator/SelectionIndicator',
'Widgets/Timeline/Timeline'
], function(
Viewer,
Expand Down Expand Up @@ -56,6 +57,7 @@ defineSuite([
Geocoder,
HomeButton,
SceneModePicker,
SelectionIndicator,
Timeline) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
Expand Down Expand Up @@ -106,6 +108,7 @@ defineSuite([
expect(viewer.animation).toBeInstanceOf(Animation);
expect(viewer.timeline).toBeInstanceOf(Timeline);
expect(viewer.fullscreenButton).toBeInstanceOf(FullscreenButton);
expect(viewer.selectionIndicator).toBeInstanceOf(SelectionIndicator);
expect(viewer.imageryLayers).toBeInstanceOf(ImageryLayerCollection);
expect(viewer.terrainProvider).toBeInstanceOf(EllipsoidTerrainProvider);
expect(viewer.camera).toBeInstanceOf(Camera);
Expand Down Expand Up @@ -137,6 +140,7 @@ defineSuite([
expect(viewer.animation).toBeInstanceOf(Animation);
expect(viewer.timeline).toBeInstanceOf(Timeline);
expect(viewer.fullscreenButton).toBeInstanceOf(FullscreenButton);
expect(viewer.selectionIndicator).toBeInstanceOf(SelectionIndicator);
viewer.resize();
viewer.render();
});
Expand All @@ -154,6 +158,7 @@ defineSuite([
expect(viewer.animation).toBeInstanceOf(Animation);
expect(viewer.timeline).toBeInstanceOf(Timeline);
expect(viewer.fullscreenButton).toBeInstanceOf(FullscreenButton);
expect(viewer.selectionIndicator).toBeInstanceOf(SelectionIndicator);
viewer.resize();
viewer.render();
});
Expand All @@ -171,6 +176,7 @@ defineSuite([
expect(viewer.animation).toBeInstanceOf(Animation);
expect(viewer.timeline).toBeInstanceOf(Timeline);
expect(viewer.fullscreenButton).toBeInstanceOf(FullscreenButton);
expect(viewer.selectionIndicator).toBeInstanceOf(SelectionIndicator);
viewer.resize();
viewer.render();
});
Expand All @@ -188,6 +194,7 @@ defineSuite([
expect(viewer.animation).toBeUndefined();
expect(viewer.timeline).toBeInstanceOf(Timeline);
expect(viewer.fullscreenButton).toBeInstanceOf(FullscreenButton);
expect(viewer.selectionIndicator).toBeInstanceOf(SelectionIndicator);
viewer.resize();
viewer.render();
});
Expand All @@ -205,6 +212,7 @@ defineSuite([
expect(viewer.animation).toBeInstanceOf(Animation);
expect(viewer.timeline).toBeUndefined();
expect(viewer.fullscreenButton).toBeInstanceOf(FullscreenButton);
expect(viewer.selectionIndicator).toBeInstanceOf(SelectionIndicator);
viewer.resize();
viewer.render();
});
Expand All @@ -222,6 +230,7 @@ defineSuite([
expect(viewer.animation).toBeInstanceOf(Animation);
expect(viewer.timeline).toBeInstanceOf(Timeline);
expect(viewer.fullscreenButton).toBeUndefined();
expect(viewer.selectionIndicator).toBeInstanceOf(SelectionIndicator);
viewer.resize();
viewer.render();
});
Expand All @@ -240,6 +249,7 @@ defineSuite([
expect(viewer.animation).toBeInstanceOf(Animation);
expect(viewer.timeline).toBeUndefined();
expect(viewer.fullscreenButton).toBeUndefined();
expect(viewer.selectionIndicator).toBeInstanceOf(SelectionIndicator);
viewer.resize();
viewer.render();
});
Expand All @@ -259,6 +269,7 @@ defineSuite([
expect(viewer.animation).toBeUndefined(Animation);
expect(viewer.timeline).toBeUndefined();
expect(viewer.fullscreenButton).toBeUndefined();
expect(viewer.selectionIndicator).toBeInstanceOf(SelectionIndicator);
viewer.resize();
viewer.render();
});
Expand All @@ -276,6 +287,25 @@ defineSuite([
expect(viewer.animation).toBeInstanceOf(Animation);
expect(viewer.timeline).toBeInstanceOf(Timeline);
expect(viewer.fullscreenButton).toBeInstanceOf(FullscreenButton);
expect(viewer.selectionIndicator).toBeInstanceOf(SelectionIndicator);
viewer.resize();
viewer.render();
});

it('can shut off SelectionIndicator', function() {
viewer = new Viewer(container, {
selectionIndicator : false
});
expect(viewer.container).toBe(container);
expect(viewer.cesiumWidget).toBeInstanceOf(CesiumWidget);
expect(viewer.geocoder).toBeInstanceOf(Geocoder);
expect(viewer.homeButton).toBeInstanceOf(HomeButton);
expect(viewer.sceneModePicker).toBeInstanceOf(SceneModePicker);
expect(viewer.baseLayerPicker).toBeInstanceOf(BaseLayerPicker);
expect(viewer.animation).toBeInstanceOf(Animation);
expect(viewer.timeline).toBeInstanceOf(Timeline);
expect(viewer.fullscreenButton).toBeInstanceOf(FullscreenButton);
expect(viewer.selectionIndicator).toBeUndefined();
viewer.resize();
viewer.render();
});
Expand Down

0 comments on commit f4b785c

Please sign in to comment.