edu.rice.cs.drjava.ui
Class InteractionsPaneTest

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.ui.InteractionsPaneTest
All Implemented Interfaces:
Test

public final class InteractionsPaneTest
extends DrJavaTestCase

Test functions of InteractionsPane.

Version:
$Id: InteractionsPaneTest.java 5439 2011-08-11 17:13:04Z rcartwright $

Nested Class Summary
 
Nested classes/interfaces inherited from class junit.framework.TestCase
TestCase.WrappedException
 
Field Summary
protected  InteractionsDJDocument _adapter
           
protected  InteractionsController _controller
           
protected  InteractionsDocument _doc
           
protected  InteractionsModel _model
           
protected  InteractionsPane _pane
           
private static int PRESSED
           
private static int RELEASED
           
private static int SHIFT
           
private static int TYPED
           
private static char UNDEFINED
           
private static int VK_UNDEF
           
 
Constructor Summary
InteractionsPaneTest()
           
 
Method Summary
 void setUp()
          Setup method for each JUnit test case.
 void tearDown()
          Clean up for every test case.
 void testCannotEditBeforePrompt()
          Tests that the InteractionsPane cannot be edited before the prompt.
 void testCaretMovementCyclesWhenAtEnd()
          Tests that moving the caret right when it's already at the end will cycle it to the prompt.
 void testCaretMovementCyclesWhenAtPrompt()
          Tests that moving the caret left when it's already at the prompt will cycle it to the end of the line.
 void testCaretMovesUpToPromptAfterInsert()
          Tests that the caret catches up to the prompt if it is before it and output is displayed.
 void testCaretStaysAtEndDuringInteraction()
           
 void testCaretUpdatedOnInsert()
          Tests that the caret is put in the correct position after an insert.
 void testClearCurrentInteraction()
          Tests that the caret is moved properly when the current interaction is cleared.
 void testHistoryRecallNextMovesToEnd()
          Tests that moving the caret down (recalling the next command from history) will move the caret to the end of the document.
 void testHistoryRecallPrevMovesToEnd()
          Tests that moving the caret up (recalling the previous command from history) will move the caret to the end of the document.
 void testInitialPosition()
          Tests that this.setUp() puts the caret in the correct position.
 void testLeftBeforePromptMovesToPrompt()
          Tests that moving the caret left when it's before the prompt will cycle it to the prompt.
 void testRightBeforePromptMovesToEnd()
          Tests that moving the caret right when it's before the prompt will cycle it to the end of the document.
 void testSystemIn_NOJOIN()
           
 void testUndoRedoNewLine()
          Tests to see if SHIFT_ENTER starts a new undo action
 void testUndoRedoWorks()
          Tests basic functionality of undo/redo
 
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
 

Field Detail

UNDEFINED

private static final char UNDEFINED
See Also:
Constant Field Values

PRESSED

private static final int PRESSED
See Also:
Constant Field Values

RELEASED

private static final int RELEASED
See Also:
Constant Field Values

SHIFT

private static final int SHIFT
See Also:
Constant Field Values

TYPED

private static final int TYPED
See Also:
Constant Field Values

VK_UNDEF

private static final int VK_UNDEF
See Also:
Constant Field Values

_adapter

protected volatile InteractionsDJDocument _adapter

_model

protected volatile InteractionsModel _model

_doc

protected volatile InteractionsDocument _doc

_pane

protected volatile InteractionsPane _pane

_controller

protected volatile InteractionsController _controller
Constructor Detail

InteractionsPaneTest

public InteractionsPaneTest()
Method Detail

setUp

public void setUp()
           throws Exception
Setup method for each JUnit test case.

Overrides:
setUp in class DrJavaTestCase
Throws:
Exception - This convention is mandated by JUnit.TestCase, the superclass of this class.

tearDown

public void tearDown()
              throws Exception
Description copied from class: DrJavaTestCase
Clean up for every test case. Only used in unit tests. Added because Windows would intermittently throw a java.util.concurrent.RejectedExecutionException during cleanup.

Overrides:
tearDown in class DrJavaTestCase
Throws:
Exception

testInitialPosition

public void testInitialPosition()
Tests that this.setUp() puts the caret in the correct position.


testCaretMovementCyclesWhenAtPrompt

public void testCaretMovementCyclesWhenAtPrompt()
                                         throws EditDocumentException
Tests that moving the caret left when it's already at the prompt will cycle it to the end of the line.

Throws:
EditDocumentException

testCaretMovementCyclesWhenAtEnd

public void testCaretMovementCyclesWhenAtEnd()
                                      throws EditDocumentException
Tests that moving the caret right when it's already at the end will cycle it to the prompt.

Throws:
EditDocumentException

testLeftBeforePromptMovesToPrompt

public void testLeftBeforePromptMovesToPrompt()
Tests that moving the caret left when it's before the prompt will cycle it to the prompt.


testRightBeforePromptMovesToEnd

public void testRightBeforePromptMovesToEnd()
Tests that moving the caret right when it's before the prompt will cycle it to the end of the document.


testHistoryRecallPrevMovesToEnd

public void testHistoryRecallPrevMovesToEnd()
Tests that moving the caret up (recalling the previous command from history) will move the caret to the end of the document.


testHistoryRecallNextMovesToEnd

public void testHistoryRecallNextMovesToEnd()
Tests that moving the caret down (recalling the next command from history) will move the caret to the end of the document.


testCaretStaysAtEndDuringInteraction

public void testCaretStaysAtEndDuringInteraction()
                                          throws EditDocumentException
Throws:
EditDocumentException

testCaretMovesUpToPromptAfterInsert

public void testCaretMovesUpToPromptAfterInsert()
                                         throws EditDocumentException
Tests that the caret catches up to the prompt if it is before it and output is displayed.

Throws:
EditDocumentException

testClearCurrentInteraction

public void testClearCurrentInteraction()
                                 throws EditDocumentException
Tests that the caret is moved properly when the current interaction is cleared.

Throws:
EditDocumentException

testCannotEditBeforePrompt

public void testCannotEditBeforePrompt()
                                throws EditDocumentException
Tests that the InteractionsPane cannot be edited before the prompt.

Throws:
EditDocumentException

testCaretUpdatedOnInsert

public void testCaretUpdatedOnInsert()
                              throws EditDocumentException
Tests that the caret is put in the correct position after an insert.

Throws:
EditDocumentException

testSystemIn_NOJOIN

public void testSystemIn_NOJOIN()

testUndoRedoWorks

public void testUndoRedoWorks()
Tests basic functionality of undo/redo


testUndoRedoNewLine

public void testUndoRedoNewLine()
Tests to see if SHIFT_ENTER starts a new undo action