From: Agnelo Vaz Date: Mon, 23 Sep 2019 15:38:30 +0000 (+0100) Subject: [NUI][TCSACR-278][Layouting Tests added] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=392be8da3c18e8df96ba2befc57c218ea6428c88;p=test%2Ftct%2Fcsharp%2Fapi.git [NUI][TCSACR-278][Layouting Tests added] Change-Id: I75af3a60d022cf59d8e55744de3bac437656e3ed --- diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSAbsoluteLayout.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSAbsoluteLayout.cs new file mode 100644 index 000000000..e39428f84 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSAbsoluteLayout.cs @@ -0,0 +1,127 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Tests +{ + [TestFixture] + [Description("Tizen.NUI.AbsoluteLayout Tests")] + public class AbsoluteLayoutTests + { + private string TAG = "NUI"; + private static bool _flagOnMeasureOverride; + private static bool _flagOnLayoutOverride; + internal class DerivedLayout : AbsoluteLayout + { + public DerivedLayout() : base() + {} + + // This method needs to call protected method, OnMeasure for the test cases. + public void OnMeasureTest( MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec ) + { + OnMeasure( widthMeasureSpec, heightMeasureSpec ); + } + protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec) + { + _flagOnMeasureOverride = true; + } + + public void OnLayoutTest(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom) + { + OnLayout( changed, left, top, right, bottom ); + } + protected override void OnLayout(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom) + { + _flagOnLayoutOverride = true; + } + } + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("AbsoluteLayoutTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("AbsoluteLayout constructor test")] + [Property("SPEC", "Tizen.NUI.AbsoluteLayout.AbsoluteLayout C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void AbsoluteLayout_INIT() + { + var layout = new AbsoluteLayout(); + Assert.IsNotNull(layout, "null handle"); + Assert.IsInstanceOf(layout, "Should return AbsoluteLayout instance."); + } + + [Test] + [Category("P1")] + [Description("Check override method OnMeasure is invoked when called on a derived class .")] + [Property("SPEC", "Tizen.NUI.AbsoluteLayout.OnMeasure M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void OnMeasure_OVERRIDE_METHOD() + { + /*PRE CONDITION + * _flagOnMeasureOverride flag is initialize false value + * Create a derived instance of AbsoluteLayout + */ + _flagOnMeasureOverride = false; + Assert.False(_flagOnMeasureOverride, "_flagOnMeasureOverride should be false initial"); + /**TEST CODE**/ + var derivedLayout = new DerivedLayout(); + Assert.IsNotNull(derivedLayout, "null handle"); + Assert.IsInstanceOf(derivedLayout, "Should be an instance of AbsoluteLayout type."); + + MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); + MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); + + derivedLayout.OnMeasureTest(measureWidth, measureHeight); + Assert.True(_flagOnMeasureOverride, "AbsoluteLayout overridden method not invoked."); + } + + [Test] + [Category("P1")] + [Description("Check override method OnLayout is invoked when called on a derived class .")] + [Property("SPEC", "Tizen.NUI.AbsoluteLayout.OnLayout M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void OnLayout_OVERRIDE_METHOD() + { + /*PRE CONDITION + * _flagOnLayoutOverride flag is initialize false value + * Create a derived instance of AbsoluteLayout + */ + _flagOnLayoutOverride = false; + Assert.False(_flagOnLayoutOverride, "_flagOnLayoutOverride should be false initial"); + /**TEST CODE**/ + var derivedLayout = new DerivedLayout(); + Assert.IsNotNull(derivedLayout, "null handle"); + Assert.IsInstanceOf(derivedLayout, "Should be an instance of AbsoluteLayout type."); + derivedLayout.OnLayoutTest( true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10)); + Assert.True(_flagOnLayoutOverride, "AbsoluteLayout overridden method not invoked."); + + // Test with false parameter + _flagOnLayoutOverride = false; + Assert.False(_flagOnLayoutOverride, "_flagOnLayoutOverride should be false initial"); + derivedLayout.OnLayoutTest( false, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10)); + Assert.True(_flagOnLayoutOverride, "AbsoluteLayout overridden method not invoked with false parameter."); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSFlexLayout.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSFlexLayout.cs new file mode 100644 index 000000000..4f9753bc7 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSFlexLayout.cs @@ -0,0 +1,309 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Tests +{ + [TestFixture] + [Description("Tizen.NUI.FlexLayout Tests")] + public class FlexLayoutTests + { + private string TAG = "NUI"; + private static bool _flagOnMeasureOverride; + private static bool _flagOnLayoutOverride; + private static bool _flagOnChildAddOverride; + private static bool _flagOnChildRemoveOverride; + internal class DerivedLayout :FlexLayout + { + public DerivedLayout() : base() + { } + + // This method needs to call protected method, OnMeasure for the test cases. + public void OnMeasureTest( MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec ) + { + OnMeasure( widthMeasureSpec, heightMeasureSpec ); + } + protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec) + { + _flagOnMeasureOverride = true; + } + + public void OnLayoutTest(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom) + { + OnLayout( changed, left, top, right, bottom ); + } + protected override void OnLayout(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom) + { + _flagOnLayoutOverride = true; + } + + public void OnChildAddTest(LayoutItem child) + { + OnChildAdd( child ); + } + protected override void OnChildAdd(LayoutItem child) + { + _flagOnChildAddOverride = true; + } + + public void OnChildRemoveTest(LayoutItem child) + { + OnChildRemove( child ); + } + protected override void OnChildRemove(LayoutItem child) + { + _flagOnChildRemoveOverride = true; + } + } + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("FlexLayoutTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("FlexLayout constructor test")] + [Property("SPEC", "Tizen.NUI.FlexLayout.FlexLayout C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void FlexLayout_INIT() + { + var flexLayout = new FlexLayout(); + Assert.IsNotNull(flexLayout, "null handle"); + Assert.IsInstanceOf(flexLayout, "Should return FlexLayout instance."); + } + + [Test] + [Category("P1")] + [Description("Test setting of Direction property.")] + [Property("SPEC", "Tizen.NUI.FlexLayout.Direction A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Direction_CHECK_RETURN_VALUE() + { + var flexLayout = new FlexLayout(); + + flexLayout.Direction = FlexLayout.FlexDirection.Column; + Assert.AreEqual(flexLayout.Direction, FlexLayout.FlexDirection.Column, "Should be Column."); + + flexLayout.Direction = FlexLayout.FlexDirection.Row; + Assert.AreEqual(flexLayout.Direction, FlexLayout.FlexDirection.Row, "Should be Row."); + + flexLayout.Direction = FlexLayout.FlexDirection.ColumnReverse; + Assert.AreEqual(flexLayout.Direction, FlexLayout.FlexDirection.ColumnReverse, "Should be ColumnReverse."); + + flexLayout.Direction = FlexLayout.FlexDirection.RowReverse; + Assert.AreEqual(flexLayout.Direction, FlexLayout.FlexDirection.RowReverse, "Should be RowReverse."); + } + + [Test] + [Category("P1")] + [Description("Test setting of Justification property.")] + [Property("SPEC", "Tizen.NUI.FlexLayout.Justification A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Justification_CHECK_RETURN_VALUE() + { + var flexLayout = new FlexLayout(); + flexLayout.Justification = FlexLayout.FlexJustification.FlexStart; + Assert.AreEqual(flexLayout.Justification, FlexLayout.FlexJustification.FlexStart, "Should be FlexStart."); + + flexLayout.Justification = FlexLayout.FlexJustification.FlexEnd; + Assert.AreEqual(flexLayout.Justification, FlexLayout.FlexJustification.FlexEnd, "Should be FlexEnd."); + + flexLayout.Justification = FlexLayout.FlexJustification.Center; + Assert.AreEqual(flexLayout.Justification, FlexLayout.FlexJustification.Center, "Should be Center."); + + flexLayout.Justification = FlexLayout.FlexJustification.SpaceBetween; + Assert.AreEqual(flexLayout.Justification, FlexLayout.FlexJustification.SpaceBetween, "Should be SpaceBetween."); + + flexLayout.Justification = FlexLayout.FlexJustification.SpaceAround; + Assert.AreEqual(flexLayout.Justification, FlexLayout.FlexJustification.SpaceAround, "Should be SpaceAround."); + } + + [Test] + [Category("P1")] + [Description("Test setting WrapType")] + [Property("SPEC", "Tizen.NUI.FlexLayout.WrapType A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void WrapType_CHECK_RETURN_VALUE() + { + var flexLayout = new FlexLayout(); + flexLayout.WrapType = FlexLayout.FlexWrapType.NoWrap; + + Assert.AreEqual(flexLayout.WrapType, FlexLayout.FlexWrapType.NoWrap, "Should be NoWrap."); + + flexLayout.WrapType = FlexLayout.FlexWrapType.Wrap; + + Assert.AreEqual(flexLayout.WrapType, FlexLayout.FlexWrapType.Wrap, "Should be Wrap."); + } + + [Test] + [Category("P1")] + [Description("Test setting Alignment")] + [Property("SPEC", "Tizen.NUI.FlexLayout.Alignment A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Alignment_CHECK_RETURN_VALUE() + { + var flexLayout = new FlexLayout(); + flexLayout.Alignment = FlexLayout.AlignmentType.FlexStart; + + Assert.AreEqual(flexLayout.Alignment, FlexLayout.AlignmentType.FlexStart, "Should be FlexStart."); + + flexLayout.Alignment = FlexLayout.AlignmentType.FlexEnd; + + Assert.AreEqual(flexLayout.Alignment, FlexLayout.AlignmentType.FlexEnd, "Should be FlexEnd."); + + flexLayout.Alignment = FlexLayout.AlignmentType.Auto; + Assert.AreEqual(flexLayout.Alignment, FlexLayout.AlignmentType.Auto, "Should be Auto."); + + flexLayout.Alignment = FlexLayout.AlignmentType.Center; + Assert.AreEqual(flexLayout.Alignment, FlexLayout.AlignmentType.Center, "Should be Center."); + + flexLayout.Alignment = FlexLayout.AlignmentType.Stretch; + Assert.AreEqual(flexLayout.Alignment, FlexLayout.AlignmentType.Stretch, "Should be Stretch."); + } + + [Test] + [Category("P1")] + [Description("Test setting ItemsAlignment")] + [Property("SPEC", "Tizen.NUI.FlexLayout.ItemsAlignment A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void ItemsAlignment_CHECK_RETURN_VALUE() + { + var flexLayout = new FlexLayout(); + flexLayout.ItemsAlignment = FlexLayout.AlignmentType.FlexStart; + + Assert.AreEqual(flexLayout.ItemsAlignment, FlexLayout.AlignmentType.FlexStart, "Should be FlexStart."); + + flexLayout.ItemsAlignment = FlexLayout.AlignmentType.FlexEnd; + + Assert.AreEqual(flexLayout.ItemsAlignment, FlexLayout.AlignmentType.FlexEnd, "Should be FlexEnd."); + } + + [Test] + [Category("P1")] + [Description("Check override method OnMeasure is invoked when called on a derived class .")] + [Property("SPEC", "Tizen.NUI.FlexLayout.OnMeasure M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void OnMeasure_OVERRIDE_METHOD() + { + /*PRE CONDITION + * _flagOnMeasureOverride flag is initialize false value + * Create a derived instance of FlexLayout + */ + _flagOnMeasureOverride = false; + Assert.False(_flagOnMeasureOverride, "_flagOnMeasureOverride should be false initial"); + /**TEST CODE**/ + var derivedLayout = new DerivedLayout(); + Assert.IsInstanceOf(derivedLayout, "Should be an instance ofFlexLayout type."); + + MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); + MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); + + derivedLayout.OnMeasureTest(measureWidth, measureHeight); + Assert.True(_flagOnMeasureOverride, "FlexLayout overridden method not invoked."); + } + + [Test] + [Category("P1")] + [Description("Check override method OnLayout is invoked when called on a derived class .")] + [Property("SPEC", "Tizen.NUI.FlexLayout.OnLayout M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void OnLayout_OVERRIDE_METHOD() + { + /*PRE CONDITION + * _flagOnLayoutOverride flag is initialize false value + * Create an derived instance of FlexLayout + */ + _flagOnLayoutOverride = false; + Assert.False(_flagOnLayoutOverride, "_flagOnLayoutOverride should be false initial"); + /**TEST CODE**/ + var derivedLayout = new DerivedLayout(); + Assert.IsInstanceOf(derivedLayout, "Should be an instance of FlexLayout type."); + derivedLayout.OnLayoutTest(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10)); + Assert.True(_flagOnLayoutOverride, "FlexLayout overridden method not invoked."); + + // Test with false parameter + _flagOnLayoutOverride = false; + Assert.False(_flagOnLayoutOverride, "_flagOnLayoutOverride should be false initial"); + derivedLayout.OnLayoutTest(false, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10)); + Assert.True(_flagOnLayoutOverride, "FlexLayout overridden method not invoked with false parameter."); + } + + [Test] + [Category("P1")] + [Description("Check override method OnChildAdd is invoked when called on a derived class .")] + [Property("SPEC", "Tizen.NUI.FlexLayout.OnChildAdd M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void OnChildAdd_OVERRIDE_METHOD() + { + /*PRE CONDITION + * _flagOnChildAddOverride flag is initialize false value + * Create an derived instance of FlexLayout + */ + _flagOnChildAddOverride = false; + Assert.False(_flagOnChildAddOverride, "_flagOnChildAddOverride should be false initial"); + /**TEST CODE**/ + var derivedLayout = new DerivedLayout(); + Assert.IsInstanceOf(derivedLayout, "Should be an instance of FlexLayout type."); + + LayoutItem child = new LayoutItem(); + derivedLayout.OnChildAddTest(child); + Assert.True(_flagOnChildAddOverride, "FlexLayout overridden method not invoked."); + } + + [Test] + [Category("P1")] + [Description("Check override method OnChildRemove is invoked when called on a derived class .")] + [Property("SPEC", "Tizen.NUI.FlexLayout.OnChildRemove M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void OnChildRemove_OVERRIDE_METHOD() + { + /*PRE CONDITION + * _flagOnChildRemoveOverride flag is initialize false value + * Create an derived instance of FlexLayout + */ + _flagOnChildRemoveOverride = false; + Assert.False(_flagOnChildRemoveOverride, "_flagOnChildRemoveOverride should be false initial"); + /**TEST CODE**/ + var derivedLayout = new DerivedLayout(); + Assert.IsInstanceOf(derivedLayout, "Should be an instance of FlexLayout type."); + + LayoutItem child = new LayoutItem(); + derivedLayout.OnChildRemoveTest(child); + Assert.True(_flagOnChildRemoveOverride, "FlexLayout overridden method not invoked."); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSGridLayout.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSGridLayout.cs new file mode 100644 index 000000000..5712a874f --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSGridLayout.cs @@ -0,0 +1,148 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Tests +{ + [TestFixture] + [Description("Tizen.NUI.GridLayout Tests")] + public class GridLayoutTests + { + private string TAG = "NUI"; + private static bool _flagOnMeasureOverride; + private static bool _flagOnLayoutOverride; + internal class DerivedLayout : GridLayout + { + public DerivedLayout() : base() + { } + + // This method needs to call protected method, OnMeasure for the test cases. + public void OnMeasureTest( MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec ) + { + OnMeasure( widthMeasureSpec, heightMeasureSpec ); + } + protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec) + { + _flagOnMeasureOverride = true; + } + + public void OnLayoutTest(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom) + { + OnLayout( changed, left, top, right, bottom ); + } + protected override void OnLayout(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom) + { + _flagOnLayoutOverride = true; + } + } + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("GridLayoutTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("GridLayout constructor test")] + [Property("SPEC", "Tizen.NUI.GridLayout.GridLayout C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void GridLayout_INIT() + { + var layout = new GridLayout(); + Assert.IsNotNull(layout, "null handle"); + Assert.IsInstanceOf(layout, "Should return GridLayout instance."); + } + + [Test] + [Category("P1")] + [Description("Test setting of column number property.")] + [Property("SPEC", "Tizen.NUI.GridLayout.Columns A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Columns_CHECK_RETURN_VALUE() + { + var gridLayout = new GridLayout(); + + Assert.IsNotNull(gridLayout, "null handle"); + Assert.IsInstanceOf(gridLayout, "Should return GridLayout instance."); + + gridLayout.Columns = 2; + + Assert.AreEqual(gridLayout.Columns, 2, "Should be 2."); + + gridLayout.Columns = 1; + + Assert.AreEqual(gridLayout.Columns, 1, "Should be 1."); + } + + [Test] + [Category("P1")] + [Description("Check override method OnMeasure is invoked when called on a derived class .")] + [Property("SPEC", "Tizen.NUI.GridLayout.OnMeasure M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void OnMeasure_OVERRIDE_METHOD() + { + /*PRE CONDITION + * _flagOnMeasureOverride flag is initialize false value + * Create a derived instance of GridLayout + */ + _flagOnMeasureOverride = false; + Assert.False(_flagOnMeasureOverride, "_flagOnMeasureOverride should be false initial"); + /**TEST CODE**/ + var derivedLayout = new DerivedLayout(); + Assert.IsInstanceOf(derivedLayout, "Should be an instance of GridLayout type."); + + MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); + MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); + + derivedLayout.OnMeasureTest(measureWidth, measureHeight); + Assert.True(_flagOnMeasureOverride, "GridLayout overridden method not invoked."); + } + + [Test] + [Category("P1")] + [Description("Check override method OnLayout is invoked when called on a derived class .")] + [Property("SPEC", "Tizen.NUI.GridLayout.OnLayout M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void OnLayout_OVERRIDE_METHOD() + { + /*PRE CONDITION + * _flagOnLayoutOverride flag is initialize false value + * Create a derived instance of GridLayout + */ + _flagOnLayoutOverride = false; + Assert.False(_flagOnLayoutOverride, "_flagOnLayoutOverride should be false initial"); + /**TEST CODE**/ + var derivedLayout = new DerivedLayout(); + Assert.IsInstanceOf(derivedLayout, "Should be an instance of GridLayout type."); + derivedLayout.OnLayoutTest(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10)); + Assert.True(_flagOnLayoutOverride, "GridLayout overridden method not invoked."); + + // Test with false parameter + _flagOnLayoutOverride = false; + Assert.False(_flagOnLayoutOverride, "_flagOnLayoutOverride should be false initial"); + derivedLayout.OnLayoutTest(false, new LayoutLength(10), new LayoutLength(10), new LayoutLength(20), new LayoutLength(20)); + Assert.True(_flagOnLayoutOverride, "GridLayout overridden method not invoked."); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSLayoutGroup.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSLayoutGroup.cs new file mode 100644 index 000000000..b219de9f0 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSLayoutGroup.cs @@ -0,0 +1,440 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Tests +{ + [TestFixture] + [Description("Tizen.NUI.LayoutGroup Tests")] + public class LayoutGroupTests + { + private string TAG = "NUI"; + + private static bool _flagOnMeasureOverride; + private static bool _flagOnLayoutOverride; + private static bool _flagOnChildAddOverride; + private static bool _flagOnChildRemoveOverride; + private static bool _flagOnMeasureChild; + private static bool _flagOnAttachedToOwner; + + internal class DerivedLayout : LayoutGroup + { + public DerivedLayout() : base() + { } + + // This method needs to call protected method, OnMeasure for the test cases. + public void OnMeasureTest( MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec ) + { + OnMeasure( widthMeasureSpec, heightMeasureSpec ); + } + protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec) + { + _flagOnMeasureOverride = true; + } + + public void OnLayoutTest(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom) + { + OnLayout( changed, left, top, right, bottom ); + } + protected override void OnLayout(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom) + { + _flagOnLayoutOverride = true; + } + + public void OnChildAddTest(LayoutItem child) + { + OnChildAdd( child ); + } + protected override void OnChildAdd(LayoutItem child) + { + _flagOnChildAddOverride = true; + } + + public void OnChildRemoveTest(LayoutItem child) + { + OnChildRemove( child ); + } + protected override void OnChildRemove(LayoutItem child) + { + _flagOnChildRemoveOverride = true; + } + + public void MeasureChildTest(LayoutItem child, MeasureSpecification parentWidth, MeasureSpecification parentHeight ) + { + MeasureChild( child, parentWidth, parentHeight ); + } + protected override void MeasureChild(LayoutItem child, MeasureSpecification parentWidth, MeasureSpecification parentHeight ) + { + _flagOnMeasureChild = true; + } + + public void MeasureChildrenTest(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec) + { + MeasureChildren( widthMeasureSpec, heightMeasureSpec ); + } + protected override void MeasureChildren(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec) + { + _flagOnMeasureChild = true; + } + + public void MeasureChildWithMarginsTest(LayoutItem child, MeasureSpecification parentWidthMeasureSpec, LayoutLength widthUsed, MeasureSpecification parentHeightMeasureSpec, LayoutLength heightUsed) + { + MeasureChildWithMargins(child, parentWidthMeasureSpec, widthUsed, parentHeightMeasureSpec, heightUsed); + } + protected override void MeasureChildWithMargins(LayoutItem child, MeasureSpecification parentWidthMeasureSpec, LayoutLength widthUsed, MeasureSpecification parentHeightMeasureSpec, LayoutLength heightUsed) + { + _flagOnMeasureChild = true; + } + + public void OnAttachedToOwnerTest() + { + OnAttachedToOwner(); + } + protected override void OnAttachedToOwner() + { + _flagOnAttachedToOwner = true; + } + } + + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("LayoutGroup!Tests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + public class TestLayout : LayoutGroup + { + public TestLayout() + { + } + + public int ChildCount() + { + return LayoutChildren.Count; + } + } + + [Test] + [Category("P1")] + [Description("LayoutGroup constructor test")] + [Property("SPEC", "Tizen.NUI.LayoutGroup.LayoutGroup C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void LayoutGroup_INIT() + { + var layoutGroup = new LayoutGroup(); + + Assert.IsNotNull(layoutGroup, "null handle"); + Assert.IsInstanceOf(layoutGroup, "Should return LayoutGroup instance."); + } + + [Test] + [Category("P1")] + [Description("Test Add child layout")] + [Property("SPEC", "Tizen.NUI.LayoutGroup.Add M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Add_CHECK_STATUS() + { + TestLayout testLayout = new TestLayout(); + var layoutItem = new LayoutItem(); + testLayout.Add(layoutItem); + Assert.AreEqual(testLayout.ChildCount(), 1, "Should 1 for the added child"); + } + + [Test] + [Category("P1")] + [Description("Test RemoveAll child layouts")] + [Property("SPEC", "Tizen.NUI.LayoutGroup.RemoveAll M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void RemoveAll_CHECK_STATUS() + { + TestLayout testLayout = new TestLayout(); + var layoutItem = new LayoutItem(); + testLayout.Add(layoutItem); + testLayout.RemoveAll(); + Assert.AreEqual(testLayout.ChildCount(), 0, "Should 0 as child removed"); + } + + [Test] + [Category("P1")] + [Description("Test Remove a child layout")] + [Property("SPEC", "Tizen.NUI.LayoutGroup.Remove M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Remove_CHECK_STATUS() + { + TestLayout testLayout = new TestLayout(); + var layoutItem = new LayoutItem(); + testLayout.Add(layoutItem); + testLayout.Remove(layoutItem); + Assert.AreEqual(testLayout.ChildCount(), 0, "Should 0 as child removed"); + } + + [Test] + [Category("P1")] + [Description("Test getting LayoutChildren property.")] + [Property("SPEC", "Tizen.NUI.LayoutGroup.LayoutChildren A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void LayoutChildren_CHECK_RETURN_VALUE() + { + TestLayout testLayout = new TestLayout(); + + var layoutItem = new LayoutItem(); + + testLayout.Add(layoutItem); + + Assert.AreEqual(1, testLayout.ChildCount(), "Should number of children added"); + } + + + [Test] + [Category("P1")] + [Description("Test Get measure specification")] + [Property("SPEC", "Tizen.NUI.LayoutGroup.GetChildMeasureSpecification M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void GetChildMeasureSpecification_CHECK_RETURN_VALUE() + { + MeasureSpecification parentMeasureSpec = new MeasureSpecification(new LayoutLength(10), MeasureSpecification.ModeType.Exactly ); + LayoutLength padding = new LayoutLength(0); + LayoutLength childDimension = new LayoutLength(10); + + MeasureSpecification measureSpec = LayoutGroup.GetChildMeasureSpecification(parentMeasureSpec, padding, childDimension); + + Assert.AreEqual((double)(measureSpec.Size.AsRoundedValue()), 10.0f, "Should be the value set."); + Assert.AreEqual(measureSpec.Mode, MeasureSpecification.ModeType.Exactly, "ModeType should match."); + } + + [Test] + [Category("P1")] + [Description("Check override method OnMeasure is invoked when called on a derived class .")] + [Property("SPEC", "Tizen.NUI.LayoutGroup.OnMeasure M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void OnMeasure_OVERRIDE_METHOD() + { + /*PRE CONDITION + * _flagOnMeasureOverride flag is initialize false value + * Create a derived instance of LayoutGroup + */ + _flagOnMeasureOverride = false; + Assert.False(_flagOnMeasureOverride, "_flagOnMeasureOverride should be false initial"); + /**TEST CODE**/ + var derivedLayout = new DerivedLayout(); + Assert.IsInstanceOf(derivedLayout, "Should be an instance of LayoutGroup type."); + + MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); + MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); + + derivedLayout.OnMeasureTest(measureWidth, measureHeight); + Assert.True(_flagOnMeasureOverride, "LayoutGroup overridden method not invoked."); + } + + [Test] + [Category("P1")] + [Description("Check override method OnLayout is invoked when called on a derived class .")] + [Property("SPEC", "Tizen.NUI.LayoutGroup.OnLayout M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void OnLayout_OVERRIDE_METHOD() + { + /*PRE CONDITION + * _flagOnLayoutOverride flag is initialize false value + * Create a derived instance of LayoutGroup + */ + _flagOnLayoutOverride = false; + Assert.False(_flagOnLayoutOverride, "_flagOnLayoutOverride should be false initial"); + /**TEST CODE**/ + var derivedLayout = new DerivedLayout(); + Assert.IsInstanceOf(derivedLayout, "Should be an instance of LayoutGroup type."); + derivedLayout.OnLayoutTest(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10)); + Assert.True(_flagOnLayoutOverride, "LayoutGroup overridden method not invoked."); + + // Test with false parameter. + _flagOnLayoutOverride = false; + Assert.False(_flagOnLayoutOverride, "_flagOnLayoutOverride should be false initial"); + derivedLayout.OnLayoutTest(false, new LayoutLength(10), new LayoutLength(10), new LayoutLength(20), new LayoutLength(20)); + Assert.True(_flagOnLayoutOverride, "LayoutGroup overridden method not invoked."); + } + + [Test] + [Category("P1")] + [Description("Check override method OnChildAdd is invoked when called on a derived class .")] + [Property("SPEC", "Tizen.NUI.LayoutGroup.OnChildAdd M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void OnChildAdd_OVERRIDE_METHOD() + { + /*PRE CONDITION + * _flagOnChildAddOverride flag is initialize false value + * Create an derived instance of LayoutGroup + */ + _flagOnChildAddOverride = false; + Assert.False(_flagOnChildAddOverride, "_flagOnChildAddOverride should be false initial"); + /**TEST CODE**/ + var derivedLayout = new DerivedLayout(); + Assert.IsInstanceOf(derivedLayout, "Should be an instance of LayoutGroup type."); + + LayoutItem child = new LayoutItem(); + derivedLayout.OnChildAddTest(child); + Assert.True(_flagOnChildAddOverride, "LayoutGroup overridden method not invoked."); + } + + [Test] + [Category("P1")] + [Description("Check override method OnChildRemove is invoked when called on a derived class .")] + [Property("SPEC", "Tizen.NUI.LayoutGroup.OnChildRemove M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void OnChildRemove_OVERRIDE_METHOD() + { + /*PRE CONDITION + * _flagOnChildRemoveOverride flag is initialize false value + * Create an derived instance of LayoutGroup + */ + _flagOnChildRemoveOverride = false; + Assert.False(_flagOnChildRemoveOverride, "_flagOnChildRemoveOverride should be false initially"); + /**TEST CODE**/ + var derivedLayout = new DerivedLayout(); + Assert.IsInstanceOf(derivedLayout, "Should be an instance of LayoutGroup type."); + + LayoutItem child = new LayoutItem(); + derivedLayout.OnChildRemoveTest(child); + Assert.True(_flagOnChildRemoveOverride, "LayoutGroup overridden method not invoked."); + } + + [Test] + [Category("P1")] + [Description("Check override method MeasureChild is invoked when called on a derived class .")] + [Property("SPEC", "Tizen.NUI.LayoutGroup.MeasureChild M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void MeasureChild_OVERRIDE_METHOD() + { + /*PRE CONDITION + * _flagOnMeasureChild flag is initialize false value + * Create an derived instance of LayoutGroup + */ + _flagOnMeasureChild = false; + Assert.False(_flagOnMeasureChild, "_flagOnMeasureChild should be false initially"); + /**TEST CODE**/ + var derivedLayout = new DerivedLayout(); + Assert.IsInstanceOf(derivedLayout, "Should be an instance of LayoutGroup type."); + + LayoutItem child = new LayoutItem(); + MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); + MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); + + derivedLayout.MeasureChildTest(child, measureWidth, measureHeight); + Assert.True(_flagOnMeasureChild, "LayoutGroup overridden method not invoked."); + } + + [Test] + [Category("P1")] + [Description("Check override method MeasureChildren measures added child .")] + [Property("SPEC", "Tizen.NUI.LayoutGroup.MeasureChildren M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void MeasureChildren_CHANGE_STATUS() + { + /*PRE CONDITION + * _flagOnMeasureChild flag is initialize false value + * Create an derived instance of LayoutGroup + */ + _flagOnMeasureChild = false; + Assert.False(_flagOnMeasureChild, "_flagOnMeasureChild should be false initially"); + /**TEST CODE**/ + DerivedLayout derivedLayout = new DerivedLayout(); + Assert.IsInstanceOf(derivedLayout, "Should be an instance of LayoutGroup type."); + + LayoutItem child = new LayoutItem(); + + derivedLayout.Add(child); + + MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); + MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); + + derivedLayout.MeasureChildrenTest(measureWidth, measureHeight); + Assert.True(_flagOnMeasureChild, "LayoutGroup MeasureChild method not invoked when children measured."); + } + + [Test] + [Category("P1")] + [Description("Check override method OnMeasure is called on child after MeasureChildWithMargins is invoked.")] + [Property("SPEC", "Tizen.NUI.LayoutGroup.MeasureChildWithMargins M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void MeasureChildWithMargins_CHANGE_STATUS() + { + /*PRE CONDITION + * _flagOnMeasureChild flag is initialize false value + * Create an derived instance of LayoutGroup + */ + _flagOnMeasureChild = false; + Assert.False(_flagOnMeasureChild, "_flagOnMeasureChild should be false initially"); + /**TEST CODE**/ + var derivedLayout = new DerivedLayout(); + Assert.IsInstanceOf(derivedLayout, "Should be an instance of LayoutGroup type."); + + LayoutItem child = new LayoutItem(); + derivedLayout.Add(child); + + MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); + MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); + + derivedLayout.MeasureChildWithMarginsTest(child, measureWidth, new LayoutLength(10) ,measureHeight, new LayoutLength(10)); // Triggers OnMeasure of child, which is the DerivedLayout + Assert.True(_flagOnMeasureChild, "LayoutGroup MeasureChild method not invoked when children measured."); + } + + [Test] + [Category("P1")] + [Description("Check override method OnAttachedToOwner is invoked when called on a derived class .")] + [Property("SPEC", "Tizen.NUI.LayoutGroup.OnAttachedToOwner M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void OnAttachedToOwner_OVERRIDE_METHOD() + { + /*PRE CONDITION + * _flagOnAttachedToOwner flag is initialize false value + * Create an derived instance of LayoutGroup + */ + _flagOnAttachedToOwner = false; + Assert.False(_flagOnAttachedToOwner, "_flagOnAttachedToOwner should be false initially"); + /**TEST CODE**/ + var derivedLayout = new DerivedLayout(); + Assert.IsInstanceOf(derivedLayout, "Should be an instance of LayoutGroup type."); + + derivedLayout.OnAttachedToOwnerTest(); + Assert.True(_flagOnAttachedToOwner, "LayoutGroup overridden method not invoked."); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSLayoutItem.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSLayoutItem.cs new file mode 100644 index 000000000..78078c235 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSLayoutItem.cs @@ -0,0 +1,541 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Tests +{ + [TestFixture] + [Description("Tizen.NUI.LayoutItem Tests")] + public class LayoutItemTests + { + private string TAG = "NUI"; + private static bool _flagOnMeasureOverride; + private static bool _flagOnLayoutOverride; + private static bool _flagOnUnparentOverride; + private static bool _flagOnAttachedToOwnerOverride; + + // LayoutGroup used for testing + private static bool _flagOnMeasureLayoutGroupOverride; + private static bool _flagOnLayoutOverrideLayoutGroup; + + internal class DerivedLayout : LayoutItem + { + public DerivedLayout() : base() + { } + + // This method needs to call protected method, OnMeasure for the test cases. + public void OnMeasureTest( MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec ) + { + OnMeasure( widthMeasureSpec, heightMeasureSpec ); + } + protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec) + { + _flagOnMeasureOverride = true; + } + + public void OnLayoutTest(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom) + { + OnLayout( changed, left, top, right, bottom ); + } + protected override void OnLayout(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom) + { + _flagOnLayoutOverride = true; + } + + public void OnUnparentTest() + { + OnUnparent(); + } + protected override void OnUnparent() + { + _flagOnUnparentOverride = true; + } + + public void OnAttachedToOwnerTest() + { + OnAttachedToOwner(); + } + protected override void OnAttachedToOwner() + { + _flagOnAttachedToOwnerOverride = true; + } + + public MeasuredSize ResolveSizeAndState( LayoutLength size, MeasureSpecification measureSpecification, MeasuredSize.StateType childMeasuredState ) + { + return base.ResolveSizeAndState( size, measureSpecification, childMeasuredState ); + } + + public void SetMeasuredDimensions( MeasuredSize measuredWidth, MeasuredSize measuredHeight ) + { + base.SetMeasuredDimensions( measuredWidth, measuredHeight ); + } + } + + // LayoutGroup used for testing LayoutItem Layout and Measure functions. + internal class DerivedLayoutGroup : LayoutGroup + { + public DerivedLayoutGroup() : base() + { } + + public int ChildCount() + { + return LayoutChildren.Count; + } + + // This method needs to call protected method, OnMeasure for the test cases. + public void OnMeasureTest( MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec ) + { + OnMeasure( widthMeasureSpec, heightMeasureSpec ); + } + protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec) + { + _flagOnMeasureLayoutGroupOverride = true; + } + + public void OnLayoutTest(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom) + { + OnLayout( changed, left, top, right, bottom ); + } + protected override void OnLayout(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom) + { + _flagOnLayoutOverrideLayoutGroup = true; + } + } + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("LayoutItemTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("LayoutItem constructor test")] + [Property("SPEC", "Tizen.NUI.LayoutItem.LayoutItem C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void LayoutItem_INIT() + { + var layoutItem = new LayoutItem(); + Assert.IsNotNull(layoutItem, "null handle"); + Assert.IsInstanceOf(layoutItem, "Should return LayoutItem instance."); + } + + [Test] + [Category("P1")] + [Description("Test setting Owner property.")] + [Property("SPEC", "Tizen.NUI.LayoutItem.Owner A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Owner_CHECK_RETURN_VALUE() + { + var layoutItem = new LayoutItem(); + + View view = new View() + { + Layout = layoutItem, + Name = "parentView" + }; + + Assert.AreEqual(layoutItem.Owner.Name, "parentView", "Should be the parent View."); + } + + [Test] + [Category("P1")] + [Description("Test setting of Margin property.")] + [Property("SPEC", "Tizen.NUI.LayoutItem.Margin A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Margin_CHECK_RETURN_VALUE() + { + var layoutItem = new LayoutItem(); + + // Extents parameters start, end, top, bottom + layoutItem.Margin = new Extents(5,10,15,0); + + Assert.AreEqual(layoutItem.Margin.End, 10, "Should be 10."); + Assert.AreEqual(layoutItem.Margin.Start, 5, "Should be 5."); + Assert.AreEqual(layoutItem.Margin.Top, 15, "Should be 15."); + Assert.AreEqual(layoutItem.Margin.Bottom, 0, "Should be 0."); + } + + [Test] + [Category("P1")] + [Description("Test setting of Padding property.")] + [Property("SPEC", "Tizen.NUI.LayoutItem.Padding A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Padding_CHECK_RETURN_VALUE() + { + var layoutItem = new LayoutItem(); + + // Extents parameters start, end, top, bottom + layoutItem.Padding = new Extents(5,10,15,0); + + Assert.AreEqual(layoutItem.Padding.End, 10, "Should be 10."); + Assert.AreEqual(layoutItem.Padding.Start, 5, "Should be 5."); + Assert.AreEqual(layoutItem.Padding.Top, 15, "Should be 15."); + Assert.AreEqual(layoutItem.Padding.Bottom, 0, "Should be 0."); + } + + + [Test] + [Category("P1")] + [Description("Test setting of SuggestedMinimumWidth property.")] + [Property("SPEC", "Tizen.NUI.LayoutItem.SuggestedMinimumWidth A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void SuggestedMinimumWidth_CHECK_RETURN_VALUE() + { + var layoutItem = new LayoutItem(); + + View view = new View() + { + Layout = layoutItem, + Name = "parentView", + MinimumSize = new Size2D(10,10) + }; + + float suggestedMinimumWidth = layoutItem.SuggestedMinimumWidth.AsRoundedValue(); + + Assert.AreEqual(suggestedMinimumWidth, 10, "Should be 10."); + } + + [Test] + [Category("P1")] + [Description("Test setting of SuggestedMinimumHeight property.")] + [Property("SPEC", "Tizen.NUI.LayoutItem.SuggestedMinimumHeight A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void SuggestedMinimumHeight_CHECK_RETURN_VALUE() + { + var layoutItem = new LayoutItem(); + + View view = new View() + { + Layout = layoutItem, + Name = "parentView", + MinimumSize = new Size2D(10,10) + }; + + float suggestedMinimumHeight = layoutItem.SuggestedMinimumHeight.AsRoundedValue(); + + Assert.AreEqual(suggestedMinimumHeight, 10, "Should be 10."); + } + + [Test] + [Category("P1")] + [Description("Test setting of MeasuredWidth property.")] + [Property("SPEC", "Tizen.NUI.LayoutItem.MeasuredWidth A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void MeasuredWidth_CHECK_RETURN_VALUE() + { + var layoutItem = new LayoutItem(); + + layoutItem.MeasuredWidth = new MeasuredSize( new LayoutLength(100), MeasuredSize.StateType.MeasuredSizeOK); + Assert.AreEqual(layoutItem.MeasuredWidth.Size.AsRoundedValue(), 100.0, "Should be value set"); + } + + [Test] + [Category("P1")] + [Description("Test setting of MeasuredHeight property.")] + [Property("SPEC", "Tizen.NUI.LayoutItem.MeasuredHeight A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void MeasuredHeight_CHECK_RETURN_VALUE() + { + var layoutItem = new LayoutItem(); + + layoutItem.MeasuredHeight = new MeasuredSize( new LayoutLength(100), MeasuredSize.StateType.MeasuredSizeOK); + Assert.AreEqual(layoutItem.MeasuredHeight.Size.AsRoundedValue(), 100.0, "Should be value set"); + } + + [Test] + [Category("P1")] + [Description("Test setting of GetDefaultSize property.")] + [Property("SPEC", "Tizen.NUI.LayoutItem.GetDefaultSize M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void GetDefaultSize_CHECK_RETURN_VALUE() + { + MeasureSpecification measuredLength = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); + LayoutLength length = new LayoutLength(10); + LayoutLength result = LayoutItem.GetDefaultSize(length, measuredLength); + Assert.AreEqual(50.0f, result.AsRoundedValue(), "Should be value set"); + } + + [Test] + [Category("P1")] + [Description("Test setting of GetParent property.")] + [Property("SPEC", "Tizen.NUI.LayoutItem.GetParent M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void GetParent_CHECK_RETURN_VALUE() + { + var layoutItem = new LayoutItem(); + + Assert.IsInstanceOf(layoutItem, "Should return LayoutItem instance."); + Assert.IsNotNull(layoutItem, "null handle"); + Assert.AreEqual(null, layoutItem.GetParent(), "Should be null if not set"); + } + + [Test] + [Category("P1")] + [Description("Check override method OnMeasure is invoked when called on a derived class .")] + [Property("SPEC", "Tizen.NUI.LayoutItem.OnMeasure M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void OnMeasure_OVERRIDE_METHOD() + { + /*PRE CONDITION + * _flagOnMeasureOverride flag is initialize false value + * Create a derived instance of LayoutItem + */ + _flagOnMeasureOverride = false; + Assert.False(_flagOnMeasureOverride, "_flagOnMeasureOverride should be false initial"); + /**TEST CODE**/ + var derivedLayout = new DerivedLayout(); + Assert.IsInstanceOf(derivedLayout, "Should be an instance of LayoutItem type."); + + MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); + MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); + + derivedLayout.OnMeasureTest(measureWidth, measureHeight); + Assert.True(_flagOnMeasureOverride, "LayoutItem overridden method not invoked."); + } + + [Test] + [Category("P1")] + [Description("Check override method OnLayout is invoked when called on a derived class .")] + [Property("SPEC", "Tizen.NUI.LayoutItem.OnLayout M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void OnLayout_OVERRIDE_METHOD() + { + /*PRE CONDITION + * _flagOnLayoutOverride flag is initialize false value + * Create a derived instance of LayoutItem + */ + _flagOnLayoutOverride = false; + Assert.False(_flagOnLayoutOverride, "_flagOnLayoutOverride should be false initially"); + /**TEST CODE**/ + var derivedLayout = new DerivedLayout(); + Assert.IsInstanceOf(derivedLayout, "Should be an instance of LayoutItem type."); + derivedLayout.OnLayoutTest(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10)); + Assert.True(_flagOnLayoutOverride, "LayoutItem overridden method not invoked."); + + // Test with false parameter + _flagOnLayoutOverride = false; + Assert.False(_flagOnLayoutOverride, "_flagOnLayoutOverride should be false initially"); + derivedLayout.OnLayoutTest(false, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10)); + Assert.True(_flagOnLayoutOverride, "LayoutItem overridden method not invoked with false parameter."); + } + + [Test] + [Category("P1")] + [Description("Check override method OnUnparent is invoked when called on a derived class .")] + [Property("SPEC", "Tizen.NUI.LayoutItem.OnUnparent M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void OnUnparent_OVERRIDE_METHOD() + { + /*PRE CONDITION + * _flagOnUnparentOverride flag is initialize false value + * Create a derived instance of LayoutItem + */ + _flagOnUnparentOverride = false; + Assert.False(_flagOnUnparentOverride, "flag should be false initially"); + /**TEST CODE**/ + var derivedLayout = new DerivedLayout(); + Assert.IsInstanceOf(derivedLayout, "Should be an instance of LayoutItem type."); + derivedLayout.OnUnparentTest(); + Assert.True(_flagOnUnparentOverride, "LayoutItem overridden method not invoked."); + } + + [Test] + [Category("P1")] + [Description("Check override method OnAttachedToOwner is invoked when called on a derived class .")] + [Property("SPEC", "Tizen.NUI.LayoutItem.OnAttachedToOwner M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void OnAttachedToOwner_OVERRIDE_METHOD() + { + /*PRE CONDITION + * _flagOnAttachedToOwnerOverride flag is initialize false value + * Create a derived instance of LayoutItem + */ + _flagOnAttachedToOwnerOverride = false; + Assert.False(_flagOnAttachedToOwnerOverride, "flag should be false initially"); + /**TEST CODE**/ + var derivedLayout = new DerivedLayout(); + Assert.IsInstanceOf(derivedLayout, "Should be an instance of LayoutItem type."); + derivedLayout.OnAttachedToOwnerTest(); + Assert.True(_flagOnAttachedToOwnerOverride, "LayoutItem overridden method not invoked."); + } + + + [Test] + [Category("P1")] + [Description("Test ResolveSizeAndSize")] + [Property("SPEC", "Tizen.NUI.LayoutItem.ResolveSizeAndState M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void ResolveSizeAndState_CHECK_RETURN_VALUE() + { + var derivedLayout = new DerivedLayout(); + MeasureSpecification measureSpec = new MeasureSpecification(new LayoutLength(10), MeasureSpecification.ModeType.Exactly); + + MeasuredSize measuredSize = derivedLayout.ResolveSizeAndState(new LayoutLength(50), measureSpec, MeasuredSize.StateType.MeasuredSizeOK); + + Assert.AreEqual(measureSpec.Size.AsRoundedValue(), 10, "measuredSize not resolved correctly"); + } + + [Test] + [Category("P1")] + [Description("Test SetMeasuredDimensions")] + [Property("SPEC", "Tizen.NUI.LayoutItem.SetMeasuredDimensions M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void SetMeasuredDimensions_CHANGE_STATUS() + { + var derivedLayout = new DerivedLayout(); + MeasuredSize measuredWidth = new MeasuredSize(new LayoutLength(100), MeasuredSize.StateType.MeasuredSizeOK); + MeasuredSize measuredHeight = new MeasuredSize(new LayoutLength(50), MeasuredSize.StateType.MeasuredSizeOK); + + derivedLayout.SetMeasuredDimensions(measuredWidth, measuredHeight); + + Assert.AreEqual(100, derivedLayout.MeasuredWidth.Size.AsRoundedValue(), "Should be value set"); + Assert.AreEqual(50, derivedLayout.MeasuredHeight.Size.AsRoundedValue(), "Should be value set"); + } + + [Test] + [Category("P1")] + [Description("Check override method OnMeasure is called after RequestLayout is invoked.")] + [Property("SPEC", "Tizen.NUI.LayoutItem.RequestLayout M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void RequestLayout_CHANGE_STATUS() + { + /*PRE CONDITION + * _flagOnMeasureLayoutGroupOverride flag is initialize false value + * Create an derived instance of LayoutGroup + */ + _flagOnMeasureLayoutGroupOverride = false; + Assert.False(_flagOnMeasureLayoutGroupOverride, "_flagOnMeasureLayoutGroupOverride should be false initially"); + /**TEST CODE**/ + var child = new LayoutItem(); + + DerivedLayoutGroup layoutGroup = new DerivedLayoutGroup(); + Assert.IsInstanceOf(layoutGroup, "Should be an instance of LayoutGroup type."); + layoutGroup.Add(child); + // Set measured height and width to match measure specification so Measure only triggered by RequestLayout not size change. + layoutGroup.MeasuredWidth = new MeasuredSize(new LayoutLength(300), MeasuredSize.StateType.MeasuredSizeOK); + layoutGroup.MeasuredHeight = new MeasuredSize(new LayoutLength(300), MeasuredSize.StateType.MeasuredSizeOK); + + Assert.AreEqual(layoutGroup.ChildCount(), 1, "Should be 1 for the added child"); + MeasureSpecification imposedWidth = new MeasureSpecification(new LayoutLength(300.0f), MeasureSpecification.ModeType.Exactly); + MeasureSpecification imposedHeight = new MeasureSpecification(new LayoutLength(300.0f), MeasureSpecification.ModeType.Exactly); + + layoutGroup.RequestLayout(); // Ensures a layout pass is needed. + layoutGroup.Measure(imposedWidth, imposedHeight); // Triggers OnMeasure of LayoutGroup which would only occur if RequestLayout suceeds. + Assert.True(_flagOnMeasureLayoutGroupOverride, "LayoutGroup OnLayout method not invoked when Layout invoked."); + } + + [Test] + [Category("P1")] + [Description("Check override method OnMeasure is called after Measure is invoked.")] + [Property("SPEC", "Tizen.NUI.LayoutItem.Measure M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Measure_CHANGE_STATUS() + { + /*PRE CONDITION + * _flagOnMeasureLayoutGroupOverride flag is initialize false value + * Create an derived instance of LayoutGroup + */ + _flagOnMeasureLayoutGroupOverride = false; + Assert.False(_flagOnMeasureLayoutGroupOverride, "_flagOnMeasureLayoutGroupOverride should be false initially"); + /**TEST CODE**/ + var child = new LayoutItem(); + + DerivedLayoutGroup layoutGroup = new DerivedLayoutGroup(); + Assert.IsInstanceOf(layoutGroup, "Should be an instance of LayoutGroup type."); + layoutGroup.Add(child); + + Assert.AreEqual(layoutGroup.ChildCount(), 1, "Should be 1 for the added child"); + MeasureSpecification imposedWidth = new MeasureSpecification(new LayoutLength(300.0f), MeasureSpecification.ModeType.Exactly); + MeasureSpecification imposedHeight = new MeasureSpecification(new LayoutLength(300.0f), MeasureSpecification.ModeType.Exactly); + + layoutGroup.RequestLayout(); // Ensures a layout pass is needed. + layoutGroup.OnMeasureTest(imposedWidth, imposedHeight); // Triggers OnMeasure of LayoutGroup + Assert.True(_flagOnMeasureLayoutGroupOverride, "LayoutGroup OnLayout method not invoked when Layout invoked."); + } + + [Test] + [Category("P1")] + [Description("Confirm Layout can be called. This would be used by layouts created outside the assembly")] + [Property("SPEC", "Tizen.NUI.LayoutItem.Layout M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Layout_CHANGE_STATUS() + { + /*PRE CONDITION + * _flagOnLayoutLayoutGroupOverride flag is initialize false value + * Create an derived instance of LayoutGroup + */ + _flagOnLayoutOverrideLayoutGroup = false; + Assert.False(_flagOnLayoutOverrideLayoutGroup, "_flagOnLayoutOverrideLayoutGroup should be false initially"); + /**TEST CODE**/ + var child = new LayoutItem(); + + var layoutGroup = new DerivedLayoutGroup(); + Assert.IsInstanceOf(layoutGroup, "Should be an instance of LayoutGroup type."); + Assert.IsNotNull(layoutGroup, "null handle"); + layoutGroup.Add(child); + + Assert.AreEqual(layoutGroup.ChildCount(), 1, "Should be 1 for the added child"); + + layoutGroup.RequestLayout(); // Ensures a layout pass is needed. + MeasureSpecification imposedWidth = new MeasureSpecification(new LayoutLength(0.0f), MeasureSpecification.ModeType.Exactly); + MeasureSpecification imposedHeight = new MeasureSpecification(new LayoutLength(0.0f), MeasureSpecification.ModeType.Exactly); + layoutGroup.Measure(imposedWidth,imposedHeight); + + // Triggers OnLayout of LayoutGroup, can not test result of Layout in LayoutItem directly. + layoutGroup.Layout( new LayoutLength(0), new LayoutLength(0), new LayoutLength(0), new LayoutLength(0) ); + + Assert.True(_flagOnLayoutOverrideLayoutGroup, "LayoutGroup OnLayout method not invoked when Layout invoked."); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSLayoutLength.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSLayoutLength.cs new file mode 100755 index 000000000..57a0c90d5 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSLayoutLength.cs @@ -0,0 +1,306 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Tests +{ + [TestFixture] + [Description("Tizen.NUI.LayoutLength Tests")] + public class LayoutLengthTests + { + private string TAG = "NUI"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("LayoutLengthTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("LayoutLength int constructor test")] + [Property("SPEC", "Tizen.NUI.LayoutLength.LayoutLength C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "int")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void LayoutLength_INIT_WITH_INT() + { + var layoutLength = new LayoutLength( 10 ); + Assert.IsNotNull(layoutLength, "null handle"); + Assert.IsInstanceOf(layoutLength, "Should be an instance of LayoutLength type."); + Assert.AreEqual(layoutLength.AsDecimal(), 10.0f, "Should be 10.0f."); + } + + [Test] + [Category("P1")] + [Description("LayoutLength float constructor test")] + [Property("SPEC", "Tizen.NUI.LayoutLength.LayoutLength C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "Single")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void LayoutLength_INIT_WITH_FLOAT() + { + var layoutLength = new LayoutLength( 10.0f ); + Assert.IsNotNull(layoutLength , "null handle"); + Assert.IsInstanceOf(layoutLength, "Should be an instance of LayoutLength type."); + Assert.AreEqual(layoutLength.AsDecimal(), 10.0f, "Should be 10.0f."); + } + + [Test] + [Category("P1")] + [Description("LayoutLength constructor from LayoutLength instance test")] + [Property("SPEC", "Tizen.NUI.LayoutLength.LayoutLength C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "LayoutLength")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void LayoutLength_INIT_WITH_LayoutLength() + { + var layoutLength = new LayoutLength( 10.0f ); + Assert.IsNotNull(layoutLength, "null handle"); + Assert.IsInstanceOf(layoutLength, "Should be an instance of LayoutLength type."); + + var layoutLengthTested = new LayoutLength( layoutLength ); + + Assert.IsNotNull(layoutLengthTested , "null handle"); + Assert.IsInstanceOf(layoutLengthTested, "Should be an instance of LayoutLength type."); + Assert.AreEqual(layoutLengthTested.AsDecimal(), 10.0f, "Should be 10.0f."); + } + + [Test] + [Category("P1")] + [Description("LayoutLength AsRoundedValue test")] + [Property("SPEC", "Tizen.NUI.LayoutLength.AsRoundedValue M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void AsRoundedValue_GET_VALUE() + { + var layoutLength = new LayoutLength( 10.1f ); + Assert.AreEqual(layoutLength.AsRoundedValue(), 10.0f, "Should be 10.0f."); + } + + [Test] + [Category("P1")] + [Description("LayoutLength AsRounded test")] + [Property("SPEC", "Tizen.NUI.LayoutLength.AsDecimal M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void AsDecimal_GET_VALUE() + { + var layoutLength = new LayoutLength( 10.1f ); + Assert.AreEqual(layoutLength.AsDecimal(), 10.1f, "Should be 10.0f."); + } + + [Test] + [Category("P1")] + [Description("LayoutLength Equality test")] + [Property("SPEC", "Tizen.NUI.LayoutLength.== M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("COVPARAM", "LayoutLength, LayoutLength")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Equality_CHECK_RETURN_TYPE() + { + LayoutLength layoutLengthA = new LayoutLength( 10.0f ); + LayoutLength layoutLengthB = new LayoutLength( 10.0f ); + Assert.IsTrue(layoutLengthA == layoutLengthB, "Should be equal."); + } + + [Test] + [Category("P1")] + [Description("LayoutLength Not Equals test")] + [Property("SPEC", "Tizen.NUI.LayoutLength.!= M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void NotEquals_WITH_LayoutLength() + { + var layoutLengthA = new LayoutLength( 10.0f ); + var layoutLengthB = new LayoutLength( 11.0f ); + Assert.IsTrue(layoutLengthA != layoutLengthB, "Should not be equal."); + } + + [Test] + [Category("P1")] + [Description("LayoutLength Equals test")] + [Property("SPEC", "Tizen.NUI.LayoutLength.Equals M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("COVPARAM", "object")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Equals_WITH_Object() + { + var layoutLengthA = new LayoutLength( 10.0f ); + Assert.IsTrue(layoutLengthA.Equals(new LayoutLength(10.0f)), "Should be equal."); + } + + [Test] + [Category("P1")] + [Description("LayoutLength Equals test")] + [Property("SPEC", "Tizen.NUI.LayoutLength.Equals M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("COVPARAM", "LayoutLength")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Equals_WITH_LayoutLength() + { + var layoutLengthA = new LayoutLength( 10.0f ); + LayoutLength layoutLengthB = new LayoutLength( 10.0f ); + Assert.IsTrue(layoutLengthA.Equals(layoutLengthB), "Should be equal."); + } + + [Test] + [Category("P1")] + [Description("LayoutLength Get hash code")] + [Property("SPEC", "Tizen.NUI.LayoutLength.GetHashCode M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void GetHashCode_CHECK_RETURN_VALUE() + { + var layoutLengthB = new LayoutLength( 10.0f ); + Assert.AreEqual(layoutLengthB.GetHashCode(), 10, "Should be ."); + } + + [Test] + [Category("P1")] + [Description("LayoutLength Addition LayoutLength test")] + [Property("SPEC", "Tizen.NUI.LayoutLength.+ M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("COVPARAM", "LayoutLength, LayoutLength")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Addition_CHECK_RETURN_VALUE() + { + var layoutLengthA = new LayoutLength( 10.0f ); + var layoutLengthB = new LayoutLength( 10.0f ); + var layoutLengthResult = layoutLengthA + layoutLengthB; + Assert.AreEqual(layoutLengthResult.AsDecimal(), 20.0f, "Should be the sum."); + } + + [Test] + [Category("P1")] + [Description("LayoutLength Addition Int test")] + [Property("SPEC", "Tizen.NUI.LayoutLength.+ M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("COVPARAM", "LayoutLength, int")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Addition_WITH_INT_CHECK_RETURN_VALUE() + { + var layoutLengthA = new LayoutLength( 10.0f ); + var layoutLengthResult = layoutLengthA + 10; + Assert.AreEqual(layoutLengthResult.AsDecimal(), 20.0f, "Should be the sum."); + } + + + [Test] + [Category("P1")] + [Description("LayoutLength Subtract LayoutLength test")] + [Property("SPEC", "Tizen.NUI.LayoutLength.- M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("COVPARAM", "LayoutLength, LayoutLength")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Subtraction_WITH_LayoutLength() + { + var layoutLengthA = new LayoutLength( 10.0f ); + var layoutLengthB = new LayoutLength( 5.0f ); + var layoutLengthResult = layoutLengthA - layoutLengthB; + Assert.AreEqual(layoutLengthResult.AsDecimal(), 5.0f, "Should be the substract of B from A."); + } + + [Test] + [Category("P1")] + [Description("LayoutLength Subtract Int test")] + [Property("SPEC", "Tizen.NUI.LayoutLength.- M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("COVPARAM", "LayoutLength, int")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Subtraction_WITH_INT() + { + var layoutLengthA = new LayoutLength( 10.0f ); + var layoutLengthResult = layoutLengthA - 5; + Assert.AreEqual(layoutLengthResult.AsDecimal(), 5.0f, "Should be the substraction of 5.0f."); + } + + [Test] + [Category("P1")] + [Description("LayoutLength Multiply LayoutLength test")] + [Property("SPEC", "Tizen.NUI.LayoutLength.* M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("COVPARAM", "LayoutLength, LayoutLength")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Multiply_WITH_LayoutLength() + { + var layoutLengthA = new LayoutLength( 10.0f ); + var layoutLengthB = new LayoutLength( 2.0f ); + var layoutLengthResult = layoutLengthA * layoutLengthB; + Assert.AreEqual(layoutLengthResult.AsDecimal(), 20.0f, "Should be the multiplication of A x B."); + } + + [Test] + [Category("P1")] + [Description("LayoutLength Multiply Int test")] + [Property("SPEC", "Tizen.NUI.LayoutLength.* M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("COVPARAM", "LayoutLength, int")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Multiply_WITH_INT() + { + var layoutLengthA = new LayoutLength( 10.0f ); + var layoutLengthResult = layoutLengthA * 2; + Assert.AreEqual(layoutLengthResult.AsDecimal(), 20.0f, "Should be the multiplication of A x 2"); + } + + [Test] + [Category("P1")] + [Description("LayoutLength Division LayoutLength test")] + [Property("SPEC", "Tizen.NUI.LayoutLength./ M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("COVPARAM", "LayoutLength, LayoutLength")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Division_WITH_LayoutLength() + { + var layoutLengthA = new LayoutLength( 10.0f ); + var layoutLengthB = new LayoutLength( 2.0f ); + var layoutLengthResult = layoutLengthA / layoutLengthB; + Assert.AreEqual(layoutLengthResult.AsDecimal(), 5.0f, "Should be the division of A by B."); + } + + [Test] + [Category("P1")] + [Description("LayoutLength Division Int test")] + [Property("SPEC", "Tizen.NUI.LayoutLength./ M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("COVPARAM", "LayoutLength, int")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Division_WITH_INT() + { + var layoutLengthA = new LayoutLength( 10.0f ); + var layoutLengthResult = layoutLengthA / 2; + Assert.AreEqual(layoutLengthResult.AsDecimal(), 5.0f, "Should be the multiplication of A x 2"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSLayoutTransition.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSLayoutTransition.cs new file mode 100755 index 000000000..9499ea16f --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSLayoutTransition.cs @@ -0,0 +1,154 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Tests +{ + [TestFixture] + [Description("Tizen.NUI.LayoutTransition Tests")] + public class LayoutTransitionTests + { + private string TAG = "NUI"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("LayoutTransitionTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("LayoutTransition default constructor test")] + [Property("SPEC", "Tizen.NUI.LayoutTransition.LayoutTransition C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void LayoutTransition_INIT() + { + var layoutTransition = new LayoutTransition(); + Assert.IsNotNull(layoutTransition, "null handle"); + Assert.IsInstanceOf(layoutTransition, "Should return LayoutTransition instance."); + } + + [Test] + [Category("P1")] + [Description("LayoutTransition constructor with parameters test")] + [Property("SPEC", "Tizen.NUI.LayoutTransition.LayoutTransition C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "TransitionCondition, AnimatableProperties, object, TransitionComponents")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void LayoutTransition_CONSTRUCTOR_WITH_PARAMETERS() + { + + var transitionComponents = new TransitionComponents(); + + var layoutTransition = new LayoutTransition(TransitionCondition.Unspecified, + AnimatableProperties.Position, + 0.0f, + transitionComponents + ); + + Assert.IsNotNull(layoutTransition, "null handle"); + Assert.IsInstanceOf(layoutTransition, "Should return LayoutTransition instance."); + } + + [Test] + [Category("P1")] + [Description("Test getting and setting of property.")] + [Property("SPEC", "Tizen.NUI.LayoutTransition.Condition A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Condition_PROPERTY_CHECK() + { + var layoutTransition = new LayoutTransition(); + + Assert.AreEqual(layoutTransition.Condition, TransitionCondition.Unspecified, "Should be value set."); + + layoutTransition.Condition = TransitionCondition.LayoutChanged; + Assert.AreEqual(layoutTransition.Condition, TransitionCondition.LayoutChanged, "Should be value set."); + + layoutTransition.Condition = TransitionCondition.Add; + Assert.AreEqual(layoutTransition.Condition, TransitionCondition.Add, "Should be value set."); + + layoutTransition.Condition = TransitionCondition.Remove; + Assert.AreEqual(layoutTransition.Condition, TransitionCondition.Remove, "Should be value set."); + + + layoutTransition.Condition = TransitionCondition.ChangeOnAdd; + Assert.AreEqual(layoutTransition.Condition, TransitionCondition.ChangeOnAdd, "Should be value set."); + + + layoutTransition.Condition = TransitionCondition.ChangeOnRemove; + Assert.AreEqual(layoutTransition.Condition, TransitionCondition.ChangeOnRemove, "Should be value set."); + } + + [Test] + [Category("P1")] + [Description("Test getting and setting of property.")] + [Property("SPEC", "Tizen.NUI.LayoutTransition.AnimatableProperty A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void AnimatableProperty_PROPERTY_CHECK() + { + var layoutTransition = new LayoutTransition(); + + layoutTransition.AnimatableProperty = AnimatableProperties.Position; + Assert.AreEqual(layoutTransition.AnimatableProperty, AnimatableProperties.Position, "Should be value set."); + + layoutTransition.AnimatableProperty = AnimatableProperties.Size; + Assert.AreEqual(layoutTransition.AnimatableProperty, AnimatableProperties.Size, "Should be value set."); + + layoutTransition.AnimatableProperty = AnimatableProperties.Opacity; + Assert.AreEqual(layoutTransition.AnimatableProperty, AnimatableProperties.Opacity, "Should be value set."); + } + + [Test] + [Category("P1")] + [Description("Test getting and setting of property.")] + [Property("SPEC", "Tizen.NUI.LayoutTransition.Animator A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Animator_PROPERTY_CHECK() + { + var layoutTransition = new LayoutTransition(); + + AlphaFunction alphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Linear); + var transitionComponents = new TransitionComponents( 0, 64, alphaFunction); + layoutTransition.Animator = transitionComponents; + Assert.AreEqual(layoutTransition.Animator.Duration, transitionComponents.Duration, "Should be value set."); + Assert.AreEqual(layoutTransition.Animator.Delay, transitionComponents.Delay, "Should be value set."); + } + + [Test] + [Category("P1")] + [Description("Test getting and setting of property.")] + [Property("SPEC", "Tizen.NUI.LayoutTransition.TargetValue A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void TargetValue_PROPERTY_CHECK() + { + var layoutTransition = new LayoutTransition(); + + layoutTransition.TargetValue = 1.0f; + + Assert.AreEqual(layoutTransition.TargetValue, 1.0f, "Should be value set."); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSLinearLayout.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSLinearLayout.cs new file mode 100644 index 000000000..bbb10dac1 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSLinearLayout.cs @@ -0,0 +1,196 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Tests +{ + [TestFixture] + [Description("Tizen.NUI.LinearLayout Tests")] + public class LinearLayoutTests + { + private string TAG = "NUI"; + + private static bool _flagOnMeasureOverride; + private static bool _flagOnLayoutOverride; + public class DerivedLayout : LinearLayout + { + public DerivedLayout() : base() + { } + + // This method needs to call protected method, OnMeasure for the test cases. + public void OnMeasureTest( MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec ) + { + OnMeasure( widthMeasureSpec, heightMeasureSpec ); + } + protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec) + { + _flagOnMeasureOverride = true; + } + + public void OnLayoutTest(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom) + { + OnLayout( changed, left, top, right, bottom ); + } + protected override void OnLayout(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom) + { + _flagOnLayoutOverride = true; + } + } + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("LinearLayoutTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("LinearLayout constructor test")] + [Property("SPEC", "Tizen.NUI.LinearLayout.LinearLayout C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void LinearLayout_INIT() + { + var linearLayout = new LinearLayout(); + Assert.IsNotNull(linearLayout, "null handle returned"); + Assert.IsInstanceOf(linearLayout, "Should return LinearLayout instance."); + } + + [Test] + [Category("P1")] + [Description("Test setting of orientation property.")] + [Property("SPEC", "Tizen.NUI.LinearLayout.LinearOrientation A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void LinearOrientation_CHECK_RETURN_VALUE() + { + var linearLayout = new LinearLayout(); + + linearLayout.LinearOrientation = LinearLayout.Orientation.Vertical; + + Assert.AreEqual(linearLayout.LinearOrientation, LinearLayout.Orientation.Vertical, "Should be Vertical."); + + linearLayout.LinearOrientation = LinearLayout.Orientation.Horizontal; + + Assert.AreEqual(linearLayout.LinearOrientation, LinearLayout.Orientation.Horizontal, "Should be Horizontal."); + } + + [Test] + [Category("P1")] + [Description("Test setting of alignment property.")] + [Property("SPEC", "Tizen.NUI.LinearLayout.LinearAlignment A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void LinearAlignment_CHECK_RETURN_VALUE() + { + var linearLayout = new LinearLayout(); + + linearLayout.LinearAlignment = LinearLayout.Alignment.End; + Assert.AreEqual(linearLayout.LinearAlignment, LinearLayout.Alignment.End, "Should be End."); + + linearLayout.LinearAlignment = LinearLayout.Alignment.Center; + Assert.AreEqual(linearLayout.LinearAlignment, LinearLayout.Alignment.Center, "Should be Center."); + + linearLayout.LinearAlignment = LinearLayout.Alignment.Begin; + Assert.AreEqual(linearLayout.LinearAlignment, LinearLayout.Alignment.Begin, "Should be Begin."); + + linearLayout.LinearAlignment = LinearLayout.Alignment.CenterHorizontal; + Assert.AreEqual(linearLayout.LinearAlignment, LinearLayout.Alignment.CenterHorizontal, "Should be CenterHorizontal."); + + linearLayout.LinearAlignment = LinearLayout.Alignment.Top; + Assert.AreEqual(linearLayout.LinearAlignment, LinearLayout.Alignment.Top, "Should be Top."); + + linearLayout.LinearAlignment = LinearLayout.Alignment.Bottom; + Assert.AreEqual(linearLayout.LinearAlignment, LinearLayout.Alignment.Bottom, "Should be Bottom."); + + linearLayout.LinearAlignment = LinearLayout.Alignment.CenterVertical; + Assert.AreEqual(linearLayout.LinearAlignment, LinearLayout.Alignment.CenterVertical, "Should be CenterVertical."); + } + + [Test] + [Category("P1")] + [Description("Test setting cell padding")] + [Property("SPEC", "Tizen.NUI.LinearLayout.CellPadding A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void CellPadding_CHECK_RETURN_VALUE() + { + var linearLayout = new LinearLayout(); + linearLayout.CellPadding = new Size2D(6, 8); + + Assert.AreEqual(linearLayout.CellPadding.Width, 6, "Should be equal."); + Assert.AreEqual(linearLayout.CellPadding.Height, 8, "Should be equal."); + } + + [Test] + [Category("P1")] + [Description("Check override method OnMeasure is invoked when called on a derived class .")] + [Property("SPEC", "Tizen.NUI.LinearLayout.OnMeasure M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void OnMeasure_OVERRIDE_METHOD() + { + /*PRE CONDITION + * _flagOnMeasureOverride flag is initialize false value + * Create a derived instance of LinearLayout + */ + _flagOnMeasureOverride = false; + Assert.False(_flagOnMeasureOverride, "_flagOnMeasureOverride should be false initial"); + /**TEST CODE**/ + var derivedLayout = new DerivedLayout(); + Assert.IsInstanceOf(derivedLayout, "Should be an instance of LinearLayout type."); + + MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); + MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly); + + derivedLayout.OnMeasureTest(measureWidth, measureHeight); + Assert.True(_flagOnMeasureOverride, "LinearLayout overridden method not invoked."); + } + + [Test] + [Category("P1")] + [Description("Check override method OnLayout is invoked when called on a derived class .")] + [Property("SPEC", "Tizen.NUI.LinearLayout.OnLayout M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void OnLayout_OVERRIDE_METHOD() + { + /*PRE CONDITION + * _flagOnLayoutOverride flag is initialize false value + * Create a derived instance of LinearLayout + */ + _flagOnLayoutOverride = false; + Assert.False(_flagOnLayoutOverride, "_flagOnLayoutOverride should be false initial"); + /**TEST CODE**/ + var derivedLayout = new DerivedLayout(); + Assert.IsInstanceOf(derivedLayout, "Should be an instance of LinearLayout type."); + derivedLayout.OnLayoutTest(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10)); + Assert.True(_flagOnLayoutOverride, "LinearLayout overridden method not invoked."); + + /**Test false method override works with false flag too */ + _flagOnLayoutOverride = false; + Assert.False(_flagOnLayoutOverride, "_flagOnLayoutOverride should be false initial"); + Assert.IsInstanceOf(derivedLayout, "Should be an instance of LinearLayout type."); + derivedLayout.OnLayoutTest(false, new LayoutLength(10), new LayoutLength(10), new LayoutLength(20), new LayoutLength(20)); + Assert.True(_flagOnLayoutOverride, "LinearLayout overridden method not invoked."); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSMeasureSpecification.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSMeasureSpecification.cs new file mode 100755 index 000000000..d7d63cca7 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSMeasureSpecification.cs @@ -0,0 +1,91 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Tests +{ + [TestFixture] + [Description("Tizen.NUI.MeasureSpecification Tests")] + public class MeasureSpecificationTests + { + private string TAG = "NUI"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("MeasureSpecificationTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("MeasureSpecification constructor test")] + [Property("SPEC", "Tizen.NUI.MeasureSpecification.MeasureSpecification C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void MeasureSpecification_INIT() + { + var measureSpecification = new MeasureSpecification(new LayoutLength(10), MeasureSpecification.ModeType.Exactly ); + + Assert.IsNotNull(measureSpecification, "null handle returned"); + Assert.IsInstanceOf(measureSpecification, "Should return MeasureSpecification instance."); + } + + [Test] + [Category("P1")] + [Description("Test setting of Size property.")] + [Property("SPEC", "Tizen.NUI.MeasureSpecification.Size A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Size_CHECK_RETURN_VALUE() + { + var measureSpecification = new MeasureSpecification(new LayoutLength(10), MeasureSpecification.ModeType.Exactly ); + + Assert.AreEqual(measureSpecification.Size.AsRoundedValue(), 10, "Should be 10."); + + var TestValue = 20.0f; + measureSpecification.Size = new LayoutLength(TestValue); + + Assert.AreEqual(measureSpecification.Size.AsRoundedValue(), TestValue, "Should be TestValue."); + } + + [Test] + [Category("P1")] + [Description("Test setting of Mode property.")] + [Property("SPEC", "Tizen.NUI.MeasureSpecification.Mode A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Mode_CHECK_RETURN_VALUE() + { + var measureSpecification = new MeasureSpecification(new LayoutLength(10), MeasureSpecification.ModeType.Exactly ); + + Assert.AreEqual(measureSpecification.Mode, MeasureSpecification.ModeType.Exactly, "Should be Exactly."); + + var TestValue = MeasureSpecification.ModeType.AtMost; + measureSpecification.Mode = TestValue; + Assert.AreEqual(measureSpecification.Mode, TestValue, "Should be TestValue."); + + TestValue = MeasureSpecification.ModeType.Unspecified; + measureSpecification.Mode = TestValue; + Assert.AreEqual(measureSpecification.Mode, TestValue, "Should be TestValue."); + + TestValue = MeasureSpecification.ModeType.Exactly; + measureSpecification.Mode = TestValue; + Assert.AreEqual(measureSpecification.Mode, TestValue, "Should be TestValue."); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSMeasuredSize.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSMeasuredSize.cs new file mode 100644 index 000000000..b7e473e57 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSMeasuredSize.cs @@ -0,0 +1,102 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Tests +{ + [TestFixture] + [Description("Tizen.NUI.MeasuredSize Tests")] + public class MeasuredSizeTests + { + private string TAG = "NUI"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("MeasuredSizeTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("MeasuredSize constructor test")] + [Property("SPEC", "Tizen.NUI.MeasuredSize.MeasuredSize C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + [Property("COVPARAM", "LayoutLength, MeasuredSize.StateType")] + public void MeasuredSize_INIT() + { + var measuredSize = new MeasuredSize(new LayoutLength(10), MeasuredSize.StateType.MeasuredSizeOK ); + + Assert.IsNotNull(measuredSize, "null handle returned"); + Assert.IsInstanceOf(measuredSize, "Should return MeasuredSize instance."); + } + + [Test] + [Category("P1")] + [Description("MeasuredSize constructor created from LayoutLength")] + [Property("SPEC", "Tizen.NUI.MeasuredSize.Implicit M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + [Property("COVPARAM", "LayoutLength")] + public void Implicit_MeasuredSize_LayoutLength_CHECK_RETURN_VALUE() + { + var measuredSize = new MeasuredSize(new LayoutLength(10), MeasuredSize.StateType.MeasuredSizeOK); + + Assert.IsNotNull(measuredSize, "null handle returned"); + Assert.IsInstanceOf(measuredSize, "Should return MeasuredSize instance."); + } + + [Test] + [Category("P1")] + [Description("Test setting of Size property.")] + [Property("SPEC", "Tizen.NUI.MeasuredSize.Size A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Size_CHECK_RETURN_VALUE() + { + var measuredSize = new MeasuredSize(new LayoutLength(10), MeasuredSize.StateType.MeasuredSizeOK ); + + float length = measuredSize.Size.AsRoundedValue(); + Assert.AreEqual(length, 10.0f, "Should be value set."); + + measuredSize.Size = new LayoutLength(20); + + length = measuredSize.Size.AsRoundedValue(); + Assert.AreEqual(length, 20.0f, "Should be value set."); + } + + [Test] + [Category("P1")] + [Description("Test setting of State property.")] + [Property("SPEC", "Tizen.NUI.MeasuredSize.State A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void State_CHECK_RETURN_VALUE() + { + var measuredSize = new MeasuredSize(new LayoutLength(10), MeasuredSize.StateType.MeasuredSizeOK ); + + Assert.AreEqual(measuredSize.State, MeasuredSize.StateType.MeasuredSizeOK, "Should match default state"); + + measuredSize.State = MeasuredSize.StateType.MeasuredSizeTooSmall; + + Assert.AreEqual(measuredSize.State, MeasuredSize.StateType.MeasuredSizeTooSmall, "Should state set"); + + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSTransitionComponents.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSTransitionComponents.cs new file mode 100755 index 000000000..c91211736 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSTransitionComponents.cs @@ -0,0 +1,173 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Tests +{ + [TestFixture] + [Description("Tizen.NUI.TransitionComponents Tests")] + public class TransitionComponentsTests + { + private string TAG = "NUI"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("TransitionComponentsTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("TransitionComponents default constructor test")] + [Property("SPEC", "Tizen.NUI.TransitionComponents.TransitionComponents C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void TransitionComponents_DEFAULT_CONSTRUCTOR() + { + var transitionComponents = new TransitionComponents(); + Assert.IsNotNull(transitionComponents, "null handle"); + Assert.IsInstanceOf(transitionComponents, "Should return TransitionComponents instance."); + } + + [Test] + [Category("P1")] + [Description("MeasuredSize constructor default state test")] + [Property("SPEC", "Tizen.NUI.TransitionComponents.TransitionComponents C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "int, int, Tizen.NUI.AlphaFunction")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void TransitionComponents_INIT() + { + AlphaFunction alphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Linear); + var transitionComponents = new TransitionComponents(16, 32, alphaFunction); + Assert.IsNotNull(transitionComponents, "null handle"); + Assert.IsInstanceOf(transitionComponents, "Should return TransitionComponents instance."); + } + + [Test] + [Category("P1")] + [Description("Test getting and setting of property.")] + [Property("SPEC", "Tizen.NUI.TransitionComponents.Duration A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Duration_PROPERTY_CHECK() + { + int duration = 16; + int newDuration = 24; + AlphaFunction alphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Linear); + + var transitionComponents = new TransitionComponents(0, duration, alphaFunction); + + Assert.AreEqual(transitionComponents.Duration, duration, "Should be value set."); + + transitionComponents.Duration = newDuration; + + Assert.AreEqual(transitionComponents.Duration, newDuration, "Should be value set."); + } + + [Test] + [Category("P1")] + [Description("Test getting and setting of property.")] + [Property("SPEC", "Tizen.NUI.TransitionComponents.Delay A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Delay_PROPERTY_CHECK() + { + int delay = 32; + int newDelay = 24; + AlphaFunction alphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Linear); + + var transitionComponents = new TransitionComponents( delay, 64, alphaFunction); + + Assert.AreEqual(transitionComponents.Duration, 64, "Should be value set."); + + transitionComponents.Delay = newDelay; + + Assert.AreEqual(transitionComponents.Delay, newDelay, "Should be value set."); + } + + [Test] + [Category("P1")] + [Description("Test getting and setting of property.")] + [Property("SPEC", "Tizen.NUI.TransitionComponents.AlphaFunction A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void AlphaFunction_PROPERTY_CHECK() + { + AlphaFunction defaultAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Default); + AlphaFunction linearAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Linear); + AlphaFunction reverseAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Reverse); + AlphaFunction easeInSqaureAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseInSquare); + AlphaFunction easeOutSquareAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOutSquare); + AlphaFunction easeInAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseIn); + AlphaFunction easeOutAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOut); + AlphaFunction easeInOutAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseInOut); + AlphaFunction easeInSineAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseInSine); + AlphaFunction easeOutSineAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOutSine); + AlphaFunction easeInOutSineAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseInOutSine); + AlphaFunction bounceAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Bounce); + AlphaFunction sinAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Sin); + AlphaFunction easeOutBackAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOutBack); + + var transitionComponents = new TransitionComponents( 0, 64, defaultAlphaFunction); + Assert.AreEqual(transitionComponents.AlphaFunction.GetBuiltinFunction(), AlphaFunction.BuiltinFunctions.Default, "Should be value set."); + + transitionComponents.AlphaFunction = linearAlphaFunction; + Assert.AreEqual(transitionComponents.AlphaFunction.GetBuiltinFunction(), AlphaFunction.BuiltinFunctions.Linear, "Should be value set."); + + transitionComponents.AlphaFunction = reverseAlphaFunction; + Assert.AreEqual(transitionComponents.AlphaFunction.GetBuiltinFunction(), AlphaFunction.BuiltinFunctions.Reverse, "Should be value set."); + + transitionComponents.AlphaFunction = easeInSqaureAlphaFunction; + Assert.AreEqual(transitionComponents.AlphaFunction.GetBuiltinFunction(), AlphaFunction.BuiltinFunctions.EaseInSquare, "Should be value set."); + + transitionComponents.AlphaFunction = easeOutSquareAlphaFunction; + Assert.AreEqual(transitionComponents.AlphaFunction.GetBuiltinFunction(), AlphaFunction.BuiltinFunctions.EaseOutSquare, "Should be value set."); + + transitionComponents.AlphaFunction = easeInAlphaFunction; + Assert.AreEqual(transitionComponents.AlphaFunction.GetBuiltinFunction(), AlphaFunction.BuiltinFunctions.EaseIn, "Should be value set."); + + transitionComponents.AlphaFunction = easeOutAlphaFunction; + Assert.AreEqual(transitionComponents.AlphaFunction.GetBuiltinFunction(), AlphaFunction.BuiltinFunctions.EaseOut, "Should be value set."); + + transitionComponents.AlphaFunction = easeInOutAlphaFunction; + Assert.AreEqual(transitionComponents.AlphaFunction.GetBuiltinFunction(), AlphaFunction.BuiltinFunctions.EaseInOut, "Should be value set."); + + transitionComponents.AlphaFunction = easeInSineAlphaFunction; + Assert.AreEqual(transitionComponents.AlphaFunction.GetBuiltinFunction(), AlphaFunction.BuiltinFunctions.EaseInSine, "Should be value set."); + + transitionComponents.AlphaFunction = easeOutSineAlphaFunction; + Assert.AreEqual(transitionComponents.AlphaFunction.GetBuiltinFunction(), AlphaFunction.BuiltinFunctions.EaseOutSine, "Should be value set."); + + transitionComponents.AlphaFunction = easeInOutSineAlphaFunction; + Assert.AreEqual(transitionComponents.AlphaFunction.GetBuiltinFunction(), AlphaFunction.BuiltinFunctions.EaseInOutSine, "Should be value set."); + + transitionComponents.AlphaFunction = bounceAlphaFunction; + Assert.AreEqual(transitionComponents.AlphaFunction.GetBuiltinFunction(), AlphaFunction.BuiltinFunctions.Bounce, "Should be value set."); + + transitionComponents.AlphaFunction = sinAlphaFunction; + Assert.AreEqual(transitionComponents.AlphaFunction.GetBuiltinFunction(), AlphaFunction.BuiltinFunctions.Sin, "Should be value set."); + + transitionComponents.AlphaFunction = easeOutBackAlphaFunction; + Assert.AreEqual(transitionComponents.AlphaFunction.GetBuiltinFunction(), AlphaFunction.BuiltinFunctions.EaseOutBack, "Should be value set."); + } + + } +} diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSTransitionList.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSTransitionList.cs new file mode 100755 index 000000000..304b6ad97 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSTransitionList.cs @@ -0,0 +1,46 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Tests +{ + [TestFixture] + [Description("Tizen.NUI.TransitionList Tests")] + public class TransitionListTests + { + private string TAG = "NUI"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("TransitionListTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("TransitionList default constructor test")] + [Property("SPEC", "Tizen.NUI.TransitionList.TransitionList C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void TransitionList_DEFAULT_CONSTRUCTOR() + { + var transitionList = new TransitionList(); + Assert.IsNotNull(transitionList, "null handle"); + Assert.IsInstanceOf(transitionList, "Should return TransitionList instance."); + } + + } +} diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSView.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSView.cs index 2fbfd73d3..85ceca9a2 100755 --- a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSView.cs +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSView.cs @@ -54,7 +54,7 @@ namespace Tizen.NUI.Tests private void viewEventCallback(object sender, EventArgs e) { _flag = true; - } + } [Test] [Category("P1")] @@ -67,6 +67,7 @@ namespace Tizen.NUI.Tests { /* TEST CODE */ var view = new View(); + Assert.IsNotNull(view, "null handle"); Assert.IsInstanceOf(view, "Should return View instance."); } @@ -357,8 +358,8 @@ namespace Tizen.NUI.Tests View actor = new View(); actor.Size2D = new Size2D(100, 100); Position position = new Position(6.0f, 6.0f, 6.0f); - actor.Position = position; - + actor.Position = position; + actor.PositionUsesPivotPoint = true; actor.PivotPoint = PivotPoint.Center; actor.ParentOrigin = PivotPoint.Center; @@ -949,6 +950,118 @@ namespace Tizen.NUI.Tests Assert.AreEqual(100, actor.Margin.Bottom, "The actor's Margin.Bottom is not correct"); } + [Test] + [Category("P1")] + [Description("Test Margin. Check whether WidthSpecification is readable and writable.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.View.WidthSpecification A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void WidthSpecification_SET_GET_VALUE() + { + /* TEST CODE */ + View view = new View(); + view.WidthSpecification = 100; + Assert.AreEqual(100, view.WidthSpecification, "Should match value set"); + } + + [Test] + [Category("P1")] + [Description("Test Margin. Check whether HeightSpecification is readable and writable.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.View.HeightSpecification A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void HeightSpecification_SET_GET_VALUE() + { + /* TEST CODE */ + View view = new View(); + view.HeightSpecification = 100; + Assert.AreEqual(100, view.HeightSpecification, "Should match value set"); + } + + [Test] + [Category("P1")] + [Description("Test Margin. Check whether LayoutTransition is settable.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.View.LayoutTransition A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PCST")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void LayoutTransition_SET_PROPERTY() + { + /* TEST CODE */ + View view = new View(); + var transitionComponents = new TransitionComponents(); + + var layoutTransition = new LayoutTransition(TransitionCondition.Unspecified, + AnimatableProperties.Position, + 0.0f, + transitionComponents + ); + + view.LayoutTransition = layoutTransition; + Assert.AreEqual(view.LayoutTransitions.Count, 1, "Should be the number of layout transitions added"); + } + + [Test] + [Category("P1")] + [Description("Test Margin. Check whether LayoutTransition is readable.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.View.LayoutTransitions A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void LayoutTransitions_GET_PROPERTY() + { + /* TEST CODE */ + View view = new View(); + var transitionComponents = new TransitionComponents(); + + var layoutTransition = new LayoutTransition(TransitionCondition.Unspecified, + AnimatableProperties.Position, + 0.0f, + transitionComponents + ); + + view.LayoutTransition = layoutTransition; + + Dictionary transitions = view.LayoutTransitions; + + Assert.AreEqual(transitions.Count, 1, "Should be the number of layout transitions added"); + } + + [Test] + [Category("P1")] + [Description("Test Margin. Check whether Layout is read write.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.View.Layout A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Layout_SET_GET_VALUE() + { + /* TEST CODE */ + View view = new View(); + LayoutItem layout = new LayoutItem(); + view.Layout = layout; + + Assert.IsNotNull(view.Layout, "Layout should contain a valid LayoutItem"); + } + + [Test] + [Category("P1")] + [Description("Test Margin. Check whether Weight is read write.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.View.Weight A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Agnelo Vaz, agnelo.vaz@samsung.com")] + public void Weight_SET_GET_VALUE() + { + /* TEST CODE */ + View view = new View(); + view.Weight = 0.75f; + + Assert.AreEqual(view.Weight, 0.75f, "Should match value set"); + } + [Test] [Category("P1")] [Description("Test GetChildCount. Check whether GetChildCount is readable and writable.")] @@ -2082,7 +2195,7 @@ namespace Tizen.NUI.Tests Window.Instance.GetDefaultLayer().Add(view); try { - view.Unparent(); + view.Unparent(); Window.Instance.GetDefaultLayer().Remove(view); } catch (Exception e)