Skip to content

Instantly share code, notes, and snippets.

@keehun
Created August 9, 2018 03:35
Show Gist options
  • Select an option

  • Save keehun/054a6968890dd18dc67ff20ce383c41b to your computer and use it in GitHub Desktop.

Select an option

Save keehun/054a6968890dd18dc67ff20ce383c41b to your computer and use it in GitHub Desktop.
Practical Dynamic Type, Part 2
import XCTest
@testable import PracticalDynamicTypePart2
class PracticalDynamicTypePart2Tests: XCTestCase {
var subject: Hal9000!
override func setUp() {
super.setUp()
subject = Hal9000()
}
func testDynamicType() {
/// pointSize = 31
FontMetrics.default.sizeCategory = .extraSmall
let smallSize = subject.dialog.font.pointSize
/// pointSize = 36
FontMetrics.default.sizeCategory = .large
let defaultSize = subject.dialog.font.pointSize
/// pointSize = 101
FontMetrics.default.sizeCategory = .accessibilityExtraExtraExtraLarge
let xxxlSize = subject.dialog.font.pointSize
XCTAssertGreaterThan(defaultSize, smallSize)
XCTAssertGreaterThan(xxxlSize, defaultSize)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment