altium: Improve test-coverage of *.PcbLib import functionality
* Add test-code for pads * Move test-code into board_test_utils.cpp for reuse, one method per object * Add a real (rather small) Altium footprint for testing purposes
This commit is contained in:
parent
27aa71cebe
commit
81b4229e12
|
@ -2385,6 +2385,8 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con
|
|||
{
|
||||
PAD* pad = new PAD( aFootprint );
|
||||
|
||||
pad->SetKeepTopBottom( false ); // TODO: correct? This seems to be KiCad default on import
|
||||
|
||||
pad->SetNumber( aElem.name );
|
||||
pad->SetNetCode( GetNetCode( aElem.net ) );
|
||||
pad->SetLocked( aElem.is_locked );
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,163 @@
|
|||
(footprint "Espressif ESP32-WROOM-32" (version 20220211) (generator pcbnew)
|
||||
(layer "F.Cu")
|
||||
(tedit 0)
|
||||
(descr "39-SMD Module")
|
||||
(fp_text reference "REF**" (at 0 0) (layer "F.SilkS")
|
||||
(effects (font (size 1.27 1.27) (thickness 0.15)))
|
||||
(tstamp 04716587-a44e-418d-ba57-60afa7c0605e)
|
||||
)
|
||||
(fp_text value "Espressif ESP32-WROOM-32" (at 0 0) (layer "F.SilkS")
|
||||
(effects (font (size 1.27 1.27) (thickness 0.15)))
|
||||
(tstamp 42ff79f5-7aba-4233-be21-4072d4762c22)
|
||||
)
|
||||
(fp_rect (start -4 3) (end 2 -3)
|
||||
(stroke (width 0) (type default)) (fill solid) (layer "F.Cu") (tstamp 4af93b7f-4d56-4dd6-8b00-fbfc2a1f8cef))
|
||||
(fp_rect (start -4 3) (end 2 -3)
|
||||
(stroke (width 0) (type default)) (fill solid) (layer "B.Cu") (tstamp 226a922f-5ac2-439b-a85a-8f1e92b1c5fa))
|
||||
(fp_line (start -9 -15) (end 9 -15)
|
||||
(stroke (width 0.2) (type solid)) (layer "F.SilkS") (tstamp 51f3d9d7-479c-459d-8df1-2e59f12da1f0))
|
||||
(fp_line (start -9 -8.3) (end -9 -15)
|
||||
(stroke (width 0.2) (type solid)) (layer "F.SilkS") (tstamp 12b20531-f70d-425e-aa6b-9f8c1dc05208))
|
||||
(fp_line (start -9 10.5) (end -9 9.6)
|
||||
(stroke (width 0.2) (type solid)) (layer "F.SilkS") (tstamp 47531507-ee9d-4c3f-8806-390d7f3631d2))
|
||||
(fp_line (start -9 10.5) (end -6.4 10.5)
|
||||
(stroke (width 0.2) (type solid)) (layer "F.SilkS") (tstamp 256ea15b-8858-4372-812f-a1876e96250a))
|
||||
(fp_line (start 6.4 10.5) (end 9 10.5)
|
||||
(stroke (width 0.2) (type solid)) (layer "F.SilkS") (tstamp de1b4a89-62ac-4fd3-b54c-5043156a6d87))
|
||||
(fp_line (start 9 -8.3) (end 9 -15)
|
||||
(stroke (width 0.2) (type solid)) (layer "F.SilkS") (tstamp 18180f33-f49e-4c81-ba1c-70cdc7e98126))
|
||||
(fp_line (start 9 10.5) (end 9 9.6)
|
||||
(stroke (width 0.2) (type solid)) (layer "F.SilkS") (tstamp 19193437-c06a-480c-b1cd-bc034912a3cc))
|
||||
(fp_circle (center -10.4648 -7.62) (end -10.4648 -7.87)
|
||||
(stroke (width 0.75) (type solid)) (fill none) (layer "F.SilkS") (tstamp 93aec781-9154-453b-9543-70ddd0ef21fb))
|
||||
(fp_line (start -9.7 -15.2) (end 9.7 -15.2)
|
||||
(stroke (width 0.05) (type solid)) (layer "Eco2.User") (tstamp 53d636c0-d779-477e-bcc1-0f4fec21faf9))
|
||||
(fp_line (start -9.7 11.2) (end -9.7 -15.2)
|
||||
(stroke (width 0.05) (type solid)) (layer "Eco2.User") (tstamp e3788626-21d5-4a01-b4d2-0008805cb618))
|
||||
(fp_line (start -9.7 11.2) (end 9.7 11.2)
|
||||
(stroke (width 0.05) (type solid)) (layer "Eco2.User") (tstamp 0921b09f-b713-4233-9a1b-9196bdd42a5f))
|
||||
(fp_line (start -0.5 -0.001) (end 0.5 -0.001)
|
||||
(stroke (width 0.05) (type solid)) (layer "Eco2.User") (tstamp a866eb7c-5c72-495b-a9ae-87d9107a0e89))
|
||||
(fp_line (start 0 0.499) (end 0 -0.501)
|
||||
(stroke (width 0.05) (type solid)) (layer "Eco2.User") (tstamp 61c2e5e7-c8a6-40b6-ad8a-380fcca5b46b))
|
||||
(fp_line (start 9.7 11.2) (end 9.7 -15.2)
|
||||
(stroke (width 0.05) (type solid)) (layer "Eco2.User") (tstamp 2cf9c3f1-0d50-48cb-ab20-2dde6aa507ea))
|
||||
(fp_line (start -9 -15) (end 9 -15)
|
||||
(stroke (width 0.1) (type solid)) (layer "B.Fab") (tstamp 1c0ca95e-1ebf-4fcc-b5f0-fb87d0329255))
|
||||
(fp_line (start -9 10.5) (end -9 -15)
|
||||
(stroke (width 0.1) (type solid)) (layer "B.Fab") (tstamp c02f0c67-be29-4695-acb9-81afacbcd384))
|
||||
(fp_line (start -9 10.5) (end 9 10.5)
|
||||
(stroke (width 0.1) (type solid)) (layer "B.Fab") (tstamp e46dd247-41ab-4a11-88ca-2cd335bf69f8))
|
||||
(fp_line (start 9 10.5) (end 9 -15)
|
||||
(stroke (width 0.1) (type solid)) (layer "B.Fab") (tstamp fa4189a4-5ba5-44e0-8ed3-4dc58a3055a6))
|
||||
(fp_circle (center -7.9 -7.6) (end -7.9 -8.1)
|
||||
(stroke (width 0.1) (type solid)) (fill none) (layer "B.Fab") (tstamp 603fc6dd-4690-4fc8-8b44-56d17ed63c5e))
|
||||
(pad "1" smd roundrect (at -8.5 -7.51) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 6686c5fd-67b3-4c26-a60c-b979aa371890))
|
||||
(pad "2" smd roundrect (at -8.5 -6.24) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 706b9dd2-3531-464e-accb-a6626ab67dbc))
|
||||
(pad "3" smd roundrect (at -8.5 -4.97) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp b3540e45-a8cd-4dc7-8320-bbe8c718bdc3))
|
||||
(pad "4" smd roundrect (at -8.5 -3.7) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 09a01d93-288f-4506-a562-b85215b34258))
|
||||
(pad "5" smd roundrect (at -8.5 -2.43) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 694fd5f4-c111-44b1-b42c-1b87063c8ba5))
|
||||
(pad "6" smd roundrect (at -8.5 -1.16) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 0887c206-3a66-4b5e-82d7-7c21128b49d4))
|
||||
(pad "7" smd roundrect (at -8.5 0.11) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 9e15554b-96c3-44f9-8766-e34e18f4ddac))
|
||||
(pad "8" smd roundrect (at -8.5 1.38) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 71325b6b-d379-4e71-8141-87a630c26595))
|
||||
(pad "9" smd roundrect (at -8.5 2.65) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 0f50dd5f-d876-4d43-ac7b-6e954bac87c9))
|
||||
(pad "10" smd roundrect (at -8.5 3.92) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 0fd0a8e5-ed02-4447-873f-d5ab65d011c1))
|
||||
(pad "11" smd roundrect (at -8.5 5.19 180) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 15a4c1d4-79e8-4410-9a73-87109bcb7f5c))
|
||||
(pad "12" smd roundrect (at -8.5 6.46 180) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp f548aee8-7faa-4c61-b7a3-1d37f296e1b4))
|
||||
(pad "13" smd roundrect (at -8.5 7.73 180) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 0c2378e7-98b6-4341-a606-7013471a0b87))
|
||||
(pad "14" smd roundrect (at -8.5 9 180) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 60a2b3b7-beef-4c20-99f6-d269a14e54d2))
|
||||
(pad "15" smd roundrect (at -5.715 10 270) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 7ab03288-9a32-4011-99c1-1d80fbbcd678))
|
||||
(pad "16" smd roundrect (at -4.445 10 90) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp bc947ef2-1a25-4fc3-90a8-e452619c96c9))
|
||||
(pad "17" smd roundrect (at -3.175 10 90) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 18b5c696-1093-40c2-b2ef-33cde1543082))
|
||||
(pad "18" smd roundrect (at -1.905 10 90) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 8affbbfc-7a19-4367-8cbf-abdf4e25dcaa))
|
||||
(pad "19" smd roundrect (at -0.635 10 90) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 26ba2f46-130d-4a69-ac1f-d3ba99b6ab50))
|
||||
(pad "20" smd roundrect (at 0.635 10 90) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 69b756a3-12a8-42b0-8021-0e5a4af9ef03))
|
||||
(pad "21" smd roundrect (at 1.905 10 90) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp a3d0b657-8288-4493-8b1a-0f7c5cf670c8))
|
||||
(pad "22" smd roundrect (at 3.175 10 90) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp afc5f493-e4c7-4a7e-91ca-7829b912a44e))
|
||||
(pad "23" smd roundrect (at 4.445 10 90) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 18824509-dd9a-4fc2-8c0e-e217ed58e26e))
|
||||
(pad "24" smd roundrect (at 5.715 10 90) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 86d2adea-a062-4d19-91e5-ed0affac8199))
|
||||
(pad "25" smd roundrect (at 8.5 9) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 59d13ece-c564-4c59-bfd9-780db895bcc2))
|
||||
(pad "26" smd roundrect (at 8.5 7.73) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp d84d5d47-57a7-42ec-b083-1ded8201a6ac))
|
||||
(pad "27" smd roundrect (at 8.5 6.46) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp be51fd1f-bf89-42bd-97b2-4dab1b586650))
|
||||
(pad "28" smd roundrect (at 8.5 5.19) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 2d911663-0d4a-4001-a82d-07da47674458))
|
||||
(pad "29" smd roundrect (at 8.5 3.92) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp bf36e9d5-29fc-4979-9020-81e493e3b1c6))
|
||||
(pad "30" smd roundrect (at 8.5 2.65) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.05)
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp ee9cca1e-67e0-423d-81dd-8e074c191193))
|
||||
(pad "31" smd rect (at 8.5 1.38) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask")
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 098109b6-bfed-41e1-9593-bddad016ea18))
|
||||
(pad "32" smd rect (at 8.5 0.11) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask")
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 70e27f74-f7b1-45cd-a08a-ab1763b1011f))
|
||||
(pad "33" smd rect (at 8.5 -1.16) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask")
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 21abc1b5-4c19-42cf-97fb-c6c42a0b3939))
|
||||
(pad "34" smd rect (at 8.5 -2.43) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask")
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 2a9dc246-15a7-4c3b-a212-00808becdc42))
|
||||
(pad "35" smd rect (at 8.5 -3.7) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask")
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 97207351-f8d4-4db3-9d58-7a9819e97ecc))
|
||||
(pad "36" smd rect (at 8.5 -4.97) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask")
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 84172753-dc4b-4e2f-8009-fedcb93b8b2e))
|
||||
(pad "37" smd rect (at 8.5 -6.24) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask")
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 4725caf9-fd3b-453d-bc25-8fa970919cfc))
|
||||
(pad "38" smd rect (at 8.5 -7.51) (size 2 0.9) (layers "F.Cu" "F.Paste" "F.Mask")
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 197ee073-8df2-40ec-bccc-00e85fb1ca6e))
|
||||
(pad "39" smd rect (at -2.835 -1.835) (size 1.33 1.33) (layers "F.Cu" "F.Paste" "F.Mask")
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 0fcc6589-13d0-41b2-aeda-e70f5127a2c7))
|
||||
(pad "39" smd rect (at -2.835 0 90) (size 1.33 1.33) (layers "F.Cu" "F.Paste" "F.Mask")
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 1009eeb8-4be8-49ff-871d-1e30079ffe54))
|
||||
(pad "39" smd rect (at -2.835 1.835 180) (size 1.33 1.33) (layers "F.Cu" "F.Paste" "F.Mask")
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp f21e0d2f-30e3-44a7-b089-f9815487c7f8))
|
||||
(pad "39" smd rect (at -1.000003 0) (size 1.33 1.33) (layers "F.Cu" "F.Paste" "F.Mask")
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 047aa3bb-6884-4df5-83ed-7ea551b329b1))
|
||||
(pad "39" smd rect (at -1 -1.835) (size 1.33 1.33) (layers "F.Cu" "F.Paste" "F.Mask")
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp c35a9928-3453-4c10-b581-c909a87ff023))
|
||||
(pad "39" smd rect (at -1 1.835 180) (size 1.33 1.33) (layers "F.Cu" "F.Paste" "F.Mask")
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp c91644e3-e2e9-476e-bec0-d28e2c21a011))
|
||||
(pad "39" smd rect (at 0.835 -1.835) (size 1.33 1.33) (layers "F.Cu" "F.Paste" "F.Mask")
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 8774f0a1-1469-43a9-96cb-2dc2471a56a4))
|
||||
(pad "39" smd rect (at 0.835 0 270) (size 1.33 1.33) (layers "F.Cu" "F.Paste" "F.Mask")
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp f57881b5-c9c9-4bcf-be4b-dd8cfd505873))
|
||||
(pad "39" smd rect (at 0.835 1.835 180) (size 1.33 1.33) (layers "F.Cu" "F.Paste" "F.Mask")
|
||||
(solder_mask_margin 0.05) (thermal_bridge_angle 45) (tstamp 7c70a95d-e021-4338-a3de-d7656880600e))
|
||||
(zone (net 0) (net_name "") (layer "F.Cu") (tstamp da4ad6f3-5f0a-4c19-ae8d-5aa0f1ec37b7) (hatch edge 0.508)
|
||||
(connect_pads (clearance 0))
|
||||
(min_thickness 0.254) (filled_areas_thickness no)
|
||||
(keepout (tracks allowed) (vias allowed) (pads allowed ) (copperpour not_allowed) (footprints allowed))
|
||||
(fill (thermal_gap 0.508) (thermal_bridge_width 0.508))
|
||||
(polygon
|
||||
(pts
|
||||
(xy -9 -15)
|
||||
(xy 9 -15)
|
||||
(xy 9 -8.7)
|
||||
(xy -9 -8.7)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
|
@ -26,6 +26,10 @@
|
|||
#include <wx/filename.h>
|
||||
#include <board.h>
|
||||
#include <board_design_settings.h>
|
||||
#include <footprint.h>
|
||||
#include <fp_shape.h>
|
||||
#include <fp_text.h>
|
||||
#include <pad.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <pcbnew_utils/board_file_utils.h>
|
||||
#include <tool/tool_manager.h>
|
||||
|
@ -36,6 +40,11 @@
|
|||
#include <boost/test/unit_test.hpp>
|
||||
#include <board_commit.h>
|
||||
|
||||
|
||||
#define CHECK_ENUM_CLASS_EQUAL( L, R ) \
|
||||
BOOST_CHECK_EQUAL( static_cast<int>( L ), static_cast<int>( R ) )
|
||||
|
||||
|
||||
namespace KI_TEST
|
||||
{
|
||||
|
||||
|
@ -113,4 +122,163 @@ void FillZones( BOARD* m_board )
|
|||
}
|
||||
|
||||
|
||||
void CheckFootprint( const FOOTPRINT* expected, const FOOTPRINT* fp )
|
||||
{
|
||||
// TODO: validate those informations match the importer
|
||||
BOOST_CHECK_EQUAL( expected->GetPosition(), fp->GetPosition() );
|
||||
BOOST_CHECK_EQUAL( expected->GetOrientation(), fp->GetOrientation() );
|
||||
|
||||
BOOST_CHECK_EQUAL( expected->GetReference(), fp->GetReference() );
|
||||
BOOST_CHECK_EQUAL( expected->GetValue(), fp->GetValue() );
|
||||
BOOST_CHECK_EQUAL( expected->GetDescription(), fp->GetDescription() );
|
||||
BOOST_CHECK_EQUAL( expected->GetKeywords(), fp->GetKeywords() );
|
||||
BOOST_CHECK_EQUAL( expected->GetAttributes(), fp->GetAttributes() );
|
||||
BOOST_CHECK_EQUAL( expected->GetFlag(), fp->GetFlag() );
|
||||
//BOOST_CHECK_EQUAL( expected->GetProperties(), fp->GetProperties() );
|
||||
BOOST_CHECK_EQUAL( expected->GetTypeName(), fp->GetTypeName() );
|
||||
|
||||
// simple test if count matches
|
||||
BOOST_CHECK_EQUAL( expected->Pads().size(), fp->Pads().size() );
|
||||
BOOST_CHECK_EQUAL( expected->GraphicalItems().size(), fp->GraphicalItems().size() );
|
||||
BOOST_CHECK_EQUAL( expected->Zones().size(), fp->Zones().size() );
|
||||
BOOST_CHECK_EQUAL( expected->Groups().size(), fp->Groups().size() );
|
||||
BOOST_CHECK_EQUAL( expected->Models().size(), fp->Models().size() );
|
||||
|
||||
std::set<PAD*, FOOTPRINT::cmp_pads> expectedPads( expected->Pads().begin(),
|
||||
expected->Pads().end() );
|
||||
std::set<PAD*, FOOTPRINT::cmp_pads> fpPads( fp->Pads().begin(), fp->Pads().end() );
|
||||
for( auto itExpected = expectedPads.begin(), itFp = fpPads.begin();
|
||||
itExpected != expectedPads.end() && itFp != fpPads.end(); itExpected++, itFp++ )
|
||||
{
|
||||
CheckFpPad( *itExpected, *itFp );
|
||||
}
|
||||
|
||||
std::set<BOARD_ITEM*, FOOTPRINT::cmp_drawings> expectedGraphicalItems(
|
||||
expected->GraphicalItems().begin(), expected->GraphicalItems().end() );
|
||||
std::set<BOARD_ITEM*, FOOTPRINT::cmp_drawings> fpGraphicalItems( fp->GraphicalItems().begin(),
|
||||
fp->GraphicalItems().end() );
|
||||
for( auto itExpected = expectedGraphicalItems.begin(), itFp = fpGraphicalItems.begin();
|
||||
itExpected != expectedGraphicalItems.end() && itFp != fpGraphicalItems.end();
|
||||
itExpected++, itFp++ )
|
||||
{
|
||||
BOOST_CHECK_EQUAL( ( *itExpected )->Type(), ( *itFp )->Type() );
|
||||
switch( ( *itExpected )->Type() )
|
||||
{
|
||||
case PCB_FP_TEXT_T:
|
||||
{
|
||||
const FP_TEXT* expectedText = static_cast<const FP_TEXT*>( *itExpected );
|
||||
const FP_TEXT* text = static_cast<const FP_TEXT*>( *itFp );
|
||||
|
||||
// TODO: text is not sorted the same way!
|
||||
/*CHECK_ENUM_CLASS_EQUAL( text1->GetType(), text2->GetType() );
|
||||
|
||||
BOOST_CHECK_EQUAL( text1->GetText(), text2->GetText() );
|
||||
BOOST_CHECK_EQUAL( text1->GetPosition(), text2->GetPosition() );
|
||||
BOOST_CHECK_EQUAL( text1->GetTextAngle(), text2->GetTextAngle() );
|
||||
BOOST_CHECK_EQUAL( text1->GetTextThickness(), text2->GetTextThickness() );
|
||||
|
||||
BOOST_CHECK( text1->Compare( text2 ) == 0 );*/
|
||||
}
|
||||
break;
|
||||
case PCB_FP_SHAPE_T:
|
||||
{
|
||||
const FP_SHAPE* expectedShape = static_cast<const FP_SHAPE*>( *itExpected );
|
||||
const FP_SHAPE* shape = static_cast<const FP_SHAPE*>( *itFp );
|
||||
|
||||
KI_TEST::CheckFpShape( expectedShape, shape );
|
||||
}
|
||||
break;
|
||||
/*case PCB_FP_DIM_ALIGNED_T: break;
|
||||
case PCB_FP_DIM_LEADER_T: break;
|
||||
case PCB_FP_DIM_CENTER_T: break;
|
||||
case PCB_FP_DIM_RADIAL_T: break;
|
||||
case PCB_FP_DIM_ORTHOGONAL_T: break;*/
|
||||
default: BOOST_ERROR( "KICAD_T not known" ); break;
|
||||
}
|
||||
}
|
||||
|
||||
/*std::set<FP_ZONE*, FOOTPRINT::cmp_zones> expectedZones( expected->Zones().begin(),
|
||||
expected->Zones().end() );
|
||||
std::set<FP_ZONE*, FOOTPRINT::cmp_zones> fp2Zones( fp->Zones().begin(),
|
||||
fp->Zones().end() );
|
||||
for( auto it1 = expectedZones.begin(), it2 = fp2Zones.begin();
|
||||
it1 != expectedZones.end() && it2 != fp2Zones.end(); it1++, it2++ )
|
||||
{
|
||||
// TODO: BOOST_CHECK( (*it1)->IsSame( **it2 ) );
|
||||
}*/
|
||||
|
||||
// TODO: Groups
|
||||
}
|
||||
|
||||
|
||||
void CheckFpPad( const PAD* expected, const PAD* pad )
|
||||
{
|
||||
BOOST_CHECK_EQUAL( expected->GetNumber(), pad->GetNumber() );
|
||||
CHECK_ENUM_CLASS_EQUAL( expected->GetAttribute(), pad->GetAttribute() );
|
||||
CHECK_ENUM_CLASS_EQUAL( expected->GetProperty(), pad->GetProperty() );
|
||||
CHECK_ENUM_CLASS_EQUAL( expected->GetShape(), pad->GetShape() );
|
||||
|
||||
BOOST_CHECK_EQUAL( expected->IsLocked(), pad->IsLocked() );
|
||||
|
||||
BOOST_CHECK_EQUAL( expected->GetPosition(), pad->GetPosition() );
|
||||
BOOST_CHECK_EQUAL( expected->GetSize(), pad->GetSize() );
|
||||
BOOST_CHECK_EQUAL( expected->GetOrientation(), pad->GetOrientation() );
|
||||
BOOST_CHECK_EQUAL( expected->GetDelta(), pad->GetDelta() );
|
||||
BOOST_CHECK_EQUAL( expected->GetOffset(), pad->GetOffset() );
|
||||
BOOST_CHECK_EQUAL( expected->GetDrillSize(), pad->GetDrillSize() );
|
||||
CHECK_ENUM_CLASS_EQUAL( expected->GetDrillShape(), pad->GetDrillShape() );
|
||||
|
||||
BOOST_CHECK_EQUAL( expected->GetLayer(), pad->GetLayer() ); // this is not used for pads I think
|
||||
BOOST_CHECK_EQUAL( expected->GetLayerSet(), pad->GetLayerSet() );
|
||||
|
||||
BOOST_CHECK_EQUAL( expected->GetNetCode(), pad->GetNetCode() );
|
||||
BOOST_CHECK_EQUAL( expected->GetPinFunction(), pad->GetPinFunction() );
|
||||
BOOST_CHECK_EQUAL( expected->GetPinType(), pad->GetPinType() );
|
||||
BOOST_CHECK_EQUAL( expected->GetPadToDieLength(), pad->GetPadToDieLength() );
|
||||
BOOST_CHECK_EQUAL( expected->GetLocalSolderMaskMargin(), pad->GetLocalSolderMaskMargin() );
|
||||
BOOST_CHECK_EQUAL( expected->GetLocalSolderPasteMargin(), pad->GetLocalSolderPasteMargin() );
|
||||
BOOST_CHECK_EQUAL( expected->GetLocalSolderPasteMarginRatio(),
|
||||
pad->GetLocalSolderPasteMarginRatio() );
|
||||
BOOST_CHECK_EQUAL( expected->GetLocalClearance(), pad->GetLocalClearance() );
|
||||
CHECK_ENUM_CLASS_EQUAL( expected->GetZoneConnection(), pad->GetZoneConnection() );
|
||||
BOOST_CHECK_EQUAL( expected->GetThermalSpokeWidth(), pad->GetThermalSpokeWidth() );
|
||||
BOOST_CHECK_EQUAL( expected->GetThermalSpokeAngle(), pad->GetThermalSpokeAngle() );
|
||||
BOOST_CHECK_EQUAL( expected->GetThermalGap(), pad->GetThermalGap() );
|
||||
BOOST_CHECK_EQUAL( expected->GetRoundRectRadiusRatio(), pad->GetRoundRectRadiusRatio() );
|
||||
BOOST_CHECK_EQUAL( expected->GetChamferRectRatio(), pad->GetChamferRectRatio() );
|
||||
BOOST_CHECK_EQUAL( expected->GetChamferPositions(), pad->GetChamferPositions() );
|
||||
BOOST_CHECK_EQUAL( expected->GetRemoveUnconnected(), pad->GetRemoveUnconnected() );
|
||||
BOOST_CHECK_EQUAL( expected->GetKeepTopBottom(), pad->GetKeepTopBottom() );
|
||||
|
||||
// TODO: check complex pad shapes
|
||||
CHECK_ENUM_CLASS_EQUAL( expected->GetAnchorPadShape(), pad->GetAnchorPadShape() );
|
||||
CHECK_ENUM_CLASS_EQUAL( expected->GetCustomShapeInZoneOpt(), pad->GetCustomShapeInZoneOpt() );
|
||||
}
|
||||
|
||||
|
||||
void CheckFpShape( const FP_SHAPE* expected, const FP_SHAPE* shape )
|
||||
{
|
||||
CHECK_ENUM_CLASS_EQUAL( expected->GetShape(), shape->GetShape() );
|
||||
|
||||
BOOST_CHECK_EQUAL( expected->IsLocked(), shape->IsLocked() );
|
||||
|
||||
BOOST_CHECK_EQUAL( expected->GetCenter(), shape->GetCenter() );
|
||||
BOOST_CHECK_EQUAL( expected->GetStart(), shape->GetStart() );
|
||||
BOOST_CHECK_EQUAL( expected->GetEnd(), shape->GetEnd() );
|
||||
BOOST_CHECK_EQUAL( expected->GetPosition(), shape->GetPosition() );
|
||||
BOOST_CHECK_EQUAL( expected->GetBezierC1(), shape->GetBezierC1() );
|
||||
BOOST_CHECK_EQUAL( expected->GetBezierC2(), shape->GetBezierC2() );
|
||||
|
||||
// TODO: polyshape
|
||||
|
||||
BOOST_CHECK_EQUAL( expected->GetLayer(), shape->GetLayer() );
|
||||
BOOST_CHECK_EQUAL( expected->GetLayerSet(), shape->GetLayerSet() );
|
||||
|
||||
BOOST_CHECK_EQUAL( expected->GetStroke().GetWidth(), shape->GetStroke().GetWidth() );
|
||||
CHECK_ENUM_CLASS_EQUAL( expected->GetStroke().GetPlotStyle(),
|
||||
shape->GetStroke().GetPlotStyle() );
|
||||
CHECK_ENUM_CLASS_EQUAL( expected->GetFillMode(), shape->GetFillMode() );
|
||||
}
|
||||
|
||||
|
||||
} // namespace KI_TEST
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
|
||||
class BOARD;
|
||||
class BOARD_ITEM;
|
||||
class FOOTPRINT;
|
||||
class FP_SHAPE;
|
||||
class PAD;
|
||||
class SETTINGS_MANAGER;
|
||||
|
||||
|
||||
|
@ -64,6 +67,16 @@ void LoadBoard( SETTINGS_MANAGER& aSettingsManager, const wxString& aRelPath,
|
|||
void FillZones( BOARD* m_board );
|
||||
|
||||
|
||||
/**
|
||||
* Helper method to check if two footprints are semantically the same.
|
||||
*/
|
||||
void CheckFootprint( const FOOTPRINT* expected, const FOOTPRINT* fp );
|
||||
|
||||
void CheckFpPad( const PAD* expected, const PAD* pad );
|
||||
|
||||
void CheckFpShape( const FP_SHAPE* expected, const FP_SHAPE* shape );
|
||||
|
||||
|
||||
} // namespace KI_TEST
|
||||
|
||||
#endif // QA_PCBNEW_BOARD_TEST_UTILS__H
|
||||
|
|
|
@ -50,109 +50,9 @@ struct ALTIUM_PCBLIB_IMPORT_FIXTURE
|
|||
|
||||
ALTIUM_DESIGNER_PLUGIN altiumPlugin;
|
||||
PCB_PLUGIN kicadPlugin;
|
||||
|
||||
void CompareFootprints( const FOOTPRINT* fp1, const FOOTPRINT* fp2 )
|
||||
{
|
||||
BOOST_CHECK_EQUAL( fp1->GetPosition(), fp2->GetPosition() );
|
||||
BOOST_CHECK_EQUAL( fp1->GetOrientation(), fp2->GetOrientation() );
|
||||
|
||||
BOOST_CHECK_EQUAL( fp1->GetReference(), fp2->GetReference() );
|
||||
BOOST_CHECK_EQUAL( fp1->GetValue(), fp2->GetValue() );
|
||||
BOOST_CHECK_EQUAL( fp1->GetDescription(), fp2->GetDescription() );
|
||||
BOOST_CHECK_EQUAL( fp1->GetKeywords(), fp2->GetKeywords() );
|
||||
BOOST_CHECK_EQUAL( fp1->GetAttributes(), fp2->GetAttributes() );
|
||||
BOOST_CHECK_EQUAL( fp1->GetFlag(), fp2->GetFlag() );
|
||||
//BOOST_CHECK_EQUAL( fp1->GetProperties(), fp2->GetProperties() );
|
||||
BOOST_CHECK_EQUAL( fp1->GetTypeName(), fp2->GetTypeName() );
|
||||
|
||||
BOOST_CHECK_EQUAL( fp1->Pads().size(), fp2->Pads().size() );
|
||||
BOOST_CHECK_EQUAL( fp1->GraphicalItems().size(), fp2->GraphicalItems().size() );
|
||||
BOOST_CHECK_EQUAL( fp1->Zones().size(), fp2->Zones().size() );
|
||||
BOOST_CHECK_EQUAL( fp1->Groups().size(), fp2->Groups().size() );
|
||||
BOOST_CHECK_EQUAL( fp1->Models().size(), fp2->Models().size() );
|
||||
|
||||
std::set<PAD*, FOOTPRINT::cmp_pads> fp1Pads( fp1->Pads().begin(), fp1->Pads().end() );
|
||||
std::set<PAD*, FOOTPRINT::cmp_pads> fp2Pads( fp2->Pads().begin(), fp2->Pads().end() );
|
||||
for( auto it1 = fp1Pads.begin(), it2 = fp2Pads.begin();
|
||||
it1 != fp1Pads.end() && it2 != fp2Pads.end(); it1++, it2++ )
|
||||
{
|
||||
BOOST_CHECK( PAD::Compare( *it1, *it2 ) == 0 );
|
||||
}
|
||||
|
||||
std::set<BOARD_ITEM*, FOOTPRINT::cmp_drawings> fp1GraphicalItems(
|
||||
fp1->GraphicalItems().begin(), fp1->GraphicalItems().end() );
|
||||
std::set<BOARD_ITEM*, FOOTPRINT::cmp_drawings> fp2GraphicalItems(
|
||||
fp2->GraphicalItems().begin(), fp2->GraphicalItems().end() );
|
||||
for( auto it1 = fp1GraphicalItems.begin(), it2 = fp2GraphicalItems.begin();
|
||||
it1 != fp1GraphicalItems.end() && it2 != fp2GraphicalItems.end(); it1++, it2++ )
|
||||
{
|
||||
BOOST_CHECK_EQUAL( ( *it1 )->GetLayer(), ( *it2 )->GetLayer() );
|
||||
BOOST_CHECK_EQUAL( ( *it1 )->GetLayerSet(), ( *it2 )->GetLayerSet() );
|
||||
BOOST_CHECK_EQUAL( ( *it2 )->GetCenter(), ( *it2 )->GetCenter() );
|
||||
|
||||
BOOST_CHECK_EQUAL( ( *it1 )->Type(), ( *it2 )->Type() );
|
||||
switch( ( *it1 )->Type() )
|
||||
{
|
||||
case PCB_FP_TEXT_T:
|
||||
{
|
||||
const FP_TEXT* text1 = static_cast<const FP_TEXT*>( *it1 );
|
||||
const FP_TEXT* text2 = static_cast<const FP_TEXT*>( *it2 );
|
||||
|
||||
// TODO: text is not sorted the same way!
|
||||
/*CHECK_ENUM_CLASS_EQUAL( text1->GetType(), text2->GetType() );
|
||||
|
||||
BOOST_CHECK_EQUAL( text1->GetText(), text2->GetText() );
|
||||
BOOST_CHECK_EQUAL( text1->GetPosition(), text2->GetPosition() );
|
||||
BOOST_CHECK_EQUAL( text1->GetTextAngle(), text2->GetTextAngle() );
|
||||
BOOST_CHECK_EQUAL( text1->GetTextThickness(), text2->GetTextThickness() );
|
||||
|
||||
BOOST_CHECK( text1->Compare( text2 ) == 0 );*/
|
||||
}
|
||||
break;
|
||||
case PCB_FP_SHAPE_T:
|
||||
{
|
||||
const FP_SHAPE* shape1 = static_cast<const FP_SHAPE*>( *it1 );
|
||||
const FP_SHAPE* shape2 = static_cast<const FP_SHAPE*>( *it2 );
|
||||
|
||||
CHECK_ENUM_CLASS_EQUAL( shape1->GetShape(), shape2->GetShape() );
|
||||
|
||||
BOOST_CHECK_EQUAL( shape1->GetStroke().GetWidth(), shape2->GetStroke().GetWidth() );
|
||||
CHECK_ENUM_CLASS_EQUAL( shape1->GetStroke().GetPlotStyle(),
|
||||
shape2->GetStroke().GetPlotStyle() );
|
||||
|
||||
BOOST_CHECK_EQUAL( shape1->GetPosition(), shape2->GetPosition() );
|
||||
BOOST_CHECK_EQUAL( shape1->GetStart(), shape2->GetStart() );
|
||||
BOOST_CHECK_EQUAL( shape1->GetEnd(), shape2->GetEnd() );
|
||||
|
||||
CHECK_ENUM_CLASS_EQUAL( shape1->GetFillMode(), shape2->GetFillMode() );
|
||||
}
|
||||
break;
|
||||
/*case PCB_FP_DIM_ALIGNED_T: break;
|
||||
case PCB_FP_DIM_LEADER_T: break;
|
||||
case PCB_FP_DIM_CENTER_T: break;
|
||||
case PCB_FP_DIM_RADIAL_T: break;
|
||||
case PCB_FP_DIM_ORTHOGONAL_T: break;*/
|
||||
default: BOOST_ERROR( "KICAD_T not known" ); break;
|
||||
}
|
||||
}
|
||||
|
||||
std::set<FP_ZONE*, FOOTPRINT::cmp_zones> fp1Zones( fp1->Zones().begin(),
|
||||
fp1->Zones().end() );
|
||||
std::set<FP_ZONE*, FOOTPRINT::cmp_zones> fp2Zones( fp2->Zones().begin(),
|
||||
fp2->Zones().end() );
|
||||
for( auto it1 = fp1Zones.begin(), it2 = fp2Zones.begin();
|
||||
it1 != fp1Zones.end() && it2 != fp2Zones.end(); it1++, it2++ )
|
||||
{
|
||||
// TODO: BOOST_CHECK( (*it1)->IsSame( **it2 ) );
|
||||
}
|
||||
|
||||
// TODO: Groups
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// TODO: see https://gitlab.com/kicad/code/kicad/-/blob/master/qa/pcbnew/test_save_load.cpp
|
||||
|
||||
/**
|
||||
* Declares the struct as the Boost test fixture.
|
||||
*/
|
||||
|
@ -164,8 +64,10 @@ BOOST_FIXTURE_TEST_SUITE( AltiumPcbLibImport, ALTIUM_PCBLIB_IMPORT_FIXTURE )
|
|||
*/
|
||||
BOOST_AUTO_TEST_CASE( AltiumPcbLibImport )
|
||||
{
|
||||
std::vector<std::pair<wxString, wxString>> tests = { { "TracksTest.PcbLib",
|
||||
"TracksTest.pretty" } };
|
||||
std::vector<std::pair<wxString, wxString>> tests = {
|
||||
{ "TracksTest.PcbLib", "TracksTest.pretty" },
|
||||
{ "Espressif ESP32-WROOM-32.PcbLib", "Espressif ESP32-WROOM-32.pretty" }
|
||||
};
|
||||
|
||||
std::string dataPath = KI_TEST::GetPcbnewTestDataDir() + "plugins/altium/pcblib/";
|
||||
|
||||
|
@ -198,7 +100,7 @@ BOOST_AUTO_TEST_CASE( AltiumPcbLibImport )
|
|||
false, nullptr );
|
||||
BOOST_CHECK( kicadFp );
|
||||
|
||||
CompareFootprints( altiumFp, kicadFp );
|
||||
KI_TEST::CheckFootprint( kicadFp, altiumFp );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue