forked from fanruan/design
Browse Source
* commit '0531a02f94419921cdb0cffbafab18f7f7c9db63': REPORT-38555 fix:数字控件中内容可以输入空格和减号 REPORT-38555 fix:数字控件中内容可以输入空格和减号 REPORT-38523 fix: 右侧单元格属性表鼠标事件有误,修改了mouseReleased事件
superman
2 years ago
4 changed files with 74 additions and 7 deletions
@ -0,0 +1,44 @@
|
||||
package com.fr.design.gui.itextfield; |
||||
|
||||
import org.junit.Assert; |
||||
import org.junit.Test; |
||||
|
||||
/** |
||||
* @author Destiny.Lin |
||||
* @version 10.0 |
||||
* created by Destiny.Lin on 2022-07-11 |
||||
*/ |
||||
public class UINumberFieldTest { |
||||
|
||||
@Test |
||||
public void testUINumberFieldTest(){ |
||||
UINumberField uiNumberField = new UINumberField(); |
||||
uiNumberField.setFieldDocument(); |
||||
//异常输入测试
|
||||
uiNumberField.setText("-.1"); |
||||
Assert.assertEquals("",uiNumberField.getText()); |
||||
uiNumberField.setText(".-1"); |
||||
Assert.assertEquals("",uiNumberField.getText()); |
||||
uiNumberField.setText("1-"); |
||||
Assert.assertEquals("",uiNumberField.getText()); |
||||
uiNumberField.setText("1-1"); |
||||
Assert.assertEquals("",uiNumberField.getText()); |
||||
uiNumberField.setText("1 "); |
||||
Assert.assertEquals("",uiNumberField.getText()); |
||||
uiNumberField.setText(".1"); |
||||
Assert.assertEquals("",uiNumberField.getText()); |
||||
uiNumberField.setText("1 -"); |
||||
Assert.assertEquals("",uiNumberField.getText()); |
||||
|
||||
//正常输入测试
|
||||
uiNumberField.setText("0.1"); |
||||
Assert.assertEquals("0.1",uiNumberField.getText()); |
||||
uiNumberField.setText("1"); |
||||
Assert.assertEquals("1",uiNumberField.getText()); |
||||
uiNumberField.setText("-1.5"); |
||||
Assert.assertEquals("-1.5",uiNumberField.getText()); |
||||
uiNumberField.setText("-123.123"); |
||||
Assert.assertEquals("-123.123",uiNumberField.getText()); |
||||
|
||||
} |
||||
} |
Loading…
Reference in new issue