Group: LibreDWG/TestSuite
Contents
Test Suite for LibreDwg
The aim of the Test Suite is to test the reading and writing capabilities of LibreDwg for various versions of DWG files.
Test Suite using testSVG script.
Test suite contains various dwg files. Each dwg file contains one single object like Line, Ray, Construction Line, etc.
Test Suite also contains a png file for each dwg file.
testSVG is script that converts a dwg file into a svg file.
When the Test Suite runs, it converts all dwg files into svg files. If there are errors in conversion, then an error file is created instead of svg file. Finally the result is seen in form of a webpage where the original PNG files are shown next to the svg file. If both appear similar then the test for that particular file is successful. In case of errors the error message is shown.
Running the testsuite
Copy testsuite folder in libredwg folder and run the script test.sh in it.
Viewing the results
After running the test, a new results.htm file will be created. Open the file in a browser to view the results.
Limitations
SVG do not support many features that are available in DWG. Thus many features of DWG can not be tested using the current testsuite
XML based TestSuite
This is just an idea open for discussions. Every DWG file used for test will have a corresponding XML file. The XML file will have all properties of elements in DWG file. For Example A DWG file with a single line with starting coordinate as (1.2354668,4.5698759,-12.567988), end coordinate as (-4.26648,56.5648985,54.567989), color as "red", lineweight as 2.25, layer as "LAYERNAME", linetype as "dotted", linetypescale as "1.25" and so on... The xml file can have a strucutre as follows
<source lang="xml"> <?xml version="1.0" encoding='UTF-8'?> <DWGELEMENT> <line id="123456789" StartX="1.2354668" StartY="4.5698759" StartZ="-12.567988" EndX="-4.26648" EndY="56.5648985" EndZ="54.567989" Color="red" Lineweight="2.25" Layer="LAYERNAME" Linetype="dotted" Linetypescale="1.25" /> </DWGELEMENT> </source>
This xml file can be created manually or using a autolisp, VBA in Autocad
The testSVG script can be modified to generate an XML file as above. The XML file generate by testSVG can be comapred with the XML from the TESTSUITE which was created manually or using a autolisp, VBA in Autocad. If both the XML files are matching then the reading capabilities of LibreDwg for that particular drawing file is OK.