From 72d4809468770b41faddee8464dbdd659ee3ca3c Mon Sep 17 00:00:00 2001 From: Dongsug Song Date: Thu, 29 Apr 2021 10:07:06 +0900 Subject: [PATCH] [Non-ACR][NUI] Fix testhub fails - fix testhub auto tct fails, it only occurs on RPI board - add delays to cover all profiles Change-Id: Id0c99c534dc4a468c5bdb890aac25dfc4645a1e1 --- .../Tizen.NUI.Tests/testcase/TSVideoView.cs | 41 ++++-- tct-suite-vs/Tizen.NUI.Tests/testcase/TSWindow.cs | 146 +++++++++++++-------- 2 files changed, 123 insertions(+), 64 deletions(-) mode change 100644 => 100755 tct-suite-vs/Tizen.NUI.Tests/testcase/TSWindow.cs diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVideoView.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVideoView.cs index 6758aea..225f44f 100755 --- a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVideoView.cs +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVideoView.cs @@ -6,12 +6,11 @@ using System.Threading.Tasks; namespace Tizen.NUI.Tests { - [TestFixture] [Description("Tizen.VideoView Tests")] public class VideoViewTests { - private string TAG = "NUI"; + private string TAG = "NUITEST"; private string videoPath = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "demoVideo.mp4"; private bool _flagOnFinished; @@ -232,7 +231,6 @@ namespace Tizen.NUI.Tests string tempvalue = ""; propertyvalue3.Get(out tempvalue); Assert.AreEqual("Hello Goodbye", tempvalue, "Video function does not work"); - //videoView.Stop(); videoView.Dispose(); } @@ -247,15 +245,20 @@ namespace Tizen.NUI.Tests { /* TEST CODE */ var videoView = new VideoView(); + videoView.Size2D = new Size2D(200, 200); + videoView.ResourceUrl = videoPath; + videoView.Underlay = false; Window.Instance.GetDefaultLayer().Add(videoView); - await Task.Delay(1000); + Assert.IsInstanceOf(videoView, "Should be an instance of VideoView type."); 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(); + await Task.Delay(1000); } [Test] @@ -269,9 +272,11 @@ namespace Tizen.NUI.Tests { /* TEST CODE */ var videoView = new VideoView(); + videoView.Size2D = new Size2D(200, 200); videoView.ResourceUrl = videoPath; + videoView.Underlay = false; Window.Instance.GetDefaultLayer().Add(videoView); - await Task.Delay(1000); + Assert.IsInstanceOf(videoView, "Should be an instance of VideoView type."); bool isSupportRawVideo = false; if (Tizen.System.Information.TryGetValue("tizen.org/feature/multimedia.raw_video", out isSupportRawVideo)) @@ -291,8 +296,10 @@ namespace Tizen.NUI.Tests { Tizen.Log.Error(TAG, "Error checking if raw_video is supported(systeminfo)"); } + videoView.Unparent(); videoView.Dispose(); + await Task.Delay(1000); } [Test] @@ -306,11 +313,11 @@ namespace Tizen.NUI.Tests { /* TEST CODE */ var videoView = new VideoView(); - Window.Instance.GetDefaultLayer().Add(videoView); - await Task.Delay(1000); - videoView.Size2D = new Size2D(200, 200); videoView.ResourceUrl = videoPath; + videoView.Underlay = false; + Window.Instance.GetDefaultLayer().Add(videoView); + Assert.IsInstanceOf(videoView, "Should be an instance of VideoView type."); videoView.Muted = true; Assert.AreEqual(true, videoView.Muted, "Muted function does not work"); @@ -320,6 +327,7 @@ namespace Tizen.NUI.Tests videoView.Unparent(); videoView.Dispose(); + await Task.Delay(1000); } [Test] @@ -333,11 +341,11 @@ namespace Tizen.NUI.Tests { /* TEST CODE */ var videoView = new VideoView(); - Window.Instance.GetDefaultLayer().Add(videoView); - await Task.Delay(1000); - videoView.Size2D = new Size2D(200, 200); videoView.ResourceUrl = videoPath; + videoView.Underlay = false; + Window.Instance.GetDefaultLayer().Add(videoView); + Assert.IsInstanceOf(videoView, "Should be an instance of VideoView type."); PropertyMap propertyMap = new PropertyMap(); propertyMap.Add("volumeLeft", new PropertyValue(0.3f)); @@ -353,7 +361,9 @@ namespace Tizen.NUI.Tests Assert.AreEqual(0.3f, left, "values must be equal"); Assert.AreEqual(0.3f, right, "values must be equal"); + videoView.Unparent(); videoView.Dispose(); + await Task.Delay(1000); } [Test] @@ -380,15 +390,19 @@ namespace Tizen.NUI.Tests Assert.False(_flagOnFinished, "_flagOnFinished should false initial"); videoView.Play(); Tizen.Log.Error(TAG, $"Finished_CHECK_EVENT, videoPath={videoPath}"); - await Task.Delay(3000); + await Task.Delay(4000); + Tizen.Log.Error(TAG, $"check _flagOnFinished={_flagOnFinished}"); if (false == _flagOnFinished) { Tizen.Log.Error(TAG, $"Finished_CHECK_EVENT, _flagOnFinished is false! this is just Finished event test, so Stop() forcefully"); videoView.Stop(); await Task.Delay(1000); + Tizen.Log.Error(TAG, $"videoView.Stop()!"); } Assert.True(_flagOnFinished, "_flagOnFinished should be true after Finished triggered"); videoView.Unparent(); + Tizen.Log.Error(TAG, $"videoView.Unparent()!"); + await Task.Delay(1000); } catch (Exception e) { @@ -398,9 +412,12 @@ namespace Tizen.NUI.Tests } finally { + Tizen.Log.Error(TAG, $"videoView.Finished -= OnFinished!"); videoView.Finished -= OnFinished; } videoView.Dispose(); + Tizen.Log.Error(TAG, $"videoView.Dispose()!"); + await Task.Delay(1000); } [Test] diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSWindow.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSWindow.cs old mode 100644 new mode 100755 index b3a3b99..8448263 --- a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSWindow.cs +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSWindow.cs @@ -1,6 +1,7 @@ using NUnit.Framework; using NUnit.Framework.TUnit; using System; +using System.Threading.Tasks; using Tizen.NUI.BaseComponents; using Tizen.NUI.Test; @@ -11,16 +12,14 @@ namespace Tizen.NUI.Tests [Description("Tizen.NUI.Window Tests")] public class WindowTests { - private string TAG = "NUI"; - bool isSurfacelessContextSupported = false; + private string TAG = "NUITEST"; [SetUp] public void Init() { Tizen.Log.Info(TAG, "Init() is called!"); App.MainTitleChangeText("WindowTests"); - App.MainTitleChangeBackgroundColor(null); - Tizen.System.Information.TryGetValue("http://tizen.org/feature/opengles.surfaceless_context", out isSurfacelessContextSupported); + App.MainTitleChangeBackgroundColor(null); } [TearDown] @@ -49,22 +48,30 @@ namespace Tizen.NUI.Tests [Property("CRITERIA", "CONSTR")] [Property("COVPARAM", "Rectangle, bool")] [Property("AUTHOR", "Sunghyun kim, scholb.kim@samsung.com")] - public void Window_INIT() + public async Task Window_INIT() { /* TEST CODE */ - if( isSurfacelessContextSupported == false ) + bool isSurfacelessContextSupported = false; + Tizen.System.Information.TryGetValue("http://tizen.org/feature/opengles.surfaceless_context", out isSurfacelessContextSupported); + if (isSurfacelessContextSupported == false) { Assert.Pass("Test skipped! This Device is not support to opengles.surfaceless_context"); return; } - var window = new Window(new Rectangle(0,0,1920,1080), false ); + var window = new Window(new Rectangle(0, 0, 1920, 1080), false); Assert.IsNotNull(window, "The instance should be not null"); Assert.IsInstanceOf(window, "Should return View instance."); - var twindow = new Window(new Rectangle(0,0,1920,1080), true ); + var twindow = new Window(new Rectangle(0, 0, 1920, 1080), true); Assert.IsNotNull(twindow, "The instance should be not null"); Assert.IsInstanceOf(twindow, "Should return View instance."); + + window.Hide(); + window.Dispose(); + twindow.Hide(); + twindow.Dispose(); + await Task.Delay(3000); } [Test] @@ -75,22 +82,30 @@ namespace Tizen.NUI.Tests [Property("CRITERIA", "CONSTR")] [Property("COVPARAM", "string, Rectangle, bool")] [Property("AUTHOR", "Sunghyun kim, scholb.kim@samsung.com")] - public void Window_INIT_NAME() + public async Task Window_INIT_NAME() { /* TEST CODE */ - if( isSurfacelessContextSupported == false ) + bool isSurfacelessContextSupported = false; + Tizen.System.Information.TryGetValue("http://tizen.org/feature/opengles.surfaceless_context", out isSurfacelessContextSupported); + if (isSurfacelessContextSupported == false) { Assert.Pass("Test skipped! This Device is not support to opengles.surfaceless_context"); return; } - var window = new Window("Test Window", new Rectangle(0,0,1920,1080), false ); + var window = new Window("Test Window", new Rectangle(0, 0, 1920, 1080), false); Assert.IsNotNull(window, "The instance should be not null"); Assert.IsInstanceOf(window, "Should return View instance."); - var twindow = new Window("Test Window", new Rectangle(0,0,1920,1080), true ); + var twindow = new Window("Test Window", new Rectangle(0, 0, 1920, 1080), true); Assert.IsNotNull(twindow, "The instance should be not null"); Assert.IsInstanceOf(twindow, "Should return View instance."); + + window.Hide(); + window.Dispose(); + twindow.Hide(); + twindow.Dispose(); + await Task.Delay(3000); } [Test] @@ -952,7 +967,8 @@ namespace Tizen.NUI.Tests window.SetNotificationLevel(NotificationLevel.Top); //This is for multi Window feature, currently not supported. Assert.IsNotNull(window.GetNotificationLevel()); - } + } + [Test] [Category("P1")] [Description("Test SetScreenOffMode. Check whether SetScreenOffMode works fine or not.")] @@ -1062,16 +1078,23 @@ namespace Tizen.NUI.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "PRW")] [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] - public void WindowSize_SET_GET_VALUE() - { - /* TEST CODE */ - Window window = Window.Instance; - window.WindowSize = new Size2D(100, 100); + public async Task WindowSize_SET_GET_VALUE() + { + /* TEST CODE */ + await Task.Delay(3000); + var targetWidth = 300; + var targetHeight = 300; + Window window = Window.Instance; + + window.WindowSize = new Size2D(targetWidth, targetHeight); - Tizen.Log.Debug(TAG, $"window.WindowSize.Width={window.WindowSize.Width} window.WindowSize.Height={window.WindowSize.Height}"); + var currentWidowSize = window.Size; + Assert.AreEqual(targetWidth, currentWidowSize.Width, "The currentWidowSize Width is not correct!"); + Assert.AreEqual(targetHeight, currentWidowSize.Height, "The currentWidowSize Height is not correct!"); + Assert.AreEqual(targetWidth, window.WindowSize.Width, "The WindowSize Width is not correct!"); + Assert.AreEqual(targetHeight, window.WindowSize.Height, "The WindowSize Height is not correct!"); - Assert.AreEqual(100, window.WindowSize.Width, "The WindowSize.Width is not correct!"); - Assert.AreEqual(100, window.WindowSize.Height, "The WindowSize.Height is not correct!"); + Tizen.Log.Debug(TAG, $"currentWidowSize.Width={currentWidowSize.Width} currentWidowSize.Height={currentWidowSize.Height}"); } [Test] @@ -1238,15 +1261,15 @@ namespace Tizen.NUI.Tests var window = Window.Instance; try { - window.AddAvailableOrientation( Window.WindowOrientation.Portrait ); - window.AddAvailableOrientation( Window.WindowOrientation.Landscape ); - window.AddAvailableOrientation( Window.WindowOrientation.PortraitInverse ); - window.AddAvailableOrientation( Window.WindowOrientation.LandscapeInverse ); + window.AddAvailableOrientation(Window.WindowOrientation.Portrait); + window.AddAvailableOrientation(Window.WindowOrientation.Landscape); + window.AddAvailableOrientation(Window.WindowOrientation.PortraitInverse); + window.AddAvailableOrientation(Window.WindowOrientation.LandscapeInverse); window.AddAvailableOrientation((Window.WindowOrientation)100); - window.AddAvailableOrientation((Window.WindowOrientation)200 ); - window.AddAvailableOrientation((Window.WindowOrientation)300 ); + window.AddAvailableOrientation((Window.WindowOrientation)200); + window.AddAvailableOrientation((Window.WindowOrientation)300); } - catch( Exception e ) + catch (Exception e) { Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); @@ -1271,16 +1294,16 @@ namespace Tizen.NUI.Tests window.AddAvailableOrientation(Window.WindowOrientation.Landscape); window.AddAvailableOrientation(Window.WindowOrientation.PortraitInverse); window.AddAvailableOrientation(Window.WindowOrientation.LandscapeInverse); - window.RemoveAvailableOrientation( Window.WindowOrientation.Landscape ); - window.RemoveAvailableOrientation( Window.WindowOrientation.Landscape); - window.RemoveAvailableOrientation( Window.WindowOrientation.Landscape); + window.RemoveAvailableOrientation(Window.WindowOrientation.Landscape); + window.RemoveAvailableOrientation(Window.WindowOrientation.Landscape); + window.RemoveAvailableOrientation(Window.WindowOrientation.Landscape); window.AddAvailableOrientation(Window.WindowOrientation.LandscapeInverse); - window.AddAvailableOrientation((Window.WindowOrientation)100 ); + window.AddAvailableOrientation((Window.WindowOrientation)100); window.RemoveAvailableOrientation(Window.WindowOrientation.Landscape); - window.AddAvailableOrientation((Window.WindowOrientation)200 ); - window.AddAvailableOrientation((Window.WindowOrientation)300 ); + window.AddAvailableOrientation((Window.WindowOrientation)200); + window.AddAvailableOrientation((Window.WindowOrientation)300); } - catch( Exception e ) + catch (Exception e) { Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); @@ -1300,7 +1323,7 @@ namespace Tizen.NUI.Tests /* TEST CODE */ var window = Window.Instance; window.SetPreferredOrientation(Window.WindowOrientation.Landscape); - Assert.AreEqual(Window.WindowOrientation.Landscape , window.GetPreferredOrientation(), "SetPreferredOrientation does not work."); + Assert.AreEqual(Window.WindowOrientation.Landscape, window.GetPreferredOrientation(), "SetPreferredOrientation does not work."); } [Test] @@ -1325,21 +1348,27 @@ namespace Tizen.NUI.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "MR")] [Property("AUTHOR", "Sunghyun kim, scholb.kim@samsung.com")] - public void SetParent_CHECK_RETURN_VALUE() - { - /* TEST CODE */ - if( isSurfacelessContextSupported == false ) + public async Task SetParent_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + bool isSurfacelessContextSupported = false; + Tizen.System.Information.TryGetValue("http://tizen.org/feature/opengles.surfaceless_context", out isSurfacelessContextSupported); + if (isSurfacelessContextSupported == false) { Assert.Pass("Test skipped! This Device is not support to opengles.surfaceless_context"); return; - } - + } try { var window = Window.Instance; var pwindow = new Window(); Assert.IsNotNull(pwindow, "The instance should be not null"); - window.SetParent(pwindow); + window.SetParent(pwindow); + + window.Unparent(); + pwindow.Hide(); + pwindow.Dispose(); + await Task.Delay(3000); } catch (Exception e) { @@ -1356,10 +1385,12 @@ namespace Tizen.NUI.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "MR")] [Property("AUTHOR", "Sunghyun kim, scholb.kim@samsung.com")] - public void Unparent_CHECK_RETURN_VALUE() - { - /* TEST CODE */ - if( isSurfacelessContextSupported == false ) + public async Task Unparent_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + bool isSurfacelessContextSupported = false; + Tizen.System.Information.TryGetValue("http://tizen.org/feature/opengles.surfaceless_context", out isSurfacelessContextSupported); + if (isSurfacelessContextSupported == false) { Assert.Pass("Test skipped! This Device is not support to opengles.surfaceless_context"); return; @@ -1372,7 +1403,11 @@ namespace Tizen.NUI.Tests Assert.IsNotNull(pwindow, "The instance should be not null"); window.SetParent(pwindow); window.Unparent(); - Assert.AreNotEqual(pwindow, window.GetParent(), "Unparent does not work"); + Assert.AreNotEqual(pwindow, window.GetParent(), "Unparent does not work"); + + pwindow.Hide(); + pwindow.Dispose(); + await Task.Delay(3000); } catch (Exception e) { @@ -1389,10 +1424,12 @@ namespace Tizen.NUI.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "MR")] [Property("AUTHOR", "Sunghyun kim, scholb.kim@samsung.com")] - public void GetParent_CHECK_RETURN_VALUE() - { - /* TEST CODE */ - if( isSurfacelessContextSupported == false ) + public async Task GetParent_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + bool isSurfacelessContextSupported = false; + Tizen.System.Information.TryGetValue("http://tizen.org/feature/opengles.surfaceless_context", out isSurfacelessContextSupported); + if (isSurfacelessContextSupported == false) { Assert.Pass("Test skipped! This Device is not support to opengles.surfaceless_context"); return; @@ -1405,6 +1442,11 @@ namespace Tizen.NUI.Tests Assert.IsNotNull(pwindow, "The instance should be not null"); window.SetParent(pwindow); Assert.AreEqual(pwindow, window.GetParent(), "GetParent does not work"); + + window.Unparent(); + pwindow.Hide(); + pwindow.Dispose(); + await Task.Delay(3000); } catch (Exception e) { -- 2.7.4