public void changeProp(String name) {

    Object gValue = null;
    Object sValue = null;
    Object ValueToSet = null;

    try {
      // waitForAllThreads();
      gValue = oObj.getPropertyValue(name);
      // waitForAllThreads();
      if ((name.equals("LineEnd")) || (name.equals("LineStart"))) {
        if (gValue == null) gValue = newPoints(null);
        ValueToSet = newPoints((Point[]) gValue);
      } else {
        ValueToSet = ValueChanger.changePValue(gValue);
      }
      // waitForAllThreads();
      oObj.setPropertyValue(name, ValueToSet);
      sValue = oObj.getPropertyValue(name);

      // check get-set methods
      if (gValue.equals(sValue)) {
        log.println("Value for '" + name + "' hasn't changed");
        tRes.tested(name, false);
      } else {
        log.println("Property '" + name + "' OK");
        tRes.tested(name, true);
      }
    } catch (Exception e) {
      log.println("Exception occurred while testing property '" + name + "'");
      e.printStackTrace(log);
      tRes.tested(name, false);
    }
  } // end of ChangeProp
示例#2
0
  /**
   * Tries to change each property of each control. Has <b>OK</b> status if values are properly
   * changed.
   */
  public void _setControlProperty() {
    boolean result = true;
    String error = "";

    for (int i = 0; i < supControls.length; i++) {
      log.println("Checking properties for control " + supControls[i]);
      for (int j = 0; j < supProperties[i].length; j++) {
        log.println("\t" + supProperties[i][j]);
        try {
          Object oldVal = oObj.getControlProperty(supControls[i], supProperties[i][j]);
          Object newVal = util.ValueChanger.changePValue(oldVal);
          if (supProperties[i][j].startsWith("Help")) {
            newVal = "HID:133";
          }
          oObj.setControlProperty(supControls[i], supProperties[i][j], newVal);
          Object resVal = oObj.getControlProperty(supControls[i], supProperties[i][j]);
          log.println("\t Old:" + oldVal + ",New:" + newVal + ",Result:" + resVal);
          if (!util.ValueComparer.equalValue(newVal, resVal)) {
            error +=
                "####Property '"
                    + supProperties[i][j]
                    + " of "
                    + supControls[i]
                    + " didn't work\n\r"
                    + "\t Old:"
                    + oldVal
                    + ",New:"
                    + newVal
                    + ",Result:"
                    + resVal
                    + "\n\r";
          }
          result &= util.ValueComparer.equalValue(newVal, resVal);
        } catch (com.sun.star.lang.IllegalArgumentException e) {
          log.println("Unexpected exception:");
          e.printStackTrace(log);
          result = false;
        }
      }
    }

    log.println(error);

    tRes.tested("setControlProperty()", result);
    tRes.tested("getControlProperty()", result);
  }