The code used to rely on the dimension. However, the dimension can only be read from a GML3 document. This caused, for 3D geometries: - An assertion error to be raised since the flatCoordinates list contains more than 3 elements: "Assertion failed: flatCoordinates should have a length of 3" The value of flatCoordinates for a 3D point was something like `[2586394, 1232407, 0, 731, NaN, 0]` - The value of the Z coordinates to be incorrect and always set to 0 This patch simplifies and correct the parsing of the coordinates: - Don't parse groups of coords and the coordonates at the same time. - Detect the dimension for the coordinates. - If the Z coordinate exists, its value is used, otherwise, we use 0. - Correct the presentation of test data to make it work with the new parser. - Add a test for a 3D point.
Included in this directory
-
index.html - the web page used to run the test suite.
-
spec - includes the OpenLayers test/spec files.
-
test-extensions.js - includes OpenLayers-specific extensions to the testing frameworks.
Run the test suite
Install the test dependencies (from the root of the repository):
npm install
Run the tests once with PhantomJS:
make test
(Note that for npm users, this can also be run as npm test.)
Run the tests in a browser:
make serve
(Again for npm users, this is npm start.)
Now visit http://localhost:3000/test/ in your browser. The tests will re-run any time one of the source or spec files changes.
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".