Test video playback. Xna video loading won't work from ReSharper, use Program.cs instead.
View code on GitHub
Inheritance Hierarchy
DeltaEngine.Platforms TestWithMocksOrVisually
DeltaEngine.Multimedia.Tests VideoTests
Namespace: DeltaEngine.Multimedia.Tests
Assembly: DeltaEngine.Multimedia.Tests (in DeltaEngine.Multimedia.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The VideoTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
VideoTests | Initializes a new instance of the VideoTests class |
Methods
Name | Description | |
---|---|---|
AdvanceTimeAndUpdateEntities | (Inherited from TestWithMocksOrVisually.) | |
CheckDurationAndPosition | ||
ExpectExceptionIfVideoIsNotAvailable | ||
InitializeResolver | (Inherited from TestWithMocksOrVisually.) | |
LoadTestVideo | ||
PlayAndStop | ||
PlayAndStopWithEntitiesRunner | ||
PlayVideo | ||
PlayVideoOnClick | ||
PlayVideoWhileOtherIsPlaying | ||
RegisterMock T | (Inherited from TestWithMocksOrVisually.) | |
Resolve T | (Inherited from TestWithMocksOrVisually.) | |
RunAfterFirstFrame | (Inherited from TestWithMocksOrVisually.) | |
RunTestAndDisposeResolverWhenDone | (Inherited from TestWithMocksOrVisually.) | |
StartAndStopVideo |
Properties
Name | Description | |
---|---|---|
IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
Examples
[Test] public void ExpectExceptionIfVideoIsNotAvailable() { Assert.Throws<Video.VideoNotFoundOrAccessible>( () => ContentLoader.Load<Video>("NonExistingVideo")); }
[Test] public void PlayVideo() { testVideo.Play(); }
[Test] public void PlayVideoOnClick() { new FontText(Font.Default, "Click to Play", Rectangle.One); new Command(() => { testVideo.Play(); }).Add(new MouseButtonTrigger()); }
[Test] public void PlayAndStop() { testVideo.Stop(); Assert.IsFalse(testVideo.IsPlaying()); testVideo.Play(); Assert.IsTrue(testVideo.IsPlaying()); }
[Test] public void PlayAndStopWithEntitiesRunner() { int startedNumberOfEntities = EntitiesRunner.Current.NumberOfEntities; Assert.AreEqual(startedNumberOfEntities, EntitiesRunner.Current.NumberOfEntities); testVideo.Stop(); Assert.AreEqual(startedNumberOfEntities, EntitiesRunner.Current.NumberOfEntities); testVideo.Play(); Assert.AreEqual(startedNumberOfEntities + 1, EntitiesRunner.Current.NumberOfEntities); testVideo.Stop(); Assert.AreEqual(startedNumberOfEntities, EntitiesRunner.Current.NumberOfEntities); }
[Test] public void PlayVideoWhileOtherIsPlaying() { var otherTestVideo = ContentLoader.Load<Video>("DefaultVideo"); testVideo.Play(); Assert.False(MockVideo.VideoStopCalled); otherTestVideo.Play(); Assert.False(MockVideo.VideoStopCalled); }
[Test] public void CheckDurationAndPosition() { testVideo.Update(); Assert.AreEqual(3.791f, testVideo.DurationInSeconds, 0.5f); Assert.AreEqual(1.0f, testVideo.PositionInSeconds); }
[Test] public void StartAndStopVideo() { Assert.AreEqual(3.791f, testVideo.DurationInSeconds, 0.5f); var videoTester = new VideoPlayedOneSecondTester(testVideo); Assert.IsTrue(videoTester.IsPauseable); testVideo.Play(); }
See Also