Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Xiaoji Chen
committed
Jun 14, 2019
1 parent
2ece47e
commit f043e62
Showing
5 changed files
with
72 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import test from 'tape-catch'; | ||
import {Deck} from '@deck.gl/core'; | ||
import {gl} from '@deck.gl/test-utils'; | ||
|
||
test('Deck#constructor', t => { | ||
const callbacks = { | ||
onWebGLInitialized: 0, | ||
onBeforeRender: 0, | ||
onResize: 0, | ||
onLoad: 0 | ||
}; | ||
|
||
const deck = new Deck({ | ||
gl, | ||
width: 1, | ||
height: 1, | ||
// This is required because the jsdom canvas does not have client width/height | ||
autoResizeDrawingBuffer: gl.canvas.clientWidth > 0, | ||
|
||
viewState: { | ||
longitude: 0, | ||
latitude: 0, | ||
zoom: 0 | ||
}, | ||
|
||
layers: [], | ||
|
||
onWebGLInitialized: () => callbacks.onWebGLInitialized++, | ||
onBeforeRender: () => callbacks.onBeforeRender++, | ||
onResize: () => callbacks.onResize++, | ||
|
||
onAfterRender: () => { | ||
t.is(callbacks.onWebGLInitialized, 1, 'onWebGLInitialized called'); | ||
t.is(callbacks.onLoad, 1, 'onLoad called'); | ||
t.is(callbacks.onResize, 1, 'onResize called'); | ||
t.is(callbacks.onBeforeRender, 1, 'first draw'); | ||
|
||
deck.finalize(); | ||
t.notOk(deck.layerManager, 'layerManager is finalized'); | ||
t.notOk(deck.viewManager, 'viewManager is finalized'); | ||
t.notOk(deck.deckRenderer, 'deckRenderer is finalized'); | ||
t.end(); | ||
}, | ||
|
||
onLoad: () => { | ||
callbacks.onLoad++; | ||
|
||
t.ok(deck.layerManager, 'layerManager initialized'); | ||
t.ok(deck.viewManager, 'viewManager initialized'); | ||
t.ok(deck.deckRenderer, 'deckRenderer initialized'); | ||
} | ||
}); | ||
|
||
t.pass('Deck constructor did not throw'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters