Browse Source

Merge remote-tracking branch 'origin/release/11.0' into release/11.0

bugfix/11.0
Yvan 3 years ago
parent
commit
42a314fb13
  1. 27
      designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html
  2. 4
      designer-form/src/main/java/com/fr/design/mainframe/share/action/CreateComponentAction.java
  3. 41
      designer-realize/src/test/java/com/fr/design/mainframe/app/DesignerAppUtilsTest.java

27
designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html

@ -20,6 +20,33 @@
<script src="script/editor.service.js"></script>
<script>
window.onload = function () {
BI.config("bi.constant.materials.rich_editor.font_size", function (items) {
return [
{
value: 9,
text: 9
},
{
value: 10,
text: 10
},
{
value: 11,
text: 11
},
].concat(items);
});
BI.config("bi.constant.materials.rich_editor.font_size_range", function (range) {
return {
MIN: 9,
MAX: 128
};
});
var content = Pool.data.getContent();
var isAuto = Pool.data.isAuto();
var params = Pool.data.getParams();

4
designer-form/src/main/java/com/fr/design/mainframe/share/action/CreateComponentAction.java

@ -273,9 +273,9 @@ public class CreateComponentAction extends UpdateAction {
XChartEditor chartEditor = (XChartEditor) body;
Dimension size = chartEditor.getSize();
BufferedImage chartImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB);
Insets margin = chartEditor.getInsets();;
Insets margin = chartEditor.getInsets();
chartEditor.getDesignerEditor().paintEditor(chartImage.getGraphics(), size, margin);
im.getGraphics().drawImage(chartImage, 0, chartEditor.getY(), null);
im.getGraphics().drawImage(chartImage, chartEditor.getX(), chartEditor.getY(), null);
}
}
return im;

41
designer-realize/src/test/java/com/fr/design/mainframe/app/DesignerAppUtilsTest.java

@ -3,15 +3,11 @@ package com.fr.design.mainframe.app;
import com.fr.invoke.Reflect;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.context.PluginMarkerAdapter;
import com.fr.plugin.engine.remote.PluginRemoteSync;
import com.fr.stable.TemplateIOErrorContextHolder;
import com.fr.third.guava.collect.Multimap;
import org.easymock.EasyMock;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.easymock.PowerMock;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import java.util.Collection;
@ -24,13 +20,12 @@ import java.util.HashSet;
* Created by vito on 2021/5/31
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest({PluginRemoteSync.class})
public class DesignerAppUtilsTest {
@Test
public void testDealWithErrorDetailMultiLineAndCache() {
TemplateIOErrorContextHolder.registerPluginNameMap(new HashMap<String, String>() {{
put("2", "好用的插件");
}},new HashSet<>());
}}, new HashSet<>());
TemplateIOErrorContextHolder.addNeedEnablePlugin(PluginMarkerAdapter.create("1", "1.0", "1插件"));
TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("2", "1.0"));
TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("3", "1.0"));
@ -47,7 +42,7 @@ public class DesignerAppUtilsTest {
public void testInvalidatePlugins() {
TemplateIOErrorContextHolder.registerPluginNameMap(new HashMap<String, String>() {{
put("2", "好用的插件");
}},new HashSet<>());
}}, new HashSet<>());
TemplateIOErrorContextHolder.addNeedEnablePlugin(PluginMarkerAdapter.create("1", "1.0", "1插件"));
TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("2", "1.0"));
TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("3", "1.0"));
@ -60,19 +55,19 @@ public class DesignerAppUtilsTest {
}
@Test
public void testRearrange(){
public void testRearrange() {
// 远程插件模拟注册
PluginRemoteSync pluginRemoteSync = EasyMock.createMock(PluginRemoteSync.class);
EasyMock.expect(pluginRemoteSync.getPluginRemoteStatusByIdIndex()).andReturn(new HashMap<String, PluginRemoteSync.PluginStatus>(){{
put("com.fr.plugin1", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin1","1",true).get());
put("com.fr.plugin2", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin2","1",true).get());
put("com.fr.plugin3", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin3","1",false).get());
put("com.fr.plugin4", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin4","1",false).get());
}}).anyTimes();
EasyMock.replay(pluginRemoteSync);
PowerMock.mockStaticPartial(PluginRemoteSync.class, "getInstance");
EasyMock.expect(PluginRemoteSync.getInstance()).andReturn(pluginRemoteSync).anyTimes();
PowerMock.replay(PluginRemoteSync.class);
// PluginRemoteSync pluginRemoteSync = EasyMock.createMock(PluginRemoteSync.class);
// EasyMock.expect(pluginRemoteSync.getPluginRemoteStatusByIdIndex()).andReturn(new HashMap<String, PluginRemoteSync.PluginStatus>(){{
// put("com.fr.plugin1", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin1","1",true).get());
// put("com.fr.plugin2", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin2","1",true).get());
// put("com.fr.plugin3", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin3","1",false).get());
// put("com.fr.plugin4", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin4","1",false).get());
// }}).anyTimes();
// EasyMock.replay(pluginRemoteSync);
// PowerMock.mockStaticPartial(PluginRemoteSync.class, "getInstance");
// EasyMock.expect(PluginRemoteSync.getInstance()).andReturn(pluginRemoteSync).anyTimes();
// PowerMock.replay(PluginRemoteSync.class);
// 本地插件模拟检查
TemplateIOErrorContextHolder.registerPluginNameMap(new HashMap<String, String>() {{
@ -81,7 +76,7 @@ public class DesignerAppUtilsTest {
put("com.fr.plugin3", "好用的插件3");
put("com.fr.plugin4", "好用的插件4");
put("com.fr.plugin5", "好用的插件5");
}},new HashSet<>());
}}, new HashSet<>());
// unknown
TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("com.fr.plugin7", "1"));
// disable
@ -93,14 +88,14 @@ public class DesignerAppUtilsTest {
Multimap<String, PluginMarkerAdapter> pendingPlugins = TemplateIOErrorContextHolder.getPendingPlugin();
Reflect.on(DesignerAppUtils.class).call("rearrange",pendingPlugins).get();
Assert.assertEquals(1,pendingPlugins.get(TemplateIOErrorContextHolder.UNKNOWN_PLUGIN).size());
Reflect.on(DesignerAppUtils.class).call("rearrange", pendingPlugins).get();
Assert.assertEquals(1, pendingPlugins.get(TemplateIOErrorContextHolder.UNKNOWN_PLUGIN).size());
Collection<PluginMarkerAdapter> pluginMarkerAdapters = pendingPlugins.get(TemplateIOErrorContextHolder.DISABLE_PLUGIN);
Assert.assertEquals(2, pluginMarkerAdapters.size());
pluginMarkerAdapters.contains(PluginMarker.create("com.fr.plugin3", "1"));
pluginMarkerAdapters.contains(PluginMarker.create("com.fr.plugin4", "1"));
Collection<PluginMarkerAdapter> pluginMarkerAdapters1 = pendingPlugins.get(TemplateIOErrorContextHolder.NOT_INSTALLED_PLUGIN);
Assert.assertEquals(1, pluginMarkerAdapters1.size());
pluginMarkerAdapters1.contains(PluginMarker.create("com.fr.plugin5","1"));
pluginMarkerAdapters1.contains(PluginMarker.create("com.fr.plugin5", "1"));
}
}
Loading…
Cancel
Save