altium: Start with a test-suite to validate that *.PcbLib footprints are correctly imported

The test simply loads every footprint of a library, and compares all elements with an equivalent
KiCad footprint. This allows us to quickly spot regressions in the altium and kicad footprint importer,
and any code in-between. This test is only a demo, as the checks are still incomplete and quite a few
tests are missing.

It has to be noted that mask expansion is not supported rigt now by the altium importer, thus the
reference footprint is adjusted to keep the test happy.
This commit is contained in:
Thomas Pointhuber 2022-02-09 22:34:04 +01:00
parent 2250211ebf
commit 3f36e7d725
10 changed files with 626 additions and 0 deletions

View File

@ -84,6 +84,7 @@ BOARD* ALTIUM_DESIGNER_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendTo
{ ALTIUM_PCB_DIR::COMPONENTS6, "Components6\\" },
{ ALTIUM_PCB_DIR::COMPONENTBODIES6, "ComponentBodies6\\" },
{ ALTIUM_PCB_DIR::DIMENSIONS6, "Dimensions6\\" },
{ ALTIUM_PCB_DIR::EXTENDPRIMITIVEINFORMATION, "ExtendedPrimitiveInformation\\" },
{ ALTIUM_PCB_DIR::FILLS6, "Fills6\\" },
{ ALTIUM_PCB_DIR::MODELS, "Models\\" },
{ ALTIUM_PCB_DIR::NETS6, "Nets6\\" },

Binary file not shown.

View File

@ -0,0 +1,47 @@
(footprint "KEEPOUT" (version 20220131) (generator pcbnew)
(layer "F.Cu")
(tedit 0)
(descr "Keepouyt via/track/copper/smd/th")
(fp_text reference "REF**" (at 0 0) (layer "F.SilkS")
(effects (font (size 1.27 1.27) (thickness 0.15)))
(tstamp d92cfbfa-da4b-4f63-8ad6-7bb6977d4f44)
)
(fp_text value "KEEPOUT" (at 0 0) (layer "F.SilkS")
(effects (font (size 1.27 1.27) (thickness 0.15)))
(tstamp e6a27cb0-d090-4b8c-9a7b-e787b9ea11b6)
)
(zone (net 0) (net_name "") (layer "F.Cu") (tstamp 66f97120-6c7e-441a-9997-acbf3e610e6e) (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 5.140866 -0.479746)
(xy 5.27032 -0.420627)
(xy 5.377875 -0.32743)
(xy 5.454816 -0.207708)
(xy 5.494911 -0.071157)
(xy 5.494911 0.071157)
(xy 5.454816 0.207708)
(xy 5.377875 0.32743)
(xy 5.27032 0.420627)
(xy 5.140866 0.479746)
(xy 5 0.5)
(xy -5 0.5)
(xy -5.140866 0.479746)
(xy -5.27032 0.420627)
(xy -5.377875 0.32743)
(xy -5.454816 0.207708)
(xy -5.494911 0.071157)
(xy -5.494911 -0.071157)
(xy -5.454816 -0.207708)
(xy -5.377875 -0.32743)
(xy -5.27032 -0.420627)
(xy -5.140866 -0.479746)
(xy -5 -0.5)
(xy 5 -0.5)
)
)
)
)

View File

