コード例 #1
0
  /**
   * Test clears formula and value contents, calls the method <code>computeFunction</code> and
   * checks returned value.
   *
   * <p>Has <b> OK </b> status if returned value is equal to zero and no exceptions were thrown.
   *
   * <p>
   */
  public void _clearContents() {
    boolean result = true;
    double resultVal = -1;

    log.println("Testing clearContents() ...");

    int allFlags;
    allFlags = CellFlags.VALUE | CellFlags.FORMULA;

    oObj.clearContents(allFlags);

    try {
      resultVal = oObj.computeFunction(GeneralFunction.SUM);
      result &= (resultVal == 0.0) || (resultVal == 0);
    } catch (com.sun.star.uno.Exception e) {
      result &= false;
      log.println("Exception occurred while checking results of method");
      e.printStackTrace(log);
    }

    tRes.tested("clearContents()", result);
  } // finished clearContents
コード例 #2
0
  /**
   * Test calls the method and checks returned value.
   *
   * <p>Has <b> OK </b> status if returned value is equal or greate than zero and no exceptions were
   * thrown.
   *
   * <p>
   */
  public void _computeFunction() {

    log.println("Testing computeFunction() ...");
    double resultVal = -1;
    boolean result = true;

    try {
      resultVal = oObj.computeFunction(GeneralFunction.COUNT);
      result = resultVal >= 0;
    } catch (com.sun.star.uno.Exception e) {
      result = false;
      log.println("Exception occurred in method computeFunction.");
      e.printStackTrace(log);
    }

    tRes.tested("computeFunction()", result);
  } // finished computeFunction