public class setSelectionStart implements Testlet
{
public void test(TestHarness harness)
{
TextComponent textComp = new TextField();
// Check that default value is correct.
harness.check(textComp.getSelectionStart(), 0);
harness.check(textComp.getSelectionEnd(), 0);
// Check behaviour when setting text.
textComp.setText("This is some text.");
harness.check(textComp.getSelectionStart(), 0);
harness.check(textComp.getSelectionEnd(), 0);
// Check behaviour when start < 0.
textComp.setSelectionStart(-6);
harness.check(textComp.getSelectionStart(), 0);
harness.check(textComp.getSelectionEnd(), 0);
// Check behaviour when start = end
textComp.setSelectionStart(0);
harness.check(textComp.getSelectionStart(), 0);
harness.check(textComp.getSelectionEnd(), 0);
// Check behaviour when start > end
textComp.setSelectionStart(13);
harness.check(textComp.getSelectionStart(), 13);
harness.check(textComp.getSelectionEnd(), 13);
// Check behaviour when start < end
textComp.setSelectionStart(9);
harness.check(textComp.getSelectionStart(), 9);
harness.check(textComp.getSelectionEnd(), 13);
}