@ -0,0 +1,35 @@
(footprint "MASKS" (version 20220131) (generator pcbnew)
(layer "F.Cu")
(tedit 0)
(descr "Various mask settings")
(fp_text reference "REF**" (at 0 0) (layer "F.SilkS")
(effects (font (size 1.27 1.27) (thickness 0.15)))
(tstamp 0c83fcb5-bcc7-4f84-8394-d4fc9899e233)
)
(fp_text value "MASKS" (at 0 0) (layer "F.SilkS")
(effects (font (size 1.27 1.27) (thickness 0.15)))
(tstamp 784b6458-3ae8-48f4-9482-731714d7927e)
)
(fp_text user "Mask Exp" (at -19.746 7.238164 unlocked) (layer "Dwgs.User")
(effects (font (size 1.524 1.524) (thickness 0.254)) (justify left bottom))
(tstamp 1b0f55f9-5fa5-489c-9db2-e63c29ecdd31)
)
(fp_text user "-0.1" (at 10.254 7.746 unlocked) (layer "Dwgs.User")
(effects (font (size 1.524 1.524) (thickness 0.254)) (justify left bottom))
(tstamp 44d6780b-0f7d-4066-bfb2-bff50f00afa0)
)
(fp_text user "-1" (at -5.746 7.746 unlocked) (layer "Dwgs.User")
(effects (font (size 1.524 1.524) (thickness 0.254)) (justify left bottom))
(tstamp e584f27e-45dd-4fdd-8c50-c7400e4b2ab2)
)
(fp_text user "-0.25" (at -0.746 7.746 unlocked) (layer "Dwgs.User")
(effects (font (size 1.524 1.524) (thickness 0.254)) (justify left bottom))
(tstamp f01a08c4-d9f1-4838-af18-b59bca81082c)
)
(fp_line (start -5 5) (end -5 -5)
(stroke (width 0.5) (type solid)) (layer "F.Cu") (tstamp c47c1013-522e-4afa-9dd5-776b2bbec89a))
(fp_line (start 4 5) (end 4 -5)
(stroke (width 0.5) (type solid)) (layer "F.Cu") (tstamp e16db058-fa43-40bf-9cff-c2ed4fab6ab5))
(fp_line (start 13 5) (end 13 -5)
(stroke (width 0.5) (type solid)) (layer "F.Cu") (tstamp 3de27c1c-897a-4a6c-b0f7-6b3c6fd91fd1))
)

View File

