Buggy code:
static final RGB YELLOW = new RGB ( 255 , 255 , 0 ) ; static final RGB CYAN = new RGB ( 0 , 255 , 255 ) ; static final RGB PURPLE = new RGB ( 255 , 0 , 255 ) ; static final String PLATFORM_LINE_DELIMITER = System . getProperty ( "line.separator" ) ; Hashtable colors = new Hashtable ( ) ; private boolean listenerCalled ; private boolean listener2Called ; public Test_org_eclipse_swt_custom_StyledText ( String name ) { } public static void main ( String [ ] args ) { } protected void setUp ( ) { } protected void tearDown ( ) { } private StyleRange [ ] defaultStyles ( ) { } protected void getLineBackgrounds ( ) { } private String textString ( ) { } private boolean isBidi ( ) { } private StyleRange getStyle ( int start , int length , RGB fg , RGB bg ) { } private Color getColor ( RGB rgb ) { } protected void initializeColors ( ) { } public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI ( ) { } public void test_addExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener ( ) { } public void test_setKeyBindingII ( ) { } public void test_addBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener ( ) { } public void test_addLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener ( ) { } public void test_addLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener ( ) { } public void test_addModifyListenerLorg_eclipse_swt_events_ModifyListener ( ) { } public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener ( ) { } public void test_addVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener ( ) { } public void test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener ( ) { } public void test_appendLjava_lang_String ( ) { } public void test_computeSizeIIZ ( ) { } public void test_copy ( ) { } public void test_cut ( ) { } public void test_getBidiColoring ( ) { } public void test_getCaretOffset ( ) { } public void test_getContent ( ) { } public void test_getDoubleClickEnabled ( ) { } public void test_getEditable ( ) { } public void test_getHorizontalIndex ( ) { } public void test_getHorizontalPixel ( ) { } public void test_getKeyBindingI ( ) { } public void test_getCharCount ( ) { } public void test_getLineBackgroundI ( ) { } public void test_getLineCount ( ) { } public void test_getLineAtOffsetI ( ) { } public void test_getLineDelimiter ( ) { } public void test_getLineHeight ( ) { } public void test_getLineIndex ( ) { } void test_getLineIndex ( StyledText text ) { } public void test_getLinePixel ( ) { } void test_getLinePixel ( StyledText text ) { } public void test_getLocationAtOffsetI ( ) { } public void test_getOffsetAtLineI ( ) { } public void test_getOffsetAtLocationLorg_eclipse_swt_graphics_Point ( ) { boolean exceptionThrown = false ; Point location ; final int XINSET = ( isBidi ( ) ) ? 2 : 0 ; assertTrue ( ":a:" , ( ( text . getOffsetAtLocation ( new Point ( XINSET , 0 ) ) ) == 0 ) ) ; try { text . getOffsetAtLocation ( new Point ( ( - 1 ) , 0 ) ) ; } catch ( IllegalArgumentException e ) { exceptionThrown = true ; } assertTrue ( ":b:" , ( exceptionThrown == true ) ) ; exceptionThrown = false ; try { text . getOffsetAtLocation ( new Point ( 0 , ( - 1 ) ) ) ; } catch ( IllegalArgumentException e ) { exceptionThrown = true ; } assertTrue ( ":c:" , ( exceptionThrown == true ) ) ; exceptionThrown = false ; text . setText ( "Line0\r\nLine1" ) ; location = text . getLocationAtOffset ( 5 ) ; assertTrue ( ":d:" , ( ( text . getOffsetAtLocation ( new Point ( 10 , 0 ) ) ) > 0 ) ) ; <START_BUG> assertTrue ( ":e:" , ( ( text . getOffsetAtLocation ( new Point ( ( ( location . x ) - 1 ) , 0 ) ) ) == 4 ) ) ; <END_BUG> location = text . getLocationAtOffset ( 7 ) ; assertTrue ( ":f:" , ( ( text . getOffsetAtLocation ( location ) ) == 7 ) ) ; try { text . getOffsetAtLocation ( new Point ( 100 , 0 ) ) ; } catch ( IllegalArgumentException e ) { exceptionThrown = true ; } assertTrue ( ":g:" , ( exceptionThrown == true ) ) ; exceptionThrown = false ; try { text . getOffsetAtLocation ( new Point ( 100 , 50 ) ) ; } catch ( IllegalArgumentException e ) { exceptionThrown = true ; } assertTrue ( ":h:" , ( exceptionThrown == true ) ) ; exceptionThrown = false ; text . setTopIndex ( 1 ) ; assertTrue ( ":i:" , ( ( text . getOffsetAtLocation ( new Point ( XINSET , ( - 5 ) ) ) ) == 0 ) ) ; assertTrue ( ":j:" , ( ( text . getOffsetAtLocation ( new Point ( XINSET , 0 ) ) ) == 7 ) ) ; text . setHorizontalIndex ( 1 ) ; assertTrue ( ":k:" , ( ( text . getOffsetAtLocation ( new Point ( ( XINSET + ( - 5 ) ) , ( - 5 ) ) ) ) == 0 ) ) ; assertTrue ( ":l:" , ( ( text . getOffsetAtLocation ( new Point ( ( XINSET + ( - 5 ) ) , 0 ) ) ) == 7 ) ) ; assertTrue ( ":m:" , ( ( text . getOffsetAtLocation ( text . getLocationAtOffset ( 2 ) ) ) == 2 ) ) ; text . setHorizontalIndex ( 0 ) ; assertTrue ( ":n:" , ( ( text . getOffsetAtLocation ( text . getLocationAtOffset ( 2 ) ) ) == 2 ) ) ; } public void test_getOrientation ( ) { } public void test_getSelection ( ) { } public void test_getSelectionBackground ( ) { } public void test_getSelectionForeground ( ) { } public void test_getSelectionRange ( ) { } public void test_getSelectionCount ( ) { } public void test_getSelectionText ( ) { } public void test_getStyleRangeAtOffsetI ( ) { } public void test_getStyleRanges ( ) { } public void test_getStyleRangesII ( ) { } public void test_getTabs ( ) { }

Fix:
assertTrue ( ":e:" , ( ( text . getOffsetAtLocation ( new Point ( ( ( location . x ) - 1 ) , 0 ) ) ) == 5 ) ) ;