@Test
public void testFixSelectionOffset() {

	String text = "something not too long";
	Assert.assertEquals( 0, TextUtils.fixSelectionOffset( text, -2 ));
	Assert.assertEquals( 0, TextUtils.fixSelectionOffset( text, 500 ));
	Assert.assertEquals( 0, TextUtils.fixSelectionOffset( text, 2 ));
	Assert.assertEquals( 0, TextUtils.fixSelectionOffset( text, 0 ));
	text = "  something not too long";
	Assert.assertEquals( 0, TextUtils.fixSelectionOffset( text, 0 ));
	Assert.assertEquals( 0, TextUtils.fixSelectionOffset( text, 1 ));
	Assert.assertEquals( 0, TextUtils.fixSelectionOffset( text, 2 ));
	Assert.assertEquals( 0, TextUtils.fixSelectionOffset( text, 3 ));
	text = "\nline 1\r\nline 2";
	Assert.assertEquals( 9, TextUtils.fixSelectionOffset( text, 9 ));
	Assert.assertEquals( 9, TextUtils.fixSelectionOffset( text, 10 ));
	Assert.assertEquals( 9, TextUtils.fixSelectionOffset( text, 11 ));
	Assert.assertEquals( 9, TextUtils.fixSelectionOffset( text, 12 ));
	Assert.assertEquals( 0, TextUtils.fixSelectionOffset( text, 0 ));
	Assert.assertEquals( 1, TextUtils.fixSelectionOffset( text, 1 ));
	Assert.assertEquals( 1, TextUtils.fixSelectionOffset( text, 2 ));
	Assert.assertEquals( 1, TextUtils.fixSelectionOffset( text, 3 ));
}