generated from element-hq/.github
-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace Prefire with a very similar but simpler and more direct appro…
…ach (#3232) * Replace Prefire with a very similar but simpler and more direct approach * Move PreviewTest snapshots to their new location (snapshotting default, mirrors UITests) * Update acknowledgements * Switch snapshot configuration extensions to a custom version * Exclude snapshots from the PreviewTests target * Fix acknowledgements * Rename snapshotting preference keys * Remove `skipPackagePluginValidation`
- Loading branch information
1 parent
a4166de
commit 2f6fea2
Showing
1,196 changed files
with
1,416 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
UITests/Sources/__Snapshots__/** filter=lfs diff=lfs merge=lfs -text | ||
UnitTests/Resources/** filter=lfs diff=lfs merge=lfs -text | ||
UnitTests/__Snapshots__/** filter=lfs diff=lfs merge=lfs -text | ||
PreviewTests/__Snapshots__/** filter=lfs diff=lfs merge=lfs -text | ||
PreviewTests/Sources/__Snapshots__/** filter=lfs diff=lfs merge=lfs -text |
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// | ||
// Copyright 2024 New Vector Ltd | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
import SwiftUI | ||
|
||
public struct SnapshotDelayPreferenceKey: PreferenceKey { | ||
public static var defaultValue: TimeInterval = 0.0 | ||
|
||
public static func reduce(value: inout TimeInterval, nextValue: () -> TimeInterval) { | ||
value = nextValue() | ||
} | ||
} | ||
|
||
public struct SnapshotPrecisionPreferenceKey: PreferenceKey { | ||
public static var defaultValue: Float = 1.0 | ||
|
||
public static func reduce(value: inout Float, nextValue: () -> Float) { | ||
value = nextValue() | ||
} | ||
} | ||
|
||
public struct SnapshotPerceptualPrecisionPreferenceKey: PreferenceKey { | ||
public static var defaultValue: Float = 1.0 | ||
|
||
public static func reduce(value: inout Float, nextValue: () -> Float) { | ||
value = nextValue() | ||
} | ||
} | ||
|
||
public extension SwiftUI.View { | ||
/// Use this modifier when you want to apply snapshot-specific preferences, | ||
/// like delay and precision, to the view. | ||
/// These preferences can then be retrieved and used elsewhere in your view hierarchy. | ||
/// | ||
/// - Parameters: | ||
/// - delay: The delay time in seconds that you want to set as a preference to the View. | ||
/// - precision: The percentage of pixels that must match. | ||
/// - perceptualPrecision: The percentage a pixel must match the source pixel to be considered a match. 98-99% mimics the precision of the human eye. | ||
@inlinable | ||
func snapshotPreferences(delay: TimeInterval = .zero, precision: Float = 1.0, perceptualPrecision: Float = 1.0) -> some SwiftUI.View { | ||
preference(key: SnapshotDelayPreferenceKey.self, value: delay) | ||
.preference(key: SnapshotPrecisionPreferenceKey.self, value: precision) | ||
.preference(key: SnapshotPerceptualPrecisionPreferenceKey.self, value: perceptualPrecision) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,4 @@ | |
|
||
import SwiftUI | ||
|
||
import Prefire | ||
|
||
protocol TestablePreview: PrefireProvider { } | ||
protocol TestablePreview { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.