Skip to content

Commit

Permalink
feat: color test tiles black to see flaws
Browse files Browse the repository at this point in the history
  • Loading branch information
blacha committed Oct 7, 2019
1 parent e1ce06d commit 9c635be
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 3 deletions.
Binary file modified packages/tiler/data/expected/tile_1024_262144_262144_z19.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 modified packages/tiler/data/expected/tile_2048_262144_262144_z19.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 modified packages/tiler/data/expected/tile_256_131072_131072_z18.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 modified packages/tiler/data/expected/tile_256_262144_262144_z19.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 modified packages/tiler/data/expected/tile_4096_262144_262144_z19.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 modified packages/tiler/data/expected/tile_512_262144_262144_z19.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions packages/tiler/src/__test__/tile.creation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ describe('TileCreation', () => {
].forEach(({ tileSize, zoom }) => {
it(`should render a tile zoom:${zoom} tile: ${tileSize}`, async () => {
const center = 2 ** zoom;

const centerTile = center / 2;

const tiler = new Tiler(tileSize);

// Make the background black to easily spot flaws
tiler.raster.background.alpha = 1;
const layers = await tiler.tile([tiff], centerTile, centerTile, zoom, Logger);
expect(layers).not.toEqual(null);
if (layers == null) throw new Error('Tile is null');
Expand Down
4 changes: 3 additions & 1 deletion packages/tiler/src/raster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ const SharpScaleOptions = { fit: Sharp.fit.cover };

export class Raster {
private tileSize: number;
/** The background of all tiles that are created */
public background = { r: 0, g: 0, b: 0, alpha: 0 };

public constructor(tileSize: number) {
this.tileSize = tileSize;
Expand Down Expand Up @@ -90,7 +92,7 @@ export class Raster {
width: this.tileSize,
height: this.tileSize,
channels: 4,
background: { r: 0, g: 0, b: 0, alpha: 0 },
background: this.background,
},
});
}
Expand Down

0 comments on commit 9c635be

Please sign in to comment.