edu.rice.cs.drjava.model
Class GlobalIndentTest

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--edu.rice.cs.drjava.model.GlobalModelTestCase
                    |
                    +--edu.rice.cs.drjava.model.GlobalIndentTest
All Implemented Interfaces:
Test

public class GlobalIndentTest
extends GlobalModelTestCase

Tests the indenting functionality on the level of the GlobalModel. Not only are we testing that the document turns out right, but also that the cursor position in the document is consistent with a standard.

Version:
$Id: GlobalIndentTest.java,v 1.8 2002/02/08 14:22:19 brianstoler Exp $

Inner classes inherited from class edu.rice.cs.drjava.model.GlobalModelTestCase
GlobalModelTestCase.CancelingSelector, GlobalModelTestCase.CompileShouldFailListener, GlobalModelTestCase.CompileShouldSucceedListener, GlobalModelTestCase.FileSelector, GlobalModelTestCase.OpenWarningException, GlobalModelTestCase.OverwriteException, GlobalModelTestCase.TestListener, GlobalModelTestCase.WarningFileSelector
 
Field Summary
private static String BAR_CALL_1
           
private static String BAR_CALL_2
           
private static String BEAT_1
           
private static String BEAT_2
           
private static String FOO_EX_1
           
private static String FOO_EX_2
           
 
Fields inherited from class edu.rice.cs.drjava.model.GlobalModelTestCase
_model, _originalModel, _tempDir, BAR_TEXT, BAZ_TEXT, FOO_MISSING_CLOSE_TEXT, FOO_PACKAGE_AFTER_IMPORT, FOO_PACKAGE_AS_FIELD, FOO_PACKAGE_AS_FIELD_2, FOO_PACKAGE_AS_PART_OF_FIELD, FOO_PACKAGE_INSIDE_CLASS, FOO_TEXT
 
Fields inherited from class junit.framework.TestCase
fName
 
Constructor Summary
GlobalIndentTest(String name)
          put your documentation comment here
 
Method Summary
private  void _assertContents(String expected, Document document)
           
private  void _assertLocation(int loc, OpenDefinitionsDocument openDoc)
           
private  void _assertNumOpenDocs(int num)
           
private  OpenDefinitionsDocument _getOpenDoc()
          Get the only open definitions document.
static Test suite()
          put your documentation comment here
 void testIndentDoesNothing()
          Indent does nothing to change the document when everything is in place.
 void testIndentGrowTabAtEnd()
          Tests indent that increases the size of the tab when the cursor is at the end of the line.
 void testIndentGrowTabAtMiddle()
          Tests indent that increases the size of the tab when the cursor is in the middle of the line.
 void testIndentGrowTabAtStart()
          Tests indent that increases the size of the tab when the cursor is at the start of the line.
 void testIndentInsideParenAtEnd()
          Do an indent that follows the behavior in line with parentheses.
 void testIndentInsideParenAtStart()
          Do an indent that follows the behavior in line with parentheses.
 void testIndentSameAsLineAboveAtEnd()
          Do an indent that should match up with the indent on the line above.
 void testIndentSameAsLineAboveAtStart()
          Do an indent that should match up with the indent on the line above.
 void testIndentShrinkTabAtEnd()
          Tests indent that increases the size of the tab when the cursor is at the end of the line.
 void testIndentShrinkTabAtMiddle()
          Tests indent that increases the size of the tab when the cursor is in the middle of the line.
 void testIndentShrinkTabAtStart()
          Tests indent that increases the size of the tab when the cursor is at the start of the line.
 
Methods inherited from class edu.rice.cs.drjava.model.GlobalModelTestCase
assertCompileErrorsPresent, assertCompileErrorsPresent, assertContents, assertLength, assertModified, assertNumOpenDocs, changeDocumentText, classForJava, createFile, createModel, interpret, interpretIgnoreResult, setUp, setupDocument, tearDown, tempDirectory, tempFile, tempFile, writeToNewTempFile
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, name, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

FOO_EX_1

private static final String FOO_EX_1

FOO_EX_2

private static final String FOO_EX_2

BAR_CALL_1

private static final String BAR_CALL_1

BAR_CALL_2

private static final String BAR_CALL_2

BEAT_1

private static final String BEAT_1

BEAT_2

private static final String BEAT_2
Constructor Detail

GlobalIndentTest

public GlobalIndentTest(String name)
put your documentation comment here
Parameters:
String - name
Method Detail

suite

public static Test suite()
put your documentation comment here
Returns:
 

testIndentGrowTabAtStart

public void testIndentGrowTabAtStart()
                              throws BadLocationException
Tests indent that increases the size of the tab when the cursor is at the start of the line. When the cursor is in the whitespace before the first word on a line, indent always moves the cursor up to the beginning of the first non-whitespace character.
Throws:
BadLocationException -  

testIndentGrowTabAtMiddle

public void testIndentGrowTabAtMiddle()
                               throws BadLocationException
Tests indent that increases the size of the tab when the cursor is in the middle of the line. The cursor stays in the same place.
Throws:
BadLocationException -  

testIndentGrowTabAtEnd

public void testIndentGrowTabAtEnd()
                            throws BadLocationException
Tests indent that increases the size of the tab when the cursor is at the end of the line. The cursor stays in the same place.
Throws:
BadLocationException -  

testIndentShrinkTabAtStart

public void testIndentShrinkTabAtStart()
                                throws BadLocationException
Tests indent that increases the size of the tab when the cursor is at the start of the line. When the cursor is in the whitespace before the first word on a line, indent always moves the cursor up to the beginning of the first non-whitespace character.
Throws:
BadLocationException -  

testIndentShrinkTabAtMiddle

public void testIndentShrinkTabAtMiddle()
                                 throws BadLocationException
Tests indent that increases the size of the tab when the cursor is in the middle of the line. The cursor stays in the same place.
Throws:
BadLocationException -  

testIndentShrinkTabAtEnd

public void testIndentShrinkTabAtEnd()
                              throws BadLocationException
Tests indent that increases the size of the tab when the cursor is at the end of the line. The cursor stays in the same place.
Throws:
BadLocationException -  

testIndentSameAsLineAboveAtStart

public void testIndentSameAsLineAboveAtStart()
                                      throws BadLocationException
Do an indent that should match up with the indent on the line above. The cursor is at the start of the line.
Throws:
BadLocationException -  

testIndentSameAsLineAboveAtEnd

public void testIndentSameAsLineAboveAtEnd()
                                    throws BadLocationException
Do an indent that should match up with the indent on the line above. The cursor is at the end of the line.
Throws:
BadLocationException -  

testIndentInsideParenAtStart

public void testIndentInsideParenAtStart()
                                  throws BadLocationException
Do an indent that follows the behavior in line with parentheses. The cursor is at the start of the line.
Throws:
BadLocationException -  

testIndentInsideParenAtEnd

public void testIndentInsideParenAtEnd()
                                throws BadLocationException
Do an indent that follows the behavior in line with parentheses. The cursor is at the end of the line.
Throws:
BadLocationException -  

testIndentDoesNothing

public void testIndentDoesNothing()
                           throws BadLocationException
Indent does nothing to change the document when everything is in place.

_getOpenDoc

private OpenDefinitionsDocument _getOpenDoc()
Get the only open definitions document.

_assertNumOpenDocs

private void _assertNumOpenDocs(int num)

_assertContents

private void _assertContents(String expected,
                             Document document)
                      throws BadLocationException

_assertLocation

private void _assertLocation(int loc,
                             OpenDefinitionsDocument openDoc)