Skip to content

Commit

Permalink
Merge pull request #8 from brendankenny/expectationsviewer
Browse files Browse the repository at this point in the history
add a test expectations viewer
  • Loading branch information
brendankenny committed Nov 8, 2014
2 parents 314971f + 00c7152 commit dc156e6
Show file tree
Hide file tree
Showing 7 changed files with 2,134 additions and 210 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ triangulating it, and then drawing it with WebGL.
## Tests
Run the tests locally with `npm test`, or in the browser [here](https://brendankenny.github.io/libtess.js/test/index.html).

See the [expectations viewer](https://brendankenny.github.io/libtess.js/test/browser/expectations-viewer.html)
to compare the test geometry tessellated with the latest version of the library
versus the expected (baseline) tessellation.

## Tesselator or Tessellator?

Probably tessellator, but `GLUtesselator`, etc is in the original GLU API handed
Expand Down
30 changes: 28 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var LINT_SRC = LIBTESS_SRC.concat([
'./libtess.cat.js',
'./{build,examples,test,third_party}/**/*.{js,html}',
'!./build/externs/*',
'!./test/browser/tests-browserified.js',
'!./test/browser/*-browserified.js',
'!./test/expectations/*',
'!./third_party/node_modules/**'
]);
Expand Down Expand Up @@ -84,6 +84,7 @@ gulp.task('dist-test-libs', function() {
});

gulp.task('browserify-tests', function() {
// only includes baseline tess (uses libtess in page), so no prereqs
return browserify(glob.sync('./test/*.test.js'))
// custom chai and libtess injected on page (for e.g. debug libtess)
// TODO(bckenny): is there a less-dumb way of doing this?
Expand Down Expand Up @@ -114,7 +115,8 @@ gulp.task('build', [
'build-cat',
'build-min',
'browserify-tests',
'dist-test-libs'
'dist-test-libs',
'browserify-expectations-viewer'
]);

gulp.task('lint', ['build'], function() {
Expand Down Expand Up @@ -172,4 +174,28 @@ gulp.task('coverage', ['build'], function(doneCallback) {
});
});

gulp.task('browserify-expectations-viewer', function() {
return browserify('./test/expectations-viewer.js')
.require('./test/browser/fake-chai.js', {expose: 'chai'})
.require('./test/browser/fake-libtess.js',
{expose: '../libtess.cat.js'})
.require('./test/browser/fake-libtess.js',
{expose: '../libtess.min.js'})

// expand list of tests in geometry/ at browserify time
.ignore('./test/rfolder.js')
.transform('rfolderify')

// eliminate env nonsense in common.js
.transform(envify({
testType: 'browserify'
}))

.bundle()

// convert to vinyl stream and output via gulp.dest
.pipe(vinylSource('expectations-viewer-browserified.js'))
.pipe(gulp.dest('./test/browser'));
});

gulp.task('default', ['build']);
Loading

0 comments on commit dc156e6

Please sign in to comment.