Procedure
This test
should test the various aspects of the snippet update process so that
the source to UI update mechanism is stable
Setup
Create an RCP Mail
sample by performing the following steps:
RCP View snippet update test
Open the file testproject.rcp.View
in the Visual Editor
Verify
that the
file opens properly and you can see the RCP Mail View
Select the Date: label in the
UI and in the source change its l.setText("Date:")
to l.setText("Day/Date:")
Verify that just that
label has its text updated in the UI and in the Java Beans Outline view
Select the
container named banner and
change the field name
property to mailHeaders
Verify that after the
entire snippet update, the UI is back to how it used to be. The only
change should be that the name of field is updated in the Java Beans
outline view.
Select any
Label with the variable name l
and change its field name
property to someLabel
Verify that the variable
names for all Labels with
variable name l are changes to
someLabel and that the
snippet update correctly updates the UI and the Java Beans view.
Select the mailHeaders
composite in the UI. Go to the layout
property in the PS and change it to null.
After the change is finished hit the undo
action
Verify that the UI has
returned back to its original gridlayout form.
Verify
by expanding the layout
property of the mailHeaders composite,
that all the values are as they are in the source.
Verify by expanding the layout property of the top composite, that all the values
are as they are in the source.
Go to the source of the mailHeaders layout and change the numColumns value to say 3
(layout.numColumns = 3)
Verify that the mailHeaders composite now has three
columns with components
Hit Undo
Verify that the UI reverts
back to having two clumns
Select the top composite in
the UI. Go to the layout
property in the PS and change it to null. [This will produce compile
problems, but thats ok for the test]
After the change is finished hit the undo
action
Verify that the UI has
returned back to its original gridlayout form.
Verify
by expanding the layout
property of the mailHeaders composite,
that all the values are as they are in the source.
Verify by expanding the layout property of the top composite, that all the values
are as they are in the source.
Select the mailHeaders
composite in the UI. Go to the layout
property in the PS and keep testing switching to other layouts and
hitting combinations of undo/redo to see if it is stable
Verify that the UI has
returned back to its original gridlayout form.
Verify
by expanding the layout
property of the mailHeaders composite,
that all the values are as they are in the source.
Verify by expanding the layout property of the top composite, that all the values
are as they are in the source.
Other snippet tests
In the above project use the New
Java Visual Class wizard to create an SWT Shell (say MyShell).
Set the layout to RowLayout.
Drop some Composites into the Shell (composite, composite1, ...)
Select the Shell and go to its method. Reorder the order of the
createComposite*() methods in the source
Verify that the ordering
in the source is reflected in the UI and in the Java Beans view
Select the shell and go to the end of its method. Select the area of
text covering its last bracket and paste in the following source:
|
createComposite2(); } /** * This method initializes composite * */ private void createComposite2() { Composite composite2 = new Composite(sShell, SWT.NONE); composite2.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); } |
Verify that a new composite of red color is added at the end of the children of the shell. Check this in the UI and in the Java Beans view.
Drop a Label on the Shell so that a field label is created. Paste the
following source in the newly created createComposite2() method
|
label = new Label(composite2, SWT.NONE); label.setText("new Label"); |
Verify that a new label with the appropriate text is created in the red composite
Verify that the text is updated in the UI and Java Beans view