public class KielerJUnitTest
extends java.lang.Object
There are two types of tests.
1. _layoutModelCompareAgainstFile(NamedObj, String)
We
read in a model and run the Kieler layout algorithm on on the model
and compare the results against the original model. This test is
run on regression tests to be sure that the Kieler algorithm has
not changed. Typically, the models are in the
ptolemy/vergil/basic/layout/kieler/test/junit/models
subdirectory.
2. We read in a model, use the Ptolemy layouter and then the Kieler layout algorithm. We then do an undo, a redo and an undo and compare. the model against the model after the Ptolemy layouter. This test is used run on models in the Ptolemy tree to make sure that the Kieler layouter and the undo/redo mechanism works.
Constructor and Description |
---|
KielerJUnitTest() |
Modifier and Type | Method and Description |
---|---|
protected void |
_layoutModelCompareAgainstFile(NamedObj model,
java.lang.String modelFileName)
Lay out the model and compare the results against the original
model file name.
|
protected void |
_layoutTest(java.lang.String modelFileName,
boolean compareAgainstOriginal)
Test the layout facility by reading in a model, laying out the
model, comparing the new results with the known good results
and then doing undo and redo.
|
protected void |
_redo(NamedObj model)
Redo the last operation on the model.
|
protected static void |
_sleep()
Sleep the current thread, which is usually not the Swing Event
Dispatch Thread.
|
protected void |
_undo(NamedObj model)
Undo the last operation on the model.
|
static void |
closeSentinelModel()
Reset the ptolemy.ptII.doNotExit property to the previous value.
|
static void |
main(java.lang.String[] args)
Test the Kieler layout facility.
|
static void |
openSentinelModel()
Save the previous value of the ptolemy.ptII.doNotExit property
and set it to true while running this test.
|
void |
runModulation()
Test the layout of the modulation model.
|
public static void main(java.lang.String[] args)
To run, use:
java -classpath \ $PTII:$PTII/lib/junit-4.8.2.jar:$PTII/lib/kieler.jar \ ptolemy.vergil.basic.layout.kieler.test.junit.KielerJUnitTest
args
- Not used.public static void openSentinelModel() throws java.lang.Exception
java.lang.Exception
- If there is a problem opening the modelpublic void runModulation() throws java.lang.Exception
java.lang.Exception
- If there is a problem reading or laying
out a model.public static void closeSentinelModel() throws java.lang.Throwable
java.lang.Throwable
- If there is a problem setting the property.protected void _layoutTest(java.lang.String modelFileName, boolean compareAgainstOriginal) throws java.lang.Exception
This is the main entry point for Kieler layout tests.
The caller of this method need notbe in the Swing Event Thread.
modelFileName
- The file name of the test model.compareAgainstOriginal
- If true, then run the Kieler
Layouter and compare against the original file. If false, run
the Ptolemy layouter, the Kieler layouter, then undo, redo,
undo and compare against the output after the Ptolemy layouter.java.lang.Exception
- If the file name cannot be read or laid out.protected void _layoutModelCompareAgainstFile(NamedObj model, java.lang.String modelFileName) throws java.lang.Exception
The caller of this method should be in the Swing Event Thread.
model
- The model.modelFileName
- The pathname of the model, used for
comparing.java.lang.Exception
- If thrown while opening or laying
out the model.protected void _redo(NamedObj model)
The caller of this method should be in the Swing Event Thread.
model
- The model upon which the last operation
should be redone.protected static void _sleep()
protected void _undo(NamedObj model)
The caller of this method should be in the Swing Event Thread.
model
- The model upon which the last operation
should be redone.