@ -0,0 +1,205 @@
(footprint "MULTILAYER MASK EXPANSION" (version 20220131) (generator pcbnew)
(layer "F.Cu")
(tedit 0)
(descr "A multilayer track and inner-layer tracks with mask expansion")
(fp_text reference "REF**" (at 0 0) (layer "F.SilkS")
(effects (font (size 1.27 1.27) (thickness 0.15)))
(tstamp 27101d2b-1f80-4d40-be5b-78bdcb31c291)
)
(fp_text value "MULTILAYER MASK EXPANSION" (at 0 0) (layer "F.SilkS")
(effects (font (size 1.27 1.27) (thickness 0.15)))
(tstamp 2fb7c72d-0d63-4df2-879e-15ff023fd1c7)
)
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "F.Cu") (tstamp 211ba5f5-6627-4b10-b9d4-2b719a124b05))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "F.Cu") (tstamp cfc3b2fc-1257-4353-9902-85cb6291fba4))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "F.Cu") (tstamp 18282a1a-7012-465b-b257-9994d1176f23))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In1.Cu") (tstamp 6884c1b4-ba74-400a-b15a-2bf546c04e73))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In1.Cu") (tstamp 97c58935-8898-41d5-af6f-2caecb03bd8b))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In1.Cu") (tstamp 1e9dcbc0-ed04-41e3-9512-fbb37cd7d179))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In2.Cu") (tstamp 3be5bd27-9454-4a5f-b633-97d435ecd4be))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In2.Cu") (tstamp d4afa5e8-9757-447e-9a26-66d5df023d71))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In2.Cu") (tstamp bc0c4d76-7073-443a-8935-0c1edc20eb60))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In3.Cu") (tstamp 7056f785-c3a5-4410-b6bb-e5d4b16e698a))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In3.Cu") (tstamp 23b2684a-2e45-4486-8777-c94a6d847baf))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In3.Cu") (tstamp 388986aa-d9a5-485c-b2a5-20f9608e57de))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In4.Cu") (tstamp 2143a25a-25e8-4e2e-9312-ce2f7400ce5a))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In4.Cu") (tstamp 51aef7ea-783f-44d5-8cab-9faf10da9064))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In4.Cu") (tstamp a1df41ee-57e8-4cf8-a863-aa2ac7fada82))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In5.Cu") (tstamp 6bd7efd5-74f5-4b09-8bb7-5762073a2f78))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In5.Cu") (tstamp 748d63ca-ef14-4e90-85ec-56619f2bea16))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In5.Cu") (tstamp c41835e2-2b20-4f99-a85d-b1859480e6e6))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In6.Cu") (tstamp 181135d6-242b-4baf-94b0-054802ef6df0))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In6.Cu") (tstamp b75ad8c5-9f55-49ef-9af8-7ab1b11ab9d4))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In6.Cu") (tstamp 245afab8-87c2-4797-af78-aa00d5229c94))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In7.Cu") (tstamp 03f16627-7ce3-4e9a-9706-778678e98c1c))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In7.Cu") (tstamp 665ff082-de8d-4434-bdea-5354e7d0b15e))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In7.Cu") (tstamp 5ee97714-8ad8-47a4-bd70-3ebc8406c7b5))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In8.Cu") (tstamp b1ef00bc-27fd-4f4a-a155-1b738e608b48))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In8.Cu") (tstamp 7594fd2b-c5d9-4333-9f70-e53128d27c5a))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In8.Cu") (tstamp 40f2d922-dc77-4165-a4ba-77aa54d0f1fa))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In9.Cu") (tstamp 5e5cd445-0654-433f-a688-b9a23b9e5558))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In9.Cu") (tstamp 3f787304-0f09-428f-9615-a178d53b5ed2))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In9.Cu") (tstamp 7e97b323-0f13-4745-becc-fa60e39b31ab))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In10.Cu") (tstamp 10e85d49-8c1d-4e38-920c-77246389daec))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In10.Cu") (tstamp f603df29-ba7f-4366-8b24-7592d4086934))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In10.Cu") (tstamp 5ed661fa-d25a-413c-8f9b-894484c176c8))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In11.Cu") (tstamp 45005e12-36a9-4853-a83d-a87ffad800b4))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In11.Cu") (tstamp 6d259b3b-196b-4e6b-acdf-fc3e09319776))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In11.Cu") (tstamp c034fa22-c359-4a30-b345-2b159807ba6c))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In12.Cu") (tstamp d1cf4093-87af-4b49-8879-3ac410551bfc))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In12.Cu") (tstamp 7f093f1d-323b-4b4e-b33a-3f6815b22768))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In12.Cu") (tstamp 21846961-2a78-4e46-8242-5b4de77ca82d))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In13.Cu") (tstamp cca964ad-d64e-4c84-a05a-4b48498db544))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In13.Cu") (tstamp bad86c5b-550c-459d-ae24-5ea963bd342c))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In13.Cu") (tstamp 6b4ca676-3379-4b8d-a1e2-e3fc88dc7cd2))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In14.Cu") (tstamp f90672d0-2ca8-4eaf-98ba-17042306fced))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In14.Cu") (tstamp 3ae98a70-72b8-4d72-8f0c-ecef7b1ca6d6))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In14.Cu") (tstamp 2097c02a-9419-426d-a010-cdecd44e7e36))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In15.Cu") (tstamp ba033dd1-a5e2-4136-b71b-d0a1cef6fc1f))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In15.Cu") (tstamp 16fbbcc3-471d-4df7-bd39-383fab759fde))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In15.Cu") (tstamp a500369a-3292-46a6-8a64-7c1bf6098bda))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In16.Cu") (tstamp 04f09747-54bd-4ccb-936d-3baa80652154))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In16.Cu") (tstamp 066e1992-d763-4a9e-8986-82a289c6f7d3))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In16.Cu") (tstamp 917dba0e-1b1e-4fc1-b97b-7105df526305))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In17.Cu") (tstamp 09986a87-49c2-4491-b1b1-87dfad52ab95))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In17.Cu") (tstamp 7af171ef-c1a8-4817-ac3c-eb72938c314e))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In17.Cu") (tstamp c5c59683-c7c2-4b4e-928e-13e0f78a5fa5))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In18.Cu") (tstamp 0339f2f9-1d07-4033-b6d0-c95452f524c6))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In18.Cu") (tstamp 93ef09ab-58f4-40ee-8d2b-6370d66890c0))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In18.Cu") (tstamp bdf0e688-b15d-45d8-a79c-81e4aaf38323))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In19.Cu") (tstamp dd5d8675-d91a-46c9-a0f4-ca5bb7941f9f))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In19.Cu") (tstamp d2f6c7ec-fb14-4c80-b507-e05e76c13bdf))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In19.Cu") (tstamp 056f9cb3-715f-434f-b47c-815c372d9a5b))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In20.Cu") (tstamp 7e60f163-8805-4bc8-82a5-453da20ba1a2))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In20.Cu") (tstamp d51ba27b-8ed7-4eca-b0be-3ba1363dff58))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In20.Cu") (tstamp dde2f451-a39d-4356-be48-b264625a1f92))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In21.Cu") (tstamp 0f262423-d4d1-4f04-805d-93d3f5b41978))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In21.Cu") (tstamp ea31f51c-3f0e-4e37-9fd4-9e1b1b7d7784))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In21.Cu") (tstamp 6356fe97-06cd-4a4b-b2f2-2e98498da4a1))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In22.Cu") (tstamp 5add257c-7316-4000-a2a3-e6a8c316ab9c))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In22.Cu") (tstamp 0fa241a2-e684-4224-bccf-feed816795b0))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In22.Cu") (tstamp f238640e-3401-420a-ac31-a433f268cbfc))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In23.Cu") (tstamp c4a3c708-c9b1-415d-ade1-45ed1cc0c8de))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In23.Cu") (tstamp 1dc423f3-1741-4cb4-aa3d-a702d125d769))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In23.Cu") (tstamp 67ab6325-5225-42ee-86cc-5aee5e01efce))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In24.Cu") (tstamp 135dc062-d77d-4089-9b0c-b888ac79f63d))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In24.Cu") (tstamp 525775d5-0e6e-4c76-b5ab-199b2e54ac41))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In24.Cu") (tstamp 716698ac-ed16-401e-958b-a147596def51))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In25.Cu") (tstamp 2904c703-ae82-4d76-85d3-cfc7aa518669))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In25.Cu") (tstamp c8b3bfbd-79b7-4863-9ae7-79b3f077a5ad))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In25.Cu") (tstamp 43d030b0-c46c-4448-bc9e-987f12c7559d))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In26.Cu") (tstamp 7b08b6d2-d7a0-45d0-95d4-d9dfb9198b27))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In26.Cu") (tstamp 759bd0f6-2646-44e7-94e8-5efbb41acb61))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In26.Cu") (tstamp 02bac189-ce88-4201-a986-e602f9553dc1))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In27.Cu") (tstamp 7048b6de-9faa-47a1-99c5-b74e17a09a6e))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In27.Cu") (tstamp eb15020f-39fa-457e-8bb2-2cd2948845ca))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In27.Cu") (tstamp 45580b2c-f853-4bae-b48d-8b2b7a8c9649))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In28.Cu") (tstamp 7af1455e-5ab2-4286-8c74-1c6dee563208))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In28.Cu") (tstamp f7aa75c5-0bfb-4814-b8eb-5f8a9a128aa9))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In28.Cu") (tstamp 3f473a8d-2328-4446-9e36-aaf72c0dfceb))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In29.Cu") (tstamp f50237bb-f9c4-46da-b66f-024d10bb7b7e))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In29.Cu") (tstamp 9dffc0da-762b-42b7-80b1-72a451bb294f))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In29.Cu") (tstamp d9486185-1c1d-4547-bd7d-6cdded6e4187))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "In30.Cu") (tstamp 98e246fc-6637-419f-a1a8-e2b22f10addf))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "In30.Cu") (tstamp 5f10ab2e-0baa-42eb-b877-7c3c9e704ef3))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "In30.Cu") (tstamp fd04ef58-75d9-44e8-b553-d9bff716e067))
(fp_line (start -10 -2) (end 10 -2)
(stroke (width 0.5) (type solid)) (layer "B.Cu") (tstamp 6b24a7a2-717b-4448-a40d-7886a2ed3d71))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.5) (type solid)) (layer "B.Cu") (tstamp 775b50f1-c021-45e5-b4f4-3da4bfa305be))
(fp_line (start -10 2) (end 10 2)
(stroke (width 0.5) (type solid)) (layer "B.Cu") (tstamp ee19307b-ab88-4d6f-9dfb-4149660b5a08))
)

