Skip to content

Commit

Permalink
wip: fix something
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Aug 25, 2024
1 parent 3d05711 commit 03952a2
Show file tree
Hide file tree
Showing 4 changed files with 159 additions and 169 deletions.
7 changes: 7 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ const customConfig = [
'n/no-extraneous-import': 'off',
},
},
{
files: ['packages/webhid-demo/src/**/*'],
rules: {
'@typescript-eslint/no-require-imports': 'off',
'n/no-missing-import': 'off',
},
},
]

export default customConfig
312 changes: 147 additions & 165 deletions packages/core/src/__tests__/__snapshots__/util.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,184 +1,166 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`imageToByteArray basic bgra -> bgr 1`] = `
{
"data": [
0,
0,
0,
0,
0,
1,
2,
4,
5,
6,
8,
9,
10,
12,
13,
14,
],
"type": "Buffer",
}
Uint8Array [
0,
0,
0,
0,
0,
1,
2,
4,
5,
6,
8,
9,
10,
12,
13,
14,
]
`;

exports[`imageToByteArray basic bgra -> rgba 1`] = `
{
"data": [
0,
0,
0,
0,
2,
1,
0,
255,
6,
5,
4,
255,
10,
9,
8,
255,
14,
13,
12,
255,
],
"type": "Buffer",
}
Uint8Array [
0,
0,
0,
0,
2,
1,
0,
255,
6,
5,
4,
255,
10,
9,
8,
255,
14,
13,
12,
255,
]
`;

exports[`imageToByteArray basic rgb -> bgr 1`] = `
{
"data": [
0,
0,
0,
0,
2,
1,
0,
5,
4,
3,
8,
7,
6,
11,
10,
9,
],
"type": "Buffer",
}
Uint8Array [
0,
0,
0,
0,
2,
1,
0,
5,
4,
3,
8,
7,
6,
11,
10,
9,
]
`;

exports[`imageToByteArray basic rgb -> rgba 1`] = `
{
"data": [
0,
0,
0,
0,
0,
0,
1,
2,
255,
3,
4,
5,
255,
6,
7,
8,
255,
9,
10,
11,
255,
],
"type": "Buffer",
}
Uint8Array [
0,
0,
0,
0,
0,
0,
1,
2,
255,
3,
4,
5,
255,
6,
7,
8,
255,
9,
10,
11,
255,
]
`;

exports[`imageToByteArray basic vflip 1`] = `
{
"data": [
0,
0,
0,
0,
18,
19,
20,
21,
22,
23,
24,
25,
26,
9,
10,
11,
12,
13,
14,
15,
16,
17,
0,
1,
2,
3,
4,
5,
6,
7,
8,
],
"type": "Buffer",
}
Uint8Array [
0,
0,
0,
0,
18,
19,
20,
21,
22,
23,
24,
25,
26,
9,
10,
11,
12,
13,
14,
15,
16,
17,
0,
1,
2,
3,
4,
5,
6,
7,
8,
]
`;

exports[`imageToByteArray basic xflip 1`] = `
{
"data": [
0,
0,
0,
0,
6,
7,
8,
3,
4,
5,
0,
1,
2,
15,
16,
17,
12,
13,
14,
9,
10,
11,
24,
25,
26,
21,
22,
23,
18,
19,
20,
],
"type": "Buffer",
}
Uint8Array [
0,
0,
0,
0,
6,
7,
8,
3,
4,
5,
0,
1,
2,
15,
16,
17,
12,
13,
14,
9,
10,
11,
24,
25,
26,
21,
22,
23,
18,
19,
20,
]
`;
7 changes: 4 additions & 3 deletions packages/core/src/__tests__/test.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,11 @@ function runForDevice(path: string, model: DeviceModelId, supportsRgbKeyFill: bo
const fillKeyBufferMock = ((streamDeck as any).fillImageRange = jest.fn())
await streamDeck.fillPanelBuffer(buffer)

expect(fillKeyBufferMock).toHaveBeenCalledTimes(streamDeck.NUM_KEYS)
expect(fillKeyBufferMock).toHaveBeenCalledTimes(buttonControls.length)
const columnCount = buttonControls.reduce((acc, c) => Math.max(acc, c.column), 0) + 1

const stride = streamDeck.KEY_COLUMNS * streamDeck.BUTTON_WIDTH_PX * 3
for (let i = 0; i < streamDeck.NUM_KEYS; i++) {
const stride = columnCount * streamDeck.BUTTON_WIDTH_PX * 3
for (let i = 0; i < buttonControls.length; i++) {
expect(fillKeyBufferMock).toHaveBeenCalledWith(i, expect.any(Buffer), {
format: 'rgb',
offset: expect.any(Number),
Expand Down
2 changes: 1 addition & 1 deletion packages/webhid-demo/webpack.config.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const { ProvidePlugin, DefinePlugin } = require('webpack')
const { DefinePlugin } = require('webpack')

module.exports = {
// Where to fine the source code
Expand Down

0 comments on commit 03952a2

Please sign in to comment.