swift-snapshot-testing icon indicating copy to clipboard operation
swift-snapshot-testing copied to clipboard

RTL is not reversing direction when i pass UIView

Open alshcompiler opened this issue 1 year ago • 0 comments

usually i control RTL and LTR using .environment(\.layoutDirection, .leftToRight) but for UIViews i need to make the view LTR then take snapshot then make it RTL and take another snapshot at the same test however it feels impossible, i tried UIView.appearance().semanticContentAttribute = .forceRightToLeft and tried also recursively apply semanticContentAttribute to all it's subviews but it what only make it work is test plan config for Application Language, i need another way to successfully do it same as SwiftUI views .environment(\.layoutDirection, .leftToRight)

i am using:

verifySnapshot(
        matching: uiview,
        as: .image(precision: precision, subpixelThreshold: 5),
        named: testName,
        record: recording,
        snapshotDirectory: snapshotDirectory,
        timeout: timeout,
        file: file,
        testName: testName
    )

Please advise

alshcompiler avatar Mar 14 '23 11:03 alshcompiler