View File

@ -0,0 +1,77 @@
(footprint "MULTILAYER" (version 20220131) (generator pcbnew)
(layer "F.Cu")
(tedit 0)
(descr "A multilayer track")
(fp_text reference "REF**" (at 0 0) (layer "F.SilkS")
(effects (font (size 1.27 1.27) (thickness 0.15)))
(tstamp 2717f789-6e9a-45e5-ba68-0e97a483a090)
)
(fp_text value "MULTILAYER" (at 0 0) (layer "F.SilkS")
(effects (font (size 1.27 1.27) (thickness 0.15)))
(tstamp c06b07a5-81e8-4fba-b75f-eafa053e1406)
)
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "F.Cu") (tstamp a02008a9-68e1-4709-bfc0-24c27997889b))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In1.Cu") (tstamp 947acefe-ac33-4206-9de3-25b50b4731dd))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In2.Cu") (tstamp f75ebc7d-c37e-40c2-a424-54729f414b88))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In3.Cu") (tstamp 14fc535c-cb89-48aa-90fe-76e1fd47f505))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In4.Cu") (tstamp 9f6748e8-8f0d-48e2-827e-24181f021855))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In5.Cu") (tstamp 673ed119-91db-4148-9876-56639d2d2321))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In6.Cu") (tstamp 93d4d131-a9f1-4257-bd4f-e06ad27b3631))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In7.Cu") (tstamp c4d75d3d-bb31-481d-a4a7-a0f504882b68))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In8.Cu") (tstamp becc358e-ef6d-41ed-a412-61ca01ad5ed6))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In9.Cu") (tstamp 4925c46f-467c-40b3-95db-ef4df267cd8b))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In10.Cu") (tstamp e5b90e39-3962-49db-a2a4-466531862883))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In11.Cu") (tstamp 01fb1e6b-cb11-499c-98a0-6bff6dff5959))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In12.Cu") (tstamp d976a998-0355-4b51-98dc-421418498533))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In13.Cu") (tstamp 7b859b76-0528-49b2-a54e-fd6560111b42))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In14.Cu") (tstamp 2e0de0fd-ad73-4e93-8d2e-96ad3d9f4bc7))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In15.Cu") (tstamp ed06b896-4df0-4238-b6eb-bbbe5360e849))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In16.Cu") (tstamp 6d7c23f0-27c3-4fa6-89cc-f79a540be70c))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In17.Cu") (tstamp d92867dc-3e98-46a9-a48e-3161efe31b10))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In18.Cu") (tstamp c9a40d5d-4fe7-4da0-89eb-466f8c6c321b))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In19.Cu") (tstamp effa9ffa-d173-4290-8a92-c5f93d4c73ba))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In20.Cu") (tstamp 76ff16ff-0d33-4704-b0f8-f9c9f4b3e595))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In21.Cu") (tstamp 0c3dbbcf-98e0-48d2-853d-b67234b32313))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In22.Cu") (tstamp 208a6583-df1c-4ff8-9045-47b7770a5518))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In23.Cu") (tstamp 787ed861-bac6-4a43-9839-40cdf7ee276e))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In24.Cu") (tstamp c485d3ef-a691-4d45-9595-86938e754812))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In25.Cu") (tstamp 15dc4b2e-003f-454e-bdaf-e1febd8c55e0))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In26.Cu") (tstamp dacff3a5-d976-4461-a265-5c771e382f92))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In27.Cu") (tstamp 169fbf9e-c683-4879-aed2-ef27f2a35b47))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In28.Cu") (tstamp ebd0fc89-8e13-43bb-945a-2e8b75c613c1))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In29.Cu") (tstamp fa96cd3f-f267-4e6d-9212-fd48f9f4aabe))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "In30.Cu") (tstamp cefc466a-271e-483c-abaa-dae7c1574727))
(fp_line (start -10 0) (end 10 0)
(stroke (width 0.254) (type solid)) (layer "B.Cu") (tstamp 179ded49-c8d7-40c2-a728-5841fda625bd))
)

