3 import static org.junit.Assert.assertEquals;
5 import javax.swing.JScrollBar;
9 public class JvSwingUtilsTest
13 public void testGetScrollBarProportion()
16 * orientation, value, extent (width), min, max
18 JScrollBar sb = new JScrollBar(0, 125, 50, 0, 450);
21 * operating range is 25 - 425 (400 wide) so value 125 is 100/400ths of this
24 assertEquals(0.25f, JvSwingUtils.getScrollBarProportion(sb), 0.001f);
28 public void testGetScrollValueForProportion()
31 * orientation, value, extent (width), min, max
33 JScrollBar sb = new JScrollBar(0, 125, 50, 0, 450);
36 * operating range is 25 - 425 (400 wide) so value 125 is a quarter of this
39 assertEquals(125, JvSwingUtils.getScrollValueForProportion(sb, 0.25f));