Procedure

This test is meant to be an assault on the underlying worker threads that the VE's code generation employs to generate code and listen for changes in the model and source code.

Setup

 

Create a simple visual class consisting of a JFrame and a few Swing beans with the layout manager of the JFrame’s content pane set to FlowLayout.

Bean Removal Test

In the source code, comment out the private field for one of the beans, for example
// private javax.swing.JButton jButton1 = null;
Verify that the corresponding bean no longer appears in the graphical view.

Produce the same effect by commenting out a VE-generated member function for one of the beans.
Verify that the corresponding bean no longer appears in the graphical view.

User Modifications/Code Test

Change the order of any two private fields in the source code
Verify that the graphical model remains unchanged.

Insert your own user code inside of a VE-generated method
Verify that the graphical model remains unchanged.

Create your own methods in various placed within the source code
Verify that the graphical model isn’t changed.

Cut and paste these methods as well as the VE-generated methods to rearrange the order of methods in the source code
Verify that the graphical model stays consistent throughout the rearrangement process.
Verify that editing the source code is natural and defect-free. For example, the cursor should never leave the place where you’re currently typing and nothing should get highlighted, replaced, or otherwise disturbed without your consent.

Drop a JPanel on the freeform and a JButton on the freeform. Add the line "int i = 10;" to the JButton accessor method and then move the JButton into the JPanel.
Verify that the "int i" statement is not lost.

Edit properties from the Property Sheet(PS) by manually typing into the code, and
Verify that CodeGen’s generated statements are put in the right place and don’t create un-compilable code.

Insert statements like "int myVar = 42;" into the code where the members are declared and within the accessor methods and then set properties or add beans to containers.
Verify that nothing unusual happens.

Test local variables with same name:
Drop two panels and set both of their layout managers to BorderLayout. For each BorderLayout, set the hgap to something. Now close the VE and open the file with a plain Java editor. The layout managers will each have local variables called layBorderLayoutXXX. Make them both the same name and then reopen the file with the VE editor.
Verify that both panels have BorderLayout set as their layout property.

Parsing Test

Drop a JButton onto the free form.
Select the JButton, in the Property Sheet, set the 'text' property to "stuff" (or anything). This will add a statement in the getJButton() method:  jButton.setText("stuff");
In the source viewer, set the text to something else, (e.g. "more stuff").
Verify that round-tripping works, i.e. the PS  and canvas should change to reflect the new text.

Change the text several more times from the source,
Verify the PS and canvas stays up-to-date.

Verify that deleting all of the source content of a class is properly reflected on the canvas and in the PS