Merge pull request #90 from barrault01/fixe-issue-89

Fixe issue 89
This commit is contained in:
Alexsander Khitev 2016-04-22 20:33:38 +04:00
commit 5f5e0b7950
2 changed files with 27 additions and 7 deletions

View File

@ -203,19 +203,21 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate {
setup()
}
public convenience init(photos: [SKPhotoProtocol]) {
public convenience init(photos: [AnyObject]) {
self.init(nibName: nil, bundle: nil)
for photo in photos {
let picutres = photos.flatMap {$0 as? SKPhotoProtocol}
for photo in picutres {
photo.checkCache()
self.photos.append(photo)
}
}
public convenience init(originImage: UIImage, photos: [SKPhotoProtocol], animatedFromView: UIView) {
public convenience init(originImage: UIImage, photos: [AnyObject], animatedFromView: UIView) {
self.init(nibName: nil, bundle: nil)
self.senderOriginImage = originImage
self.senderViewForAnimation = animatedFromView
for photo in photos {
let picutres = photos.flatMap {$0 as? SKPhotoProtocol}
for photo in picutres {
photo.checkCache()
self.photos.append(photo)
}

View File

@ -7,6 +7,14 @@
//
import XCTest
@testable import SKPhotoBrowser
class FakeSKPhotoBrowser : SKPhotoBrowser {
override func setup () {
}
}
class SKPhotoBrowserTests: XCTestCase {
@ -19,12 +27,22 @@ class SKPhotoBrowserTests: XCTestCase {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
func testSKPhotoArray() {
var images = [SKPhoto]()
let photo = SKPhoto.photoWithImage(UIImage())// add some UIImage
images.append(photo)
let _ = FakeSKPhotoBrowser(photos: images)
}
func testSKLocalPhotoArray() {
var images = [SKLocalPhoto]()
let photo = SKLocalPhoto.photoWithImageURL("")
images.append(photo)
let _ = FakeSKPhotoBrowser(photos: images)
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock {