File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -154,6 +154,27 @@ class ImageCacheTests: XCTestCase {
154
154
waitForExpectationsWithTimeout ( 1 , handler: nil )
155
155
}
156
156
157
+ func testRetrivingImagePerformance( ) {
158
+
159
+ let expectation = self . expectationWithDescription ( " wait for retriving image " )
160
+
161
+ self . cache. storeImage ( testImage, forKey: testKeys [ 0 ] , toDisk: true ) { ( ) -> ( ) in
162
+
163
+ // Base line is ~0.25 in iPhone 6 simulator.
164
+ // (Baseline setting for block measure is not available for using in Xcode 6.3 & Swift 1.2)
165
+ self . measureBlock ( { ( ) -> Void in
166
+ for _ in 1 ..< 1000 {
167
+ self . cache. retrieveImageInDiskCacheForKey ( testKeys [ 0 ] )
168
+ }
169
+ } )
170
+
171
+ expectation. fulfill ( )
172
+
173
+ }
174
+
175
+ self . waitForExpectationsWithTimeout ( 5 , handler: nil )
176
+ }
177
+
157
178
// MARK: - Helper
158
179
func storeMultipleImages( completionHandler: ( ) -> ( ) ) {
159
180
You can’t perform that action at this time.
0 commit comments