Beispiel #1
0
  /**
   * Performs a test (of the given identifying name) on the canvas and an associated tool by
   * injecting the given inputs, and comparing the final state of the associated tool with the
   * expected one given.
   */
  public void performTest(String testID, Inputs inputs, int expectedState) throws Exception {
    this.testID = testID;

    try {
      // perform the inputs on the canvas
      inputs.perform();
      Activepoller_c.Oneshot();

      // test that the new current tool state is the given one
      // that was expected
      int currentState = inputs.getToolCurrentState();
      assertTrue(
          "Expected State: " + expectedState + " got " + currentState,
          currentState == expectedState);

      validateOrGenerateResults(
          UITestingUtilities.getGraphicalEditorFor(
              (NonRootModelElement) canvas.getRepresents(), true),
          recordResults,
          true);
    } finally {
      // perform the given cleanup inputs on the canvas
      inputs.cleanup();
      Activepoller_c.Oneshot();
    }
  }