View File

@ -0,0 +1,29 @@
(footprint "Tracks" (version 20220131) (generator pcbnew)
(layer "F.Cu")
(tedit 0)
(descr "A few tracks in different directions")
(fp_text reference "REF**" (at 0 0) (layer "F.SilkS")
(effects (font (size 1.27 1.27) (thickness 0.15)))
(tstamp d4ef5db0-5fba-4fcd-ab64-2ef2646c5c6d)
)
(fp_text value "Tracks" (at 0 0) (layer "F.SilkS")
(effects (font (size 1.27 1.27) (thickness 0.15)))
(tstamp 720ec55a-7c69-4064-b792-ef3dbba4eab9)
)
(fp_line (start -5.334 -1.651) (end -4.064 -2.921)
(stroke (width 0.254) (type solid)) (layer "F.Cu") (tstamp c6462399-f2e4-4f1a-b34a-b49a04c8bdb9))
(fp_line (start -5.334 1.524) (end -5.334 -1.651)
(stroke (width 0.254) (type solid)) (layer "F.Cu") (tstamp 722636b6-8ff0-452f-9357-23deb317d921))
(fp_line (start -5.334 1.524) (end -3.429 3.429)
(stroke (width 0.254) (type solid)) (layer "F.Cu") (tstamp 4160bbf7-ffff-4c5c-a647-5ee58ddecf06))
(fp_line (start -4.064 -2.921) (end 2.921 -2.921)
(stroke (width 0.254) (type solid)) (layer "F.Cu") (tstamp bf8d857b-70bf-41ee-a068-5771461e04e9))
(fp_line (start -3.429 3.429) (end 2.794 3.429)
(stroke (width 0.254) (type solid)) (layer "F.Cu") (tstamp 8ae05d37-86b4-45ea-800f-f1f9fb167857))
(fp_line (start 2.794 3.429) (end 4.191 2.032)
(stroke (width 0.254) (type solid)) (layer "F.Cu") (tstamp 96781640-c07e-4eea-a372-067ded96b703))
(fp_line (start 2.921 -2.921) (end 4.191 -1.651)
(stroke (width 0.254) (type solid)) (layer "F.Cu") (tstamp 6d7ff8c0-8a2a-4636-844f-c7210ff3e6f2))
(fp_line (start 4.191 2.032) (end 4.191 -1.651)
(stroke (width 0.254) (type solid)) (layer "F.Cu") (tstamp f284b1e2-75a4-4a3f-a5f4-6f05f15fb4f5))
)

