Skip to content

Commit b24d465

Browse files
committed
Update the readme about Unit Test and Thanks chapter
1 parent 4ea0601 commit b24d465

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
[![Platform](https://img.shields.io/cocoapods/p/SDWebImageSwiftUI.svg?style=flat)](https://cocoapods.org/pods/SDWebImageSwiftUI)
77
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
88
[![SwiftPM compatible](https://img.shields.io/badge/SwiftPM-Compatible-brightgreen.svg)](https://swift.org/package-manager/)
9+
[![codecov](https://codecov.io/gh/SDWebImage/SDWebImageSwiftUI/branch/master/graph/badge.svg)](https://codecov.io/gh/SDWebImage/SDWebImageSwiftUI)
910

1011
## What's for
1112

@@ -344,6 +345,23 @@ Demo Tips:
344345
4. Pinch gesture (Digital Crown on watchOS, play button on tvOS) to zoom-in detail page image.
345346
5. Clear cache and go to detail page to see progressive loading.
346347

348+
## Test
349+
350+
SDWebImageSwiftUI has Unit Test to increase code quality. For SwiftUI, there are no official Unit Test solution provided by Apple.
351+
352+
However, since SwiftUI is State-Based and Attributed-Implemented layout system, there are open source projects who provide the solution:
353+
354+
+ [ViewInspector](https://github.com/nalexn/ViewInspector): Inspect View's runtime attribute value (like `.frame` modifier, `.image` value). We use this to test `AnimatedImage` and `WebImage`
355+
+ [SwiftUI-Introspect](https://github.com/siteline/SwiftUI-Introspect): Introspect the native UIKit/AppKit View, even for SwiftUI component (like `List`, which is actually `UITableView` in implementation). We use this to test `AnimatedImage`
356+
357+
To run the test:
358+
359+
1. Run `carthage build` on root directory to install the dependency.
360+
2. Open `SDWebImageSwiftUI.xcodeproj`, wait for SwiftPM finishing downloading the test dependency.
361+
3. Choose `SDWebImageSwiftUITests` scheme and start testing.
362+
363+
We've already setup the CI pipeline, each PR will run the test case and upload the test report to [codecov](https://codecov.io/gh/SDWebImage/SDWebImageSwiftUI).
364+
347365
## Screenshot
348366

349367
+ iOS Demo
@@ -376,6 +394,15 @@ Which means, this project is one core use case and downstream dependency, which
376394

377395
[DreamPiggy](https://github.com/dreampiggy)
378396

397+
## Thanks
398+
399+
- [SDWebImage](https://github.com/SDWebImage/SDWebImage)
400+
- [libwebp](https://github.com/SDWebImage/libwebp-Xcode)
401+
- [Kingfisher](https://github.com/onevcat/Kingfisher)
402+
- [SwiftUIX](https://github.com/SwiftUIX/SwiftUIX)
403+
- [SwiftUI-Introspect](https://github.com/siteline/SwiftUI-Introspect)
404+
- [ViewInspector](https://github.com/nalexn/ViewInspector)
405+
379406
## License
380407

381408
SDWebImageSwiftUI is available under the MIT license. See the LICENSE file for more info.

0 commit comments

Comments
 (0)