cashapp / AccessibilitySnapshot

Easy regression testing for iOS accessibility
Apache License 2.0
553 stars 68 forks source link

Snapshotting a view with an infinite activation point results in exception #12

Closed NickEntin closed 4 years ago

NickEntin commented 4 years ago

Setting an element's accessibilityActivationPoint to infinity is a useful way to avoid having the element pass touch events to any views when it's activated.

element.accessibilityActivationPoint = .init(x: CGFloat.infinity, y: .infinity)

This currently causes an exception when AccessibilitySnapshotView tries to position the image view representing the activation point.

<unknown>:0: error: -[TestClass testAccessibility] : failed: caught "CALayerInvalidGeometry", "CALayer position contains NaN: [nan nan]"
(
    0   CoreFoundation                      0x000000011cbef1bb __exceptionPreprocess + 331
    1   libobjc.A.dylib                     0x000000011b7f7735 objc_exception_throw + 48
    2   CoreFoundation                      0x000000011cbef015 +[NSException raise:format:] + 197
    3   QuartzCore                          0x000000011ac941a3 _ZN2CA5Layer12set_positionERKNS_4Vec2IdEEb + 141
    4   QuartzCore                          0x000000011ac83293 -[CALayer setPosition:] + 57
    5   UIKitCore                           0x0000000127e12ef5 -[UIView setCenter:] + 268
        ...
)