Skip to content

Commit

Permalink
#2 fix for matrix, revert test images
Browse files Browse the repository at this point in the history
  • Loading branch information
smellman committed Dec 10, 2023
1 parent 1d5410e commit dac8908
Show file tree
Hide file tree
Showing 16 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/lib/matrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export class Matrix {
this.images.map((image) => {
return {
image,
width: image.buffer_width(),
height: image.buffer_height(),
width: image.sdf ? image.buffer_width() : image.real_width(),
height: image.sdf ? image.buffer_height() : image.real_height(),
}
}),
)
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/test1.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"airport":{"height":15,"width":15,"x":0,"y":49,"pixelRatio":1,"sdf":false},"my_bbq":{"height":32,"width":32,"x":49,"y":0,"pixelRatio":1,"sdf":false},"airport_xl":{"height":43,"width":43,"x":0,"y":0,"pixelRatio":1,"sdf":false}}
{"airport":{"height":15,"width":15,"x":0,"y":43,"pixelRatio":1,"sdf":false},"my_bbq":{"height":32,"width":32,"x":43,"y":0,"pixelRatio":1,"sdf":false},"airport_xl":{"height":43,"width":43,"x":0,"y":0,"pixelRatio":1,"sdf":false}}
Binary file modified tests/fixtures/test1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/fixtures/test2.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"airport":{"height":30,"width":30,"x":0,"y":92,"pixelRatio":2,"sdf":false},"airport_xl":{"height":86,"width":86,"x":0,"y":0,"pixelRatio":2,"sdf":false},"my_bbq":{"height":64,"width":64,"x":92,"y":0,"pixelRatio":2,"sdf":false}}
{"airport":{"height":30,"width":30,"x":0,"y":86,"pixelRatio":2,"sdf":false},"airport_xl":{"height":86,"width":86,"x":0,"y":0,"pixelRatio":2,"sdf":false},"my_bbq":{"height":64,"width":64,"x":86,"y":0,"pixelRatio":2,"sdf":false}}
Binary file modified tests/fixtures/test2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/fixtures/test3.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"airport":{"height":15,"width":15,"x":0,"y":49,"pixelRatio":1,"sdf":false},"my_bbq":{"height":32,"width":32,"x":49,"y":0,"pixelRatio":1,"sdf":false},"airport_xl":{"height":43,"width":43,"x":0,"y":0,"pixelRatio":1,"sdf":false}}
{"airport":{"height":15,"width":15,"x":0,"y":43,"pixelRatio":1,"sdf":false},"my_bbq":{"height":32,"width":32,"x":43,"y":0,"pixelRatio":1,"sdf":false},"airport_xl":{"height":43,"width":43,"x":0,"y":0,"pixelRatio":1,"sdf":false}}
Binary file modified tests/fixtures/test3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/fixtures/test3@2x.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"airport":{"height":30,"width":30,"x":0,"y":92,"pixelRatio":2,"sdf":false},"airport_xl":{"height":86,"width":86,"x":0,"y":0,"pixelRatio":2,"sdf":false},"my_bbq":{"height":64,"width":64,"x":92,"y":0,"pixelRatio":2,"sdf":false}}
{"airport":{"height":30,"width":30,"x":0,"y":86,"pixelRatio":2,"sdf":false},"airport_xl":{"height":86,"width":86,"x":0,"y":0,"pixelRatio":2,"sdf":false},"my_bbq":{"height":64,"width":64,"x":86,"y":0,"pixelRatio":2,"sdf":false}}
Binary file modified tests/fixtures/test3@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/fixtures/test4.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"airport":{"height":15,"width":15,"x":0,"y":49,"pixelRatio":1,"sdf":false},"arrow":{"height":15,"width":15,"x":21,"y":49,"pixelRatio":1,"sdf":false},"circle":{"height":15,"width":15,"x":42,"y":49,"pixelRatio":1,"sdf":false},"my_bbq":{"height":32,"width":32,"x":49,"y":0,"pixelRatio":1,"sdf":false},"airport_xl":{"height":43,"width":43,"x":0,"y":0,"pixelRatio":1,"sdf":false}}
{"airport":{"height":15,"width":15,"x":0,"y":43,"pixelRatio":1,"sdf":false},"arrow":{"height":15,"width":15,"x":15,"y":43,"pixelRatio":1,"sdf":false},"circle":{"height":15,"width":15,"x":30,"y":43,"pixelRatio":1,"sdf":false},"my_bbq":{"height":32,"width":32,"x":43,"y":0,"pixelRatio":1,"sdf":false},"airport_xl":{"height":43,"width":43,"x":0,"y":0,"pixelRatio":1,"sdf":false}}
Binary file modified tests/fixtures/test4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/fixtures/test5.json

Large diffs are not rendered by default.

Binary file modified tests/fixtures/test5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/fixtures/test5@2x.json

Large diffs are not rendered by default.

Binary file modified tests/fixtures/test5@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions tests/lib/matrix.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ describe('test lib/matrix.ts', (): void => {
const matrix = new Matrix(images1)
matrix.calc()

expect(matrix.max_x).toStrictEqual(21)
expect(matrix.max_y).toStrictEqual(21)
expect(matrix.max_x).toStrictEqual(15)
expect(matrix.max_y).toStrictEqual(15)
})

test('matrix calculation works with 2 images', async () => {
Expand All @@ -40,7 +40,7 @@ describe('test lib/matrix.ts', (): void => {
const matrix = new Matrix(images1)
matrix.calc()

expect(matrix.max_x).toStrictEqual(42)
expect(matrix.max_y).toStrictEqual(21)
expect(matrix.max_x).toStrictEqual(30)
expect(matrix.max_y).toStrictEqual(15)
})
})

0 comments on commit dac8908

Please sign in to comment.