Skip to content

Commit

Permalink
multiple lookback tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dnomadb committed Mar 31, 2016
1 parent ce176de commit fcfefd5
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ Backend.prototype.getTile = function(z, x, y, callback) {
} else if (typeof backend._lookback === 'number' &&
err && err.message === 'Tile does not exist' &&
lookbacks <= backend._lookback) {
lookbacks += 1
bz = bz - 1;
bx = Math.floor(x / Math.pow(2, z - bz));
by = Math.floor(y / Math.pow(2, z - bz));
Expand Down
Binary file added test/expected/l.0.0.0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/expected/l.1.0.0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/expected/l.1.0.1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/expected/l.1.1.1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/expected/l.2.0.0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/expected/l.2.3.3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions test/fixtures/l.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Map[]>
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" maximum-extent="-20037508.34,-20037508.34,20037508.34,20037508.34">

<Parameters>
<Parameter name="bounds">-180,-85.0511,180,85.0511</Parameter>
<Parameter name="center">0,0,2</Parameter>
<Parameter name="format">png8:m=h</Parameter>
<Parameter name="minzoom">0</Parameter>
<Parameter name="maxzoom">8</Parameter>
<Parameter name="scale">1</Parameter>
<Parameter name="source">test:///l</Parameter>
<Parameter name="name"><![CDATA[test-l]]></Parameter>
</Parameters>

<Style name="_image" filter-mode="first">
<Rule>
<RasterSymbolizer opacity=".7" />
</Rule>
</Style>

<Layer name="_image"
srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
<StyleName>_image</StyleName>
</Layer>

</Map>
Binary file added test/fixtures/l/1.0.0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var xml = {
b: fs.readFileSync(path.resolve(__dirname + '/fixtures/b.xml'), 'utf8'),
c: fs.readFileSync(path.resolve(__dirname + '/fixtures/c.xml'), 'utf8'),
i: fs.readFileSync(path.resolve(__dirname + '/fixtures/i.xml'), 'utf8'),
l: fs.readFileSync(path.resolve(__dirname + '/fixtures/l.xml'), 'utf8'),
space: fs.readFileSync(path.resolve(__dirname + '/fixtures/s p a c e/i.xml'), 'utf8'),
expires: fs.readFileSync(path.resolve(__dirname + '/fixtures/expires.xml'), 'utf8'),
invalid: fs.readFileSync(path.resolve(__dirname + '/fixtures/invalid.xml'), 'utf8')
Expand Down Expand Up @@ -116,6 +117,7 @@ var sources = {
h: new Vector({ backend: new Testsource('b'), xml: xml.b, scale: 2 }),
i: new Vector({ backend: new Testsource('i'), xml: xml.i }),
'i@2x': new Vector({ backend: new Testsource('i'), xml: xml.i }),
l: new Vector({ backend: new Testsource('l'), xml: xml.l}),
invalid: new Vector({ backend: new Testsource('invalid'), xml: xml.invalid })
};
var tests = {
Expand All @@ -141,7 +143,8 @@ var tests = {
i: ['0.0.0', '1.0.0'],
// Image sources.
'i@2x': ['0.0.0', '1.0.0'],
l: ['0.0.0', '1.0.1', '2.1.1'],
// Image sources for multiple lookback
l: ['0.0.0', '1.0.0', '1.1.1', '2.0.0', '2.3.3'],
// Invalid tiles that are empty
invalid: ['1.1.0', '1.1.1'],

Expand Down
1 change: 1 addition & 0 deletions test/testsource.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ function Testsource(uri, callback) {
minzoom: infos[uri].minzoom,
maxzoom: infos[uri].maxzoom,
fillzoom: infos[uri].fillzoom,
lookback: infos[uri].lookback,
vector_layers: infos[uri].vector_layers
};
this.stats = {};
Expand Down

0 comments on commit fcfefd5

Please sign in to comment.