diff options
| author | Ryan <fauxpark@gmail.com> | 2021-11-05 08:08:52 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-05 08:08:52 +1100 |
| commit | 94018367278f44fcf3eab8a86525f2b257ecf4ba (patch) | |
| tree | c926797b833b2c51f3b458bd0726944b21fdf0a8 /lib | |
| parent | 45a8176e325130775b51058199e69aa8f06c88cc (diff) | |
| download | qmk_firmware-94018367278f44fcf3eab8a86525f2b257ecf4ba.tar.gz qmk_firmware-94018367278f44fcf3eab8a86525f2b257ecf4ba.zip | |
Map `PRODUCT` define to `keyboard_name` (#14372)
* Map `PRODUCT` define to `keyboard_name`
* Fix tests
* Fix last test
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/python/qmk/cli/generate/dfu_header.py | 2 | ||||
| -rw-r--r-- | lib/python/qmk/tests/minimal_info.json | 2 | ||||
| -rw-r--r-- | lib/python/qmk/tests/test_cli_commands.py | 10 |
3 files changed, 7 insertions, 7 deletions
diff --git a/lib/python/qmk/cli/generate/dfu_header.py b/lib/python/qmk/cli/generate/dfu_header.py index 5a1b109f1..7fb585fc7 100644 --- a/lib/python/qmk/cli/generate/dfu_header.py +++ b/lib/python/qmk/cli/generate/dfu_header.py | |||
| @@ -32,7 +32,7 @@ def generate_dfu_header(cli): | |||
| 32 | 32 | ||
| 33 | keyboard_h_lines = ['/* This file was generated by `qmk generate-dfu-header`. Do not edit or copy.', ' */', '', '#pragma once'] | 33 | keyboard_h_lines = ['/* This file was generated by `qmk generate-dfu-header`. Do not edit or copy.', ' */', '', '#pragma once'] |
| 34 | keyboard_h_lines.append(f'#define MANUFACTURER {kb_info_json["manufacturer"]}') | 34 | keyboard_h_lines.append(f'#define MANUFACTURER {kb_info_json["manufacturer"]}') |
| 35 | keyboard_h_lines.append(f'#define PRODUCT {cli.config.generate_dfu_header.keyboard} Bootloader') | 35 | keyboard_h_lines.append(f'#define PRODUCT {kb_info_json["keyboard_name"]} Bootloader') |
| 36 | 36 | ||
| 37 | # Optional | 37 | # Optional |
| 38 | if 'qmk_lufa_bootloader.esc_output' in kb_info_json: | 38 | if 'qmk_lufa_bootloader.esc_output' in kb_info_json: |
diff --git a/lib/python/qmk/tests/minimal_info.json b/lib/python/qmk/tests/minimal_info.json index 11ef12fef..3aae4722b 100644 --- a/lib/python/qmk/tests/minimal_info.json +++ b/lib/python/qmk/tests/minimal_info.json | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | "layouts": { | 4 | "layouts": { |
| 5 | "LAYOUT": { | 5 | "LAYOUT": { |
| 6 | "layout": [ | 6 | "layout": [ |
| 7 | { "label": "KC_A", "x": 0, "y": 0, "matrix": [0, 0] } | 7 | { "label": "KC_A", "matrix": [0, 0], "x": 0, "y": 0 } |
| 8 | ] | 8 | ] |
| 9 | } | 9 | } |
| 10 | } | 10 | } |
diff --git a/lib/python/qmk/tests/test_cli_commands.py b/lib/python/qmk/tests/test_cli_commands.py index e4eaef899..9f2c258ab 100644 --- a/lib/python/qmk/tests/test_cli_commands.py +++ b/lib/python/qmk/tests/test_cli_commands.py | |||
| @@ -151,7 +151,7 @@ def test_json2c_stdin(): | |||
| 151 | def test_info(): | 151 | def test_info(): |
| 152 | result = check_subcommand('info', '-kb', 'handwired/pytest/basic') | 152 | result = check_subcommand('info', '-kb', 'handwired/pytest/basic') |
| 153 | check_returncode(result) | 153 | check_returncode(result) |
| 154 | assert 'Keyboard Name: handwired/pytest/basic' in result.stdout | 154 | assert 'Keyboard Name: pytest' in result.stdout |
| 155 | assert 'Processor: atmega32u4' in result.stdout | 155 | assert 'Processor: atmega32u4' in result.stdout |
| 156 | assert 'Layout:' not in result.stdout | 156 | assert 'Layout:' not in result.stdout |
| 157 | assert 'k0' not in result.stdout | 157 | assert 'k0' not in result.stdout |
| @@ -160,7 +160,7 @@ def test_info(): | |||
| 160 | def test_info_keyboard_render(): | 160 | def test_info_keyboard_render(): |
| 161 | result = check_subcommand('info', '-kb', 'handwired/pytest/basic', '-l') | 161 | result = check_subcommand('info', '-kb', 'handwired/pytest/basic', '-l') |
| 162 | check_returncode(result) | 162 | check_returncode(result) |
| 163 | assert 'Keyboard Name: handwired/pytest/basic' in result.stdout | 163 | assert 'Keyboard Name: pytest' in result.stdout |
| 164 | assert 'Processor: atmega32u4' in result.stdout | 164 | assert 'Processor: atmega32u4' in result.stdout |
| 165 | assert 'Layouts:' in result.stdout | 165 | assert 'Layouts:' in result.stdout |
| 166 | assert 'k0' in result.stdout | 166 | assert 'k0' in result.stdout |
| @@ -169,7 +169,7 @@ def test_info_keyboard_render(): | |||
| 169 | def test_info_keymap_render(): | 169 | def test_info_keymap_render(): |
| 170 | result = check_subcommand('info', '-kb', 'handwired/pytest/basic', '-km', 'default_json') | 170 | result = check_subcommand('info', '-kb', 'handwired/pytest/basic', '-km', 'default_json') |
| 171 | check_returncode(result) | 171 | check_returncode(result) |
| 172 | assert 'Keyboard Name: handwired/pytest/basic' in result.stdout | 172 | assert 'Keyboard Name: pytest' in result.stdout |
| 173 | assert 'Processor: atmega32u4' in result.stdout | 173 | assert 'Processor: atmega32u4' in result.stdout |
| 174 | 174 | ||
| 175 | if is_windows: | 175 | if is_windows: |
| @@ -181,7 +181,7 @@ def test_info_keymap_render(): | |||
| 181 | def test_info_matrix_render(): | 181 | def test_info_matrix_render(): |
| 182 | result = check_subcommand('info', '-kb', 'handwired/pytest/basic', '-m') | 182 | result = check_subcommand('info', '-kb', 'handwired/pytest/basic', '-m') |
| 183 | check_returncode(result) | 183 | check_returncode(result) |
| 184 | assert 'Keyboard Name: handwired/pytest/basic' in result.stdout | 184 | assert 'Keyboard Name: pytest' in result.stdout |
| 185 | assert 'Processor: atmega32u4' in result.stdout | 185 | assert 'Processor: atmega32u4' in result.stdout |
| 186 | assert 'LAYOUT_ortho_1x1' in result.stdout | 186 | assert 'LAYOUT_ortho_1x1' in result.stdout |
| 187 | 187 | ||
| @@ -242,7 +242,7 @@ def test_generate_config_h(): | |||
| 242 | assert '# define DESCRIPTION handwired/pytest/basic' in result.stdout | 242 | assert '# define DESCRIPTION handwired/pytest/basic' in result.stdout |
| 243 | assert '# define DIODE_DIRECTION COL2ROW' in result.stdout | 243 | assert '# define DIODE_DIRECTION COL2ROW' in result.stdout |
| 244 | assert '# define MANUFACTURER none' in result.stdout | 244 | assert '# define MANUFACTURER none' in result.stdout |
| 245 | assert '# define PRODUCT handwired/pytest/basic' in result.stdout | 245 | assert '# define PRODUCT pytest' in result.stdout |
| 246 | assert '# define PRODUCT_ID 0x6465' in result.stdout | 246 | assert '# define PRODUCT_ID 0x6465' in result.stdout |
| 247 | assert '# define VENDOR_ID 0xFEED' in result.stdout | 247 | assert '# define VENDOR_ID 0xFEED' in result.stdout |
| 248 | assert '# define MATRIX_COLS 1' in result.stdout | 248 | assert '# define MATRIX_COLS 1' in result.stdout |
