Browse Source

KERNEL-1197 新增两个单元测试,添加了一个返回值说明,删除掉了被标记为Open的BaseFormula

master
Mars.Ma 5 years ago
parent
commit
1429f63c69
  1. 4
      src/main/java/com/fanruan/api/base/BaseFormula.java
  2. 2
      src/main/java/com/fanruan/api/util/CellKit.java
  3. 22
      src/test/java/com/fanruan/api/util/CellKitTest.java
  4. 19
      src/test/java/com/fanruan/api/util/StableKitTest.java

4
src/main/java/com/fanruan/api/base/BaseFormula.java

@ -1,4 +0,0 @@
package com.fanruan.api.base;
public abstract class BaseFormula extends com.fr.base.BaseFormula {
}

2
src/main/java/com/fanruan/api/util/CellKit.java

@ -14,7 +14,7 @@ public class CellKit {
* @param style 绘制image的style
* @param width 绘制image的宽
* @param height 绘制image的高
* @return
* @return 返回宽为width高为height,类型为TYPE_4BYTE_ABGR的image
*/
public static Image value2Image(Object value, int resolution, Style style, int width, int height){
return CellUtils.value2Image(value, resolution, style, width, height);

22
src/test/java/com/fanruan/api/util/CellKitTest.java

@ -0,0 +1,22 @@
package com.fanruan.api.util;
import com.fr.base.Style;
import com.fr.plugin.present.fun.StarPainter;
import org.junit.Assert;
import org.junit.Test;
import java.awt.*;
import static org.junit.Assert.*;
public class CellKitTest {
@Test
public void value2Image() {
StarPainter star = new StarPainter(1);
Style style = Style.getInstance();
Image image = CellKit.value2Image(star, 1, style, 30, 50);
Assert.assertEquals(30, image.getWidth(null));
Assert.assertEquals(50, image.getHeight(null));
}
}

19
src/test/java/com/fanruan/api/util/StableKitTest.java

@ -0,0 +1,19 @@
package com.fanruan.api.util;
import org.junit.Assert;
import org.junit.Test;
import static org.junit.Assert.*;
public class StableKitTest {
@Test
public void canBeFormula() {
String s1 = "=1";
String s2 = "=a+b+";
String s3 = "ppp";
Assert.assertTrue(StableKit.canBeFormula(s1));
Assert.assertTrue(StableKit.canBeFormula(s2));
Assert.assertFalse(StableKit.canBeFormula(s3));
}
}
Loading…
Cancel
Save