Previously, a lookup object containing start indexes was also used. This allowed us to remove arrays of vertices and properly update the start indexes for remaining coordinate values. In order to provide callers with stable identifiers and to work with arrays of integers alone, we cannot support a remove method. I think this is worth revisiting. Even if the array length cannot be changed in WebGL, we don't need to also impose the restriction outside. Instead, the WebGL renderer could be notified when array sizes change and update itself accordingly. I think there is more value in providing geometries with stable identifiers. This common structure is used to store vertices for all geometry types. A slight optimization could be made by creating yet another structure to store point vertices - since these don't need to have a counts array (always 1). Creating a new structure would mean saving memory at the expense of more lib code to transport. The coordinate value lookups are not negatively impacted by using the same structure for points and higher order geometries. Since the first change above goes against my instincts, I'm not making this second change (to add another structure for shared point vertices).
Included in this directory
-
ol.html - the web page used to run the test suite.
-
spec - includes the OpenLayers test/spec files.
-
jasmine-1.2.0 - includes the Jasmine Testing Framework. https://github.com/pivotal/jasmine
-
jasmine-extensions.js - includes OpenLayers-specific extensions to Jasmine.
-
phantom-jasmine - a PhantomJS script and a console reporter to for headless testing. Comes from https://github.com/jcarver989/phantom-jasmine.
Run the test suite with PhantomJS
With PhantomJS installed, and assuming phantomjs is in the PATH:
$ phantomjs phantom-jasmine/run_jasmine_test.coffee ol.html
(Works with PhantomJS 1.6.1, untested with other versions.)
This command can also be run by doing make test at the root of ol3.
Tip for TDD'ers: to make PhantomJS run the test suite continuously each time
a spec file is changed you can use nosier (http://pypi.python.org/pypi/nosier)
and do nosier -p test -p src "make test".