Skip to content

Commit

Permalink
Merge branch 'release/1.1_39'
Browse files Browse the repository at this point in the history
  • Loading branch information
duemunk committed Nov 26, 2014
2 parents 4c01742 + e8391f6 commit 312a009
Show file tree
Hide file tree
Showing 627 changed files with 51,905 additions and 164 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,4 @@ xcuserdata
# Xcode 5 introduced a new file type .xccheckout. This files contains VCS metadata
# and should therefore not be checked into the VCS.

*.xccheckout

Pods/
*.xccheckout
11 changes: 10 additions & 1 deletion BeMyEyes Tests/BeMyEyes Tests-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,13 @@
#import "BMEGlobal.h"
#import "BMEClient.h"

#import "GVUserDefaults+Settings.h"
#import "GVUserDefaults+Settings.h"
#import "BMEUserLevel.h"

#import <FBSnapshotTestCase/FBSnapshotTestCase.h>
#import <MiawKit/MKLocalization.h>
#import <MiawKit/MKFunctions.h>
#import "MKLocalizationKeys.h"


#import "BMEHelperMainViewController.h"
27 changes: 27 additions & 0 deletions BeMyEyes Tests/DataHelper.swift
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
}
}
34 changes: 34 additions & 0 deletions BeMyEyes Tests/HelperMainViewController_Tests.swift
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)
}
}
29 changes: 29 additions & 0 deletions BeMyEyes Tests/MaskedLabel_Tests.swift
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")
}
}
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.
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.
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.
46 changes: 46 additions & 0 deletions BeMyEyes Tests/SnapshotHelper.swift
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)
}
}
}
Loading

0 comments on commit 312a009

Please sign in to comment.