Browse Source
Merge in DESIGN/design from ~DESTINY.LIN/design:release/10.0 to release/10.0 * commit '8d26f1b05807986f00e2d320fa94b37003c1a192': REPORT-38555 fix:数字控件中内容可以输入空格和减号 REPORT-38555 fix:数字控件中内容可以输入空格和减号security/10.0
Destiny.Lin
2 years ago
3 changed files with 69 additions and 3 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