예제 #1
0
  protected boolean compareProperties(XPropertySet props1, XPropertySet props2) {

    Property[] p1 = props1.getPropertySetInfo().getProperties();
    Property[] p2 = props2.getPropertySetInfo().getProperties();

    if (p1.length != p2.length) {
      log.println("Number of properties differs");
      return false;
    }

    boolean result = true;

    for (int i = 0; i < p1.length; i++) {
      String propName = p1[i].Name;

      log.print("Comparing property '" + propName + "' ...");
      boolean res = false;
      try {
        res =
            ValueComparer.equalValue(
                props1.getPropertyValue(propName), props2.getPropertyValue(propName));
      } catch (com.sun.star.beans.UnknownPropertyException e) {
        log.println("Not found !");
      } catch (com.sun.star.lang.WrappedTargetException e) {
        log.println(e);
      }

      if (res) log.println("OK.");
      else log.println("Different !");

      result &= res;
    }

    return result;
  }
예제 #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);
  }
 protected Object getNewValue(String propName, Object oldValue)
     throws java.lang.IllegalArgumentException {
   if (util.ValueComparer.equalValue(oldValue, the_bitmap)) {
     return the_secondBitmap;
   } else {
     return the_bitmap;
   }
 }