From d5f12fff94838888cc42cab74af6cfde95198db3 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Thu, 25 Jan 2024 13:04:20 -0300 Subject: [PATCH] [Tests][Position][Added] for sub-pcbs Using internal mechanism and KiKit mechanism --- tests/test_plot/test_position.py | 23 +++++++++++++++++++ .../position_sub_pcb_bp_kikit.kibot.yaml | 18 +++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 tests/yaml_samples/position_sub_pcb_bp_kikit.kibot.yaml diff --git a/tests/test_plot/test_position.py b/tests/test_plot/test_position.py index 86ab1c03..970e7646 100644 --- a/tests/test_plot/test_position.py +++ b/tests/test_plot/test_position.py @@ -385,3 +385,26 @@ def test_position_gerber_1(test_dir): ctx.expect_out_file_d(prj+'-top_pos.gbr') ctx.expect_out_file_d(prj+'-bottom_pos.gbr') ctx.clean_up(keep_project=True) + + +@pytest.mark.skipif(context.ki5(), reason="KiKit currently supports KiCad 6 only") +def test_position_sub_pcb_bp_1(test_dir): + prj = 'batteryPack' + ctx = context.TestContext(test_dir, prj, 'position_sub_pcb_bp', POS_DIR) + ctx.run(extra=['-g', 'variant=default[charger]']) + expect_position(ctx, os.path.join(POS_DIR, prj+'-both_pos_charger.pos'), ['J13'], ['J2', 'J3'], + a_pos={'J13': (126.5, 95, 'top', 90)}) + ctx.clean_up(keep_project=True) + + +@pytest.mark.skipif(context.ki5(), reason="KiKit currently supports KiCad 6 only") +def test_position_sub_pcb_bp_2(test_dir): + prj = 'batteryPack' + ctx = context.TestContext(test_dir, prj, 'position_sub_pcb_bp_kikit', POS_DIR) + ctx.run(extra=['-g', 'variant=default[charger]']) + # KiKit just sends the PCB to 150,100; not centered, A4 page is 270x210: + # 297/2-150 = -1.5 -> 126.5+1.5 + # 210/2-100 = 5 -> 95-5 + expect_position(ctx, os.path.join(POS_DIR, prj+'-both_pos_charger.pos'), ['J13'], ['J2', 'J3'], + a_pos={'J13': (126.5+1.5, 95-5, 'top', 90)}) + ctx.clean_up(keep_project=True) diff --git a/tests/yaml_samples/position_sub_pcb_bp_kikit.kibot.yaml b/tests/yaml_samples/position_sub_pcb_bp_kikit.kibot.yaml new file mode 100644 index 00000000..33de8916 --- /dev/null +++ b/tests/yaml_samples/position_sub_pcb_bp_kikit.kibot.yaml @@ -0,0 +1,18 @@ +# Example KiBot config file for a basic 2-layer board +kibot: + version: 1 + +import: + - file: battery_pack_sub_pcbs_kikit.kibot.yaml + +outputs: + + - name: 'position' + comment: "Pick and place file" + type: position + dir: positiondir + options: + format: ASCII # CSV or ASCII format + units: millimeters # millimeters or inches + separate_files_for_front_and_back: false + only_smd: false