From: Sunghyun kim Date: Mon, 23 Sep 2019 09:43:35 +0000 (+0900) Subject: [NUI][TCSACR-279][Add a new testcase for Window] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=69b500b5c24911bc7c0b458deb23516c99fe7d69;p=test%2Ftct%2Fcsharp%2Fapi.git [NUI][TCSACR-279][Add a new testcase for Window] Change-Id: I5f2acbf3856c676e7560818290656a09b12082a9 --- diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSWindow.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSWindow.cs index ca091e03b..f2b15bc88 100755 --- a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSWindow.cs +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSWindow.cs @@ -28,20 +28,60 @@ namespace Tizen.NUI.Tests public void Destroy() { Tizen.Log.Info(TAG, "Destroy() is called!"); - } - - private void OnFocusChanged(object obj, EventArgs e) + } + + private void OnFocusChanged(object obj, EventArgs e) { } - private void OnKeyEvent(object obj, EventArgs e) + private void OnKeyEvent(object obj, EventArgs e) { } - private void OnTouchEvent(object obj, EventArgs e) + private void OnTouchEvent(object obj, EventArgs e) { } - private void OnWheelEvent(object obj, EventArgs e) + private void OnWheelEvent(object obj, EventArgs e) { } + [Test] + [Category("P1")] + [Description("Create a new Window. Check whether window is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Window.Window C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "Rectangle, bool")] + [Property("AUTHOR", "Sunghyun kim, scholb.kim@samsung.com")] + public void Window_INIT() + { + /* TEST CODE */ + 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 ); + Assert.IsNotNull(twindow, "The instance should be not null"); + Assert.IsInstanceOf(twindow, "Should return View instance."); + } + + [Test] + [Category("P1")] + [Description("Create a new Window include name. Check whether window is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Window.Window C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "string, Rectangle, bool")] + [Property("AUTHOR", "Sunghyun kim, scholb.kim@samsung.com")] + public void Window_INIT_NAME() + { + /* TEST CODE */ + 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 ); + Assert.IsNotNull(twindow, "The instance should be not null"); + Assert.IsInstanceOf(twindow, "Should return View instance."); + } + [Test] [Category("P1")] [Description("dali window Raise test, try to raise the window")] @@ -398,24 +438,24 @@ namespace Tizen.NUI.Tests /* TEST CODE */ Window stage = Window.Instance; Layer layer = stage.GetDefaultLayer(); - uint cnt = stage.LayerCount; - Tizen.Log.Debug("NUITEST", $"num of layers={cnt}"); - - // default layer's depth can be changed by sibling order or rendering order - uint defaultLayerdepth = 0; - for (uint i = 0; i < cnt; i++) - { - var iterLayer = stage.GetLayer(i); - if (iterLayer == null) - { - Tizen.Log.Debug("NUITEST", $"iterLayer[{i}] is NULL!"); - } - else if (iterLayer == layer) - { - Tizen.Log.Debug("NUITEST", $"iterLayer[{i}] is same as default layer!"); - defaultLayerdepth = i; - break; - } + uint cnt = stage.LayerCount; + Tizen.Log.Debug("NUITEST", $"num of layers={cnt}"); + + // default layer's depth can be changed by sibling order or rendering order + uint defaultLayerdepth = 0; + for (uint i = 0; i < cnt; i++) + { + var iterLayer = stage.GetLayer(i); + if (iterLayer == null) + { + Tizen.Log.Debug("NUITEST", $"iterLayer[{i}] is NULL!"); + } + else if (iterLayer == layer) + { + Tizen.Log.Debug("NUITEST", $"iterLayer[{i}] is same as default layer!"); + defaultLayerdepth = i; + break; + } } Assert.IsTrue((stage.GetLayer(defaultLayerdepth) == layer), "Should be equal!"); } @@ -844,26 +884,26 @@ namespace Tizen.NUI.Tests public void GetLayer_CHECK_RETURN_VALUE() { /* TEST CODE */ - Layer layer = Window.Instance.GetDefaultLayer(); - - uint cnt = Window.Instance.LayerCount; - Tizen.Log.Debug("NUITEST", $"num of layers={cnt}"); - - // default layer's depth can be changed by sibling order or rendering order - uint defaultLayerdepth = 0; - for (uint i = 0; i < cnt; i++) - { - var iterLayer = Window.Instance.GetLayer(i); - if (iterLayer == null) - { - Tizen.Log.Debug("NUITEST", $"iterLayer[{i}] is NULL!"); - } - else if (iterLayer == layer) - { - Tizen.Log.Debug("NUITEST", $"iterLayer[{i}] is same as default layer!"); - defaultLayerdepth = i; - break; - } + Layer layer = Window.Instance.GetDefaultLayer(); + + uint cnt = Window.Instance.LayerCount; + Tizen.Log.Debug("NUITEST", $"num of layers={cnt}"); + + // default layer's depth can be changed by sibling order or rendering order + uint defaultLayerdepth = 0; + for (uint i = 0; i < cnt; i++) + { + var iterLayer = Window.Instance.GetLayer(i); + if (iterLayer == null) + { + Tizen.Log.Debug("NUITEST", $"iterLayer[{i}] is NULL!"); + } + else if (iterLayer == layer) + { + Tizen.Log.Debug("NUITEST", $"iterLayer[{i}] is same as default layer!"); + defaultLayerdepth = i; + break; + } } Assert.IsTrue((Window.Instance.GetLayer(defaultLayerdepth) == layer), "Should be equal!"); @@ -1173,5 +1213,176 @@ namespace Tizen.NUI.Tests Assert.Fail("Caught Exception" + e.ToString()); } } - } + + [Test] + [Category("P1")] + [Description("AddAvailableOrientation test. After AddAvailableOrientation, Windows rotation is possible in that direction.")] + [Property("SPEC", "Tizen.NUI.Window.AddAvailableOrientation M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Sunghyun kim, scholb.kim@samsung.com")] + public void AddAvailableOrientation_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + 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)100); + window.AddAvailableOrientation((Window.WindowOrientation)200 ); + window.AddAvailableOrientation((Window.WindowOrientation)300 ); + } + catch( Exception e ) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("checks for Window::RemoveAvailableOrientation() functionality")] + [Property("SPEC", "Tizen.NUI.Window.RemoveAvailableOrientation M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Sunghyun kim, scholb.kim@samsung.com")] + public void RemoveAvailableOrientation_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + 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.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.RemoveAvailableOrientation(Window.WindowOrientation.Landscape); + window.AddAvailableOrientation((Window.WindowOrientation)200 ); + window.AddAvailableOrientation((Window.WindowOrientation)300 ); + } + catch( Exception e ) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("SetPreferredOrientation test. After SetPreferredOrientation, window is forcibly rotated in that direction.")] + [Property("SPEC", "Tizen.NUI.Window.SetPreferredOrientation M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Sunghyun kim, scholb.kim@samsung.com")] + public void SetPreferredOrientation_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + var window = Window.Instance; + window.SetPreferredOrientation(Window.WindowOrientation.Landscape); + Assert.AreEqual(Window.WindowOrientation.Landscape , window.GetPreferredOrientation(), "SetPreferredOrientation does not work."); + } + + [Test] + [Category("P1")] + [Description("GetPreferredOrientation test. GetPreferredOrientation() have to return the currently set orientation value.")] + [Property("SPEC", "Tizen.NUI.Window.GetPreferredOrientation M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Sunghyun kim, scholb.kim@samsung.com")] + public void GetPreferredOrientation_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + var window = Window.Instance; + window.SetPreferredOrientation(Window.WindowOrientation.Portrait); + Assert.AreEqual(Window.WindowOrientation.Portrait, window.GetPreferredOrientation(), "GetPreferredOrientation does not work."); + } + + [Test] + [Category("P1")] + [Description("Test SetParent. Check whether setting the parent window for the current window works fine or not")] + [Property("SPEC", "Tizen.NUI.Window.SetParent M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Sunghyun kim, scholb.kim@samsung.com")] + public void SetParent_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + try + { + var window = Window.Instance; + var pwindow = new Window(); + Assert.IsNotNull(pwindow, "The instance should be not null"); + window.SetParent(pwindow); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test Unparent. Check whether unsetting the parent window for the current window works fine or not")] + [Property("SPEC", "Tizen.NUI.Window.Unparent M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Sunghyun kim, scholb.kim@samsung.com")] + public void Unparent_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + try + { + var window = Window.Instance; + var pwindow = new Window(); + Assert.IsNotNull(pwindow, "The instance should be not null"); + window.SetParent(pwindow); + window.Unparent(); + Assert.AreNotEqual(pwindow, window.GetParent(), "Unparent does not work"); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test GetParent. GetParent() have to return the currently set parent window.")] + [Property("SPEC", "Tizen.NUI.Window.GetParent M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Sunghyun kim, scholb.kim@samsung.com")] + public void GetParent_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + try + { + var window = Window.Instance; + var pwindow = new Window(); + Assert.IsNotNull(pwindow, "The instance should be not null"); + window.SetParent(pwindow); + Assert.AreEqual(pwindow, window.GetParent(), "GetParent does not work"); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + } + } }