This repository has been archived by the owner on Sep 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added FBSnapshotTestCase integration. Added initial tests for Attribu…
…tedStringView
- Loading branch information
Showing
66 changed files
with
4,745 additions
and
2,525 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,3 +78,7 @@ _site/ | |
# secrets | ||
Resources/*.xcconfig | ||
|
||
|
||
|
||
# FBSnapshotTestCase Failure Diffs | ||
FailureDiffs/ |
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
42 changes: 42 additions & 0 deletions
42
FreetimeTests/Snapshot Tests/AttributedStringViewTests.swift
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,42 @@ | ||
// | ||
// AttributedStringViewTests.swift | ||
// FreetimeTests | ||
// | ||
// Created by Austinate on 10/22/17. | ||
// Copyright © 2017 Ryan Nystrom. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
import FBSnapshotTestCase | ||
@testable import Freetime | ||
|
||
class AttributedStringViewTests: FBSnapshotTestCase { | ||
let initialFrame = CGRect(origin: .zero, size: CGSize(width: 320, height: 44)) | ||
var view: AttributedStringView! | ||
|
||
override func setUp() { | ||
super.setUp() | ||
view = AttributedStringView(frame: initialFrame) | ||
} | ||
|
||
func testAttributedStringUIWithSimpleTextIsCorrect() { | ||
let attributed = NSAttributedString(string: "This is just a sample\nof simple\ntext") | ||
let text = NSAttributedStringSizing(containerWidth: initialFrame.width, | ||
attributedText: attributed) | ||
view.configureAndSizeToFit(text: text, width: initialFrame.width) | ||
FBSnapshotVerifyView(view) | ||
} | ||
|
||
func testAttributedStringUIEmailIsCorrect() { | ||
let attributes: [NSAttributedStringKey: Any] = [.foregroundColor: UIColor.gray] | ||
let attributedTitle = NSMutableAttributedString(string: "This is sample title with\n email: ", | ||
attributes: attributes) | ||
let email = NSAttributedString(string: "[email protected]", | ||
attributes: [MarkdownAttribute.email: "[email protected]"]) | ||
attributedTitle.append(email) | ||
let text = NSAttributedStringSizing(containerWidth: initialFrame.width, | ||
attributedText: attributedTitle) | ||
view.configureAndSizeToFit(text: text, width: initialFrame.width) | ||
FBSnapshotVerifyView(view) | ||
} | ||
} |
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
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
20 changes: 20 additions & 0 deletions
20
Pods/FBSnapshotTestCase/FBSnapshotTestCase/Categories/UIApplication+StrictKeyWindow.h
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
Pods/FBSnapshotTestCase/FBSnapshotTestCase/Categories/UIApplication+StrictKeyWindow.m
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
Pods/FBSnapshotTestCase/FBSnapshotTestCase/Categories/UIImage+Compare.h
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.