(color: number)
| 15 | DEST_H = 108 |
| 16 | |
| 17 | function createTest (color: number): void { |
| 18 | const srcSize = 4 * SRC_W * SRC_H, |
| 19 | resultSize = 4 * DEST_W * DEST_H, |
| 20 | hexColor = color.toString(16), |
| 21 | src = new Uint8Array(srcSize), |
| 22 | correct = new Uint8Array(resultSize) |
| 23 | |
| 24 | fill(src, color) |
| 25 | fill(correct, color) |
| 26 | |
| 27 | const test_name = `test ${SRC_W}x${SRC_H} -> ${DEST_W}x${DEST_H} with color #${hexColor}${hexColor}${hexColor}` |
| 28 | |
| 29 | it(test_name, async () => { |
| 30 | const result = await pica.resizeBuffer({ |
| 31 | src, |
| 32 | width: SRC_W, |
| 33 | height: SRC_H, |
| 34 | toWidth: DEST_W, |
| 35 | toHeight: DEST_H |
| 36 | }) |
| 37 | |
| 38 | assert.deepStrictEqual(result, correct) |
| 39 | }) |
| 40 | } |
| 41 | |
| 42 | describe('Brightness should not change', () => { |
| 43 | createTest(255) |
no test coverage detected
searching dependent graphs…