@@ -140,6 +140,7 @@ func TestPlayer_FlashDurationTimeRemaining_Fallback(t *testing.T) {
140140func TestPlayer_IsSpottedBy_HasSpotted_True (t * testing.T ) {
141141 pl := playerWithProperty ("m_bSpottedByMask.000" , st.PropertyValue {IntVal : 2 })
142142 pl .EntityID = 1
143+ pl .demoInfoProvider = s1DemoInfoProvider
143144
144145 other := newPlayer (0 )
145146 other .EntityID = 2
@@ -150,6 +151,7 @@ func TestPlayer_IsSpottedBy_HasSpotted_True(t *testing.T) {
150151
151152func TestPlayer_IsSpottedBy_HasSpotted_False (t * testing.T ) {
152153 pl := playerWithProperty ("m_bSpottedByMask.000" , st.PropertyValue {IntVal : 0 })
154+ pl .demoInfoProvider = s1DemoInfoProvider
153155 pl .EntityID = 1
154156
155157 other := newPlayer (0 )
@@ -161,6 +163,7 @@ func TestPlayer_IsSpottedBy_HasSpotted_False(t *testing.T) {
161163
162164func TestPlayer_IsSpottedBy_HasSpotted_BitOver32 (t * testing.T ) {
163165 pl := playerWithProperty ("m_bSpottedByMask.001" , st.PropertyValue {IntVal : 1 })
166+ pl .demoInfoProvider = s1DemoInfoProvider
164167 pl .EntityID = 1
165168
166169 other := newPlayer (0 )
@@ -182,67 +185,78 @@ func TestPlayer_IsSpottedBy_EntityNull(t *testing.T) {
182185
183186func TestPlayer_IsInBombZone (t * testing.T ) {
184187 pl := playerWithProperty ("m_bInBombZone" , st.PropertyValue {IntVal : 1 })
188+ pl .demoInfoProvider = s1DemoInfoProvider
185189
186190 assert .True (t , pl .IsInBombZone ())
187191}
188192
189193func TestPlayer_IsInBuyZone (t * testing.T ) {
190194 pl := playerWithProperty ("m_bInBuyZone" , st.PropertyValue {IntVal : 1 })
195+ pl .demoInfoProvider = s1DemoInfoProvider
191196
192197 assert .True (t , pl .IsInBuyZone ())
193198}
194199
195200func TestPlayer_IsWalking (t * testing.T ) {
196201 pl := playerWithProperty ("m_bIsWalking" , st.PropertyValue {IntVal : 1 })
202+ pl .demoInfoProvider = s1DemoInfoProvider
197203
198204 assert .True (t , pl .IsWalking ())
199205}
200206
201207func TestPlayer_IsScoped (t * testing.T ) {
202208 pl := playerWithProperty ("m_bIsScoped" , st.PropertyValue {IntVal : 1 })
209+ pl .demoInfoProvider = s1DemoInfoProvider
203210
204211 assert .True (t , pl .IsScoped ())
205212}
206213
207214func TestPlayer_IsAirborne_NilEntity (t * testing.T ) {
208215 pl := new (Player )
216+ pl .demoInfoProvider = s1DemoInfoProvider
209217
210218 assert .False (t , pl .IsAirborne ())
211219}
212220
213221func TestPlayer_IsAirborne (t * testing.T ) {
214222 pl := playerWithProperty ("m_hGroundEntity" , st.PropertyValue {IntVal : 0 })
223+ pl .demoInfoProvider = s1DemoInfoProvider
215224
216225 assert .False (t , pl .IsAirborne ())
217226
218227 pl = playerWithProperty ("m_hGroundEntity" , st.PropertyValue {IntVal : 2097151 })
228+ pl .demoInfoProvider = s1DemoInfoProvider
219229
220230 assert .True (t , pl .IsAirborne ())
221231}
222232
223233func TestPlayer_IsDucking (t * testing.T ) {
224234 pl := playerWithProperty ("m_fFlags" , st.PropertyValue {IntVal : 0 })
235+ pl .demoInfoProvider = s1DemoInfoProvider
225236
226237 assert .False (t , pl .IsDucking ())
227238 assert .True (t , pl .IsStanding ())
228239 assert .False (t , pl .IsDuckingInProgress ())
229240 assert .False (t , pl .IsUnDuckingInProgress ())
230241
231242 pl = playerWithProperty ("m_fFlags" , st.PropertyValue {IntVal : 1 << 1 })
243+ pl .demoInfoProvider = s1DemoInfoProvider
232244
233245 assert .False (t , pl .IsDucking ())
234246 assert .False (t , pl .IsStanding ())
235247 assert .False (t , pl .IsDuckingInProgress ())
236248 assert .True (t , pl .IsUnDuckingInProgress ())
237249
238250 pl = playerWithProperty ("m_fFlags" , st.PropertyValue {IntVal : 1 << 2 })
251+ pl .demoInfoProvider = s1DemoInfoProvider
239252
240253 assert .False (t , pl .IsDucking ())
241254 assert .False (t , pl .IsStanding ())
242255 assert .True (t , pl .IsDuckingInProgress ())
243256 assert .False (t , pl .IsUnDuckingInProgress ())
244257
245258 pl = playerWithProperty ("m_fFlags" , st.PropertyValue {IntVal : 1 << 1 | 1 << 2 })
259+ pl .demoInfoProvider = s1DemoInfoProvider
246260
247261 assert .True (t , pl .IsDucking ())
248262 assert .False (t , pl .IsStanding ())
@@ -252,46 +266,55 @@ func TestPlayer_IsDucking(t *testing.T) {
252266
253267func TestPlayerFlags_OnGround (t * testing.T ) {
254268 pl := playerWithProperty ("m_fFlags" , st.PropertyValue {IntVal : 0 })
269+ pl .demoInfoProvider = s1DemoInfoProvider
255270
256271 assert .False (t , pl .Flags ().OnGround ())
257272
258273 pl = playerWithProperty ("m_fFlags" , st.PropertyValue {IntVal : 1 })
274+ pl .demoInfoProvider = s1DemoInfoProvider
259275
260276 assert .True (t , pl .Flags ().OnGround ())
261277}
262278
263279func TestPlayer_HasDefuseKit (t * testing.T ) {
264280 pl := playerWithProperty ("m_bHasDefuser" , st.PropertyValue {IntVal : 0 })
281+ pl .demoInfoProvider = s1DemoInfoProvider
265282
266283 assert .False (t , pl .HasDefuseKit ())
267284
268285 pl = playerWithProperty ("m_bHasDefuser" , st.PropertyValue {IntVal : 1 })
286+ pl .demoInfoProvider = s1DemoInfoProvider
269287
270288 assert .True (t , pl .HasDefuseKit ())
271289}
272290
273291func TestPlayer_HasHelmet (t * testing.T ) {
274292 pl := playerWithProperty ("m_bHasHelmet" , st.PropertyValue {IntVal : 0 })
293+ pl .demoInfoProvider = s1DemoInfoProvider
275294
276295 assert .False (t , pl .HasHelmet ())
277296
278297 pl = playerWithProperty ("m_bHasHelmet" , st.PropertyValue {IntVal : 1 })
298+ pl .demoInfoProvider = s1DemoInfoProvider
279299
280300 assert .True (t , pl .HasHelmet ())
281301}
282302
283303func TestPlayer_IsControllingBot_NilEntity (t * testing.T ) {
284304 pl := new (Player )
305+ pl .demoInfoProvider = s1DemoInfoProvider
285306
286307 assert .False (t , pl .IsControllingBot ())
287308}
288309
289310func TestPlayer_IsControllingBot (t * testing.T ) {
290311 pl := playerWithProperty ("m_bIsControllingBot" , st.PropertyValue {IntVal : 0 })
312+ pl .demoInfoProvider = s1DemoInfoProvider
291313
292314 assert .False (t , pl .IsControllingBot ())
293315
294316 pl = playerWithProperty ("m_bIsControllingBot" , st.PropertyValue {IntVal : 1 })
317+ pl .demoInfoProvider = s1DemoInfoProvider
295318
296319 assert .True (t , pl .IsControllingBot ())
297320}
@@ -335,18 +358,21 @@ func TestPlayer_Armor(t *testing.T) {
335358
336359func TestPlayer_Money (t * testing.T ) {
337360 pl := playerWithProperty ("m_iAccount" , st.PropertyValue {IntVal : 800 })
361+ pl .demoInfoProvider = s1DemoInfoProvider
338362
339363 assert .Equal (t , 800 , pl .Money ())
340364}
341365
342366func TestPlayer_ViewDirectionX (t * testing.T ) {
343367 pl := playerWithProperty ("m_angEyeAngles[1]" , st.PropertyValue {FloatVal : 180 })
368+ pl .demoInfoProvider = s1DemoInfoProvider
344369
345370 assert .Equal (t , float32 (180 ), pl .ViewDirectionX ())
346371}
347372
348373func TestPlayer_ViewDirectionY (t * testing.T ) {
349374 pl := playerWithProperty ("m_angEyeAngles[0]" , st.PropertyValue {FloatVal : 15 })
375+ pl .demoInfoProvider = s1DemoInfoProvider
350376
351377 assert .Equal (t , float32 (15 ), pl .ViewDirectionY ())
352378}
@@ -358,12 +384,14 @@ func TestPlayer_Position(t *testing.T) {
358384 entity .On ("Position" ).Return (pos )
359385
360386 pl := & Player {Entity : entity }
387+ pl .demoInfoProvider = s1DemoInfoProvider
361388
362389 assert .Equal (t , pos , pl .Position ())
363390}
364391
365392func TestPlayer_Position_EntityNil (t * testing.T ) {
366393 pl := new (Player )
394+ pl .demoInfoProvider = s1DemoInfoProvider
367395
368396 assert .Empty (t , pl .Position ())
369397}
@@ -375,6 +403,7 @@ func TestPlayer_PositionEyes(t *testing.T) {
375403 entity .On ("Position" ).Return (pos )
376404
377405 pl := & Player {Entity : entity }
406+ pl .demoInfoProvider = s1DemoInfoProvider
378407
379408 assert .Equal (t , r3.Vector {X : 1 , Y : 2 , Z : 5 }, pl .PositionEyes ())
380409}
@@ -392,19 +421,25 @@ func TestPlayer_Velocity(t *testing.T) {
392421 entity .On ("PropertyValueMust" , "localdata.m_vecVelocity[2]" ).Return (st.PropertyValue {FloatVal : 3 })
393422
394423 pl := & Player {Entity : entity }
424+ pl .demoInfoProvider = s1DemoInfoProvider
395425
396426 expected := r3.Vector {X : 1 , Y : 2 , Z : 3 }
397427 assert .Equal (t , expected , pl .Velocity ())
398428}
399429
400430func TestPlayer_Velocity_EntityNil (t * testing.T ) {
401431 pl := new (Player )
432+ pl .demoInfoProvider = s1DemoInfoProvider
402433
403434 assert .Empty (t , pl .Velocity ())
404435}
405436
406437func TestPlayer_ClanTag (t * testing.T ) {
407- pl := playerWithResourceProperty ("m_szClan" , st.PropertyValue {StringVal : "SuperClan" })
438+ pl := playerWithResourceProperty ("m_szClan" , st.PropertyValue {Any : "SuperClan" })
439+ pl .demoInfoProvider = demoInfoProviderMock {
440+ playerResourceEntity : (pl .demoInfoProvider .(demoInfoProviderMock )).playerResourceEntity ,
441+ isSource2 : false ,
442+ }
408443
409444 assert .Equal (t , "SuperClan" , pl .ClanTag ())
410445}
@@ -520,7 +555,8 @@ func TestPlayer_SteamID32(t *testing.T) {
520555}
521556
522557func TestPlayer_LastPlaceName (t * testing.T ) {
523- pl := playerWithProperty ("m_szLastPlaceName" , st.PropertyValue {StringVal : "TopofMid" })
558+ pl := playerWithProperty ("m_szLastPlaceName" , st.PropertyValue {Any : "TopofMid" })
559+ pl .demoInfoProvider = s1DemoInfoProvider
524560
525561 assert .Equal (t , "TopofMid" , pl .LastPlaceName ())
526562}
0 commit comments