edu.rice.cs.drjava.model
Class GlobalIndentTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by edu.rice.cs.drjava.DrJavaTestCase
              extended by edu.rice.cs.drjava.model.MultiThreadedTestCase
                  extended by edu.rice.cs.drjava.model.GlobalModelTestCase
                      extended by edu.rice.cs.drjava.model.GlobalIndentTest
All Implemented Interfaces:
Test

public final 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 4447 2008-04-18 16:06:34Z rcartwright $

Nested Class Summary
 
Nested classes/interfaces inherited from class edu.rice.cs.drjava.model.GlobalModelTestCase
GlobalModelTestCase.CancelingSelector, GlobalModelTestCase.CompileShouldFailListener, GlobalModelTestCase.CompileShouldSucceedListener, GlobalModelTestCase.FileMovedWarningException, GlobalModelTestCase.FileSelector, GlobalModelTestCase.InteractionListener, GlobalModelTestCase.JUnitNonTestListener, GlobalModelTestCase.JUnitTestListener, GlobalModelTestCase.OpenWarningException, GlobalModelTestCase.OverwriteException, GlobalModelTestCase.TestGlobalModel, GlobalModelTestCase.TestListener, GlobalModelTestCase.WarningFileSelector
 
Field Summary
 
Fields inherited from class edu.rice.cs.drjava.model.GlobalModelTestCase
_doc, _interactionsController, _log, _model, _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 edu.rice.cs.drjava.model.MultiThreadedTestCase
_testFailed
 
Fields inherited from class edu.rice.cs.drjava.DrJavaTestCase
TEST_DRJAVA_CONFIG_PROPERTY
 
Constructor Summary
GlobalIndentTest()
           
 
Method Summary
 void testIndentDoesNothing()
          Indent does nothing to change the document when everything is in place.
 void testIndentGrowTabAtEnd()
          Tests that an indent 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 that an indent 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()
          Tests that an indent matches up with the indent on the line above.
 void testIndentSameAsLineAboveAtStart()
          Tests that an indent matches up with the indent on the line above.
 void testIndentShrinkTabAtEnd()
          Tests that an indent increases the size of the tab when the cursor is at the end of the line.
 void testIndentShrinkTabAtMiddle()
          Tests that an indent increases the size of the tab when the cursor is in the middle of the line.
 void testIndentShrinkTabAtStart()
          Tests that an indent 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, assertInteractionsContains, assertInteractionsDoesNotContain, assertInteractionsDoesNotMatch, assertInteractionsMatches, assertLength, assertModified, assertNumOpenDocs, changeDocumentText, classForJava, createFile, doCompile, doCompile, getCompilerErrorString, getInteractionsText, interpret, interpretIgnoreResult, safeLoadHistory, safeSaveHistory, saveAllFiles, saveFile, saveFileAs, setUp, setupDocument, tearDown, tempDirectory, tempFile, tempFile, testStartCompile, writeToNewTempFile
 
Methods inherited from class edu.rice.cs.drjava.model.MultiThreadedTestCase
join, listenerFail, wait
 
Methods inherited from class edu.rice.cs.drjava.DrJavaTestCase
setConfigSetting, setDocText
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GlobalIndentTest

public GlobalIndentTest()
Method Detail

testIndentGrowTabAtStart

public void testIndentGrowTabAtStart()
                              throws BadLocationException,
                                     OperationCanceledException
Tests that an indent increases the size of the tab when the cursor is at the start of the line. If 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
OperationCanceledException

testIndentGrowTabAtMiddle

public void testIndentGrowTabAtMiddle()
                               throws BadLocationException,
                                      OperationCanceledException
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
OperationCanceledException

testIndentGrowTabAtEnd

public void testIndentGrowTabAtEnd()
                            throws BadLocationException,
                                   OperationCanceledException
Tests that an indent 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
OperationCanceledException

testIndentShrinkTabAtStart

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

Throws:
BadLocationException
OperationCanceledException

testIndentShrinkTabAtMiddle

public void testIndentShrinkTabAtMiddle()
                                 throws BadLocationException,
                                        OperationCanceledException
Tests that an indent 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
OperationCanceledException

testIndentShrinkTabAtEnd

public void testIndentShrinkTabAtEnd()
                              throws BadLocationException,
                                     OperationCanceledException
Tests that an indent 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
OperationCanceledException

testIndentSameAsLineAboveAtStart

public void testIndentSameAsLineAboveAtStart()
                                      throws BadLocationException,
                                             OperationCanceledException
Tests that an indent matches up with the indent on the line above. The cursor is at the start of the line.

Throws:
BadLocationException
OperationCanceledException

testIndentSameAsLineAboveAtEnd

public void testIndentSameAsLineAboveAtEnd()
                                    throws BadLocationException,
                                           OperationCanceledException
Tests that an indent matches up with the indent on the line above. The cursor is at the end of the line.

Throws:
BadLocationException
OperationCanceledException

testIndentInsideParenAtStart

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

Throws:
BadLocationException
OperationCanceledException

testIndentInsideParenAtEnd

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

Throws:
BadLocationException
OperationCanceledException

testIndentDoesNothing

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

Throws:
BadLocationException
OperationCanceledException