FBSnapshotTestCaseでUIImageのテストを行う。
はじめに
FBSnapshotTestCaseはUIViewのレイアウトをテストするライブラリですが、以下のカテゴリーメソッドを追加する事によってUIImageのテストも行う事ができます!
extension FBSnapshotTestCase {
func FBSnapshotVerifyImage(_ image: UIImage, identifier: String = "", suffixes: NSOrderedSet = FBSnapshotTestCaseDefaultSuffixes(), tolerance: CGFloat = 0, file: StaticString = #file, line: UInt = #line) {
FBSnapshotVerifyView(UIImageView(image: image), identifier: identifier, suffixes: suffixes, tolerance: tolerance, file: file, line: line)
}
}
実際の呼び出し例は以下の通りです。
var image: UIImage!
UIImageの生成処理
...(テストコード)
FBSnapshotVerifyImage(image)
Author And Source
この問題について(FBSnapshotTestCaseでUIImageのテストを行う。), 我々は、より多くの情報をここで見つけました https://qiita.com/KKKKKAAAAANNNNNMMMMMOOOOO/items/fb796d072dfa8edf11b1著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .