Merge.
This commit is contained in:
@@ -60,7 +60,7 @@ exports['get/put metadata from empty file'] = function(beforeExit, assert) {
|
||||
|
||||
assert.deepEqual({
|
||||
basename: "empty.mbtiles",
|
||||
filesize: 16384,
|
||||
filesize: 0,
|
||||
id: "empty",
|
||||
scheme: "tms"
|
||||
}, data);
|
||||
@@ -88,7 +88,7 @@ exports['get/put metadata from empty file'] = function(beforeExit, assert) {
|
||||
|
||||
assert.deepEqual({
|
||||
basename: "empty.mbtiles",
|
||||
filesize: 16384,
|
||||
filesize: 0,
|
||||
id: "empty",
|
||||
scheme: "tms",
|
||||
version: "1.0.0"
|
||||
|
||||
@@ -38,9 +38,12 @@ exports['get tiles'] = function(beforeExit, assert) {
|
||||
if (coords) {
|
||||
// Flip Y coordinate because file names are TMS, but .getTile() expects XYZ.
|
||||
coords[2] = Math.pow(2, coords[3]) - 1 - coords[2];
|
||||
mbtiles.getTile(coords[3] | 0, coords[1] | 0, coords[2] | 0, function(err, tile) {
|
||||
mbtiles.getTile(coords[3] | 0, coords[1] | 0, coords[2] | 0, function(err, tile, headers) {
|
||||
if (err) throw err;
|
||||
assert.deepEqual(tile, fs.readFileSync(__dirname + '/fixtures/images/' + file));
|
||||
assert.equal(headers['Content-Type'], 'image/png');
|
||||
assert.ok(!isNaN(Date.parse(headers['Last-Modified'])));
|
||||
assert.ok(/\d+-\d+/.test(headers['ETag']));
|
||||
status.success++;
|
||||
});
|
||||
}
|
||||
@@ -75,9 +78,12 @@ exports['get grids'] = function(beforeExit, assert) {
|
||||
if (coords) {
|
||||
// Flip Y coordinate because file names are TMS, but .getTile() expects XYZ.
|
||||
coords[2] = Math.pow(2, coords[3]) - 1 - coords[2];
|
||||
mbtiles.getGrid(coords[3] | 0, coords[1] | 0, coords[2] | 0, function(err, grid) {
|
||||
mbtiles.getGrid(coords[3] | 0, coords[1] | 0, coords[2] | 0, function(err, grid, headers) {
|
||||
if (err) throw err;
|
||||
assert.deepEqual(JSON.stringify(grid), fs.readFileSync(__dirname + '/fixtures/grids/' + file, 'utf8'));
|
||||
assert.equal(headers['Content-Type'], 'text/javascript');
|
||||
assert.ok(!isNaN(Date.parse(headers['Last-Modified'])));
|
||||
assert.ok(/\d+-\d+/.test(headers['ETag']));
|
||||
status.success++;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -30,20 +30,17 @@ exports['test mbtiles file creation'] = function(beforeExit, assert) {
|
||||
// Flip Y coordinate because file names are TMS, but .putTile() expects XYZ.
|
||||
coords[2] = Math.pow(2, coords[3]) - 1 - coords[2];
|
||||
|
||||
fs.readFile(__dirname + '/fixtures/images/' + file, function(err, tile) {
|
||||
var tile = fs.readFileSync(__dirname + '/fixtures/images/' + file);
|
||||
mbtiles.putTile(coords[3] | 0, coords[1] | 0, coords[2] | 0, tile, function(err) {
|
||||
if (err) throw err;
|
||||
|
||||
mbtiles.putTile(coords[3] | 0, coords[1] | 0, coords[2] | 0, tile, function(err) {
|
||||
if (err) throw err;
|
||||
completed.written++;
|
||||
if (completed.written === 285) {
|
||||
mbtiles.stopWriting(function(err) {
|
||||
completed.stopped = true;
|
||||
if (err) throw err;
|
||||
verifyWritten();
|
||||
});
|
||||
}
|
||||
});
|
||||
completed.written++;
|
||||
if (completed.written === 285) {
|
||||
mbtiles.stopWriting(function(err) {
|
||||
completed.stopped = true;
|
||||
if (err) throw err;
|
||||
verifyWritten();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -29,20 +29,17 @@ exports['test mbtiles file creation'] = function(beforeExit, assert) {
|
||||
// Flip Y coordinate because file names are TMS, but .putGrid() expects XYZ.
|
||||
coords[2] = Math.pow(2, coords[3]) - 1 - coords[2];
|
||||
|
||||
fs.readFile(__dirname + '/fixtures/grids/' + file, 'utf8', function(err, grid) {
|
||||
var grid = fs.readFileSync(__dirname + '/fixtures/grids/' + file, 'utf8');
|
||||
mbtiles.putGrid(coords[3] | 0, coords[1] | 0, coords[2] | 0, JSON.parse(grid), function(err) {
|
||||
if (err) throw err;
|
||||
|
||||
mbtiles.putGrid(coords[3] | 0, coords[1] | 0, coords[2] | 0, JSON.parse(grid), function(err) {
|
||||
if (err) throw err;
|
||||
completed.written++;
|
||||
if (completed.written === 241) {
|
||||
mbtiles.stopWriting(function(err) {
|
||||
completed.stopped = true;
|
||||
if (err) throw err;
|
||||
verifyWritten();
|
||||
});
|
||||
}
|
||||
});
|
||||
completed.written++;
|
||||
if (completed.written === 241) {
|
||||
mbtiles.stopWriting(function(err) {
|
||||
completed.stopped = true;
|
||||
if (err) throw err;
|
||||
verifyWritten();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user