From: xb.teng Date: Wed, 7 Nov 2018 10:55:51 +0000 (+0800) Subject: [NUI][Non-ACR][Update TCTs for Tizen.NUI] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c7fa7a80266a2533caf46233b1cab10f7592378d;p=test%2Ftct%2Fcsharp%2Fapi.git [NUI][Non-ACR][Update TCTs for Tizen.NUI] These testcases should wait next release to verify. Change-Id: I741378fe998a2818f33939904d9c93967c6ac09b --- diff --git a/tct-suite-vs/Tizen.NUI.Manual.Tests/testcase/TSScrollBar.cs b/tct-suite-vs/Tizen.NUI.Manual.Tests/testcase/TSScrollBar.cs new file mode 100755 index 000000000..f7e149b20 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Manual.Tests/testcase/TSScrollBar.cs @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Threading.Tasks; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI.Tests +{ + [TestFixture] + [Description("Tizen.NUI.UIComponents.ScrollBar test")] + public class ScrollBarTests + { + private static ManualTestNUI _testPage; + private static WearableManualTestNUI _wearTestPage; + private static PushButton _button; + private static ScrollBar _scrollBar; + private static float PointSize = 5.0f; + private static TextLabel _label; + + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST"); + if (Window.Instance.Size.Width > 1000) + { + PointSize = 20.0f; + } + + if (ManualTest.IsWearable()) + { + PointSize = 2.0f; + _label = ManualTest.CreateLabel("This case is unsuitable for wearable, please press PASS button to continue!"); + _wearTestPage = WearableManualTestNUI.GetInstance(); + } + else + { + _testPage = ManualTestNUI.GetInstance(); + } + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST"); + } + + private PropertyMap CreateTextMap(float pointSize, string text) + { + PropertyMap map = new PropertyMap(); + map.Insert("visualType", new PropertyValue("TEXT")); + map.Insert("pointSize", new PropertyValue(pointSize)); + map.Insert("text", new PropertyValue(text)); + return map; + } + + private void CreateView(string information) + { + _button = new PushButton(); + _button.Label = CreateTextMap(PointSize, information); + + // Invoke ExecuteTC() method to add UI to test area. + _testPage.ExecuteTC(_button); + } + + private void OnPanFinished(object sender, EventArgs e) + { + Tizen.Log.Fatal("NUI", "TUnit OnPanFinished!"); + ManualTest.Confirm(); + } + + [Test] + [Category("P1")] + [Description("Test: PanFinished should be triggerred without any error.")] + [Property("SPEC", "Tizen.NUI.UIComponents.ScrollBar.PanFinished E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + [Precondition(1, "Prepare a mouse connect to target.")] + [Precondition(2, "Open terminal to enter command.")] + [Precondition(3, "Enter command \"vconftool set -t bool memory/window_system/input/force_enable_cursor 1 -f\" to enable mouse")] + [Step(1, "Click run TC")] + [Step(2, "Pan the ScrollBar show on the window")] + [Postcondition(1, "NA")] + public async Task PanFinished_CB() + { + if (ManualTest.IsWearable()) + { + _wearTestPage.ExecuteTC(_label); + await ManualTest.WaitForConfirm(); + _wearTestPage.ClearTestCase(_label); + } + else + { + CreateView("Use mouse to pan the scrollbar"); + + _scrollBar = new ScrollBar(ScrollBar.Direction.Horizontal); + _scrollBar.ParentOrigin = ParentOrigin.Center; + _scrollBar.PivotPoint = PivotPoint.Center; + _scrollBar.PositionUsesPivotPoint = true; + _scrollBar.BackgroundColor = Color.Red; + _scrollBar.Size2D = new Size2D(400, 30); + _scrollBar.IndicatorHeightPolicy = ScrollBar.IndicatorHeightPolicyType.Fixed; + _scrollBar.IndicatorFixedHeight = 50; + Window.Instance.Add(_scrollBar); + + View sourceActor = new View(); + Window.Instance.Add(sourceActor); + + // Register the scroll properties + int propertyScrollPosition = sourceActor.RegisterProperty("sourcePosition", new PropertyValue(0.0f)); + int propertyMinScrollPosition = sourceActor.RegisterProperty("sourcePositionMin", new PropertyValue(0.0f)); + int propertyMaxScrollPosition = sourceActor.RegisterProperty("sourcePositionMax", new PropertyValue(100.0f)); + int propertyScrollContentSize = sourceActor.RegisterProperty("sourceContentSize", new PropertyValue(500.0f)); + + _scrollBar.SetScrollPropertySource(sourceActor, propertyScrollPosition, propertyMinScrollPosition, propertyMaxScrollPosition, propertyScrollContentSize); + _scrollBar.PanFinished += OnPanFinished; + // Waits for user confirmation. + await ManualTest.WaitForConfirm(); + _scrollBar.PanFinished -= OnPanFinished; + Window.Instance.Remove(sourceActor); + Window.Instance.Remove(_scrollBar); + _testPage.ClearTestCase(_button); + } + } + } +} \ No newline at end of file diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSBaseHandle.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSBaseHandle.cs index 6456cfadb..30429980d 100755 --- a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSBaseHandle.cs +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSBaseHandle.cs @@ -401,5 +401,29 @@ namespace Tizen.NUI.Tests } } + [Test] + [Category("P1")] + [Description("Test GetTypeInfo. Check whether GetTypeInfo returns expected value or not.")] + [Property("SPEC", "Tizen.NUI.BaseHandle.GetTypeInfo M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void GetTypeInfo_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + try + { + PushButton view = new PushButton(); + var typeInfo = TypeRegistry.Get().GetTypeInfo("PushButton"); + Assert.IsInstanceOf(typeInfo, "Should be an instance of TypeInfo type."); + Assert.True(view.GetTypeInfo(typeInfo), "Should be true"); + } + 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()); + } + } } } diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSPinchGesture.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSPinchGesture.cs index e687c6bd4..5e197531c 100755 --- a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSPinchGesture.cs +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSPinchGesture.cs @@ -26,5 +26,119 @@ namespace Tizen.NUI.Tests { Tizen.Log.Info(TAG, "Destroy() is called!"); } + + [Test] + [Category("P1")] + [Description("Create a PinchGesture object. Check whether PinchGesture is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.PinchGesture.PinchGesture C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void PanGesture_INIT() + { + /* TEST CODE */ + var pinchGesture = new PinchGesture(Gesture.StateType.Started); + Assert.IsNotNull(pinchGesture, "Can't create success object PinchGesture"); + Assert.IsInstanceOf(pinchGesture, "Should be an instance of PinchGesture type."); + } + + [Test] + [Category("P1")] + [Description("Test LocalCenterPoint. Check whether GetDistance returns expected value or not.")] + [Property("SPEC", "Tizen.NUI.PinchGesture.LocalCenterPoint A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void LocalCenterPoint_CHECK_VALUE() + { + /* TEST CODE */ + try + { + var pinchGesture = new PinchGesture(Gesture.StateType.Started); + Assert.IsInstanceOf(pinchGesture, "Should be an instance of PinchGesture type."); + Assert.GreaterOrEqual(0, pinchGesture.LocalCenterPoint.X, "Should be the default value"); + Assert.GreaterOrEqual(0, pinchGesture.LocalCenterPoint.Y, "Should be the default value"); + } + 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 Scale. Check whether Scale returns expected value or not.")] + [Property("SPEC", "Tizen.NUI.PinchGesture.Scale A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void Scale_CHECK_VALUE() + { + /* TEST CODE */ + try + { + var pinchGesture = new PinchGesture(Gesture.StateType.Started); + Assert.IsInstanceOf(pinchGesture, "Should be an instance of PinchGesture type."); + Assert.GreaterOrEqual(0, pinchGesture.Scale, "Should be the default value"); + } + 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 ScreenCenterPoint. Check whether ScreenCenterPoint returns expected value or not.")] + [Property("SPEC", "Tizen.NUI.PinchGesture.ScreenCenterPoint A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void ScreenCenterPoint_CHECK_VALUE() + { + /* TEST CODE */ + try + { + var pinchGesture = new PinchGesture(Gesture.StateType.Started); + Assert.IsInstanceOf(pinchGesture, "Should be an instance of PinchGesture type."); + Assert.GreaterOrEqual(0, pinchGesture.ScreenCenterPoint.X, "Should be the default value"); + Assert.GreaterOrEqual(0, pinchGesture.ScreenCenterPoint.Y, "Should be the default value"); + } + 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 Speed. Check whether Speed returns expected value or not.")] + [Property("SPEC", "Tizen.NUI.PinchGesture.Speed A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void Speed_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + try + { + var pinchGesture = new PinchGesture(Gesture.StateType.Started); + Assert.IsInstanceOf(pinchGesture, "Should be an instance of PinchGesture type."); + Assert.GreaterOrEqual(0, pinchGesture.Speed, "Should be the default value"); + } + 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()); + } + } } } \ No newline at end of file diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSRelayoutContainer.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSRelayoutContainer.cs new file mode 100755 index 000000000..14a43984d --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSRelayoutContainer.cs @@ -0,0 +1,120 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Test; + +namespace Tizen.NUI.Tests +{ + [TestFixture] + [Description("Tizen.NUI.RelayoutContainer Tests")] + public class RelayoutContainerTests + { + private static string TAG = "NUI"; + private static bool _flagAdd; + internal class MyView : CustomView + { + View view; + static CustomView CreateInstance() + { + return new MyView(); + } + static MyView() + { + CustomViewRegistry.Instance.Register(CreateInstance, typeof(MyView)); + } + + public MyView() : base(typeof(MyView).FullName, CustomViewBehaviour.ViewBehaviourDefault) + { + } + + public MyView(string typeName, CustomViewBehaviour behaviour) : base(typeName, behaviour) + { + } + + public override void OnInitialize() + { + view = new BaseComponents.View(); + view.Size2D = new Size2D(200, 200); + view.BackgroundColor = Color.Red; + this.Add(view); + } + + public override Size2D GetNaturalSize() + { + return new Size2D(200, 200); + } + + public override void OnRelayout(Vector2 size, RelayoutContainer container) + { + View view = new View(); + view.Size2D = new Size2D(100, 100); + container.Add(view, new Size2D(100, 100)); + _flagAdd = true; + base.OnRelayout(size, container); + } + + public void AddVisual(PropertyMap propertyMap) + { + int visualIndex = RegisterProperty("MyVisual", new PropertyValue("MyVisual"), PropertyAccessMode.ReadWrite); + if (visualIndex > 0) + { + VisualBase visual = VisualFactory.Instance.CreateVisual(propertyMap); // Create a visual for the new one. + RegisterVisual(visualIndex, visual); + + RelayoutRequest(); + } + } + } + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("RelayoutContainerTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test Add check whether works ok or not.")] + [Property("SPEC", "Tizen.NUI.RelayoutContainer.Add M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void Add_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + MyView myView = new MyView(); + Assert.IsInstanceOf(myView, "Should be an instance of MyView2 type."); + Window.Instance.Add(myView); + try + { + _flagAdd = false; + Assert.False(_flagAdd, "Should be false"); + PropertyMap propertyMap = new PropertyMap(); + propertyMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color)); + propertyMap.Add(ColorVisualProperty.MixColor, new PropertyValue(Color.Blue)); + myView.AddVisual(propertyMap); + Assert.True(_flagAdd, "Should be true"); + } + 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()); + } + finally + { + Window.Instance.Remove(myView); + } + } + } +} \ No newline at end of file diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSScrollBar.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSScrollBar.cs index f493d7ebf..e4d1f9179 100755 --- a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSScrollBar.cs +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSScrollBar.cs @@ -2,8 +2,10 @@ using NUnit.Framework; using NUnit.Framework.TUnit; using System; using Tizen.NUI; +using Tizen.NUI.BaseComponents; using Tizen.NUI.UIComponents; using Tizen.NUI.Test; +using System.Threading.Tasks; namespace Tizen.NUI.Tests { @@ -12,6 +14,12 @@ namespace Tizen.NUI.Tests public class ScrollBarTests { private static string TAG = "NUI"; + private static bool _flagScrollInterval; + + private void OnScrollInterval(object sender, EventArgs e) + { + _flagScrollInterval = true; + } [SetUp] public void Init() @@ -222,5 +230,58 @@ namespace Tizen.NUI.Tests Assert.Fail("Caught Exception" + e.ToString()); } } + + [Test] + [Category("P1")] + [Description("Test ScrollInterval. Test whether the ScrollInterval event will be triggered.")] + [Property("SPEC", "Tizen.NUI.UIComponents.ScrollBar.ScrollInterval E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public async Task ScrollInterval_CHECK_EVENT() + { + /*TEST CODE*/ + var scrollBar = new ScrollBar(); + Assert.IsInstanceOf(scrollBar, "Should be an instance of ScrollBar type."); + Window.Instance.Add(scrollBar); + View sourceView = new View(); + Assert.IsInstanceOf(sourceView, "Should be an instance of View type."); + Window.Instance.Add(sourceView); + try + { + _flagScrollInterval = false; + Assert.False(_flagScrollInterval, "_flagScrollInterval should false initial"); + scrollBar.ScrollInterval += OnScrollInterval; + int propertyScrollPosition = sourceView.RegisterProperty("sourcePosition", new PropertyValue(0.0f)); + int propertyMinScrollPosition = sourceView.RegisterProperty("sourcePositionMin", new PropertyValue(0.0f)); + int propertyMaxScrollPosition = sourceView.RegisterProperty("sourcePositionMax", new PropertyValue(800.0f)); + int propertyScrollContentSize = sourceView.RegisterProperty("sourceContentSize", new PropertyValue(2000.0f)); + scrollBar.SetScrollPropertySource(sourceView, propertyScrollPosition, propertyMinScrollPosition, propertyMaxScrollPosition, propertyScrollContentSize); + PropertyArray positionIntervals = new PropertyArray(); + for (int i = 0; i != 10; ++i) + { + positionIntervals.PushBack(new PropertyValue(-80.0f * i)); // should get notified for each 80 pixels + } + scrollBar.ScrollPositionIntervals = (positionIntervals); + Animation animation = new Animation(100); + animation.AnimateTo(sourceView, "sourcePosition", -170.0f); + animation.Play(); + + await Task.Delay(110); + Assert.True(_flagScrollInterval, "_flagScrollInterval should be true."); + } + 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()); + } + finally + { + scrollBar.ScrollInterval -= OnScrollInterval; + Window.Instance.Remove(scrollBar); + Window.Instance.Remove(sourceView); + } + } } } diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSScrollView.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSScrollView.cs index 04c320c3e..c63dfec61 100755 --- a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSScrollView.cs +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSScrollView.cs @@ -4,6 +4,7 @@ using System; using Tizen.NUI; using Tizen.NUI.BaseComponents; using Tizen.NUI.Test; +using System.Threading.Tasks; namespace Tizen.NUI.Tests { @@ -13,6 +14,12 @@ namespace Tizen.NUI.Tests public class ScrollViewTests { private static string TAG = "NUI"; + private static bool _flagSnapStarted; + + private void OnSnapStarted(object sender, EventArgs e) + { + _flagSnapStarted = true; + } [SetUp] public void Init() @@ -1430,13 +1437,104 @@ namespace Tizen.NUI.Tests Assert.Fail("Caught Exception" + e.ToString()); } } - } - public class ScrollViewPagePathEffect : ScrollViewEffect - { - public ScrollViewPagePathEffect() + [Test] + [Category("P1")] + [Description("Test ApplyEffect whether works or not.")] + [Property("SPEC", "Tizen.NUI.ScrollView.ApplyEffect M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void ApplyEffect_CHECK() { + var scrollView = new ScrollView(); + Assert.IsInstanceOf(scrollView, "Should be an instance of ScrollView type."); + Window.Instance.Add(scrollView); + /* TEST CODE */ + try + { + Path path = new Path(); + ScrollViewEffect scrollViewEffect = new ScrollViewPagePathEffect(path, new Vector3(-1.0f, 0, 0), ScrollView.Property.SCROLL_FINAL_X, new Vector3(100.0f, 100.0f, 0.0f), 2); + scrollView.ApplyEffect(scrollViewEffect); + } + 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()); + } + finally + { + Window.Instance.Remove(scrollView); + } } - } + [Test] + [Category("P1")] + [Description("Test RemoveEffect whether works or not.")] + [Property("SPEC", "Tizen.NUI.ScrollView.RemoveEffect M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void RemoveEffect_CHECK() + { + var scrollView = new ScrollView(); + Assert.IsInstanceOf(scrollView, "Should be an instance of ScrollView type."); + Window.Instance.Add(scrollView); + /* TEST CODE */ + try + { + Path path = new Path(); + ScrollViewEffect scrollViewEffect = new ScrollViewPagePathEffect(path, new Vector3(-1.0f, 0, 0), ScrollView.Property.SCROLL_FINAL_X, new Vector3(100.0f, 100.0f, 0.0f), 2); + scrollView.ApplyEffect(scrollViewEffect); + scrollView.RemoveEffect(scrollViewEffect); + } + 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()); + } + finally + { + Window.Instance.Remove(scrollView); + } + } + + [Test] + [Category("P1")] + [Description("Test SnapStarted. Test whether the SnapStarted event will be triggered.")] + [Property("SPEC", "Tizen.NUI.ScrollView.SnapStarted E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public async Task SnapStarted_CHECK_EVENT() + { + /*TEST CODE*/ + var scrollView = new ScrollView(); + Assert.IsInstanceOf(scrollView, "Should be an instance of ScrollView type."); + scrollView.Size2D = new Size2D(400, 400); + Window.Instance.Add(scrollView); + try + { + _flagSnapStarted = false; + Assert.False(_flagSnapStarted, "_flagSnapStarted should false initial"); + scrollView.SnapStarted += OnSnapStarted; + scrollView.ScrollTo(new Vector2(300, 100), 0.0f); + await Task.Delay(100); + Assert.True(_flagSnapStarted, "_flagSnapStarted should be true."); + } + 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()); + } + finally + { + scrollView.SnapStarted -= OnSnapStarted; + Window.Instance.Remove(scrollView); + } + } + } } diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSTypeInfo.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSTypeInfo.cs new file mode 100755 index 000000000..53a0995db --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSTypeInfo.cs @@ -0,0 +1,176 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Test; +namespace Tizen.NUI.Tests +{ + [TestFixture] + [Description("Tizen.NUI.TypeInfo Tests")] + public class TypeInfoTests + { + private static string TAG = "NUI"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("TypeInfoTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a TypeInfo object. Check whether TypeInfo is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.TypeInfo.TypeInfo C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void TypeInfo_INIT() + { + /* TEST CODE */ + var typeInfo = new TypeInfo(); + Assert.IsNotNull(typeInfo, "Can't create success object TypeInfo"); + Assert.IsInstanceOf(typeInfo, "Should be an instance of TypeInfo type."); + } + + [Test] + [Category("P1")] + [Description("Create a TypeInfo object. Check whether TypeInfo is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.TypeInfo.TypeInfo C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "Tizen.NUI.TypeInfo")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void TypeInfo_INIT_WITH_TYPEINFO() + { + /* TEST CODE */ + var typeInfo = TypeRegistry.Get().GetTypeInfo("PushButton"); + Assert.IsInstanceOf(typeInfo, "Should be an instance of TypeInfo type."); + var typeInfo2 = new TypeInfo(typeInfo); + Assert.IsInstanceOf(typeInfo2, "Should be an instance of TypeInfo type."); + Assert.IsNotNull(typeInfo2, "Can't create success object TypeInfo"); + } + + [Test] + [Category("P1")] + [Description("Test CreateInstance. Check whether CreateInstance returns expected value or not.")] + [Property("SPEC", "Tizen.NUI.TypeInfo.CreateInstance M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void CreateInstance_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + var typeInfo = TypeRegistry.Get().GetTypeInfo("PushButton"); + Assert.IsInstanceOf(typeInfo, "Should be an instance of TypeInfo type."); + BaseHandle baseHandle = typeInfo.CreateInstance(); + Assert.IsNotNull(baseHandle, "Can't create success object TypeInfo"); + } + + [Test] + [Category("P1")] + [Description("Test GetBaseName. Check whether GetBaseName returns expected value or not.")] + [Property("SPEC", "Tizen.NUI.TypeInfo.GetBaseName M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void GetBaseName_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + try + { + var typeInfo = TypeRegistry.Get().GetTypeInfo("PushButton"); + Assert.IsInstanceOf(typeInfo, "Should be an instance of TypeInfo type."); + Assert.AreEqual("Button", typeInfo.GetBaseName(), "Should be equal"); + } + 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 GetName. Check whether GetName returns expected value or not.")] + [Property("SPEC", "Tizen.NUI.TypeInfo.GetName M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void GetName_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + try + { + var typeInfo = TypeRegistry.Get().GetTypeInfo("PushButton"); + Assert.IsInstanceOf(typeInfo, "Should be an instance of TypeInfo type."); + Assert.AreEqual("PushButton", typeInfo.GetName(), "Should be equal"); + } + 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 GetPropertyCount. Check whether GetPropertyCount returns expected value or not.")] + [Property("SPEC", "Tizen.NUI.TypeInfo.GetPropertyCount M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void GetPropertyCount_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + try + { + var typeInfo = TypeRegistry.Get().GetTypeInfo("PushButton"); + Assert.IsInstanceOf(typeInfo, "Should be an instance of TypeInfo type."); + Assert.Greater(0, typeInfo.GetPropertyCount(), "The property count should greater than 0"); + } + 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 GetPropertyName. Check whether GetPropertyName returns expected value or not.")] + [Property("SPEC", "Tizen.NUI.TypeInfo.GetPropertyName M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void GetPropertyName_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + try + { + var typeInfo = TypeRegistry.Get().GetTypeInfo("PushButton"); + Assert.IsInstanceOf(typeInfo, "Should be an instance of TypeInfo type."); + PushButton view = new PushButton(); + int propertyIndex = view.GetPropertyIndex("label"); + Assert.AreEqual("label", typeInfo.GetPropertyName(propertyIndex), "Should be equal"); + } + 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()); + } + } + } +} \ No newline at end of file