Beispiel #1
0
  /**
   * Make sure that the InteractionsPane is displaying the correct InteractionsDocument.
   * (SourceForge bug #681547) Also make sure this document cannot be edited before the prompt.
   */
  public void testCorrectInteractionsDocument() throws EditDocumentException {
    InteractionsPane pane = _frame.getInteractionsPane();
    final SingleDisplayModel model = _frame.getModel();
    InteractionsDJDocument doc = model.getSwingInteractionsDocument();

    // Make the test silent
    Utilities.invokeAndWait(
        new Runnable() {
          public void run() {
            model.getInteractionsModel().getDocument().setBeep(new TestBeep());
          }
        });
    Utilities.clearEventQueue();

    // Test for strict == equality
    assertTrue("UI's int. doc. should equals Model's int. doc.", pane.getDocument() == doc);

    int origLength = doc.getLength();
    doc.insertText(1, "typed text", ConsoleDocument.DEFAULT_STYLE);
    Utilities.clearEventQueue();
    assertEquals("Document should not have changed.", origLength, doc.getLength());
    _log.log("testCorrectInteractionsDocument completed");
  }