From 744510a3c6c7da214a894b6b605da79b143e630b Mon Sep 17 00:00:00 2001 From: Kevin Martin Date: Thu, 30 Oct 2025 12:15:48 -0400 Subject: [PATCH 1/5] Enable Python Draft import tests A failing test was added to Draft tests to ensure CI catches it --- src/Mod/Draft/TestDraft.py | 5 +++-- src/Mod/Draft/drafttests/test_dxf.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Mod/Draft/TestDraft.py b/src/Mod/Draft/TestDraft.py index 61b6c33ba4..4476af4676 100644 --- a/src/Mod/Draft/TestDraft.py +++ b/src/Mod/Draft/TestDraft.py @@ -106,7 +106,8 @@ from drafttests.test_draftgeomutils import TestDraftGeomUtils as DraftTest04 # Handling of file formats tests # from drafttests.test_svg import DraftSVG as DraftTest05 -# from drafttests.test_dxf import DraftDXF as DraftTest06 +from drafttests.test_dxf import DraftDXF as DraftTest06 + # from drafttests.test_dwg import DraftDWG as DraftTest07 # from drafttests.test_oca import DraftOCA as DraftTest08 # from drafttests.test_airfoildat import DraftAirfoilDAT as DraftTest09 @@ -118,7 +119,7 @@ True if DraftTest02 else False True if DraftTest03 else False True if DraftTest04 else False # True if DraftTest05 else False -# True if DraftTest06 else False +True if DraftTest06 else False # True if DraftTest07 else False # True if DraftTest08 else False # True if DraftTest09 else False diff --git a/src/Mod/Draft/drafttests/test_dxf.py b/src/Mod/Draft/drafttests/test_dxf.py index cdf70f1565..c19b007d26 100644 --- a/src/Mod/Draft/drafttests/test_dxf.py +++ b/src/Mod/Draft/drafttests/test_dxf.py @@ -56,7 +56,7 @@ class DraftDXF(test_base.DraftTestCaseDoc): _msg(" exists={}".format(os.path.exists(in_file))) obj = aux.fake_function(in_file) - self.assertTrue(obj, "'{}' failed".format(operation)) + self.assertFalse(obj, "'{}' failed".format(operation)) def test_export_dxf(self): """Create some figures and export them to a DXF file.""" From 3380e6ac27c40a914493622c6fb1a219428f317f Mon Sep 17 00:00:00 2001 From: Kevin Martin Date: Fri, 31 Oct 2025 09:38:40 -0400 Subject: [PATCH 2/5] Add the sample input file --- src/Mod/Draft/CMakeLists.txt | 1 + src/Mod/Draft/drafttests/Issue24314.dxf | 2310 +++++++++++++++++++++++ src/Mod/Draft/drafttests/test_dxf.py | 8 +- 3 files changed, 2315 insertions(+), 4 deletions(-) create mode 100644 src/Mod/Draft/drafttests/Issue24314.dxf diff --git a/src/Mod/Draft/CMakeLists.txt b/src/Mod/Draft/CMakeLists.txt index f985c4350c..e1f459adf9 100644 --- a/src/Mod/Draft/CMakeLists.txt +++ b/src/Mod/Draft/CMakeLists.txt @@ -67,6 +67,7 @@ SET(Draft_tests drafttests/test_pivy.py drafttests/test_svg.py drafttests/README.md + drafttests/Issue24314.dxf ) SET(Draft_utilities diff --git a/src/Mod/Draft/drafttests/Issue24314.dxf b/src/Mod/Draft/drafttests/Issue24314.dxf new file mode 100644 index 0000000000..3f8079027b --- /dev/null +++ b/src/Mod/Draft/drafttests/Issue24314.dxf @@ -0,0 +1,2310 @@ + 0 +SECTION + 2 +HEADER + 9 +$ACADVER + 1 +AC1012 + 9 +$DWGCODEPAGE + 3 +ansi_1252 + 9 +$INSBASE + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$EXTMIN + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$EXTMAX + 10 +1.0 + 20 +0.0 + 30 +0.0 + 9 +$LIMMIN + 10 +0.0 + 20 +0.0 + 9 +$LIMMAX + 10 +420.0 + 20 +297.0 + 9 +$ORTHOMODE + 70 + 0 + 9 +$REGENMODE + 70 + 1 + 9 +$FILLMODE + 70 + 1 + 9 +$QTEXTMODE + 70 + 0 + 9 +$MIRRTEXT + 70 + 1 + 9 +$DRAGMODE + 70 + 2 + 9 +$LTSCALE + 40 +1.0 + 9 +$OSMODE + 70 + 0 + 9 +$ATTMODE + 70 + 1 + 9 +$TEXTSIZE + 40 +2.5 + 9 +$TRACEWID + 40 +1.0 + 9 +$TEXTSTYLE + 7 +STANDARD + 9 +$CLAYER + 8 +0 + 9 +$CELTYPE + 6 +BYLAYER + 9 +$CECOLOR + 62 + 256 + 9 +$CELTSCALE + 40 +1.0 + 9 +$DELOBJ + 70 + 1 + 9 +$DISPSILH + 70 + 0 + 9 +$DIMSCALE + 40 +1.0 + 9 +$DIMASZ + 40 +2.5 + 9 +$DIMEXO + 40 +0.625 + 9 +$DIMDLI + 40 +3.75 + 9 +$DIMRND + 40 +0.0 + 9 +$DIMDLE + 40 +0.0 + 9 +$DIMEXE + 40 +1.25 + 9 +$DIMTP + 40 +0.0 + 9 +$DIMTM + 40 +0.0 + 9 +$DIMTXT + 40 +2.5 + 9 +$DIMCEN + 40 +2.5 + 9 +$DIMTSZ + 40 +0.0 + 9 +$DIMTOL + 70 + 0 + 9 +$DIMLIM + 70 + 0 + 9 +$DIMTIH + 70 + 1 + 9 +$DIMTOH + 70 + 0 + 9 +$DIMSE1 + 70 + 0 + 9 +$DIMSE2 + 70 + 0 + 9 +$DIMTAD + 70 + 1 + 9 +$DIMZIN + 70 + 8 + 9 +$DIMBLK + 1 + + 9 +$DIMASO + 70 + 1 + 9 +$DIMSHO + 70 + 1 + 9 +$DIMPOST + 1 + + 9 +$DIMAPOST + 1 + + 9 +$DIMALT + 70 + 0 + 9 +$DIMALTD + 70 + 2 + 9 +$DIMALTF + 40 +0.0394 + 9 +$DIMLFAC + 40 +1.0 + 9 +$DIMTOFL + 70 + 1 + 9 +$DIMTVP + 40 +1.0 + 9 +$DIMTIX + 70 + 0 + 9 +$DIMSOXD + 70 + 0 + 9 +$DIMSAH + 70 + 0 + 9 +$DIMBLK1 + 1 + + 9 +$DIMBLK2 + 1 + + 9 +$DIMSTYLE + 2 +ISO-25 + 9 +$DIMCLRD + 70 + 0 + 9 +$DIMCLRE + 70 + 0 + 9 +$DIMCLRT + 70 + 0 + 9 +$DIMTFAC + 40 +1.0 + 9 +$DIMGAP + 40 +0.625 + 9 +$DIMJUST + 70 + 0 + 9 +$DIMSD1 + 70 + 0 + 9 +$DIMSD2 + 70 + 0 + 9 +$DIMTOLJ + 70 + 1 + 9 +$DIMTZIN + 70 + 0 + 9 +$DIMALTZ + 70 + 0 + 9 +$DIMALTTZ + 70 + 0 + 9 +$DIMFIT + 70 + 3 + 9 +$DIMUPT + 70 + 0 + 9 +$DIMUNIT + 70 + 2 + 9 +$DIMDEC + 70 + 4 + 9 +$DIMTDEC + 70 + 4 + 9 +$DIMALTU + 70 + 2 + 9 +$DIMALTTD + 70 + 2 + 9 +$DIMTXSTY + 7 +STANDARD + 9 +$DIMAUNIT + 70 + 0 + 9 +$LUNITS + 70 + 2 + 9 +$LUPREC + 70 + 4 + 9 +$SKETCHINC + 40 +1.0 + 9 +$FILLETRAD + 40 +0.0 + 9 +$AUNITS + 70 + 0 + 9 +$AUPREC + 70 + 0 + 9 +$MENU + 1 +. + 9 +$ELEVATION + 40 +0.0 + 9 +$PELEVATION + 40 +0.0 + 9 +$THICKNESS + 40 +0.0 + 9 +$LIMCHECK + 70 + 0 + 9 +$BLIPMODE + 70 + 1 + 9 +$CHAMFERA + 40 +10.0 + 9 +$CHAMFERB + 40 +10.0 + 9 +$CHAMFERC + 40 +0.0 + 9 +$CHAMFERD + 40 +0.0 + 9 +$SKPOLY + 70 + 0 + 9 +$TDCREATE + 40 +2460755.400945150 + 9 +$TDUPDATE + 40 +2460755.402199340 + 9 +$TDINDWG + 40 +0.0012541898 + 9 +$TDUSRTIMER + 40 +0.0012541898 + 9 +$USRTIMER + 70 + 1 + 9 +$ANGBASE + 50 +0.0 + 9 +$ANGDIR + 70 + 0 + 9 +$PDMODE + 70 + 0 + 9 +$PDSIZE + 40 +0.0 + 9 +$PLINEWID + 40 +0.0 + 9 +$COORDS + 70 + 1 + 9 +$SPLFRAME + 70 + 0 + 9 +$SPLINETYPE + 70 + 6 + 9 +$SPLINESEGS + 70 + 8 + 9 +$ATTDIA + 70 + 0 + 9 +$ATTREQ + 70 + 1 + 9 +$HANDLING + 70 + 1 + 9 +$HANDSEED + 5 +31 + 9 +$SURFTAB1 + 70 + 6 + 9 +$SURFTAB2 + 70 + 6 + 9 +$SURFTYPE + 70 + 6 + 9 +$SURFU + 70 + 6 + 9 +$SURFV + 70 + 6 + 9 +$UCSNAME + 2 + + 9 +$UCSORG + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$UCSXDIR + 10 +1.0 + 20 +0.0 + 30 +0.0 + 9 +$UCSYDIR + 10 +0.0 + 20 +1.0 + 30 +0.0 + 9 +$PUCSNAME + 2 + + 9 +$PUCSORG + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$PUCSXDIR + 10 +1.0 + 20 +0.0 + 30 +0.0 + 9 +$PUCSYDIR + 10 +0.0 + 20 +1.0 + 30 +0.0 + 9 +$USERI1 + 70 + 0 + 9 +$USERI2 + 70 + 0 + 9 +$USERI3 + 70 + 0 + 9 +$USERI4 + 70 + 0 + 9 +$USERI5 + 70 + 0 + 9 +$USERR1 + 40 +0.0 + 9 +$USERR2 + 40 +0.0 + 9 +$USERR3 + 40 +0.0 + 9 +$USERR4 + 40 +0.0 + 9 +$USERR5 + 40 +0.0 + 9 +$WORLDVIEW + 70 + 1 + 9 +$SHADEDGE + 70 + 3 + 9 +$SHADEDIF + 70 + 70 + 9 +$TILEMODE + 70 + 1 + 9 +$MAXACTVP + 70 + 16 + 9 +$PINSBASE + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$PLIMCHECK + 70 + 0 + 9 +$PEXTMIN + 10 +1.000000E+20 + 20 +1.000000E+20 + 30 +1.000000E+20 + 9 +$PEXTMAX + 10 +-1.000000E+20 + 20 +-1.000000E+20 + 30 +-1.000000E+20 + 9 +$PLIMMIN + 10 +0.0 + 20 +0.0 + 9 +$PLIMMAX + 10 +420.0 + 20 +297.0 + 9 +$UNITMODE + 70 + 0 + 9 +$VISRETAIN + 70 + 0 + 9 +$PLINEGEN + 70 + 0 + 9 +$PSLTSCALE + 70 + 1 + 9 +$TREEDEPTH + 70 + 3020 + 9 +$PICKSTYLE + 70 + 1 + 9 +$CMLSTYLE + 2 +STANDARD + 9 +$CMLJUST + 70 + 0 + 9 +$CMLSCALE + 40 +1.0 + 9 +$SAVEIMAGES + 70 + 0 + 0 +ENDSEC + 0 +SECTION + 2 +CLASSES + 0 +ENDSEC + 0 +SECTION + 2 +TABLES + 0 +TABLE + 2 +VPORT + 5 +8 +100 +AcDbSymbolTable + 70 + 3 + 0 +VPORT + 5 +30 +100 +AcDbSymbolTableRecord +100 +AcDbViewportTableRecord + 2 +*ACTIVE + 70 + 0 + 10 +0.0 + 20 +0.0 + 11 +1.0 + 21 +1.0 + 12 +11.892094 + 22 +1.953472 + 13 +0.0 + 23 +0.0 + 14 +10.0 + 24 +10.0 + 15 +10.0 + 25 +10.0 + 16 +0.0 + 26 +0.0 + 36 +1.0 + 17 +0.0 + 27 +0.0 + 37 +0.0 + 40 +19.534714 + 41 +2.318293 + 42 +50.0 + 43 +0.0 + 44 +0.0 + 50 +0.0 + 51 +0.0 + 71 + 0 + 72 + 100 + 73 + 1 + 74 + 1 + 75 + 0 + 76 + 0 + 77 + 0 + 78 + 0 + 0 +ENDTAB + 0 +TABLE + 2 +LTYPE + 5 +5 +100 +AcDbSymbolTable + 70 + 1 + 0 +LTYPE + 5 +14 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord + 2 +BYBLOCK + 70 + 0 + 3 + + 72 + 65 + 73 + 0 + 40 +0.0 + 0 +LTYPE + 5 +15 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord + 2 +BYLAYER + 70 + 0 + 3 + + 72 + 65 + 73 + 0 + 40 +0.0 + 0 +LTYPE + 5 +16 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord + 2 +CONTINUOUS + 70 + 0 + 3 +Solid line + 72 + 65 + 73 + 0 + 40 +0.0 + 0 +ENDTAB + 0 +TABLE + 2 +LAYER + 5 +2 +100 +AcDbSymbolTable + 70 + 1 + 0 +LAYER + 5 +F +100 +AcDbSymbolTableRecord +100 +AcDbLayerTableRecord + 2 +0 + 70 + 0 + 62 + 7 + 6 +CONTINUOUS + 0 +ENDTAB + 0 +TABLE + 2 +STYLE + 5 +3 +100 +AcDbSymbolTable + 70 + 1 + 0 +STYLE + 5 +10 +100 +AcDbSymbolTableRecord +100 +AcDbTextStyleTableRecord + 2 +STANDARD + 70 + 64 + 40 +0.0 + 41 +1.0 + 50 +0.0 + 71 + 0 + 42 +2.5 + 3 +ISOCP + 4 + + 0 +ENDTAB + 0 +TABLE + 2 +VIEW + 5 +6 +100 +AcDbSymbolTable + 70 + 0 + 0 +ENDTAB + 0 +TABLE + 2 +UCS + 5 +7 +100 +AcDbSymbolTable + 70 + 0 + 0 +ENDTAB + 0 +TABLE + 2 +APPID + 5 +9 +100 +AcDbSymbolTable + 70 + 1 + 0 +APPID + 5 +11 +100 +AcDbSymbolTableRecord +100 +AcDbRegAppTableRecord + 2 +ACAD + 70 + 0 + 0 +ENDTAB + 0 +TABLE + 2 +DIMSTYLE + 5 +A +100 +AcDbSymbolTable + 70 + 8 + 0 +DIMSTYLE +105 +1D +100 +AcDbSymbolTableRecord +100 +AcDbDimStyleTableRecord + 2 +STANDARD + 70 + 0 + 3 + + 4 + + 5 + + 6 + + 7 + + 40 +1.0 + 41 +0.18 + 42 +0.0625 + 43 +0.38 + 44 +0.18 + 45 +0.0 + 46 +0.0 + 47 +0.0 + 48 +0.0 +140 +0.18 +141 +0.09 +142 +0.0 +143 +25.4 +144 +1.0 +145 +0.0 +146 +1.0 +147 +0.09 + 71 + 0 + 72 + 0 + 73 + 1 + 74 + 1 + 75 + 0 + 76 + 0 + 77 + 0 + 78 + 0 +170 + 0 +171 + 2 +172 + 0 +173 + 0 +174 + 0 +175 + 0 +176 + 0 +177 + 0 +178 + 0 +270 + 2 +271 + 4 +272 + 4 +273 + 2 +274 + 2 +340 +10 +275 + 0 +280 + 0 +281 + 0 +282 + 0 +283 + 1 +284 + 0 +285 + 0 +286 + 0 +287 + 3 +288 + 0 + 0 +DIMSTYLE +105 +24 +100 +AcDbSymbolTableRecord +100 +AcDbDimStyleTableRecord + 2 +ISO-25 + 70 + 0 + 3 + + 4 + + 5 + + 6 + + 7 + + 40 +1.0 + 41 +2.5 + 42 +0.625 + 43 +3.75 + 44 +1.25 + 45 +0.0 + 46 +0.0 + 47 +0.0 + 48 +0.0 +140 +2.5 +141 +2.5 +142 +0.0 +143 +0.0394 +144 +1.0 +145 +1.0 +146 +1.0 +147 +0.625 + 71 + 0 + 72 + 0 + 73 + 1 + 74 + 0 + 75 + 0 + 76 + 0 + 77 + 1 + 78 + 8 +170 + 0 +171 + 2 +172 + 1 +173 + 0 +174 + 0 +175 + 0 +176 + 0 +177 + 0 +178 + 0 +270 + 2 +271 + 4 +272 + 4 +273 + 2 +274 + 2 +340 +10 +275 + 0 +280 + 0 +281 + 0 +282 + 0 +283 + 1 +284 + 0 +285 + 0 +286 + 0 +287 + 3 +288 + 0 + 0 +DIMSTYLE +105 +25 +100 +AcDbSymbolTableRecord +100 +AcDbDimStyleTableRecord + 2 +ISO-35 + 70 + 0 + 3 + + 4 + + 5 + + 6 + + 7 + + 40 +1.0 + 41 +3.5 + 42 +0.875 + 43 +5.25 + 44 +1.75 + 45 +0.0 + 46 +0.0 + 47 +0.0 + 48 +0.0 +140 +3.5 +141 +3.5 +142 +0.0 +143 +0.0394 +144 +1.0 +145 +1.4 +146 +1.0 +147 +0.875 + 71 + 0 + 72 + 0 + 73 + 1 + 74 + 0 + 75 + 0 + 76 + 0 + 77 + 1 + 78 + 8 +170 + 0 +171 + 2 +172 + 1 +173 + 0 +174 + 0 +175 + 0 +176 + 0 +177 + 0 +178 + 0 +270 + 2 +271 + 4 +272 + 4 +273 + 2 +274 + 2 +340 +10 +275 + 0 +280 + 0 +281 + 0 +282 + 0 +283 + 1 +284 + 0 +285 + 0 +286 + 0 +287 + 3 +288 + 0 + 0 +DIMSTYLE +105 +26 +100 +AcDbSymbolTableRecord +100 +AcDbDimStyleTableRecord + 2 +ISO-5 + 70 + 0 + 3 + + 4 + + 5 + + 6 + + 7 + + 40 +1.0 + 41 +5.0 + 42 +1.25 + 43 +7.5 + 44 +2.5 + 45 +0.0 + 46 +0.0 + 47 +0.0 + 48 +0.0 +140 +5.0 +141 +5.0 +142 +0.0 +143 +0.0394 +144 +1.0 +145 +2.0 +146 +1.0 +147 +1.25 + 71 + 0 + 72 + 0 + 73 + 1 + 74 + 0 + 75 + 0 + 76 + 0 + 77 + 1 + 78 + 8 +170 + 0 +171 + 2 +172 + 1 +173 + 0 +174 + 0 +175 + 0 +176 + 0 +177 + 0 +178 + 0 +270 + 2 +271 + 4 +272 + 4 +273 + 2 +274 + 2 +340 +10 +275 + 0 +280 + 0 +281 + 0 +282 + 0 +283 + 1 +284 + 0 +285 + 0 +286 + 0 +287 + 3 +288 + 0 + 0 +DIMSTYLE +105 +27 +100 +AcDbSymbolTableRecord +100 +AcDbDimStyleTableRecord + 2 +ISO-7 + 70 + 0 + 3 + + 4 + + 5 + + 6 + + 7 + + 40 +1.0 + 41 +7.0 + 42 +1.75 + 43 +10.5 + 44 +3.5 + 45 +0.0 + 46 +0.0 + 47 +0.0 + 48 +0.0 +140 +7.0 +141 +7.0 +142 +0.0 +143 +0.0394 +144 +1.0 +145 +2.8 +146 +1.0 +147 +1.75 + 71 + 0 + 72 + 0 + 73 + 1 + 74 + 0 + 75 + 0 + 76 + 0 + 77 + 1 + 78 + 8 +170 + 0 +171 + 2 +172 + 1 +173 + 0 +174 + 0 +175 + 0 +176 + 0 +177 + 0 +178 + 0 +270 + 2 +271 + 4 +272 + 4 +273 + 2 +274 + 2 +340 +10 +275 + 0 +280 + 0 +281 + 0 +282 + 0 +283 + 1 +284 + 0 +285 + 0 +286 + 0 +287 + 3 +288 + 0 + 0 +DIMSTYLE +105 +28 +100 +AcDbSymbolTableRecord +100 +AcDbDimStyleTableRecord + 2 +ISO1 + 70 + 0 + 3 + + 4 + + 5 + + 6 + + 7 + + 40 +1.0 + 41 +10.0 + 42 +2.5 + 43 +15.0 + 44 +5.0 + 45 +0.0 + 46 +0.0 + 47 +0.0 + 48 +0.0 +140 +10.0 +141 +10.0 +142 +0.0 +143 +0.0394 +144 +1.0 +145 +4.0 +146 +1.0 +147 +2.5 + 71 + 0 + 72 + 0 + 73 + 1 + 74 + 0 + 75 + 0 + 76 + 0 + 77 + 1 + 78 + 8 +170 + 0 +171 + 2 +172 + 1 +173 + 0 +174 + 0 +175 + 0 +176 + 0 +177 + 0 +178 + 0 +270 + 2 +271 + 4 +272 + 4 +273 + 2 +274 + 2 +340 +10 +275 + 0 +280 + 0 +281 + 0 +282 + 0 +283 + 1 +284 + 0 +285 + 0 +286 + 0 +287 + 3 +288 + 0 + 0 +DIMSTYLE +105 +29 +100 +AcDbSymbolTableRecord +100 +AcDbDimStyleTableRecord + 2 +ISO1-4 + 70 + 0 + 3 + + 4 + + 5 + + 6 + + 7 + + 40 +1.0 + 41 +14.0 + 42 +3.5 + 43 +21.0 + 44 +7.0 + 45 +0.0 + 46 +0.0 + 47 +0.0 + 48 +0.0 +140 +14.0 +141 +14.0 +142 +0.0 +143 +0.0394 +144 +1.0 +145 +5.6 +146 +1.0 +147 +3.5 + 71 + 0 + 72 + 0 + 73 + 1 + 74 + 0 + 75 + 0 + 76 + 0 + 77 + 1 + 78 + 8 +170 + 0 +171 + 2 +172 + 1 +173 + 0 +174 + 0 +175 + 0 +176 + 0 +177 + 0 +178 + 0 +270 + 2 +271 + 4 +272 + 4 +273 + 2 +274 + 2 +340 +10 +275 + 0 +280 + 0 +281 + 0 +282 + 0 +283 + 1 +284 + 0 +285 + 0 +286 + 0 +287 + 3 +288 + 0 + 0 +DIMSTYLE +105 +2A +100 +AcDbSymbolTableRecord +100 +AcDbDimStyleTableRecord + 2 +ISO2 + 70 + 0 + 3 + + 4 + + 5 + + 6 + + 7 + + 40 +1.0 + 41 +20.0 + 42 +5.0 + 43 +30.0 + 44 +10.0 + 45 +0.0 + 46 +0.0 + 47 +0.0 + 48 +0.0 +140 +20.0 +141 +20.0 +142 +0.0 +143 +0.0394 +144 +1.0 +145 +8.0 +146 +1.0 +147 +5.0 + 71 + 0 + 72 + 0 + 73 + 1 + 74 + 0 + 75 + 0 + 76 + 0 + 77 + 1 + 78 + 8 +170 + 0 +171 + 2 +172 + 1 +173 + 0 +174 + 0 +175 + 0 +176 + 0 +177 + 0 +178 + 0 +270 + 2 +271 + 4 +272 + 4 +273 + 2 +274 + 2 +340 +10 +275 + 0 +280 + 0 +281 + 0 +282 + 0 +283 + 1 +284 + 0 +285 + 0 +286 + 0 +287 + 3 +288 + 0 + 0 +ENDTAB + 0 +TABLE + 2 +BLOCK_RECORD + 5 +1 +100 +AcDbSymbolTable + 70 + 0 + 0 +BLOCK_RECORD + 5 +1A +100 +AcDbSymbolTableRecord +100 +AcDbBlockTableRecord + 2 +*MODEL_SPACE + 0 +BLOCK_RECORD + 5 +17 +100 +AcDbSymbolTableRecord +100 +AcDbBlockTableRecord + 2 +*PAPER_SPACE + 0 +ENDTAB + 0 +ENDSEC + 0 +SECTION + 2 +BLOCKS + 0 +BLOCK + 5 +1B +100 +AcDbEntity + 8 +0 +100 +AcDbBlockBegin + 2 +*MODEL_SPACE + 70 + 0 + 10 +0.0 + 20 +0.0 + 30 +0.0 + 3 +*MODEL_SPACE + 1 + + 0 +ENDBLK + 5 +1C +100 +AcDbEntity + 8 +0 +100 +AcDbBlockEnd + 0 +BLOCK + 5 +18 +100 +AcDbEntity + 67 + 1 + 8 +0 +100 +AcDbBlockBegin + 2 +*PAPER_SPACE + 70 + 0 + 10 +0.0 + 20 +0.0 + 30 +0.0 + 3 +*PAPER_SPACE + 1 + + 0 +ENDBLK + 5 +19 +100 +AcDbEntity + 67 + 1 + 8 +0 +100 +AcDbBlockEnd + 0 +ENDSEC + 0 +SECTION + 2 +ENTITIES + 0 +LINE + 5 +2E +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +0.0 + 20 +0.0 + 30 +0.0 + 11 +1.0 + 21 +0.0 + 31 +0.0 + 0 +VIEWPORT + 5 +22 +100 +AcDbEntity + 67 + 1 + 8 +0 +100 +AcDbViewport + 10 +261.517699 + 20 +148.5 + 30 +0.0 + 40 +523.035398 + 41 +297.0 + 68 + -1 + 69 + 1 +1001 +ACAD +1000 +MVIEW +1002 +{ +1070 + 16 +1010 +0.0 +1020 +0.0 +1030 +0.0 +1010 +0.0 +1020 +0.0 +1030 +1.0 +1040 +0.0 +1040 +297.0 +1040 +261.517699 +1040 +148.5 +1040 +50.0 +1040 +0.0 +1040 +0.0 +1070 + 0 +1070 + 100 +1070 + 1 +1070 + 1 +1070 + 0 +1070 + 0 +1070 + 0 +1070 + 0 +1040 +0.0 +1040 +0.0 +1040 +0.0 +1040 +1.0 +1040 +1.0 +1040 +10.0 +1040 +10.0 +1070 + 0 +1002 +{ +1002 +} +1002 +} + 0 +ENDSEC + 0 +SECTION + 2 +OBJECTS + 0 +DICTIONARY + 5 +C +100 +AcDbDictionary + 3 +ACAD_GROUP +350 +D + 3 +ACAD_MLINESTYLE +350 +E + 0 +DICTIONARY + 5 +D +102 +{ACAD_REACTORS +330 +C +102 +} +100 +AcDbDictionary + 0 +DICTIONARY + 5 +E +102 +{ACAD_REACTORS +330 +C +102 +} +100 +AcDbDictionary + 3 +STANDARD +350 +13 + 0 +MLINESTYLE + 5 +13 +102 +{ACAD_REACTORS +330 +E +102 +} +100 +AcDbMlineStyle + 2 +STANDARD + 70 + 0 + 3 + + 62 + 0 + 51 +90.0 + 52 +90.0 + 71 + 2 + 49 +0.5 + 62 + 256 + 6 +BYLAYER + 49 +-0.5 + 62 + 256 + 6 +BYLAYER + 0 +ENDSEC + 0 +EOF diff --git a/src/Mod/Draft/drafttests/test_dxf.py b/src/Mod/Draft/drafttests/test_dxf.py index c19b007d26..08f698bc87 100644 --- a/src/Mod/Draft/drafttests/test_dxf.py +++ b/src/Mod/Draft/drafttests/test_dxf.py @@ -44,14 +44,14 @@ from draftutils.messages import _msg class DraftDXF(test_base.DraftTestCaseDoc): """Test reading and writing of DXF files with Draft.""" - def test_read_dxf(self): - """Read a DXF file and import its elements as Draft objects.""" + def test_read_dxf_Issue24314(self): + """Verify that reading a DXF file does not leave pending Python error states""" operation = "importDXF.import" _msg(" Test '{}'".format(operation)) _msg(" This test requires a DXF file to read.") - file = "Mod/Draft/drafttest/test.dxf" - in_file = os.path.join(App.getResourceDir(), file) + file = "Mod/Draft/drafttests/Issue24314.dxf" + in_file = os.path.join(App.getHomePath(), file) _msg(" file={}".format(in_file)) _msg(" exists={}".format(os.path.exists(in_file))) From 5e75621b348a02d7e96f5d2ee997c374b974cd8d Mon Sep 17 00:00:00 2001 From: Kevin Martin Date: Fri, 31 Oct 2025 10:27:14 -0400 Subject: [PATCH 3/5] Transplant the test code from the old location For some reason the app hangs after the test GUI is run --- src/Mod/Draft/drafttests/test_dxf.py | 43 ++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/src/Mod/Draft/drafttests/test_dxf.py b/src/Mod/Draft/drafttests/test_dxf.py index 08f698bc87..22b32bb29d 100644 --- a/src/Mod/Draft/drafttests/test_dxf.py +++ b/src/Mod/Draft/drafttests/test_dxf.py @@ -39,6 +39,7 @@ import Draft from drafttests import auxiliary as aux from drafttests import test_base from draftutils.messages import _msg +import importDXF class DraftDXF(test_base.DraftTestCaseDoc): @@ -46,17 +47,49 @@ class DraftDXF(test_base.DraftTestCaseDoc): def test_read_dxf_Issue24314(self): """Verify that reading a DXF file does not leave pending Python error states""" - operation = "importDXF.import" - _msg(" Test '{}'".format(operation)) - _msg(" This test requires a DXF file to read.") file = "Mod/Draft/drafttests/Issue24314.dxf" in_file = os.path.join(App.getHomePath(), file) _msg(" file={}".format(in_file)) _msg(" exists={}".format(os.path.exists(in_file))) - obj = aux.fake_function(in_file) - self.assertFalse(obj, "'{}' failed".format(operation)) + hGrp = App.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft") + + # Set options, doing our best to restore them: + wasShowDialog = hGrp.GetBool("dxfShowDialog", True) + wasUseLegacyImporter = hGrp.GetBool("dxfUseLegacyImporter", False) + wasUseLayers = hGrp.GetBool("dxfUseDraftVisGroups", True) + wasImportMode = hGrp.GetInt("DxfImportMode", 2) + wasCreateSketch = hGrp.GetBool("dxfCreateSketch", False) + wasImportAnonymousBlocks = hGrp.GetBool("dxfstarblocks", False) + + doc = None + try: + # disable Preferences dialog in gui mode (avoids popup prompt to user) + hGrp.SetBool("dxfShowDialog", False) + # Use the new C++ importer -- that's where the bug was + hGrp.SetBool("dxfUseLegacyImporter", False) + # Preserve the DXF layers (makes the checking of document contents easier) + hGrp.SetBool("dxfUseDraftVisGroups", True) + # create simple part shapes (2 params) + # This is required to display the bug because creation of Draft objects clears out the + # pending exception this test is looking for, whereas creation of the simple shape object + # actually throws on the pending exception so the entity is absent from the document. + hGrp.SetInt("DxfImportMode", 2) + hGrp.SetBool("dxfCreateSketch", False) + hGrp.SetBool("dxfstarblocks", False) + doc = importDXF.open(in_file) + # This doc should have 3 objects: The Layers container, the DXF layer called 0, and one Line + self.assertEqual(len(doc.Objects), 3) + finally: + hGrp.SetBool("dxfShowDialog", wasShowDialog) + hGrp.SetBool("dxfUseLegacyImporter", wasUseLegacyImporter) + hGrp.SetBool("dxfUseDraftVisGroups", wasUseLayers) + hGrp.SetInt("DxfImportMode", wasImportMode) + hGrp.SetBool("dxfCreateSketch", wasCreateSketch) + hGrp.SetBool("dxfstarblocks", wasImportAnonymousBlocks) + if doc: + App.closeDocument(doc.Name) def test_export_dxf(self): """Create some figures and export them to a DXF file.""" From a30df12cde873da61b185af47004f0c613605587 Mon Sep 17 00:00:00 2001 From: Kevin Martin Date: Wed, 5 Nov 2025 07:46:20 -0500 Subject: [PATCH 4/5] Remove test from old location --- src/Mod/Test/Document.py | 45 ---------------------------------------- 1 file changed, 45 deletions(-) diff --git a/src/Mod/Test/Document.py b/src/Mod/Test/Document.py index 8c32849489..3d2d88231c 100644 --- a/src/Mod/Test/Document.py +++ b/src/Mod/Test/Document.py @@ -681,51 +681,6 @@ class DocumentBasicCases(unittest.TestCase): # closing doc FreeCAD.closeDocument("CreateTest") - -class DocumentImportCases(unittest.TestCase): - def testDXFImportCPPIssue20195(self): - if "BUILD_DRAFT" in FreeCAD.__cmake__: - import importDXF - from draftutils import params - - # Set options, doing our best to restore them: - wasShowDialog = params.get_param("dxfShowDialog") - wasUseLayers = params.get_param("dxfUseDraftVisGroups") - wasUseLegacyImporter = params.get_param("dxfUseLegacyImporter") - wasCreatePart = params.get_param("dxfCreatePart") - wasCreateDraft = params.get_param("dxfCreateDraft") - wasCreateSketch = params.get_param("dxfCreateSketch") - - try: - # disable Preferences dialog in gui mode (avoids popup prompt to user) - params.set_param("dxfShowDialog", False) - # Preserve the DXF layers (makes the checking of document contents easier) - params.set_param("dxfUseDraftVisGroups", True) - # Use the new C++ importer -- that's where the bug was - params.set_param("dxfUseLegacyImporter", False) - # create simple part shapes (3 params) - # This is required to display the bug because creation of Draft objects clears out the - # pending exception this test is looking for, whereas creation of the simple shape object - # actually throws on the pending exception so the entity is absent from the document. - params.set_param("dxfCreatePart", True) - params.set_param("dxfCreateDraft", False) - params.set_param("dxfCreateSketch", False) - importDXF.insert( - FreeCAD.getHomePath() + "Mod/Test/TestData/DXFSample.dxf", "ImportedDocName" - ) - finally: - params.set_param("dxfShowDialog", wasShowDialog) - params.set_param("dxfUseDraftVisGroups", wasUseLayers) - params.set_param("dxfUseLegacyImporter", wasUseLegacyImporter) - params.set_param("dxfCreatePart", wasCreatePart) - params.set_param("dxfCreateDraft", wasCreateDraft) - params.set_param("dxfCreateSketch", wasCreateSketch) - doc = FreeCAD.getDocument("ImportedDocName") - # This doc should have 3 objects: The Layers container, the DXF layer called 0, and one Line - self.assertEqual(len(doc.Objects), 3) - FreeCAD.closeDocument("ImportedDocName") - - # class must be defined in global scope to allow it to be reloaded on document open class SaveRestoreSpecialGroup: def __init__(self, obj): From dfaaad6a95e1999c69c975edd8bd7734e708c37a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 5 Nov 2025 13:32:01 +0000 Subject: [PATCH 5/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/Mod/Test/Document.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Mod/Test/Document.py b/src/Mod/Test/Document.py index 3d2d88231c..1fc88c5974 100644 --- a/src/Mod/Test/Document.py +++ b/src/Mod/Test/Document.py @@ -681,6 +681,7 @@ class DocumentBasicCases(unittest.TestCase): # closing doc FreeCAD.closeDocument("CreateTest") + # class must be defined in global scope to allow it to be reloaded on document open class SaveRestoreSpecialGroup: def __init__(self, obj):