testRelation method

void testRelation(
  1. TargetId targetId,
  2. Rect targetBounds,
  3. RelationAssert assertion
)

Tests if the target matches the relation rules given by the assertion.

Implementation

void testRelation(
  TargetId targetId,
  Rect targetBounds,
  RelationAssert assertion,
) {
  final success = assertion.evaluate(targetBounds);
  if (!success) {
    throw AssertionFailedException.forRelation(
      targetId: targetId,
      relation: assertion.relation,
      targetBounds: targetBounds,
      compareValue: assertion.value,
    );
  }
}