Browse Source

Merge pull request #12429 in DESIGN/design from release/11.0 to bugfix/11.0

* commit 'cf9498ebe14bcf70fa80d3d29ef65d21d4b9a5eb':
  REPORT-94637 单元测试修复
bugfix/11.0
superman 1 year ago
parent
commit
584c675ffc
  1. 40
      designer-form/src/test/java/com/fr/design/mainframe/template/info/JFormProcessInfoTest.java

40
designer-form/src/test/java/com/fr/design/mainframe/template/info/JFormProcessInfoTest.java

@ -1,7 +1,9 @@
package com.fr.design.mainframe.template.info; package com.fr.design.mainframe.template.info;
import com.fr.base.background.ColorBackground; import com.fr.base.background.ColorBackground;
import com.fr.base.svg.IconUtils;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase; import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase;
import com.fr.form.main.Form; import com.fr.form.main.Form;
import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.CardSwitchButton;
@ -20,15 +22,53 @@ import com.fr.json.JSONArray;
import com.fr.plugin.chart.vanchart.VanChart; import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.worksheet.FormElementCase; import com.fr.report.worksheet.FormElementCase;
import org.easymock.EasyMock;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.easymock.PowerMock;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import javax.swing.Icon;
import java.awt.Color; import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
/** /**
* Created by kerry on 2020-05-08 * Created by kerry on 2020-05-08
*/ */
@RunWith(PowerMockRunner.class)
@PrepareForTest({Toolkit.class, IconUtils.class})
@PowerMockIgnore({"javax.management.*"})
public class JFormProcessInfoTest { public class JFormProcessInfoTest {
@Before
public void setUp() throws Exception {
PowerMock.mockStatic(Toolkit.class);
PowerMock.mockStatic(IconUtils.class);
EasyMock.expect(Toolkit.i18nText(EasyMock.anyString())).andReturn("ignore").anyTimes();
EasyMock.expect(IconUtils.readIcon(EasyMock.anyString())).andReturn(new Icon() {
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
// do nothing
}
@Override
public int getIconWidth() {
return 0;
}
@Override
public int getIconHeight() {
return 0;
}
}).anyTimes();
PowerMock.replayAll();
}
@Test @Test
public void testHasTestECReport() { public void testHasTestECReport() {
Form form = new Form(); Form form = new Form();

Loading…
Cancel
Save