Skip to content

Commit

Permalink
apply the same change in key actions
Browse files Browse the repository at this point in the history
  • Loading branch information
KazuCocoa committed Jul 19, 2024
1 parent 4e6b081 commit 912316e
Showing 1 changed file with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ - (nullable NSValue *)positionWithError:(NSError **)error
}
return nil;
}

XCUIElement *element = isOriginAnElement ? (XCUIElement *)origin : nil;
NSNumber *x = [self.actionItem objectForKey:FB_ACTION_ITEM_KEY_X];
NSNumber *y = [self.actionItem objectForKey:FB_ACTION_ITEM_KEY_Y];
Expand All @@ -272,7 +272,7 @@ - (nullable NSValue *)positionWithError:(NSError **)error
}
return nil;
}

if (nil != element) {
if (nil == x && nil == y) {
return [self hitpointWithElement:element
Expand All @@ -283,13 +283,13 @@ - (nullable NSValue *)positionWithError:(NSError **)error
positionOffset:[NSValue am_valueWithCGPoint:CGPointMake(x.floatValue, y.floatValue)]
error:error];
}

if ([origin isKindOfClass:NSString.class] && [origin isEqualToString:FB_ORIGIN_TYPE_VIEWPORT]) {
return [self hitpointWithElement:nil
positionOffset:[NSValue am_valueWithCGPoint:CGPointMake(x.floatValue, y.floatValue)]
error:error];
}

// origin == FB_ORIGIN_TYPE_POINTER
if (nil == self.previousItem) {
NSString *errorDescription = [NSString stringWithFormat:@"There is no previous item for '%@' action item, however %@ is set to '%@'", self.actionItem, FB_ACTION_ITEM_KEY_ORIGIN, FB_ORIGIN_TYPE_POINTER];
Expand Down Expand Up @@ -737,7 +737,7 @@ @implementation FBW3CActionsSynthesizer
shouldCancelNextItem = YES;
continue;
}

if (nil == self.elementCache) {
[result addObject:actionItem];
continue;
Expand Down Expand Up @@ -795,14 +795,6 @@ @implementation FBW3CActionsSynthesizer
});

NSArray<NSDictionary<NSString *, id> *> *actionItems = [actionDescription objectForKey:FB_KEY_ACTIONS];
if (nil == actionItems || 0 == actionItems.count) {
NSString *description = [NSString stringWithFormat:@"It is mandatory to have at least one item defined for each action. Action with id '%@' contains none", actionId];
if (error) {
*error = [[FBErrorBuilder.builder withDescription:description] build];
}
return nil;
}

FBW3CKeyItemsChain *chain = [[FBW3CKeyItemsChain alloc] init];
NSArray<NSDictionary<NSString *, id> *> *processedItems = [self preprocessedActionItemsWith:actionItems];
for (NSDictionary<NSString *, id> *actionItem in processedItems) {
Expand Down

0 comments on commit 912316e

Please sign in to comment.