edu.rice.cs.drjava.ui
Class MainFrameTest

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

public final class MainFrameTest
extends MultiThreadedTestCase

Test functions of MainFrame.

Version:
$Id: MainFrameTest.java 4691 2008-12-02 23:33:27Z dlsmith $

Field Summary
protected  boolean _closeDone
           
protected  Object _closeLock
           
protected  boolean _compileDone
           
protected  Object _compileLock
           
protected  boolean _openDone
           
protected  Object _openLock
           
 
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
MainFrameTest()
           
 
Method Summary
 void setUp()
          Setup method for each JUnit test case.
 void tearDown()
          If any test failed, print a message saying that some test failed in another thread (not the testing thread).
protected  File tempFile(String fileName)
          Create a new temporary file in _tempDir.
 void testClearLine()
          Tests that the clipboard is unmodified after a "clear line" action.
 void testCorrectInteractionsDocument()
          Make sure that the InteractionsPane is displaying the correct InteractionsDocument.
 void testCreateManualToolbarButton()
          Tests that the returned JButton of createManualToolbarButton: 1.
 void testCutLine()
          Tests that the clipboard is modified after a "cut line" action.
 void testDancingUIFileClosed()
          A Test to guarantee that the Dancing UI bug will not rear its ugly head again.
 void testDancingUIFileOpened()
          A Test to guarantee that the Dancing UI bug will not rear its ugly head again.
 void testDocLocationAfterSwitch()
          Tests that the current location of a document is equal to the caret Position after switching to another document and back.
 void testGlassPaneEditableState()
          Ensure that a document's editable status is set appropriately throughout the compile process.
 void testGlassPaneHidesKeyEvents()
          Ensure that all key events are disabled when the glass pane is up.
 void testGotoFileUnderCursor()
          Tests that "go to file under cursor" works if unique.
 void testGotoFileUnderCursorAppendJava()
          Tests that "go to file under cursor" works if unique after appending ".java"
 void testGotoFileUnderCursorShowDialog()
          Tests that "go to file under cursor" displays the dialog if choice is not unique
 void testMultilineIndentAfterScroll()
          Tests that undoing/redoing a multi-line indent will restore the caret position.
 void testSaveButtonEnabled()
          Tests that the save button does not set itself as enabled immediately after opening a file.
 
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
 

Field Detail

_openDone

protected volatile boolean _openDone

_openLock

protected final Object _openLock

_closeDone

protected volatile boolean _closeDone

_closeLock

protected final Object _closeLock

_compileDone

protected volatile boolean _compileDone

_compileLock

protected final Object _compileLock
Constructor Detail

MainFrameTest

public MainFrameTest()
Method Detail

setUp

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

Overrides:
setUp in class MultiThreadedTestCase
Throws:
Exception - This convention is mandated by the JUnit TestCase class which is an ancestor of this class.

tearDown

public void tearDown()
              throws Exception
Description copied from class: MultiThreadedTestCase
If any test failed, print a message saying that some test failed in another thread (not the testing thread).

Overrides:
tearDown in class MultiThreadedTestCase
Throws:
Exception

testCreateManualToolbarButton

public void testCreateManualToolbarButton()
Tests that the returned JButton of createManualToolbarButton: 1. Is disabled upon return. 2. Inherits the tooltip of the Action parameter a.


testDocLocationAfterSwitch

public void testDocLocationAfterSwitch()
                                throws BadLocationException
Tests that the current location of a document is equal to the caret Position after switching to another document and back.

Throws:
BadLocationException

testClearLine

public void testClearLine()
                   throws BadLocationException,
                          UnsupportedFlavorException,
                          IOException
Tests that the clipboard is unmodified after a "clear line" action.

Throws:
BadLocationException
UnsupportedFlavorException
IOException

testCutLine

public void testCutLine()
                 throws BadLocationException
Tests that the clipboard is modified after a "cut line" action. NOTE: Commented out for commit because of failures, despite proper behavior in GUI. This may not work unless ActionEvents are dropped in the event queue

Throws:
BadLocationException

testCorrectInteractionsDocument

public void testCorrectInteractionsDocument()
                                     throws EditDocumentException
Make sure that the InteractionsPane is displaying the correct InteractionsDocument. (SourceForge bug #681547) Also make sure this document cannot be edited before the prompt.

Throws:
EditDocumentException

testMultilineIndentAfterScroll

public void testMultilineIndentAfterScroll()
                                    throws BadLocationException,
                                           InterruptedException
Tests that undoing/redoing a multi-line indent will restore the caret position.

Throws:
BadLocationException
InterruptedException

testGlassPaneEditableState

public void testGlassPaneEditableState()
Ensure that a document's editable status is set appropriately throughout the compile process. Since the behavior is interesting only when the model changes its active document, that's what this test looks most like.


testGlassPaneHidesKeyEvents

public void testGlassPaneHidesKeyEvents()
Ensure that all key events are disabled when the glass pane is up.


testSaveButtonEnabled

public void testSaveButtonEnabled()
                           throws IOException
Tests that the save button does not set itself as enabled immediately after opening a file.

Throws:
IOException

testDancingUIFileOpened

public void testDancingUIFileOpened()
                             throws IOException
A Test to guarantee that the Dancing UI bug will not rear its ugly head again. Basically, add a component listener to the leftComponent of _docSplitPane and make certain its size does not change while compiling a class which depends on another class.

Throws:
IOException

testDancingUIFileClosed

public void testDancingUIFileClosed()
                             throws IOException
A Test to guarantee that the Dancing UI bug will not rear its ugly head again. Basically, add a component listener to the leftComponent of _docSplitPane and make certain its size does not change while closing an OpenDefinitionsDocument outside the event thread.

Throws:
IOException

tempFile

protected File tempFile(String fileName)
                 throws IOException
Create a new temporary file in _tempDir.

Throws:
IOException

testGotoFileUnderCursor

public void testGotoFileUnderCursor()
                             throws IOException
Tests that "go to file under cursor" works if unique.

Throws:
IOException

testGotoFileUnderCursorAppendJava

public void testGotoFileUnderCursorAppendJava()
                                       throws IOException
Tests that "go to file under cursor" works if unique after appending ".java"

Throws:
IOException

testGotoFileUnderCursorShowDialog

public void testGotoFileUnderCursorShowDialog()
                                       throws IOException
Tests that "go to file under cursor" displays the dialog if choice is not unique

Throws:
IOException