Esempio n. 1
0
  /**
   * Creates a <CODE>MyKeyHandler</CODE> and adds it to the <CODE>XUserInputInterception</CODE>.
   * Then an <CODE>EventTrigger</CODE> thread was created and started. Has <CODE>OK</CODE> if the
   * members <CODE>m_keyPressed</CODE> and <CODE>m_keyReleased</CODE> are <CODE>TRUE</CODE>
   *
   * @param xUII the XUserInputInterception
   * @param xModel the XModel of a document
   * @see EventTest.MyKeyHandler
   * @see EventTest.EventTrigger
   */
  private void checkKeyListener(XUserInputInterception xUII, XModel xModel) {
    m_keyPressed = false;
    m_keyReleased = false;

    MyKeyHandler keyListener = new MyKeyHandler();

    xUII.addKeyHandler(keyListener);

    System.out.println("starting thread to check the key listener...");
    EventTrigger et = new EventTrigger(xModel, EventTriggerType.KEY_TEXT_INTO_DOC);

    et.run();

    util.utils.waitForEventIdle(getMSF());
    System.out.println("key listener thread should be finished.");

    assertTrue("key event does not work!", m_keyPressed && m_keyReleased);
    xUII.removeKeyHandler(keyListener);
  }
Esempio n. 2
0
  /**
   * Creates a <CODE>MyMouseClickHandler</CODE> and adds it to the <CODE>XUserInputInterception
   * </CODE>. Then an <CODE>EventTrigger</CODE> thread was created and started. Has <CODE>OK</CODE>
   * if the members <CODE>m_mousePressed</CODE> and <CODE>m_mouseReleased</CODE> are <CODE>TRUE
   * </CODE>
   *
   * @param xUII the XUserInputInterception
   * @param xModel the XModel of a document
   * @see EventTest.MyMouseClickHandler
   * @see EventTest.EventTrigger
   */
  private void checkMouseListener(XUserInputInterception xUII, XModel xModel) {

    m_mousePressed = false;
    m_mouseReleased = false;

    MyMouseClickHandler mouseListener = new MyMouseClickHandler();

    xUII.addMouseClickHandler(mouseListener);

    System.out.println("starting thread to check the mouse listener...");
    EventTrigger et = new EventTrigger(xModel, EventTriggerType.MOUSE_KLICK_INTO_DOC);

    et.run();

    util.utils.waitForEventIdle(getMSF());
    System.out.println("mouse listener thread should be finished.");

    assertTrue("mouse event does not work!", m_mousePressed && m_mouseReleased);
    xUII.removeMouseClickHandler(mouseListener);
  }