Skip to content

Commit

Permalink
Add test for diode-switch routing when no matching nets found
Browse files Browse the repository at this point in the history
  • Loading branch information
adamws committed Apr 30, 2024
1 parent 1bb2e11 commit 6b71768
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_key_placer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import copy
import json
import logging
from typing import List, Tuple

import pcbnew
Expand Down Expand Up @@ -222,6 +223,22 @@ def test_multi_diode_switch_routing(tmpdir, request) -> None:
assert_board_tracks(expected, board)


def test_diode_switch_routing_not_matching_nets(tmpdir, request, caplog) -> None:
board, switch, diodes = get_board_with_one_switch(request, "SW_Cherry_MX_PCB_1.00u")
key_placer = KeyPlacer(board)

assert len(diodes) == 1
diodes[0].FindPadByNumber("2").SetNet(None)
set_position(diodes[0], pcbnew.wxPointMM(0, 5))

with caplog.at_level(logging.ERROR):
key_placer.route_switch_with_diode(switch, diodes)
save_and_render(board, tmpdir, request)

assert "Could not find pads with the same net, routing skipped" in caplog.text
assert_board_tracks([], board)


def test_multi_diode_illegal_position_setting(request) -> None:
board, _, _ = get_board_with_one_switch(
request, "SW_Cherry_MX_PCB_1.00u", number_of_diodes=2
Expand Down

0 comments on commit 6b71768

Please sign in to comment.