From bdfbc8dcf27028036f7b9c2a1ed2e19eade7a3c8 Mon Sep 17 00:00:00 2001 From: Dongsug Song Date: Fri, 13 Mar 2020 17:03:52 +0900 Subject: [PATCH] [Non-ACR][NUI][Fix VideoView TC fail] Change-Id: Id4a0deb9b90784f592713383ba3828a171ffce02 --- .../Tizen.NUI.Tests/testcase/TSVideoView.cs | 231 +++++++++++++-------- 1 file changed, 145 insertions(+), 86 deletions(-) diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVideoView.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVideoView.cs index 4b9b178..03f7490 100755 --- a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVideoView.cs +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVideoView.cs @@ -16,32 +16,23 @@ namespace Tizen.NUI.Tests public class VideoViewTests { private string TAG = "NUI"; - private string _videoPath = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "demoVideo.mp4"; - private bool _flagOnFinished; - private VideoView _videoView; + private string videoPath = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "demoVideo.mp4"; + private bool flagOnFinished; private void OnFinished(object obj, VideoView.FinishedEventArgs args) { - _flagOnFinished = true; + flagOnFinished = true; } [SetUp] public void Init() { - Tizen.Log.Info(TAG, "Init() is called!"); - App.MainTitleChangeText("VideoViewTests"); - App.MainTitleChangeBackgroundColor(null); - _videoView = new VideoView(); - Window.Instance.Add(_videoView); } [TearDown] public void Destroy() { - Tizen.Log.Info(TAG, "Destroy() is called!"); - _videoView.Dispose(); - _videoView = null; - } + } [Test] [Category("P1")] @@ -52,10 +43,12 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Zaijuan Sui, z6177.sui@samsung.com")] [Property("COVPARAM", "")] public void VideoView_INIT_WITH_NULL() - { - /* TEST CODE */ - Assert.IsNotNull(_videoView, "_videoView is null."); - Assert.IsInstanceOf(_videoView, "Should return VideoView instance."); + { + /* TEST CODE */ + var videoView = new VideoView(); + Assert.IsNotNull(videoView, "videoView is null."); + Assert.IsInstanceOf(videoView, "Should return VideoView instance."); + videoView.Dispose(); } [Test] @@ -69,7 +62,7 @@ namespace Tizen.NUI.Tests public void VideoView_INIT_WITH_URL() { /* TEST CODE */ - var videoView = new VideoView("DALI"); + var videoView = new VideoView("DALI"); Assert.IsNotNull(videoView, "videoView is null."); Assert.IsInstanceOf(videoView, "Should return VideoView instance."); videoView.Dispose(); @@ -85,8 +78,10 @@ namespace Tizen.NUI.Tests public void ResourceUrl_SET_GET_VALUE() { /* TEST CODE */ - _videoView.ResourceUrl = _videoPath; - Assert.AreEqual(_videoPath, _videoView.ResourceUrl, "videoview.ResourceUrl should equal to the setted value."); + VideoView videoView = new VideoView(); + videoView.ResourceUrl = videoPath; + Assert.AreEqual(videoPath, videoView.ResourceUrl, "videoview.ResourceUrl should equal to the setted value."); + videoView.Dispose(); } [Test] @@ -101,7 +96,11 @@ namespace Tizen.NUI.Tests /* TEST CODE */ try { - _videoView.Play(); + VideoView videoView = new VideoView(); + videoView.ResourceUrl = videoPath; + videoView.Play(); + videoView.Stop(); + videoView.Dispose(); } catch (Exception e) { @@ -123,7 +122,12 @@ namespace Tizen.NUI.Tests /* TEST CODE */ try { - _videoView.Pause(); + VideoView videoView = new VideoView(); + videoView.ResourceUrl = videoPath; + videoView.Play(); + videoView.Pause(); + videoView.Stop(); + videoView.Dispose(); } catch (Exception e) { @@ -145,7 +149,11 @@ namespace Tizen.NUI.Tests /* TEST CODE */ try { - _videoView.Stop(); + VideoView videoView = new VideoView(); + videoView.ResourceUrl = videoPath; + videoView.Play(); + videoView.Stop(); + videoView.Dispose(); } catch (Exception e) { @@ -167,7 +175,12 @@ namespace Tizen.NUI.Tests /* TEST CODE */ try { - _videoView.Forward(1000); + VideoView videoView = new VideoView(); + videoView.ResourceUrl = videoPath; + videoView.Play(); + videoView.Forward(100); + videoView.Stop(); + videoView.Dispose(); } catch (Exception e) { @@ -189,7 +202,12 @@ namespace Tizen.NUI.Tests /* TEST CODE */ try { - _videoView.Backward(1000); + VideoView videoView = new VideoView(); + videoView.ResourceUrl = videoPath; + videoView.Play(); + videoView.Backward(100); + videoView.Stop(); + videoView.Dispose(); } catch (Exception e) { @@ -209,14 +227,17 @@ namespace Tizen.NUI.Tests public void Video_SET_GET_VALUE() { /* TEST CODE */ + VideoView videoView = new VideoView(); 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.Video = propertyMap; - PropertyValue propertyvalue3 = _videoView.Video.GetValue(1); + propertyMap.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.Text)); + propertyMap.Insert(TextVisualProperty.Text, new PropertyValue("Hello Goodbye")); + 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"); + //videoView.Stop(); + videoView.Dispose(); } [Test] @@ -226,16 +247,19 @@ namespace Tizen.NUI.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "PRW")] [Property("AUTHOR", "Zaijuan Sui, z6177.sui@samsung.com")] - public void Looping_SET_GET_VALUE() + public async Task Looping_SET_GET_VALUE() { /* TEST CODE */ - Window.Instance.GetDefaultLayer().Add(_videoView); + VideoView videoView = new VideoView(); + Window.Instance.GetDefaultLayer().Add(videoView); + await Task.Delay(1000); - _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 = 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.Unparent(); + videoView.Dispose(); } [Test] @@ -245,29 +269,34 @@ namespace Tizen.NUI.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "PRW")] [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] - public void Underlay_SET_GET_VALUE() + public async Task Underlay_SET_GET_VALUE() { /* TEST CODE */ - Window.Instance.GetDefaultLayer().Add(_videoView); + VideoView videoView = new VideoView(); + videoView.ResourceUrl = videoPath; + Window.Instance.GetDefaultLayer().Add(videoView); + await Task.Delay(1000); bool isSupportRawVideo = false; if (Tizen.System.Information.TryGetValue("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)"); - } + else + { + Tizen.Log.Error(TAG, "Error checking if raw_video is supported(systeminfo)"); + } + videoView.Unparent(); + videoView.Dispose(); } [Test] @@ -277,16 +306,24 @@ namespace Tizen.NUI.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "PRW")] [Property("AUTHOR", "Zaijuan Sui, z6177.sui@samsung.com")] - public void Muted_SET_GET_VALUE() + public async Task Muted_SET_GET_VALUE() { /* TEST CODE */ - Window.Instance.GetDefaultLayer().Add(_videoView); + VideoView videoView = new VideoView(); + Window.Instance.GetDefaultLayer().Add(videoView); + await Task.Delay(1000); + + videoView.Size2D = new Size2D(200, 200); + videoView.ResourceUrl = videoPath; - _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"); + + videoView.Unparent(); + videoView.Dispose(); } [Test] @@ -296,34 +333,61 @@ namespace Tizen.NUI.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "PRW")] [Property("AUTHOR", "Zaijuan Sui, z6177.sui@samsung.com")] - public void Volume_SET_GET_VALUE() + public async Task Volume_SET_GET_VALUE() { /* TEST CODE */ + VideoView videoView = new VideoView(); + Window.Instance.GetDefaultLayer().Add(videoView); + await Task.Delay(1000); + + videoView.Size2D = new Size2D(200, 200); + videoView.ResourceUrl = videoPath; + PropertyMap propertyMap = new PropertyMap(); - propertyMap.Add("volumeLeft", new PropertyValue(0.0f)); - propertyMap.Add("volumeRight", new PropertyValue(5.0f)); - - _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); + propertyMap.Add("volumeLeft", new PropertyValue(0.3f)); + // left/right volumes can not be different + propertyMap.Add("volumeRight", new PropertyValue(0.3f)); + + videoView.Volume = propertyMap; + float left; + float right; + videoView.Volume.Find(0, "volumeLeft").Get(out left); + videoView.Volume.Find(1, "volumeRight").Get(out right); + + Assert.AreEqual(0.3f, left, "values must be equal"); + Assert.AreEqual(0.3f, right, "values must be equal"); + + videoView.Dispose(); } [Test] [Category("P1")] - [Description("Test Dispose, try to dispose the VideoView.")] - [Property("SPEC", "Tizen.NUI.BaseComponents.VideoView.Dispose M")] + [Description("Test Finished. Check whether the Finished event triggered when the scroll complete")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VideoView.Finished E")] [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR MCST")] - [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] - public void Dispose_TEST() + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public async Task Finished_CHECK_EVENT() { /* TEST CODE */ + VideoView videoView = new VideoView(); + videoView.Size2D = new Size2D(200, 200); + videoView.ResourceUrl = videoPath; + videoView.Underlay = false; + Window.Instance.GetDefaultLayer().Add(videoView); + await Task.Delay(3000); + + //Assert.IsInstanceOf(videoView, "Should be an instance of VideoView type."); + try { - VideoView videoView = new VideoView(); - videoView.Dispose(); + flagOnFinished = false; + videoView.Finished += OnFinished; + Assert.False(flagOnFinished, "flagOnFinished should false initial"); + videoView.Play(); + await Task.Delay(2000); + Assert.True(flagOnFinished, "flagOnFinished should be true after Finished triggered"); + videoView.Unparent(); } catch (Exception e) { @@ -331,28 +395,25 @@ namespace Tizen.NUI.Tests LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); Assert.Fail("Caught Exception" + e.ToString()); } + + videoView.Finished -= OnFinished; + videoView.Dispose(); } [Test] [Category("P1")] - [Description("Test Finished. Check whether the Finished event triggered when the scroll complete")] - [Property("SPEC", "Tizen.NUI.BaseComponents.VideoView.Finished E")] + [Description("Test Dispose, try to dispose the VideoView.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VideoView.Dispose M")] [Property("SPEC_URL", "-")] - [Property("CRITERIA", "EVL")] - [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] - public async Task Finished_CHECK_EVENT() + [Property("CRITERIA", "MR MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Dispose_TEST() { - /* TEST CODE */ - _videoView.ResourceUrl = _videoPath; - Assert.IsInstanceOf(_videoView, "Should be an instance of VideoView type."); + /* TEST CODE */ try { - _flagOnFinished = false; - Assert.False(_flagOnFinished, "_flagOnFinished should false initial"); - _videoView.Finished += OnFinished; - _videoView.Play(); - await Task.Delay(1000); - Assert.True(_flagOnFinished, "_flagOnFinished should be true after Finished triggered"); + VideoView videoView = new VideoView(); + videoView.Dispose(); } catch (Exception e) { @@ -360,10 +421,8 @@ namespace Tizen.NUI.Tests LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); Assert.Fail("Caught Exception" + e.ToString()); } - finally - { - _videoView.Finished -= OnFinished; - } } + + } } -- 2.7.4