Skip to content

Commit 82f2cc6

Browse files
committed
Fixes logic for zlib headers being slightly different in rare situations on osx. Closes #773
1 parent c335992 commit 82f2cc6

2 files changed

Lines changed: 23 additions & 13 deletions

File tree

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,17 @@ matrix:
7777
- os: osx
7878
osx_image: xcode8.3
7979
env: BUILDTYPE=release
80-
node_js: "4.8.1" # Fixed at version until https://github.com/nodejs/node/issues/12244 is resolved by nodejs
80+
node_js: 4
8181
# osx publishable node v6
8282
- os: osx
8383
osx_image: xcode8.3
8484
env: BUILDTYPE=release
85-
node_js: "6.10.1" # Fixed at version until https://github.com/nodejs/node/issues/12244 is resolved by nodejs
85+
node_js: 6
8686
# osx publishable node v7
8787
- os: osx
8888
osx_image: xcode8.2
8989
env: BUILDTYPE=release
90-
node_js: "7.5.0" # Fixed at version until https://github.com/nodejs/node/issues/12244 is resolved by nodejs
90+
node_js: 7
9191
# Sanitizer build node v4/Debug
9292
- os: linux
9393
env: BUILDTYPE=debug TOOLSET=-asan

test/vector-tile.test.js

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -985,9 +985,11 @@ describe('mapnik.VectorTile ', function() {
985985
gzip.removeAllListeners();
986986
gzip=null;
987987
var compressed = vtile.getData({compression:'gzip', strategy:'RLE'});
988-
assert.equal(buffer.toString('hex'), compressed.toString('hex'));
988+
// Substring used to remove gzip header
989+
assert.equal(buffer.toString('hex').substring(20), compressed.toString('hex').substring(20));
989990
vtile.getData({compression:'gzip', strategy:'RLE'}, function (err, compressed) {
990-
assert.equal(buffer.toString('hex'), compressed.toString('hex'));
991+
// Substring used to remove gzip header
992+
assert.equal(buffer.toString('hex').substring(20), compressed.toString('hex').substring(20));
991993
done();
992994
});
993995
});
@@ -1038,9 +1040,11 @@ describe('mapnik.VectorTile ', function() {
10381040
gzip.removeAllListeners();
10391041
gzip=null;
10401042
var compressed = vtile.getData({compression:'gzip', strategy:'FILTERED'});
1041-
assert.equal(buffer.toString('hex'), compressed.toString('hex'));
1043+
// Substring used to remove gzip header
1044+
assert.equal(buffer.toString('hex').substring(20), compressed.toString('hex').substring(20));
10421045
vtile.getData({compression:'gzip', strategy:'FILTERED'}, function (err, compressed) {
1043-
assert.equal(buffer.toString('hex'), compressed.toString('hex'));
1046+
// Substring used to remove gzip header
1047+
assert.equal(buffer.toString('hex').substring(20), compressed.toString('hex').substring(20));
10441048
done();
10451049
});
10461050
});
@@ -1091,9 +1095,11 @@ describe('mapnik.VectorTile ', function() {
10911095
gzip.removeAllListeners();
10921096
gzip=null;
10931097
var compressed = vtile.getData({compression:'gzip', strategy:'HUFFMAN_ONLY'});
1094-
assert.equal(buffer.toString('hex'), compressed.toString('hex'));
1098+
// Substring used to remove gzip header
1099+
assert.equal(buffer.toString('hex').substring(20), compressed.toString('hex').substring(20));
10951100
vtile.getData({compression:'gzip', strategy:'HUFFMAN_ONLY'}, function (err, compressed) {
1096-
assert.equal(buffer.toString('hex'), compressed.toString('hex'));
1101+
// Substring used to remove gzip header
1102+
assert.equal(buffer.toString('hex').substring(20), compressed.toString('hex').substring(20));
10971103
done();
10981104
});
10991105
});
@@ -1144,9 +1150,11 @@ describe('mapnik.VectorTile ', function() {
11441150
gzip.removeAllListeners();
11451151
gzip=null;
11461152
var compressed = vtile.getData({compression:'gzip', strategy:'FIXED'});
1147-
assert.equal(buffer.toString('hex'), compressed.toString('hex'));
1153+
// Substring used to remove gzip header
1154+
assert.equal(buffer.toString('hex').substring(20), compressed.toString('hex').substring(20));
11481155
vtile.getData({compression:'gzip', strategy:'FIXED'}, function (err, compressed) {
1149-
assert.equal(buffer.toString('hex'), compressed.toString('hex'));
1156+
// Substring is used to remove gzip header
1157+
assert.equal(buffer.toString('hex').substring(20), compressed.toString('hex').substring(20));
11501158
done();
11511159
});
11521160
});
@@ -1197,9 +1205,11 @@ describe('mapnik.VectorTile ', function() {
11971205
gzip.removeAllListeners();
11981206
gzip=null;
11991207
var compressed = vtile.getData({compression:'gzip', strategy:'DEFAULT'});
1200-
assert.equal(buffer.toString('hex'), compressed.toString('hex'));
1208+
// Substring used to remove gzip header
1209+
assert.equal(buffer.toString('hex').substring(20), compressed.toString('hex').substring(20));
12011210
vtile.getData({compression:'gzip', strategy:'DEFAULT'}, function (err, compressed) {
1202-
assert.equal(buffer.toString('hex'), compressed.toString('hex'));
1211+
// Substring used to remove gzip header
1212+
assert.equal(buffer.toString('hex').substring(20), compressed.toString('hex').substring(20));
12031213
done();
12041214
});
12051215
});

0 commit comments

Comments
 (0)