Package org.uiautomation.ios.UIAModels.predicate

Examples of org.uiautomation.ios.UIAModels.predicate.PropertyEqualCriteria


    }

    @Override
    public void decorate(Criteria c) {
      if (requiresDecoration(c)) {
        PropertyEqualCriteria criteria = (PropertyEqualCriteria) c;

        String newValue = localizeString(criteria.getValue());
        criteria.setValue(newValue);
        criteria.setL10nstrategy(L10NStrategy.none);
      }
    }
View Full Code Here


    }
  }

  private boolean requiresDecoration(Criteria c) {
    if (c instanceof PropertyEqualCriteria) {
      PropertyEqualCriteria crit = (PropertyEqualCriteria) c;
      L10NStrategy strategy = crit.getL10nstrategy();
      if (strategy == L10NStrategy.clientL10N) {
        return true;
      }
    }
    return false;
View Full Code Here

  private static final String buttonName = "Buttons, Various uses of UIButton";

  @Test
  public void exactMatch() {
    Criteria c1 = new TypeCriteria(UIATableCell.class);
    PropertyEqualCriteria c2 = new NameCriteria(buttonName);
    Assert.assertEquals(c2.getMatchingStrategy(), MatchingStrategy.exact);
    Criteria c = new AndCriteria(c1, c2);
    UIAElement element = driver.findElement(c);
    Assert.assertEquals(element.getName(), buttonName);
  }
View Full Code Here

  @Test
  public void regexMatch() throws InterruptedException {
    String regex = "Buttons, V[a-z]* uses of UIButton";
    Criteria c1 = new TypeCriteria(UIATableCell.class);
    PropertyEqualCriteria c2 = new NameCriteria(regex, MatchingStrategy.regex);
    Criteria c = new AndCriteria(c1, c2);
    UIAElement element = driver.findElement(c);
    Assert.assertEquals(element.getName(), buttonName);
  }
View Full Code Here

  }

  @Test
  public void positionMatch() {
    Criteria c1 = new TypeCriteria(UIATableCell.class);
    PropertyEqualCriteria c2 = new NameCriteria(buttonName);
    Assert.assertEquals(c2.getMatchingStrategy(), MatchingStrategy.exact);
    Criteria c = new AndCriteria(c1, c2);
    UIAElement element = driver.findElement(c);

    UIARect position = element.getRect();
View Full Code Here

  private void decorateContent(Criteria c) {
    if (!isElligibleForContent(c)) {
      return;
    }
    PropertyEqualCriteria criteria = (PropertyEqualCriteria) c;
    String key = criteria.getValue();
    String value = app.applyL10NOnKey(key);
    criteria.setValue(value);
    criteria.setL10nstrategy(L10NStrategy.none);
  }
View Full Code Here

  private void decorateMatching(Criteria c) {
    if (!isElligibleForMatching(c)) {
      return;
    }
    PropertyEqualCriteria criteria = (PropertyEqualCriteria) c;
    String oldValue = criteria.getValue();

    String newValue;
    switch (criteria.getMatchingStrategy()) {
      case starts:
        newValue = oldValue + "(.*)";
        break;
      case contains:
        newValue = "(.*)" + oldValue + "(.*)";
        break;
      case ends:
        newValue = "(.*)" + oldValue;
        break;
      default:
        throw new InvalidSelectorException("Can't find strategy");
    }
    criteria.setValue(newValue);
    criteria.setMatchingStrategy(MatchingStrategy.regex);

  }
View Full Code Here

  }

  private boolean isElligibleForContent(Criteria c) {
    if (c instanceof PropertyEqualCriteria) {
      PropertyEqualCriteria crit = (PropertyEqualCriteria) c;
      return crit.getL10nstrategy() == L10NStrategy.serverL10N;
    }
    return false;
  }
View Full Code Here

    return false;
  }

  private boolean isElligibleForMatching(Criteria c) {
    if (c instanceof PropertyEqualCriteria) {
      PropertyEqualCriteria crit = (PropertyEqualCriteria) c;
      if (crit.getMatchingStrategy() == MatchingStrategy.exact) {
        return false;
      }
      if (crit.getMatchingStrategy() == MatchingStrategy.regex) {
        return false;
      }
    } else {
      return false;
    }
View Full Code Here

TOP

Related Classes of org.uiautomation.ios.UIAModels.predicate.PropertyEqualCriteria

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.