Browse Source
Merge in DESIGN/design from ~HARRISON/design:release/10.0 to release/10.0 * commit 'c64778ee840e370140eeb8f518e08075b1e59272': REPORT-35016【组件生成】目前生成的组件,从组件库拖入模板中会变大 [场景] 从组件库拖入时,不会保持原有的大小。 [解决方案] 将原来的大小,在创建时一并初始化feature/big-screen
Harrison
4 years ago
2 changed files with 80 additions and 19 deletions
@ -0,0 +1,38 @@ |
|||||||
|
package com.fr.design.mainframe; |
||||||
|
|
||||||
|
import com.fr.chart.chartattr.ChartCollection; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.form.share.SharableWidgetProvider; |
||||||
|
import com.fr.form.ui.ChartEditor; |
||||||
|
import com.fr.general.ImageWithSuffix; |
||||||
|
import com.fr.invoke.Reflect; |
||||||
|
import org.easymock.EasyMock; |
||||||
|
import org.junit.Assert; |
||||||
|
import org.junit.Test; |
||||||
|
import org.junit.runner.RunWith; |
||||||
|
import org.powermock.core.classloader.annotations.PowerMockIgnore; |
||||||
|
import org.powermock.modules.junit4.PowerMockRunner; |
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class) |
||||||
|
@PowerMockIgnore({"com.fr.jvm.assist.*", "javax.swing.*"}) |
||||||
|
public class ShareWidgetButtonTest { |
||||||
|
|
||||||
|
@Test |
||||||
|
public void testCreateXCreator() throws Exception { |
||||||
|
|
||||||
|
SharableWidgetProvider provider = EasyMock.mock(SharableWidgetProvider.class); |
||||||
|
EasyMock.expect(provider.getWidth()).andReturn(300).anyTimes(); |
||||||
|
EasyMock.expect(provider.getHeight()).andReturn(400).anyTimes(); |
||||||
|
EasyMock.expect(provider.getName()).andReturn("test-drag").anyTimes(); |
||||||
|
EasyMock.expect(provider.getCover()).andReturn(new ImageWithSuffix("utf-8")).anyTimes(); |
||||||
|
EasyMock.replay(provider); |
||||||
|
|
||||||
|
ShareWidgetButton.ShareWidgetUI ui = new ShareWidgetButton.ShareWidgetUI(); |
||||||
|
|
||||||
|
ChartEditor editor = new ChartEditor(); |
||||||
|
Reflect.on(editor).set("chartCollection", new ChartCollection()); |
||||||
|
XCreator xCreator = ui.createXCreator(editor, "333", provider); |
||||||
|
Assert.assertEquals(300, xCreator.getWidth()); |
||||||
|
Assert.assertEquals(400, xCreator.getHeight()); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue