Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
238 changes: 238 additions & 0 deletions tests/assets/C2879853.raweasy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
{
"uuid": "12f9c3ae62fd4c20a63ae72e6dbcb7d6",
"title": "SPH0641LU4H-1",
"description": "",
"docType": 2,
"type": 3,
"thumb": "//image.lceda.cn/components/12f9c3ae62fd4c20a63ae72e6dbcb7d6.png",
"lcsc": {
"id": 3089079,
"number": "C2879853"
},
"szlcsc": {
"id": 3089079,
"number": "C2879853"
},
"owner": {
"uuid": "0819f05c4eef4c71ace90d822a990e87",
"username": "LCSC",
"nickname": "LCSC",
"avatar": "//image.lceda.cn/avatars/2018/6/kFlrasi7W06gTdBLAqW3fkrqbDhbowynuSzkjqso.png"
},
"tags": [],
"updateTime": 1737077403,
"updated_at": "2025-01-17 01:30:19",
"dataStr": {
"head": {
"docType": "2",
"editorVersion": "6.4.20.6",
"x": 400,
"y": 300,
"c_para": {
"pre": "U?",
"name": "SPH0641LU4H-1",
"package": "MIC-SMD_5P_L3.5-W2.7-P0.82_SPH0641LU4H-1",
"Contributor": "LCSC",
"Supplier": "LCSC",
"Supplier Part": "C2879853",
"Manufacturer": "Knowles(楼氏)",
"Manufacturer Part": "SPH0641LU4H-1",
"JLCPCB Part Class": "Extended Part"
},
"uuid": "12f9c3ae62fd4c20a63ae72e6dbcb7d6",
"puuid": "419905241866469e87daa1a7a126691e",
"importFlag": 0,
"c_spiceCmd": null,
"hasIdFlag": true,
"utime": 1628494544
},
"canvas": "CA~1000~1000~#FFFFFF~yes~#CCCCCC~5~1000~1000~line~5~pixel~5~400~300",
"shape": [
"R~355~280~2~2~90~40~#880000~1~0~none~gge1~0~",
"E~360~285~1.5~1.5~#880000~1~0~#880000~gge2~0",
"P~show~0~1~345~290~180~gge5~0^^345~290^^M345,290h10~#880000^^1~358.7~294~0~DATA~start~~~#0000FF^^1~354.5~289~0~1~end~~~#0000FF^^0~352~290^^0~M 355 293 L 358 290 L 355 287",
"P~show~0~2~345~300~180~gge6~0^^345~300^^M345,300h10~#880000^^1~358.7~304~0~SELECT~start~~~#0000FF^^1~354.5~299~0~2~end~~~#0000FF^^0~352~300^^0~M 355 303 L 358 300 L 355 297",
"P~show~0~3~345~310~180~gge7~0^^345~310^^M345,310h10~#880000^^1~358.7~314~0~GROUND~start~~~#0000FF^^1~354.5~309~0~3~end~~~#0000FF^^0~352~310^^0~M 355 313 L 358 310 L 355 307",
"P~show~0~4~455~305~0~gge8~0^^455~305^^M455,305h-10~#880000^^1~441.3~309~0~CLOCK~end~~~#0000FF^^1~445.5~304~0~4~start~~~#0000FF^^0~448~305^^0~M 445 302 L 442 305 L 445 308",
"P~show~0~5~455~295~0~gge9~0^^455~295^^M455,295h-10~#FF0000^^1~441.3~299~0~VDD~end~~~#FF0000^^1~445.5~294~0~5~start~~~#FF0000^^0~448~295^^0~M 445 292 L 442 295 L 445 298"
],
"BBox": {
"x": 344,
"y": 279.6,
"width": 112,
"height": 40.4
},
"colors": []
},
"verify": true,
"datastrid": "c216b9bce5434bad8c33e3a41457953c",
"SMT": true,
"jlcOnSale": 1,
"writable": false,
"isFavorite": false,
"packageDetail": {
"uuid": "419905241866469e87daa1a7a126691e",
"title": "MIC-SMD_5P_L3.5-W2.7-P0.82_SPH0641LU4H-1",
"docType": 4,
"updateTime": 1703729109,
"owner": {
"uuid": "0819f05c4eef4c71ace90d822a990e87",
"username": "lcsc",
"nickname": "LCSC",
"avatar": "//image.lceda.cn/avatars/2018/6/kFlrasi7W06gTdBLAqW3fkrqbDhbowynuSzkjqso.png"
},
"datastrid": "b45be9c75f9b472ba8274c0d00451510",
"writable": false,
"dataStr": {
"head": {
"docType": "4",
"editorVersion": "6.5.39",
"newgId": true,
"c_para": {
"package": "MIC-SMD_5P_L3.5-W2.7-P0.82_SPH0641LU4H-1",
"pre": "U?",
"Contributor": "lcsc",
"link": "https://img.jlc.com//pdf/applyPasteComponent/2021-08-07/257629D/ebb1ae7e034c4583a94c3252fc2f619e/sph0641lu4h-1-revb.pdf",
"3DModel": "MIC-SMD_5P_L3.5-W2.7-P0.82_SPH0641LU4H-1"
},
"x": 3995.352,
"y": 2968.023,
"hasIdFlag": true,
"utime": 1703729109,
"uuid": "419905241866469e87daa1a7a126691e",
"importFlag": 0,
"transformList": "",
"uuid_3d": "085574939dfb440599fd212240983b9c"
},
"canvas": "CA~1000~1000~#000000~yes~#FFFFFF~0.3937~1000~1000~line~0.03937~mm~0.3937~ARC~visible~0.5~3995.352~2968.023~0~none",
"shape": [
"CIRCLE~3990.136~2961.544~0.118~0.2362~101~gge484~0~~",
"CIRCLE~3991.887~2960.835~0.492~0.9843~12~gge229~0~~",
"CIRCLE~3995.352~2971.229~0.276~0.5512~12~gge329~0~~",
"SOLIDREGION~100~~M 3997.2242 2962.04 L 4000.0786 2962.04 L 4000.0786 2964.0872 L 3997.2242 2964.0872 Z ~solid~gge225~~~~0",
"SOLIDREGION~100~~M 3997.2242 2965.2763 L 4000.0786 2965.2763 L 4000.0786 2967.3235 L 3997.2242 2967.3235 Z ~solid~gge226~~~~0",
"SOLIDREGION~100~~M 3990.6258 2965.2764 L 3993.4802 2965.2764 L 3993.4802 2967.3236 L 3990.6258 2967.3236 Z ~solid~gge227~~~~0",
"SOLIDREGION~100~~M 3990.6258 2962.0401 L 3993.4802 2962.0401 L 3993.4802 2964.0873 L 3990.6258 2964.0873 Z ~solid~gge228~~~~0",
"SOLIDREGION~100~~M 3994.9557 2968.0533 L 3994.9551 2968.0533 A 3.1988 3.1988 0 0 0 3992.1818 2970.7932 L 3993.37 2970.7932 A 0.0493 0.0493 0 0 1 3993.4192 2970.7923 A 2.0177 2.0177 0 0 1 3994.9551 2969.2959 Z ~solid~gge456~~~~0",
"SOLIDREGION~100~~M 3992.1763 2971.6253 L 3992.1763 2971.6259 A 3.1988 3.1988 0 0 0 3994.9162 2974.3992 L 3994.9162 2973.211 A 0.0493 0.0493 0 0 1 3994.9153 2973.1618 A 2.0177 2.0177 0 0 1 3993.4189 2971.6259 Z~solid~gge462~~~~0",
"SOLIDREGION~100~~M 3998.5276 2970.8327 L 3998.5276 2970.8321 A 3.1988 3.1988 0 0 0 3995.7877 2968.0588 L 3995.7877 2969.247 A 0.0493 0.0493 0 0 1 3995.7886 2969.2962 A 2.0177 2.0177 0 0 1 3997.285 2970.8321 Z~solid~gge474~~~~0",
"SOLIDREGION~100~~M 3995.748 2974.4047 L 3995.7486 2974.4047 A 3.1988 3.1988 0 0 0 3998.5219 2971.6648 L 3997.3337 2971.6648 A 0.0493 0.0493 0 0 1 3997.2845 2971.6657 A 2.0177 2.0177 0 0 1 3995.7486 2973.1621 Z~solid~gge480~~~~0",
"SOLIDREGION~99~~M 3990.1357 2975.3234 L 4000.5687 2975.3234 L 4000.5687 2961.5442 L 3990.1357 2961.5442 Z ~solid~gge223~~~~0",
"TRACK~0.5906~3~~3990.0995 2961.5443 3989.8405 2961.5443 3989.8405 2962.9615~gge237~0",
"TRACK~0.5906~3~~3996.6977 2961.5443 3994.0065 2961.5443~gge236~0",
"TRACK~0.5906~3~~4000.8639 2961.5443 4000.6051 2961.5443~gge235~0",
"TRACK~0.5906~3~~3993.6398 2975.3233 3989.8405 2975.3233 3989.8405 2973.9063~gge234~0",
"TRACK~0.5906~3~~4000.8639 2975.3233 3997.0636 2975.3233~gge233~0",
"TRACK~0.5906~3~~4000.8639 2968.4337 4000.8639 2961.5443~gge232~0",
"TRACK~0.5906~3~~4000.8639 2968.4337 4000.8639 2975.3233~gge231~0",
"TRACK~0.5906~3~~3989.8405 2962.9615 3989.8405 2973.9063~gge230~0",
"CIRCLE~3991.887~2960.284~0.591~1.1811~3~gge222~0~~",
"PAD~RECT~3998.651~2963.064~2.874~2.0866~1~~5~0~3997.2144 2962.0203 4000.0884 2962.0203 4000.0884 2964.1069 3997.2144 2964.1069~0~gge218~0~~Y~0~0~0.1969~3998.6514,2963.0636",
"PAD~RECT~3998.651~2966.3~2.874~2.0866~1~~4~0~3997.2144 2965.2566 4000.0884 2965.2566 4000.0884 2967.3432 3997.2144 2967.3432~0~gge219~0~~Y~0~0~0.1969~3998.6514,2966.2999",
"PAD~RECT~3992.053~2966.3~2.874~2.0866~1~~2~0~3990.616 2965.2567 3993.49 2965.2567 3993.49 2967.3433 3990.616 2967.3433~0~gge220~0~~Y~0~0~0.1969~3992.053,2966.3",
"PAD~RECT~3992.053~2963.064~2.874~2.0866~1~~1~0~3990.616 2962.0204 3993.49 2962.0204 3993.49 2964.107 3990.616 2964.107~0~gge221~0~~Y~0~0~0.1969~3992.053,2963.0637",
"PAD~POLYGON~3997.158~2969.514~2.74~2.7739~1~~3~0~3998.528 2970.832 3998.528 2970.8314 3998.504 2970.672 3998.472 2970.514 3998.4321 2970.3577 3998.3844 2970.2038 3998.329 2970.0524 3998.266 2969.9039 3998.1956 2969.7589 3998.118 2969.6176 3998.0334 2969.4803 3997.942 2969.3475 3997.844 2969.2195 3997.7397 2969.0966 3997.6293 2968.9791 3997.5131 2968.8673 3997.3915 2968.7615 3997.2647 2968.662 3997.133 2968.569 3996.9968 2968.4827 3996.8564 2968.4034 3996.7122 2968.3313 3996.5646 2968.2665 3996.4139 2968.2093 3996.2605 2968.1597 3996.1047 2968.1179 3995.9471 2968.084 3995.788 2968.0581 3995.788 2969.2463 3995.7951 2969.2708 3995.789 2969.2956 3995.9171 2969.3312 3996.0426 2969.3752 3996.1649 2969.4273 3996.2835 2969.4874 3996.3979 2969.5552 3996.5076 2969.6303 3996.6121 2969.7125 3996.7109 2969.8014 3996.8037 2969.8966 3996.89 2969.9978 3996.9695 2970.1044 3997.0418 2970.216 3997.1065 2970.3321 3997.1635 2970.4522 3997.2124 2970.5758 3997.2531 2970.7024 3997.2854 2970.8314~0~gge444~0~~Y~0~0~0.19685~3997.1581,2969.5137",
"PAD~POLYGON~3997.136~2972.982~2.7739~2.74~1~~3~0~3995.7489 2974.405 3995.7495 2974.405 3995.9089 2974.381 3996.0669 2974.349 3996.2232 2974.3091 3996.3771 2974.2614 3996.5285 2974.206 3996.677 2974.143 3996.822 2974.0726 3996.9633 2973.995 3997.1006 2973.9104 3997.2334 2973.819 3997.3614 2973.721 3997.4843 2973.6167 3997.6018 2973.5063 3997.7136 2973.3901 3997.8194 2973.2685 3997.9189 2973.1417 3998.0119 2973.01 3998.0982 2972.8738 3998.1775 2972.7334 3998.2496 2972.5892 3998.3144 2972.4416 3998.3716 2972.2909 3998.4212 2972.1375 3998.463 2971.9817 3998.4969 2971.8241 3998.5228 2971.665 3997.3346 2971.665 3997.3101 2971.6721 3997.2853 2971.666 3997.2497 2971.7941 3997.2057 2971.9196 3997.1536 2972.0419 3997.0935 2972.1605 3997.0257 2972.2749 3996.9506 2972.3846 3996.8684 2972.4891 3996.7795 2972.5879 3996.6843 2972.6807 3996.5831 2972.767 3996.4765 2972.8465 3996.3649 2972.9188 3996.2488 2972.9835 3996.1287 2973.0405 3996.0051 2973.0894 3995.8785 2973.1301 3995.7495 2973.1624~0~gge447~0~~Y~0~0~0.19685~3997.1357,2972.9817",
"PAD~POLYGON~3993.546~2972.944~2.74~2.7737~1~~3~0~3992.176 2971.6259 3992.176 2971.6263 3992.2 2971.7857 3992.232 2971.9438 3992.2718 2972.1 3992.3196 2972.254 3992.375 2972.4054 3992.438 2972.5538 3992.5083 2972.6988 3992.5859 2972.8402 3992.6705 2972.9774 3992.762 2973.1102 3992.86 2973.2382 3992.9643 2973.3611 3993.0747 2973.4787 3993.1908 2973.5905 3993.3125 2973.6963 3993.4393 2973.7958 3993.571 2973.8888 3993.7072 2973.9751 3993.8476 2974.0544 3993.9918 2974.1265 3994.1394 2974.1913 3994.2901 2974.2485 3994.4435 2974.2981 3994.5992 2974.3399 3994.7569 2974.3738 3994.916 2974.3997 3994.916 2973.2115 3994.9089 2973.1869 3994.915 2973.1621 3994.7869 2973.1265 3994.6614 2973.0825 3994.5391 2973.0304 3994.4205 2972.9703 3994.3061 2972.9025 3994.1964 2972.8274 3994.0919 2972.7452 3993.9931 2972.6563 3993.9003 2972.5611 3993.814 2972.4599 3993.7345 2972.3533 3993.6622 2972.2417 3993.5975 2972.1256 3993.5405 2972.0055 3993.4916 2971.8819 3993.4509 2971.7553 3993.4186 2971.6263~0~gge450~0~~Y~0~0~0.19685~3993.546,2972.9441",
"PAD~POLYGON~3993.568~2969.476~2.7739~2.74~1~~3~0~3994.955 2968.053 3994.9544 2968.053 3994.7949 2968.077 3994.6369 2968.109 3994.4807 2968.1489 3994.3267 2968.1966 3994.1753 2968.252 3994.0269 2968.315 3993.8819 2968.3854 3993.7406 2968.463 3993.6033 2968.5476 3993.4705 2968.639 3993.3425 2968.737 3993.2196 2968.8413 3993.1021 2968.9517 3992.9903 2969.0679 3992.8845 2969.1895 3992.785 2969.3163 3992.6919 2969.448 3992.6057 2969.5842 3992.5264 2969.7246 3992.4543 2969.8688 3992.3895 2970.0164 3992.3323 2970.1671 3992.2827 2970.3205 3992.2409 2970.4763 3992.207 2970.6339 3992.1811 2970.793 3993.3693 2970.793 3993.3938 2970.7859 3993.4186 2970.792 3993.4542 2970.6639 3993.4982 2970.5384 3993.5503 2970.4161 3993.6104 2970.2975 3993.6781 2970.1831 3993.7533 2970.0734 3993.8355 2969.9689 3993.9244 2969.8701 3994.0196 2969.7773 3994.1208 2969.691 3994.2274 2969.6115 3994.339 2969.5393 3994.4551 2969.4745 3994.5752 2969.4175 3994.6988 2969.3686 3994.8254 2969.3279 3994.9544 2969.2956~0~gge453~0~~Y~0~0~0.19685~3993.5681,2969.4764",
"HOLE~3995.352~2971.229~0.9843~gge215~0",
"SVGNODE~{\"gId\":\"g1_outline\",\"nodeName\":\"g\",\"nodeType\":1,\"layerid\":\"19\",\"attrs\":{\"c_width\":\"10.43305\",\"c_height\":\"13.7795\",\"c_rotation\":\"0,0,0\",\"z\":\"0\",\"c_origin\":\"3995.352,2968.4167\",\"uuid\":\"587ef2d4cd9c42aca9875a2e1e64e486\",\"c_etype\":\"outline3D\",\"id\":\"g1_outline\",\"title\":\"MIC-SMD_5P_L3.5-W2.7-P0.82_SPH0641LU4H-1\",\"layerid\":\"19\",\"transform\":\"scale(1) translate(0, 0)\"},\"childNodes\":[{\"gId\":\"g1_outline_line0\",\"nodeName\":\"polyline\",\"nodeType\":1,\"attrs\":{\"fill\":\"none\",\"id\":\"g1_outline_line0\",\"c_shapetype\":\"line\",\"points\":\"3990.1355 2961.527 3990.1355 2964.6766 3990.1355 2975.3065 3995.3323 2975.3065 4000.5685 2975.3065 4000.5685 2964.6766 4000.5685 2961.527 3995.3323 2961.527 3990.1355 2961.527 3990.1355 2961.527\"}}]}"
],
"layers": [
"1~TopLayer~#FF0000~true~false~true~",
"2~BottomLayer~#0000FF~true~false~true~",
"3~TopSilkLayer~#FFCC00~true~false~true~",
"4~BottomSilkLayer~#66CC33~true~false~true~",
"5~TopPasteMaskLayer~#808080~true~true~true~",
"6~BottomPasteMaskLayer~#800000~true~false~true~",
"7~TopSolderMaskLayer~#800080~true~false~true~0.3",
"8~BottomSolderMaskLayer~#AA00FF~true~false~true~0.3",
"9~Ratlines~#6464FF~true~false~true~",
"10~BoardOutLine~#FF00FF~true~false~true~",
"11~Multi-Layer~#C0C0C0~true~false~true~",
"12~Document~#FFFFFF~true~false~true~",
"13~TopAssembly~#33CC99~true~false~true~",
"14~BottomAssembly~#5555FF~true~false~true~",
"15~Mechanical~#F022F0~true~false~true~",
"19~3DModel~#66CCFF~true~false~true~",
"21~Inner1~#999966~false~false~false~~",
"22~Inner2~#008000~false~false~false~~",
"23~Inner3~#00FF00~false~false~false~~",
"24~Inner4~#BC8E00~false~false~false~~",
"25~Inner5~#70DBFA~false~false~false~~",
"26~Inner6~#00CC66~false~false~false~~",
"27~Inner7~#9966FF~false~false~false~~",
"28~Inner8~#800080~false~false~false~~",
"29~Inner9~#008080~false~false~false~~",
"30~Inner10~#15935F~false~false~false~~",
"31~Inner11~#000080~false~false~false~~",
"32~Inner12~#00B400~false~false~false~~",
"33~Inner13~#2E4756~false~false~false~~",
"34~Inner14~#99842F~false~false~false~~",
"35~Inner15~#FFFFAA~false~false~false~~",
"36~Inner16~#99842F~false~false~false~~",
"37~Inner17~#2E4756~false~false~false~~",
"38~Inner18~#3535FF~false~false~false~~",
"39~Inner19~#8000BC~false~false~false~~",
"40~Inner20~#43AE5F~false~false~false~~",
"41~Inner21~#C3ECCE~false~false~false~~",
"42~Inner22~#728978~false~false~false~~",
"43~Inner23~#39503F~false~false~false~~",
"44~Inner24~#0C715D~false~false~false~~",
"45~Inner25~#5A8A80~false~false~false~~",
"46~Inner26~#2B937E~false~false~false~~",
"47~Inner27~#23999D~false~false~false~~",
"48~Inner28~#45B4E3~false~false~false~~",
"49~Inner29~#215DA1~false~false~false~~",
"50~Inner30~#4564D7~false~false~false~~",
"51~Inner31~#6969E9~false~false~false~~",
"52~Inner32~#9069E9~false~false~false~~",
"99~ComponentShapeLayer~#00CCCC~true~false~true~0.4",
"100~LeadShapeLayer~#CC9999~true~false~true~",
"101~ComponentMarkingLayer~#66FFCC~true~false~true~",
"Hole~Hole~#222222~false~false~true~",
"DRCError~DRCError~#FAD609~false~false~true~"
],
"objects": [
"All~true~false",
"Component~true~true",
"Prefix~true~true",
"Name~true~false",
"Track~true~true",
"Pad~true~true",
"Via~true~true",
"Hole~true~true",
"Copper_Area~true~true",
"Circle~true~true",
"Arc~true~true",
"Solid_Region~true~true",
"Text~true~true",
"Image~true~true",
"Rect~true~true",
"Dimension~true~true",
"Protractor~true~true"
],
"BBox": {
"x": 3989.8,
"y": 2959.7,
"width": 11,
"height": 15.6
},
"netColors": []
}
},
"_objMetadata": {
"bounds": {
"min": {
"x": -1.325,
"y": -1.75,
"z": -0.001
},
"max": {
"x": 1.325,
"y": 1.75,
"z": 0.99
}
}
}
}
21 changes: 21 additions & 0 deletions tests/convert-to-soup-tests/c2879853-polygon-pads.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import c2879853 from "tests/assets/C2879853.raweasy.json"
import { expect, test } from "bun:test"
import { convertEasyEdaJsonToCircuitJson, EasyEdaJsonSchema } from "lib/index"

test("C2879853 should parse successfully with POLYGON pad shapes", async () => {
// This test validates that POLYGON pad shapes are handled correctly
// Previously failed with: Invalid enum value. Expected 'RECT' | 'ELLIPSE' | 'OVAL', received 'POLYGON'
// See: https://github.com/tscircuit/easyeda-converter/issues/240
const bettereasy = EasyEdaJsonSchema.parse(c2879853)
expect(bettereasy).toBeDefined()

const circuitJson = convertEasyEdaJsonToCircuitJson(bettereasy)
expect(circuitJson).toBeDefined()
expect(circuitJson.length).toBeGreaterThan(0)

// Confirm polygon pads are present in the output
const polygonPads = circuitJson.filter(
(el: any) => el.type === "pcb_smtpad" && el.shape === "polygon",
)
expect(polygonPads.length).toBeGreaterThan(0)
})
Loading