marshroute

Форк
0
/
PeekAndPopUtilityImplTests_notifiesRegisteredViewControllerOnPeek.swift 
107 строк · 3.2 Кб
1
import XCTest
2
@testable import Marshroute
3

4
final class PeekAndPopUtilityImplTests_notifiesRegisteredViewControllerOnPeek: BasePeekAndPopUtilityImplTestCase {    
5
    func testPeekAndPopUtility_notifiesRegisteredViewControllerOnPeek_ifPeekBeginsOnOnscreenRegisteredViewController() {
6
        // Given
7
        let expectation = self.expectation()
8
        
9
        bindSourceViewControllerToWindow()
10
        
11
        registerSourceViewControllerForPreviewing(
12
            onPeek: { _ in
13
                expectation.fulfill()
14
            }
15
        )
16
        
17
        // When
18
        beginPeekOnRegisteredViewController()
19
        
20
        // Then
21
        waitForExpectations(timeout: asyncTimeout)
22
    }
23
    
24
    func testPeekAndPopUtility_notifiesReregisteredViewControllerOnPeek_ifPeekBeginsOnOffscreenRegisteredViewController() {
25
        // Given
26
        let invertedExpectation = self.invertedExpectation()
27
        
28
        unbindSourceViewControllerFromWindow()
29
        
30
        registerSourceViewControllerForPreviewing()
31
        
32
        unregisterSourceViewControllerFromPreviewing()
33
        
34
        registerSourceViewControllerForPreviewing(
35
            onPeek: { _ in
36
                invertedExpectation.fulfill()
37
            }
38
        )
39
        
40
        // When
41
        beginPeekOnRegisteredViewController()
42
        
43
        // Then
44
        waitForExpectations(timeout: asyncTimeout)
45
    }
46
    
47
    func testPeekAndPopUtility_notifiesNoRegisteredViewControllerOnPeek_ifPeekBeginsOnOffscreenRegisteredViewController() {
48
        // Given
49
        let invertedExpectation = self.invertedExpectation()
50
        
51
        unbindSourceViewControllerFromWindow()
52
        
53
        registerSourceViewControllerForPreviewing(
54
            onPeek: { _ in
55
                invertedExpectation.fulfill()
56
            }
57
        )
58
        
59
        // When
60
        beginPeekOnRegisteredViewController()
61
        
62
        // Then
63
        waitForExpectations(timeout: asyncTimeout)
64
    }
65
    
66
    func testPeekAndPopUtility_notifiesNoUnregisteredViewControllerOnPeek_ifPeekBeginsOnOffscreenRegisteredViewController() {
67
        // Given
68
        let invertedExpectation = self.invertedExpectation()
69

70
        unbindSourceViewControllerFromWindow()
71
        
72
        registerSourceViewControllerForPreviewing(
73
            onPeek: { _ in
74
                invertedExpectation.fulfill()
75
            }
76
        )
77
        
78
        unregisterSourceViewControllerFromPreviewing()
79
        
80
        // When
81
        beginPeekOnRegisteredViewController()
82
        
83
        // Then
84
        waitForExpectations(timeout: asyncTimeout)
85
    }
86
    
87
    func testPeekAndPopUtility_notifiesNoUnregisteredViewControllerOnPeek_ifPeekBeginsOnOnscreenRegisteredViewController() {
88
        // Given
89
        let invertedExpectation = self.invertedExpectation()
90
        
91
        bindSourceViewControllerToWindow()
92
        
93
        registerSourceViewControllerForPreviewing(
94
            onPeek: { _ in
95
                invertedExpectation.fulfill()
96
            }
97
        )
98
        
99
        unregisterSourceViewControllerFromPreviewing()
100
        
101
        // When
102
        beginPeekOnRegisteredViewController()
103
        
104
        // Then
105
        waitForExpectations(timeout: asyncTimeout)
106
    }
107
}    
108

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.