forked from fanruan/design
2 changed files with 75 additions and 15 deletions
@ -0,0 +1,51 @@
|
||||
package com.fr.design.mainframe; |
||||
|
||||
import com.fr.invoke.Reflect; |
||||
import org.junit.Assert; |
||||
import org.junit.Test; |
||||
|
||||
/** |
||||
* Created by kerry on 2020-07-28 |
||||
*/ |
||||
public class JFormSliderPaneTest { |
||||
|
||||
@Test |
||||
public void testParseInputValue() { |
||||
JFormSliderPane sliderPane = new JFormSliderPane(); |
||||
int result = Reflect.on(sliderPane).call("parseInputValue", "100%").get(); |
||||
Assert.assertEquals(100, result); |
||||
result = Reflect.on(sliderPane).call("parseInputValue", "50%").get(); |
||||
Assert.assertEquals(50, result); |
||||
result = Reflect.on(sliderPane).call("parseInputValue", "50").get(); |
||||
Assert.assertEquals(50, result); |
||||
result = Reflect.on(sliderPane).call("parseInputValue", "50abc").get(); |
||||
Assert.assertEquals(100, result); |
||||
} |
||||
|
||||
@Test |
||||
public void testGetPreferredValue() { |
||||
JFormSliderPane sliderPane = new JFormSliderPane(); |
||||
int result = Reflect.on(sliderPane).call("getPreferredValue", 100).get(); |
||||
Assert.assertEquals(100, result); |
||||
result = Reflect.on(sliderPane).call("getPreferredValue", 0).get(); |
||||
Assert.assertEquals(10, result); |
||||
result = Reflect.on(sliderPane).call("getPreferredValue", 1000).get(); |
||||
Assert.assertEquals(400, result); |
||||
} |
||||
|
||||
@Test |
||||
public void testCalSliderValue() { |
||||
JFormSliderPane sliderPane = new JFormSliderPane(); |
||||
int result = Reflect.on(sliderPane).call("calSliderValue", 10).get(); |
||||
Assert.assertEquals(0, result); |
||||
result = Reflect.on(sliderPane).call("calSliderValue", 90).get(); |
||||
Assert.assertEquals(44, result); |
||||
result = Reflect.on(sliderPane).call("calSliderValue", 100).get(); |
||||
Assert.assertEquals(50, result); |
||||
result = Reflect.on(sliderPane).call("calSliderValue", 200).get(); |
||||
Assert.assertEquals(66, result); |
||||
result = Reflect.on(sliderPane).call("calSliderValue", 400).get(); |
||||
Assert.assertEquals(100, result); |
||||
|
||||
} |
||||
} |
Loading…
Reference in new issue