pointfreeco / swift-snapshot-testing

📸 Delightful Swift snapshot testing.

Home Page:https://www.pointfree.co/episodes/ep41-a-tour-of-snapshot-testing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RTL is not reversing direction when i pass UIView

alshcompiler opened this issue · 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