mirror of
https://github.com/fxm90/GradientLoadingBar.git
synced 2026-04-17 12:17:30 +00:00
50 lines
1.3 KiB
Swift
50 lines
1.3 KiB
Swift
//
|
|
// GradientLoadingBarControllerTestCase.swift
|
|
// GradientLoadingBar_SnapshotTests
|
|
//
|
|
// Created by Felix Mau on 14.06.20.
|
|
// Copyright © 2020 CocoaPods. All rights reserved.
|
|
//
|
|
|
|
import XCTest
|
|
import SnapshotTesting
|
|
|
|
@testable import GradientLoadingBar
|
|
|
|
class GradientLoadingBarControllerTestCase: XCTestCase {
|
|
// MARK: - Private properties
|
|
|
|
private var gradientLoadingBarController: GradientLoadingBarController!
|
|
|
|
// MARK: - Public methods
|
|
|
|
override func setUpWithError() throws {
|
|
try super.setUpWithError()
|
|
|
|
gradientLoadingBarController = GradientLoadingBarController()
|
|
gradientLoadingBarController.fadeIn(duration: 0)
|
|
}
|
|
|
|
override func tearDownWithError() throws {
|
|
gradientLoadingBarController = nil
|
|
|
|
try super.tearDownWithError()
|
|
}
|
|
|
|
// MARK: - Tests
|
|
|
|
func testGradientLoadingBarController() {
|
|
// Given
|
|
let rootViewController = UIViewController()
|
|
|
|
let expectation = self.expectation(description: "Waiting for view to appear.")
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
|
expectation.fulfill()
|
|
}
|
|
|
|
// Then
|
|
wait(for: [expectation], timeout: 1)
|
|
assertSnapshot(matching: rootViewController, as: .windowedImage)
|
|
}
|
|
}
|