View File

@ -0,0 +1,23 @@
(footprint "WIDTHS" (version 20220131) (generator pcbnew)
(layer "F.Cu")
(tedit 0)
(descr "A few different track widths")
(fp_text reference "REF**" (at 0 0) (layer "F.SilkS")
(effects (font (size 1.27 1.27) (thickness 0.15)))
(tstamp c14872e9-a94b-4975-8e29-9f8e477e2679)
)
(fp_text value "WIDTHS" (at 0 0) (layer "F.SilkS")
(effects (font (size 1.27 1.27) (thickness 0.15)))
(tstamp e5c3c323-3462-4dd1-b98c-36f997c5b6c0)
)
(fp_line (start -2 3) (end -2 -2)
(stroke (width 0.2) (type solid)) (layer "F.Cu") (tstamp eabde296-8108-4f58-988b-0a8aad10b025))
(fp_line (start -1 3) (end -1 -2)
(stroke (width 0.4) (type solid)) (layer "F.Cu") (tstamp 83058c9b-309f-4f4d-b8e7-c7c6ed97bc4b))
(fp_line (start 0 3) (end 0 -2)
(stroke (width 0.6) (type solid)) (layer "F.Cu") (tstamp 6f8256e6-5dfc-4cdc-9d77-818253414951))
(fp_line (start 1 3) (end 1 -2)
(stroke (width 0.85) (type solid)) (layer "F.Cu") (tstamp ac5eb4a7-a387-48d6-b4f5-8a76d938534b))
(fp_line (start 2 3) (end 2 -2)
(stroke (width 1) (type solid)) (layer "F.Cu") (tstamp fa95aa83-2b8d-4500-b597-eb1e65e745bd))
)

