Browse Source
Merge in DESIGN/design from ~HARRISON/design:release/10.0 to release/10.0 * commit 'c5b4410d9a231d384cd4bfe23b939351fe739f05': 沿用之前的命名规则。 只进行 n 对 n 的匹配。 REPORT-32149【组件加密】@harrison两个组件进行拖入,模板预览很奇怪 [场景] 拖入组件时,组件时绝对画布块,内部有多个组件。此时,不会对内部的多个组件进行检测。 [solution] 递归的对所有组件进行处理。feature/big-screen
Harrison
5 years ago
2 changed files with 120 additions and 23 deletions
@ -0,0 +1,57 @@ |
|||||||
|
package com.fr.design.designer.beans.models; |
||||||
|
|
||||||
|
import com.fr.design.designer.creator.CRPropertyDescriptor; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.mainframe.FormDesigner; |
||||||
|
import com.fr.form.main.Form; |
||||||
|
import com.fr.form.ui.ChartEditor; |
||||||
|
import org.easymock.EasyMock; |
||||||
|
import org.junit.Assert; |
||||||
|
import org.junit.Test; |
||||||
|
|
||||||
|
import javax.swing.JComponent; |
||||||
|
import java.awt.Dimension; |
||||||
|
import java.beans.IntrospectionException; |
||||||
|
|
||||||
|
public class AddingModelTest { |
||||||
|
|
||||||
|
@Test |
||||||
|
public void testInstantiateCreator() throws Exception { |
||||||
|
|
||||||
|
ChartEditor chartEditor = new ChartEditor(); |
||||||
|
chartEditor.setWidgetName("test01"); |
||||||
|
XCreator xCreator = new XCreator(chartEditor, new Dimension(20, 20)) { |
||||||
|
@Override |
||||||
|
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { |
||||||
|
return new CRPropertyDescriptor[0]; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected JComponent initEditor() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void initXCreatorProperties() { |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String createDefaultName() { |
||||||
|
return "test"; |
||||||
|
} |
||||||
|
}; |
||||||
|
AddingModel addingModel = new AddingModel(xCreator, 20, 20); |
||||||
|
|
||||||
|
Form form = EasyMock.mock(Form.class); |
||||||
|
EasyMock.expect(form.isNameExist("test0")).andReturn(true).once(); |
||||||
|
EasyMock.expect(form.isNameExist(EasyMock.anyString())).andReturn(false).anyTimes(); |
||||||
|
EasyMock.replay(form); |
||||||
|
|
||||||
|
FormDesigner mock = EasyMock.mock(FormDesigner.class); |
||||||
|
EasyMock.expect(mock.getTarget()).andReturn(form).anyTimes(); |
||||||
|
EasyMock.replay(mock); |
||||||
|
|
||||||
|
addingModel.instantiateCreator(mock); |
||||||
|
Assert.assertEquals("test1", xCreator.toData().getWidgetName()); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue