forked from mbogh/bemyeyes-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
627 changed files
with
51,905 additions
and
164 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
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,27 @@ | ||
// | ||
// DataHelper.swift | ||
// BeMyEyes | ||
// | ||
// Created by Tobias Due Munk on 19/11/14. | ||
// Copyright (c) 2014 Be My Eyes. All rights reserved. | ||
// | ||
|
||
extension BMEUser { | ||
|
||
class func idealUser() -> BMEUser { | ||
let user = BMEUser() | ||
user.setValue("Sarah", forKey: "firstName") | ||
user.setValue(330, forKey: "totalPoints") | ||
|
||
let currentLevel = BMEUserLevel() | ||
currentLevel.title = "Trusted Helper" | ||
currentLevel.threshold = 200 | ||
user.setValue(currentLevel, forKey: "currentLevel") | ||
|
||
let nextLevel = BMEUserLevel() | ||
nextLevel.threshold = 500 | ||
user.setValue(nextLevel, forKey: "nextLevel") | ||
|
||
return user | ||
} | ||
} |
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,34 @@ | ||
// | ||
// HelperMainViewController_Tests.swift | ||
// BeMyEyes | ||
// | ||
// Created by Tobias Due Munk on 27/10/14. | ||
// Copyright (c) 2014 Be My Eyes. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
import XCTest | ||
|
||
class HelperMainViewController_Tests: FBSnapshotTestCase { | ||
|
||
var helperVC: BMEHelperMainViewController? | ||
|
||
override func setUp() { | ||
super.setUp() | ||
// recordMode = true | ||
|
||
helperVC = UIApplication.sharedApplication().keyWindow?.rootViewController?.storyboard?.instantiateViewControllerWithIdentifier(BMEMainHelperControllerIdentifier) as? BMEHelperMainViewController | ||
helperVC?.viewDidLoad() | ||
} | ||
|
||
override func tearDown() { | ||
super.tearDown() | ||
} | ||
|
||
func testOnAllDevices() { | ||
if let helperVC = helperVC { | ||
helperVC.user = BMEUser.idealUser() | ||
} | ||
verifyViewOnAllDevices(helperVC!.view) | ||
} | ||
} |
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,29 @@ | ||
// | ||
// MaskedLabel_Tests.swift | ||
// BeMyEyes | ||
// | ||
// Created by Tobias Due Munk on 27/10/14. | ||
// Copyright (c) 2014 Be My Eyes. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
import XCTest | ||
|
||
class MaskedLabel_Tests: FBSnapshotTestCase { | ||
|
||
override func setUp() { | ||
super.setUp() | ||
// recordMode = true | ||
} | ||
|
||
override func tearDown() { | ||
super.tearDown() | ||
} | ||
|
||
func testMaskedLabel() { | ||
let label = MaskedLabel() | ||
label.text = "Masked Label" | ||
label.frame = CGRect(x: 0, y: 0, width: 300, height: 44) | ||
verifyView(label, identifier: "MaskedLabel") | ||
} | ||
} |
Binary file added
BIN
+291 KB
...ages/BeMyEyes_Tests.HelperMainViewController_Tests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+117 KB
.../BeMyEyes_Tests.HelperMainViewController_Tests/testOnAllDevices_iPhone [email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+131 KB
.../BeMyEyes_Tests.HelperMainViewController_Tests/testOnAllDevices_iPhone [email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+376 KB
...BeMyEyes_Tests.HelperMainViewController_Tests/testOnAllDevices_iPhone [email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+182 KB
.../BeMyEyes_Tests.HelperMainViewController_Tests/testOnAllDevices_iPhone [email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,46 @@ | ||
// | ||
// SnapshotHelper.swift | ||
// BeMyEyes | ||
// | ||
// Created by Tobias Due Munk on 27/10/14. | ||
// Copyright (c) 2014 Be My Eyes. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
struct Device { | ||
let bounds: CGRect | ||
let description: String | ||
|
||
static func allDevices() -> [Device] { | ||
// TODO: Support scaling @1x, @2x, @3x etc. | ||
return [Device(bounds: CGRect(x: 0, y: 0, width: 320, height: 480), description: "iPhone 4"), | ||
Device(bounds: CGRect(x: 0, y: 0, width: 320, height: 568), description: "iPhone 5"), | ||
Device(bounds: CGRect(x: 0, y: 0, width: 375, height: 667), description: "iPhone 6"), | ||
Device(bounds: CGRect(x: 0, y: 0, width: 621, height: 1104), description: "iPhone 6+"), | ||
Device(bounds: CGRect(x: 0, y: 0, width: 768, height: 1024), description: "iPad")] | ||
} | ||
} | ||
|
||
extension FBSnapshotTestCase { | ||
|
||
func verifyView(view: UIView, identifier: String) { | ||
var error: NSError? | ||
let referenceImagesDirectory = "\(FB_REFERENCE_IMAGE_DIR)" | ||
let comparisonSuccess = compareSnapshotOfView(view, referenceImagesDirectory: referenceImagesDirectory, identifier: identifier, error: &error) | ||
var str = "Snapshot comparison failed" | ||
if let error = error { | ||
str += error.localizedDescription | ||
} | ||
XCTAssertTrue(comparisonSuccess, str) | ||
XCTAssertFalse(recordMode, "Test ran in record mode. Reference image is now saved. Disable record mode to perform an actual snapshot comparison!"); | ||
} | ||
|
||
func verifyViewOnAllDevices(view: UIView, identifier: String = "") { | ||
for device in Device.allDevices() { | ||
view.frame = device.bounds | ||
|
||
verifyView(view, identifier: identifier + device.description) | ||
} | ||
} | ||
} |
Oops, something went wrong.