"// filler filler filler filler filler",
"public class Test extends FlowPanel {",
" public Test() {",
" }",
"}");
GraphicalEditPart panelEditPart = canvas.getEditPart(originalPanel);
Figure panelFigure = panelEditPart.getFigure();
// no device yet
assertEquals(new Rectangle(20, 20, 450, 300), panelFigure.getBounds());
assertTrue(hasTopSelectionPolicy(panelEditPart));
// set device
DeviceSelectionSupport.setDevice(originalPanel, DeviceManager.getDevice("generic.qvga"));
assertEquals(new Rectangle(25, 25, 240, 320), panelFigure.getBounds());
assertFalse(hasTopSelectionPolicy(panelEditPart));
}
// parse again
{
openSourcePage();
m_lastEditor.replaceSubstring(0, 0, " ");
m_lastEditor.commitChanges();
openDesignPage();
fetchContentFields();
}
// ...still has device
{
ComplexPanelInfo newPanel = (ComplexPanelInfo) m_contentJavaInfo;
assertNotSame(originalPanel, newPanel);
// has device
assertNotNull(DeviceSelectionSupport.getDevice(newPanel));
// device bounds applied
GraphicalEditPart panelEditPart = canvas.getEditPart(newPanel);
Figure panelFigure = panelEditPart.getFigure();
assertEquals(new Rectangle(25, 25, 240, 320), panelFigure.getBounds());
assertFalse(hasTopSelectionPolicy(panelEditPart));
// remove device
DeviceSelectionSupport.setDevice(newPanel, null);
assertEquals(new Rectangle(20, 20, 240, 320), panelFigure.getBounds());