|
|
@ -92,20 +92,21 @@ public class AddingModelTest { |
|
|
|
|
|
|
|
|
|
|
|
Form form = EasyMock.mock(Form.class); |
|
|
|
Form form = EasyMock.mock(Form.class); |
|
|
|
EasyMock.expect(form.isNameExist("cardlayout")).andReturn(true).once(); |
|
|
|
EasyMock.expect(form.isNameExist("cardlayout")).andReturn(true).once(); |
|
|
|
|
|
|
|
EasyMock.expect(form.isNameExist("cardlayout0")).andReturn(true).once(); |
|
|
|
EasyMock.expect(form.isNameExist(EasyMock.anyString())).andReturn(false).anyTimes(); |
|
|
|
EasyMock.expect(form.isNameExist(EasyMock.anyString())).andReturn(false).anyTimes(); |
|
|
|
EasyMock.replay(form); |
|
|
|
EasyMock.replay(form); |
|
|
|
|
|
|
|
|
|
|
|
FormDesigner mock = EasyMock.mock(FormDesigner.class); |
|
|
|
FormDesigner mock = EasyMock.mock(FormDesigner.class); |
|
|
|
EasyMock.expect(mock.getTarget()).andReturn(form).anyTimes(); |
|
|
|
EasyMock.expect(mock.getTarget()).andReturn(form).anyTimes(); |
|
|
|
EasyMock.replay(mock); |
|
|
|
EasyMock.replay(mock); |
|
|
|
|
|
|
|
|
|
|
|
WCardLayout wCardLayout = new WCardLayout(20, 20); |
|
|
|
WCardLayout wCardLayout = new WCardLayout(20, 20); |
|
|
|
XWCardLayout xwCardLayout = new XWCardLayout(wCardLayout, new Dimension(20, 20)); |
|
|
|
XWCardLayout xwCardLayout = new XWCardLayout(wCardLayout, new Dimension(40, 40)); |
|
|
|
AddingModel addingModel = new AddingModel(mock, xwCardLayout); |
|
|
|
AddingModel addingModel = new AddingModel(mock, xwCardLayout); |
|
|
|
Assert.assertEquals("cardlayout1", xwCardLayout.toData().getWidgetName()); |
|
|
|
Assert.assertEquals("cardlayout1", xwCardLayout.toData().getWidgetName()); |
|
|
|
|
|
|
|
|
|
|
|
//依赖于 cardlayout 创建 container
|
|
|
|
//依赖于 cardlayout 创建 container
|
|
|
|
XLayoutContainer parentLayOut = xwCardLayout.initCreatorWrapper(20); |
|
|
|
XLayoutContainer parentLayOut = xwCardLayout.initCreatorWrapper(80); |
|
|
|
AddingModel parentModel = new AddingModel(mock, parentLayOut); |
|
|
|
AddingModel parentModel = new AddingModel(mock, parentLayOut); |
|
|
|
Assert.assertEquals("tablayout1", parentLayOut.toData().getWidgetName()); |
|
|
|
Assert.assertEquals("tablayout1", parentLayOut.toData().getWidgetName()); |
|
|
|
Assert.assertEquals("tabpane1", ((XCreator) (parentLayOut.getComponent(0))).getXCreator().toData().getWidgetName()); |
|
|
|
Assert.assertEquals("tabpane1", ((XCreator) (parentLayOut.getComponent(0))).getXCreator().toData().getWidgetName()); |
|
|
|