public class VideoViewTests
{
private string TAG = "NUI";
- private string video_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "demoVideo.mp4";
- private bool _flagOnFinished;
+ private string _videoPath = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "demoVideo.mp4";
+ private bool _flagOnFinished;\r
+ private VideoView _videoView;
private void OnFinished(object obj, VideoView.FinishedEventArgs args)
{
Tizen.Log.Info(TAG, "Init() is called!");
App.MainTitleChangeText("VideoViewTests");
App.MainTitleChangeBackgroundColor(null);
+ _videoView = new VideoView();
}
[TearDown]
public void Destroy()
{
Tizen.Log.Info(TAG, "Destroy() is called!");
+ _videoView.Dispose();
+ _videoView = null;
}\r
[Test]
[Property("AUTHOR", "Zaijuan Sui, z6177.sui@samsung.com")]
[Property("COVPARAM", "")]
public void VideoView_INIT_WITH_NULL()
- {
- /* TEST CODE */
- var videoview = new VideoView();
- Assert.IsInstanceOf<VideoView>(videoview, "Should return VideoView instance.");
+ {\r
+ /* TEST CODE */\r
+ Assert.IsNotNull(_videoView, "_videoView is null.");
+ Assert.IsInstanceOf<VideoView>(_videoView, "Should return VideoView instance.");
}
[Test]
public void VideoView_INIT_WITH_URL()
{
/* TEST CODE */
- var videoview = new VideoView("DALI");
- Assert.IsInstanceOf<VideoView>(videoview, "Should return VideoView instance.");
+ var videoView = new VideoView("DALI");\r
+ Assert.IsNotNull(videoView, "videoView is null.");
+ Assert.IsInstanceOf<VideoView>(videoView, "Should return VideoView instance.");
+ videoView.Dispose();
}
[Test]
public void ResourceUrl_SET_GET_VALUE()
{
/* TEST CODE */
- var videoview = new VideoView();
- videoview.ResourceUrl = video_path;
- Assert.AreEqual(video_path, videoview.ResourceUrl, "videoview.ResourceUrl should equal to the setted value.");
+ _videoView.ResourceUrl = _videoPath;
+ Assert.AreEqual(_videoPath, _videoView.ResourceUrl, "videoview.ResourceUrl should equal to the setted value.");
}
[Test]
/* TEST CODE */
try
{
- VideoView videoview = new VideoView();
- videoview.Play();
+ _videoView.Play();
}
catch (Exception e)
{
/* TEST CODE */
try
{
- VideoView videoview = new VideoView();
- videoview.Pause();
+ _videoView.Pause();
}
catch (Exception e)
{
/* TEST CODE */
try
{
- VideoView videoview = new VideoView();
- videoview.Stop();
+ _videoView.Stop();
}
catch (Exception e)
{
/* TEST CODE */
try
{
- VideoView videoview = new VideoView();
- videoview.Forward(1000);
+ _videoView.Forward(1000);
}
catch (Exception e)
{
/* TEST CODE */
try
{
- VideoView videoview = new VideoView();
- videoview.Backward(1000);
+ _videoView.Backward(1000);
}
catch (Exception e)
{
PropertyMap propertyMap = new PropertyMap();
propertyMap.Insert(Tizen.NUI.Visual.Property.Type, new PropertyValue((int)Tizen.NUI.Visual.Type.Text));
propertyMap.Insert(Tizen.NUI.TextVisualProperty.Text, new PropertyValue("Hello Goodbye"));
- VideoView videoview = new VideoView();
- videoview.Video = propertyMap;
- PropertyValue propertyvalue3 = videoview.Video.GetValue(1);
+ _videoView.Video = propertyMap;
+ PropertyValue propertyvalue3 = _videoView.Video.GetValue(1);
string tempvalue = "";
propertyvalue3.Get(out tempvalue);
Assert.AreEqual("Hello Goodbye", tempvalue, "Video function does not work");
public void Looping_SET_GET_VALUE()
{
/* TEST CODE */
- VideoView videoview = new VideoView();
- Window.Instance.GetDefaultLayer().Add(videoview);
+ Window.Instance.GetDefaultLayer().Add(_videoView);
- videoview.Looping = true;
- Assert.AreEqual(true, videoview.Looping, "Looping function does not work");
+ _videoView.Looping = true;
+ Assert.AreEqual(true, _videoView.Looping, "Looping function does not work");
- videoview.Looping = false;
- Assert.AreEqual(false, videoview.Looping, "Looping function does not work");
+ _videoView.Looping = false;
+ Assert.AreEqual(false, _videoView.Looping, "Looping function does not work");
}
[Test]
public void Underlay_SET_GET_VALUE()
{
/* TEST CODE */
- VideoView videoview = new VideoView();
- Window.Instance.GetDefaultLayer().Add(videoview);
+ Window.Instance.GetDefaultLayer().Add(_videoView);
bool isSupportRawVideo = false;
if (Tizen.System.Information.TryGetValue<bool>("tizen.org/feature/multimedia.raw_video", out isSupportRawVideo))
{
if (isSupportRawVideo)
{
- videoview.Underlay = false;
- Assert.AreEqual(false, videoview.Underlay, "Underlay function does not work");
+ _videoView.Underlay = false;
+ Assert.AreEqual(false, _videoView.Underlay, "Underlay function does not work");
}
else
{
- videoview.Underlay = true;
- Assert.AreEqual(true, videoview.Underlay, "Underlay function does not work");
+ _videoView.Underlay = true;
+ Assert.AreEqual(true, _videoView.Underlay, "Underlay function does not work");
}
}
else
{
- Tizen.Log.Error(TAG, "Error checking if raw_video is supported(systeminfo)");
+ Tizen.Log.Error(TAG, "Error checking if raw_video is supported(systeminfo)");\r
}
}
public void Muted_SET_GET_VALUE()
{
/* TEST CODE */
- VideoView videoview = new VideoView();
- Window.Instance.GetDefaultLayer().Add(videoview);
+ Window.Instance.GetDefaultLayer().Add(_videoView);
- videoview.Muted = true;
- Assert.AreEqual(true, videoview.Muted, "Muted function does not work");
+ _videoView.Muted = true;
+ Assert.AreEqual(true, _videoView.Muted, "Muted function does not work");
- videoview.Muted = false;
- Assert.AreEqual(false, videoview.Muted, "Muted function does not work");
+ _videoView.Muted = false;
+ Assert.AreEqual(false, _videoView.Muted, "Muted function does not work");
}
[Test]
PropertyMap propertyMap = new PropertyMap();
propertyMap.Add("volumeLeft", new PropertyValue(0.0f));
propertyMap.Add("volumeRight", new PropertyValue(5.0f));
- VideoView videoview = new VideoView();
- videoview.Volume = propertyMap;
+ _videoView.Volume = propertyMap;
float left = 0.0f;
float right = 0.0f;
- videoview.Volume.Find(0, "volumeLeft").Get(out left);
- videoview.Volume.Find(1, "volumeRight").Get(out right);
+ _videoView.Volume.Find(0, "volumeLeft").Get(out left);
+ _videoView.Volume.Find(1, "volumeRight").Get(out right);
}
[Test]
[Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]
public async Task Finished_CHECK_EVENT()
{
- /* TEST CODE */
- var videoView = new VideoView();\r
- videoView.ResourceUrl = video_path;\r
- Assert.IsInstanceOf<VideoView>(videoView, "Should be an instance of VideoView type.");
+ /* TEST CODE */\r
+ _videoView.ResourceUrl = _videoPath;\r
+ Assert.IsInstanceOf<VideoView>(_videoView, "Should be an instance of VideoView type.");
try
{
_flagOnFinished = false;\r
Assert.False(_flagOnFinished, "_flagOnFinished should false initial");
- videoView.Finished += OnFinished;\r
- videoView.Play();
+ _videoView.Finished += OnFinished;\r
+ _videoView.Play();
await Task.Delay(1000);
Assert.True(_flagOnFinished, "_flagOnFinished should be true after Finished triggered");
}
}
finally
{\r
- videoView.Finished -= OnFinished;\r
+ _videoView.Finished -= OnFinished;\r
}
}
}