Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

test formatting

  • Loading branch information...
commit 43b7d816b2fcf5db327410fad95787f34b41c4ab 1 parent 87e8037
@springmeyer springmeyer authored
View
4 test/compositing.test.js
@@ -9,7 +9,7 @@ describe('mapnik.compositeOp', function() {
var im1 = mapnik.Image.open('test/support/a.png');
var im2 = mapnik.Image.open('test/support/b.png');
it('should blend image correctly with op:' + name, function(done) {
- im1.composite(im2,mapnik.compositeOp[name], function(err,im_out) {
+ im1.composite(im2, mapnik.compositeOp[name], function(err,im_out) {
if (err) throw err;
assert.ok(im_out);
var out = 'test/tmp/' + name + '.png';
@@ -18,6 +18,6 @@ describe('mapnik.compositeOp', function() {
done();
});
});
- })(name)
+ })(name);
}
});
View
22 test/datasource.test.js
@@ -73,14 +73,14 @@ describe('mapnik.Datasource', function() {
LAT: 'Number'
},
geometry_type: 'polygon'
- }
+ };
var actual = ds.describe();
- assert.deepEqual(actual['type'],expected['type']);
- assert.deepEqual(actual['encoding'],expected['encoding']);
- assert.deepEqual(actual['fields'],expected['fields']);
- assert.deepEqual(actual['geometry_type'],expected['geometry_type']);
+ assert.deepEqual(actual.type, expected.type);
+ assert.deepEqual(actual.encoding, expected.encoding);
+ assert.deepEqual(actual.fields, expected.fields);
+ assert.deepEqual(actual.geometry_type, expected.geometry_type);
- assert.deepEqual(ds.extent(),expected['extent']);
+ assert.deepEqual(ds.extent(), expected.extent);
});
it('should validate with known geojson', function() {
@@ -137,11 +137,11 @@ describe('mapnik.Datasource', function() {
geometry_type: 'polygon'
};
var actual = ds.describe();
- assert.deepEqual(actual['type'],expected['type']);
- assert.deepEqual(actual['encoding'],expected['encoding']);
- assert.deepEqual(actual['fields'],expected['fields']);
- assert.deepEqual(actual['geometry_type'],expected['geometry_type']);
+ assert.deepEqual(actual.type, expected.type);
+ assert.deepEqual(actual.encoding, expected.encoding);
+ assert.deepEqual(actual.fields, expected.fields);
+ assert.deepEqual(actual.geometry_type, expected.geometry_type);
- assert.deepEqual(ds.extent(),expected['extent']);
+ assert.deepEqual(ds.extent(), expected.extent);
});
});
View
8 test/expression.test.js
@@ -13,13 +13,13 @@ describe('mapnik.Expression', function() {
it('should accept complex expressions', function() {
// valid expression strings
var expr = new mapnik.Expression('[ATTR]');
- var expr = new mapnik.Expression('[ATTR]+2');
- var expr = new mapnik.Expression('[ATTR]/2');
+ expr = new mapnik.Expression('[ATTR]+2');
+ expr = new mapnik.Expression('[ATTR]/2');
- var expr = new mapnik.Expression('[ATTR1]/[ATTR2]');
+ expr = new mapnik.Expression('[ATTR1]/[ATTR2]');
assert.equal(expr.toString(), '[ATTR1]/[ATTR2]');
- var expr = new mapnik.Expression('\'literal\'');
+ expr = new mapnik.Expression('\'literal\'');
assert.equal(expr.toString(), "'literal'");
});
View
40 test/image.test.js
@@ -102,30 +102,30 @@ describe('mapnik.Image ', function() {
});
it('should support compositing', function() {
- var gray = new mapnik.Image(256,256);
+ var gray = new mapnik.Image(256, 256);
gray.background = new mapnik.Color('white');
gray.setGrayScaleToAlpha();
- var gray_view = gray.view(0,0,gray.width(),gray.height());
- assert.equal(gray_view.isSolid(),true);
- var pixel = gray_view.getPixel(0,0);
- assert.equal(pixel.r,255);
- assert.equal(pixel.g,255);
- assert.equal(pixel.b,255);
- assert.equal(pixel.a,255);
-
+ var gray_view = gray.view(0, 0, gray.width(), gray.height());
+ assert.equal(gray_view.isSolid(), true);
+ var pixel = gray_view.getPixel(0, 0);
+ assert.equal(pixel.r, 255);
+ assert.equal(pixel.g, 255);
+ assert.equal(pixel.b, 255);
+ assert.equal(pixel.a, 255);
+
gray.background = new mapnik.Color('black');
gray.setGrayScaleToAlpha();
- var pixel2 = gray_view.getPixel(0,0);
- assert.equal(pixel2.r,255);
- assert.equal(pixel2.g,255);
- assert.equal(pixel2.b,255);
- assert.equal(pixel2.a,0);
-
+ var pixel2 = gray_view.getPixel(0, 0);
+ assert.equal(pixel2.r, 255);
+ assert.equal(pixel2.g, 255);
+ assert.equal(pixel2.b, 255);
+ assert.equal(pixel2.a, 0);
+
gray.setGrayScaleToAlpha(new mapnik.Color('green'));
- var pixel3 = gray_view.getPixel(0,0);
- assert.equal(pixel3.r,0);
- assert.equal(pixel3.g,128);
- assert.equal(pixel3.b,0);
- assert.equal(pixel3.a,255);
+ var pixel3 = gray_view.getPixel(0, 0);
+ assert.equal(pixel3.r, 0);
+ assert.equal(pixel3.g, 128);
+ assert.equal(pixel3.b, 0);
+ assert.equal(pixel3.a, 255);
});
});
View
6 test/image_view.test.js
@@ -25,11 +25,11 @@ describe('mapnik.ImageView ', function() {
assert.equal(pixel.b, 0);
assert.equal(pixel.a, 0);
- var im = new mapnik.Image(256, 256);
+ im = new mapnik.Image(256, 256);
im.background = new mapnik.Color(2, 2, 2, 2);
- var view = im.view(0, 0, 256, 256);
+ view = im.view(0, 0, 256, 256);
assert.equal(view.isSolid(), true);
- var pixel = view.getPixel(0, 0);
+ pixel = view.getPixel(0, 0);
assert.equal(pixel.r, 2);
assert.equal(pixel.g, 2);
assert.equal(pixel.b, 2);
View
8 test/map.test.js
@@ -60,8 +60,8 @@ describe('mapnik.Map', function() {
assert.equal(layers[0].srs, '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over');
assert.deepEqual(layers[0].styles, ['style']);
assert.equal(layers[0].datasource.type, 'vector');
- assert.equal(layers[0].datasource.parameters()['type'], 'shape');
- assert.equal(path.normalize(layers[0].datasource.parameters()['file']), path.normalize(path.join(process.cwd(), 'examples/data/world_merc.shp')));
+ assert.equal(layers[0].datasource.parameters().type, 'shape');
+ assert.equal(path.normalize(layers[0].datasource.parameters().file), path.normalize(path.join(process.cwd(), 'examples/data/world_merc.shp')));
// clear styles and layers from previous load to set up for another
// otherwise layers are duplicated
@@ -79,8 +79,8 @@ describe('mapnik.Map', function() {
assert.equal(layers[0].srs, '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over');
assert.deepEqual(layers[0].styles, ['style']);
assert.equal(layers[0].datasource.type, 'vector');
- assert.equal(layers[0].datasource.parameters()['type'], 'shape');
- assert.equal(path.normalize(layers[0].datasource.parameters()['file']), path.normalize(path.join(process.cwd(), 'examples/data/world_merc.shp')));
+ assert.equal(layers[0].datasource.parameters().type, 'shape');
+ assert.equal(path.normalize(layers[0].datasource.parameters().file), path.normalize(path.join(process.cwd(), 'examples/data/world_merc.shp')));
var layer = map.get_layer(0);
assert.ok(layer.datasource);
View
2  test/map_generation.test.js
@@ -57,7 +57,7 @@ describe('mapnik rendering ', function() {
assert.ok(path.existsSync(filename));
done();
});
- } else { done() }
+ } else { done(); }
});
it('should render async to file (guessing format)', function(done) {
View
83 test/query-map.test.js
@@ -4,23 +4,23 @@ var assert = require('assert');
describe('mapnik.queryPoint', function() {
it('should throw with invalid usage', function() {
- var map = new mapnik.Map(256,256);
+ var map = new mapnik.Map(256, 256);
map.loadSync('examples/stylesheet.xml');
map.zoomAll();
assert.throws(function() { map.queryPoint(); });
- assert.throws(function() { map.queryPoint(0,0,0); });
- assert.throws(function() { map.queryPoint(0,0,{},0); });
- assert.throws(function() { map.queryPoint(0,0,0,0); });
+ assert.throws(function() { map.queryPoint(0, 0, 0); });
+ assert.throws(function() { map.queryPoint(0, 0, {},0); });
+ assert.throws(function() { map.queryPoint(0, 0, 0, 0); });
});
it('should return a feature if geo coords are used', function(done) {
- var map = new mapnik.Map(256,256);
+ var map = new mapnik.Map(256, 256);
map.loadSync('examples/stylesheet.xml');
map.zoomAll();
- map.queryPoint(-12957605.0331, 5518141.9452, {layer:0}, function(err, results) {
- assert.equal(results.length,1);
+ map.queryPoint(-12957605.0331, 5518141.9452, {layer: 0}, function(err, results) {
+ assert.equal(results.length, 1);
var result = results[0];
- assert.equal(result.layer,'world');
+ assert.equal(result.layer, 'world');
var fs = result.featureset;
assert.ok(fs);
var feat = fs.next();
@@ -34,8 +34,8 @@ describe('mapnik.queryPoint', function() {
POP2005: 299846449,
REGION: 19,
SUBREGION: 21,
- UN: 840 }
- assert.deepEqual(feat.attributes(),expected);
+ UN: 840 };
+ assert.deepEqual(feat.attributes(), expected);
// no more features
assert.ok(!fs.next());
done();
@@ -43,13 +43,13 @@ describe('mapnik.queryPoint', function() {
});
it('should return a feature if screen coords are used', function(done) {
- var map = new mapnik.Map(256,256);
+ var map = new mapnik.Map(256, 256);
map.loadSync('examples/stylesheet.xml');
map.zoomAll();
- map.queryMapPoint(55,130, {layer:0}, function(err, results) {
- assert.equal(results.length,1);
+ map.queryMapPoint(55, 130, {layer: 0}, function(err, results) {
+ assert.equal(results.length, 1);
var result = results[0];
- assert.equal(result.layer,'world');
+ assert.equal(result.layer, 'world');
var fs = result.featureset;
assert.ok(fs);
var feat = fs.next();
@@ -63,8 +63,8 @@ describe('mapnik.queryPoint', function() {
POP2005: 299846449,
REGION: 19,
SUBREGION: 21,
- UN: 840 }
- assert.deepEqual(feat.attributes(),expected);
+ UN: 840 };
+ assert.deepEqual(feat.attributes(), expected);
// no more features
assert.ok(!fs.next());
done();
@@ -72,13 +72,13 @@ describe('mapnik.queryPoint', function() {
});
it('should return a feature if multiple layers are queried', function(done) {
- var map = new mapnik.Map(256,256);
+ var map = new mapnik.Map(256, 256);
map.loadSync('examples/stylesheet.xml');
map.zoomAll();
- map.queryPoint(-12957605.0331, 5518141.9452,{/*will query all layers*/}, function(err, results) {
- assert.equal(results.length,1);
+ map.queryPoint(-12957605.0331, 5518141.9452, {/*will query all layers*/}, function(err, results) {
+ assert.equal(results.length, 1);
var result = results[0];
- assert.equal(result.layer,'world');
+ assert.equal(result.layer, 'world');
var fs = result.featureset;
assert.ok(fs);
var feat = fs.next();
@@ -92,8 +92,8 @@ describe('mapnik.queryPoint', function() {
POP2005: 299846449,
REGION: 19,
SUBREGION: 21,
- UN: 840 }
- assert.deepEqual(feat.attributes(),expected);
+ UN: 840 };
+ assert.deepEqual(feat.attributes(), expected);
// no more features
assert.ok(!fs.next());
done();
@@ -101,7 +101,7 @@ describe('mapnik.queryPoint', function() {
});
it('should return a feature if multiple layers are queried', function(done) {
- var map = new mapnik.Map(256,256);
+ var map = new mapnik.Map(256, 256);
var layer = new mapnik.Layer('world');
layer.srs = map.srs;
var options = {
@@ -112,19 +112,15 @@ describe('mapnik.queryPoint', function() {
map.add_layer(layer);
var layer2 = new mapnik.Layer('world2');
layer2.srs = map.srs;
- var options = {
- type: 'shape',
- file: './examples/data/world_merc.shp'
- };
layer2.datasource = new mapnik.Datasource(options);
map.add_layer(layer2);
map.zoomAll();
- map.queryPoint(-12957605.0331, 5518141.9452,{/*will query all layers*/}, function(err, results) {
- assert.equal(results.length,2);
+ map.queryPoint(-12957605.0331, 5518141.9452, {/*will query all layers*/}, function(err, results) {
+ assert.equal(results.length, 2);
// first layer hit
var result = results[0];
- assert.equal(result.layer,'world');
+ assert.equal(result.layer, 'world');
var fs = result.featureset;
assert.ok(fs);
var feat = fs.next();
@@ -138,32 +134,21 @@ describe('mapnik.queryPoint', function() {
POP2005: 299846449,
REGION: 19,
SUBREGION: 21,
- UN: 840 }
- assert.deepEqual(feat.attributes(),expected);
+ UN: 840 };
+ assert.deepEqual(feat.attributes(), expected);
// no more features
assert.ok(!fs.next());
// second layer hit
- var result = results[1];
- assert.equal(result.layer,'world2');
- var fs = result.featureset;
+ result = results[1];
+ assert.equal(result.layer, 'world2');
+ fs = result.featureset;
assert.ok(fs);
- var feat = fs.next();
- var expected = { AREA: 915896,
- FIPS: 'US',
- ISO2: 'US',
- ISO3: 'USA',
- LAT: 39.622,
- LON: -98.606,
- NAME: 'United States',
- POP2005: 299846449,
- REGION: 19,
- SUBREGION: 21,
- UN: 840 }
- assert.deepEqual(feat.attributes(),expected);
+ feat = fs.next();
+ assert.deepEqual(feat.attributes(), expected);
// no more features
assert.ok(!fs.next());
done();
});
});
-});
+});
View
2  test/render_grid.test.js
@@ -70,7 +70,7 @@ describe('mapnik grid rendering ', function() {
var gv = grid.view(0, 0, 256, 256);
gv.encode('utf', {resolution: 4}, function(err,gv_utf1) {
assert.equal(JSON.stringify(gv_utf1), reference);
- done()
+ done();
});
});
});
Please sign in to comment.
Something went wrong with that request. Please try again.