How to compile a fontQA testsuite
As illustrated in the logical structure a test suite is a collection of test blocks. A test block is a collection of test items.
In this example we want to build a test suite with two blocks: one for glyph name tests and one for outline tests. The test for glyph names should verify that a name does not start with a number or an underscore. The outline test should look for very small contours.
The first thing you have to do is to give your script a name wich will show up in the macro panel. Then you have to import all the things you need for your test suite. See the reference section to find out in which module the several test items are located.
For now your script should look like this:
1 #FLM: my first testsuite 2 3 from FL import * 4 from fontQA import TestSuite 5firstSuite.py
Now we can create the test suite object as an instance of the test suite class. The constructor may use an optional parameter: the full path of the report that his test suite will generate. If this parameter is omitted, the report will be stored with a default name (fontQA_report.xml) at the default position (your FontLab programme folder).
After that we create the first test block with the 'addBlock' method of the test suite. This method uses two parameters. The first is the name for this block shown to the user, the second is the internal tag for the block. The 'addBlock' method returns the created block as the result of this operation. We store this result in a variable, so we can add some test items to that block. This is done with the 'addItem' method of the 'testBlock'. This method takes the class which represents the 'testItem' as a parameter.
The script with the first block added looks like this:
1 #FLM: my first testsuite 2 3 from FL import * 4 from fontQA import TestSuite 5 6 mySuite = TestSuite() 7 myBlock = mySuite.addBlock('Glyphname tests', 'Glyphname') 8 myBlock.addItem(startNumber) 9 myBlock.addItem(startUnderscore) 10firstSuite.py