View File

@ -49,6 +49,7 @@ set( QA_PCBNEW_SRCS
drc/test_solder_mask_bridging.cpp
plugins/altium/test_altium_rule_transformer.cpp
plugins/altium/test_altium_pcblib_import.cpp
group_saveload.cpp
)

View File

@ -0,0 +1,208 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 KiCad Developers, see AUTHORS.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file test_altium_pcblib_import.cpp
* Test suite for import of *.PcbLib libraries
*/
#include <board_test_utils.h>
#include <pcbnew_utils/board_file_utils.h>
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <pcbnew/plugins/altium/altium_designer_plugin.h>
#include <pcbnew/plugins/kicad/pcb_plugin.h>
#include <footprint.h>
#include <fp_shape.h>
#include <fp_text.h>
#include <pad.h>
#include <zone.h>
#define CHECK_ENUM_CLASS_EQUAL( L, R ) \
BOOST_CHECK_EQUAL( static_cast<int>( L ), static_cast<int>( R ) )
struct ALTIUM_PCBLIB_IMPORT_FIXTURE
{
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.
*/
BOOST_FIXTURE_TEST_SUITE( AltiumPcbLibImport, ALTIUM_PCBLIB_IMPORT_FIXTURE )
/**
* Compare all footprints declared in a *.PcbLib file with their KiCad reference footprint
*/
BOOST_AUTO_TEST_CASE( AltiumPcbLibImport )
{
std::vector<std::pair<wxString, wxString>> tests = { { "TracksTest.PcbLib",
"TracksTest.pretty" } };
std::string dataPath = KI_TEST::GetPcbnewTestDataDir() + "plugins/altium/pcblib/";
for( const std::pair<wxString, wxString>& libName : tests )
{
wxString altiumLibraryPath = dataPath + libName.first;
wxString kicadLibraryPath = dataPath + libName.second;
wxArrayString altiumFootprintNames;
altiumPlugin.FootprintEnumerate( altiumFootprintNames, altiumLibraryPath, true, nullptr );
wxArrayString kicadFootprintNames;
kicadPlugin.FootprintEnumerate( kicadFootprintNames, kicadLibraryPath, true, nullptr );
BOOST_CHECK_EQUAL( altiumFootprintNames.GetCount(), kicadFootprintNames.GetCount() );
for( size_t i = 0; i < altiumFootprintNames.GetCount(); i++ )
{
wxString footprintName = altiumFootprintNames[i];
BOOST_TEST_CONTEXT( wxString::Format( wxT( "Import '%s' from '%s'" ), footprintName,
libName.first ) )
{
FOOTPRINT* altiumFp = altiumPlugin.FootprintLoad( altiumLibraryPath, footprintName,
false, nullptr );
BOOST_CHECK( altiumFp );
BOOST_CHECK_EQUAL( wxT( "REF**" ), altiumFp->GetReference() );
BOOST_CHECK_EQUAL( footprintName, altiumFp->GetValue() );
FOOTPRINT* kicadFp = kicadPlugin.FootprintLoad( kicadLibraryPath, footprintName,
false, nullptr );
BOOST_CHECK( kicadFp );
CompareFootprints( altiumFp, kicadFp );
}
}
}
}
BOOST_AUTO_TEST_SUITE_END()