@@ -77,29 +77,36 @@ class QuickSeekMediaControlPluginTests: QuickSpec {
77
77
mediaControl. render ( )
78
78
playButton. view. layoutIfNeeded ( )
79
79
mediaControl. view. layoutIfNeeded ( )
80
+
80
81
}
81
82
82
83
context ( " and it collides with that plugin " ) {
83
84
it ( " does not seek " ) {
84
- let shouldSeek = quickSeekPlugin. shouldSeek ( point: CGPoint ( x: 100 , y: 100 ) )
85
+ let playButtonCenterInMediaControlCoordinate = playButton. view. convert ( playButton. view. center, to: mediaControl. mediaControlView)
86
+
87
+ let shouldSeek = quickSeekPlugin. shouldSeek ( point: playButtonCenterInMediaControlCoordinate)
85
88
86
89
expect ( shouldSeek) . to ( beFalse ( ) )
87
90
}
88
91
}
89
92
90
93
context ( " and it does not collide with that plugin " ) {
91
94
it ( " does seek " ) {
92
- let shouldSeek = quickSeekPlugin. shouldSeek ( point: CGPoint ( x: 260 , y: 100 ) )
95
+ let pointOutsidePlayButton = CGPoint ( x: playButton. view. frame. width + 1 , y: playButton. view. frame. height + 1 )
96
+ let outsidePointInMediaControlCoordinate = playButton. view. convert ( pointOutsidePlayButton, to: mediaControl. mediaControlView)
97
+
98
+ let shouldSeek = quickSeekPlugin. shouldSeek ( point: outsidePointInMediaControlCoordinate)
93
99
94
100
expect ( shouldSeek) . to ( beTrue ( ) )
95
101
}
96
102
}
97
103
98
104
context ( " and that plugin is not visible " ) {
99
105
it ( " does seek " ) {
106
+ let playButtonCenterInMediaControlCoordinate = playButton. view. convert ( playButton. view. center, to: mediaControl. mediaControlView)
100
107
playButton. view. alpha = 0.0
101
108
102
- let shouldSeek = quickSeekPlugin. shouldSeek ( point: CGPoint ( x : 100 , y : 100 ) )
109
+ let shouldSeek = quickSeekPlugin. shouldSeek ( point: playButtonCenterInMediaControlCoordinate )
103
110
104
111
expect ( shouldSeek) . to ( beTrue ( ) )
105
112
}
@@ -113,8 +120,9 @@ class QuickSeekMediaControlPluginTests: QuickSpec {
113
120
core. render ( )
114
121
overlayPlugin. render ( )
115
122
overlayPlugin. view. layoutIfNeeded ( )
116
-
117
- let shouldSeek = quickSeekPlugin. shouldSeek ( point: CGPoint ( x: 260 , y: 100 ) )
123
+ let overlayPluginCenterInMediaControlCoordinate = overlayPlugin. view. convert ( overlayPlugin. view. center, to: mediaControl. mediaControlView)
124
+
125
+ let shouldSeek = quickSeekPlugin. shouldSeek ( point: overlayPluginCenterInMediaControlCoordinate)
118
126
119
127
expect ( shouldSeek) . to ( beTrue ( ) )
120
128
}
0 commit comments