--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Collections.Generic;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("public/Layouting/AbsoluteLayout")]
+
+ public class PublicAbsoluteLayoutTest
+ {
+ private const string tag = "NUITEST";
+ private static bool flagOnMeasureOverride;
+ private static bool flagOnLayoutOverride;
+ internal class MyAbsoluteLayout : AbsoluteLayout
+ {
+ public MyAbsoluteLayout() : base()
+ { }
+
+ public void OnMeasureTest(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
+ {
+ OnMeasure(widthMeasureSpec, heightMeasureSpec);
+ }
+ protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
+ {
+ flagOnMeasureOverride = true;
+ base.OnMeasure(widthMeasureSpec, heightMeasureSpec);
+ }
+
+ 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;
+ base.OnLayout(changed, left, top, right, bottom);
+ }
+ }
+
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("AbsoluteLayout constructor")]
+ [Property("SPEC", "Tizen.NUI.AbsoluteLayout.AbsoluteLayout C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void AbsoluteLayoutConstructor()
+ {
+ tlog.Debug(tag, $"AbsoluteLayoutConstructor START");
+
+ var testingTarget = new AbsoluteLayout();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<AbsoluteLayout>(testingTarget, "Should return AbsoluteLayout instance.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"AbsoluteLayoutConstructor END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("AbsoluteLayout OnMeasure")]
+ [Property("SPEC", "Tizen.NUI.AbsoluteLayout.OnMeasure M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void AbsoluteLayoutOnMeasure()
+ {
+ tlog.Debug(tag, $"AbsoluteLayoutOnMeasure START");
+
+ flagOnMeasureOverride = false;
+ Assert.False(flagOnMeasureOverride, "flagOnMeasureOverride should be false initial");
+
+ LayoutItem layoutItem = new LinearLayout();
+
+ View view = new View()
+ {
+ ExcludeLayouting = false,
+ Size = new Size(100, 150),
+ Layout = new AbsoluteLayout()
+ };
+
+ layoutItem.AttachToOwner(view);
+
+ var testingTarget = new MyAbsoluteLayout();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<AbsoluteLayout>(testingTarget, "Should be an instance of AbsoluteLayout type.");
+
+ testingTarget.AttachToOwner(view);
+ testingTarget.Add(layoutItem);
+
+ MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.AtMost);
+ MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.AtMost);
+
+ testingTarget.OnMeasureTest(measureWidth, measureHeight);
+ Assert.True(flagOnMeasureOverride, "AbsoluteLayout overridden method not invoked.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"AbsoluteLayoutOnMeasure END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("AbsoluteLayout OnLayout")]
+ [Property("SPEC", "Tizen.NUI.AbsoluteLayout.OnLayout M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void AbsoluteLayoutOnLayout()
+ {
+ tlog.Debug(tag, $"AbsoluteLayoutOnLayout START");
+
+ flagOnLayoutOverride = false;
+ Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial");
+
+ LayoutItem layoutItem = new LinearLayout();
+
+ View view = new View()
+ {
+ ExcludeLayouting = false,
+ Size = new Size(100, 150),
+ Layout = new AbsoluteLayout()
+ };
+
+ layoutItem.AttachToOwner(view);
+
+ var testingTarget = new MyAbsoluteLayout();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<AbsoluteLayout>(testingTarget, "Should be an instance of AbsoluteLayout type.");
+
+ testingTarget.AttachToOwner(view);
+ testingTarget.Add(layoutItem);
+
+ testingTarget.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");
+ testingTarget.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.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"AbsoluteLayoutOnLayout END (OK)");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Collections.Generic;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("public/Layouting/FlexLayout")]
+ public class PublicFlexLayoutTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ private static bool flagOnMeasureOverride;
+ private static bool flagOnLayoutOverride;
+ private static bool flagOnChildAddOverride;
+ private static bool flagOnChildRemoveOverride;
+ internal class MyFlexLayout : FlexLayout
+ {
+ public MyFlexLayout() : base()
+ { }
+
+ public void OnMeasureTest(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
+ {
+ OnMeasure(widthMeasureSpec, heightMeasureSpec);
+ }
+ protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
+ {
+ flagOnMeasureOverride = true;
+ base.OnMeasure(widthMeasureSpec, heightMeasureSpec);
+ }
+
+ 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;
+ base.OnLayout(changed, left, top, right, bottom);
+ }
+
+ public void OnChildAddTest(LayoutItem child)
+ {
+ OnChildAdd(child);
+ }
+ protected override void OnChildAdd(LayoutItem child)
+ {
+ flagOnChildAddOverride = true;
+ base.OnChildAdd(child);
+ }
+
+ public void OnChildRemoveTest(LayoutItem child)
+ {
+ OnChildRemove(child);
+ }
+ protected override void OnChildRemove(LayoutItem child)
+ {
+ flagOnChildRemoveOverride = true;
+ base.OnChildRemove(child);
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("FlexLayout constructor")]
+ [Property("SPEC", "Tizen.NUI.FlexLayout.FlexLayout C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void FlexLayoutConstructor()
+ {
+ tlog.Debug(tag, $"FlexLayoutConstructor START");
+
+ var testingTarget = new FlexLayout();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<FlexLayout>(testingTarget, "Should return FlexLayout instance.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"FlexLayoutConstructor END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("FlexLayout SetFlexAlignmentSelf")]
+ [Property("SPEC", "Tizen.NUI.FlexLayout.SetFlexAlignmentSelf M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void FlexLayoutSetFlexAlignmentSelf()
+ {
+ tlog.Debug(tag, $"FlexLayoutSetFlexAlignmentSelf START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new FlexLayout()
+ {
+ Direction = FlexLayout.FlexDirection.Column,
+ }
+ };
+
+ try
+ {
+ FlexLayout.SetFlexAlignmentSelf(view, FlexLayout.AlignmentType.FlexStart);
+ }
+ catch (Exception e)
+ {
+ tlog.Error(tag, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ view.Dispose();
+ tlog.Debug(tag, $"FlexLayoutSetFlexAlignmentSelf END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("FlexLayout GetFlexAlignmentSelf")]
+ [Property("SPEC", "Tizen.NUI.FlexLayout.GetFlexAlignmentSelf M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void FlexLayoutGetFlexAlignmentSelf()
+ {
+ tlog.Debug(tag, $"FlexLayoutGetFlexAlignmentSelf START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new FlexLayout()
+ {
+ Direction = FlexLayout.FlexDirection.Column,
+ }
+ };
+
+ FlexLayout.SetFlexAlignmentSelf(view, FlexLayout.AlignmentType.FlexStart);
+ var result = FlexLayout.GetFlexAlignmentSelf(view);
+ Assert.AreEqual(FlexLayout.AlignmentType.FlexStart, result, "should be equal!");
+
+ view.Dispose();
+ tlog.Debug(tag, $"FlexLayoutGetFlexAlignmentSelf END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("FlexLayout SetFlexPositionType")]
+ [Property("SPEC", "Tizen.NUI.FlexLayout.SetFlexPositionType M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void FlexLayoutSetFlexPositionType()
+ {
+ tlog.Debug(tag, $"FlexLayoutSetFlexPositionType START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new FlexLayout()
+ {
+ Direction = FlexLayout.FlexDirection.Column,
+ }
+ };
+
+ try
+ {
+ FlexLayout.SetFlexPositionType(view, FlexLayout.PositionType.Relative);
+ }
+ catch (Exception e)
+ {
+ tlog.Error(tag, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ view.Dispose();
+ tlog.Debug(tag, $"FlexLayoutSetFlexPositionType END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("FlexLayout GetFlexPositionType")]
+ [Property("SPEC", "Tizen.NUI.FlexLayout.GetFlexPositionType M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void FlexLayoutGetFlexPositionType()
+ {
+ tlog.Debug(tag, $"FlexLayoutGetFlexPositionType START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new FlexLayout()
+ {
+ Direction = FlexLayout.FlexDirection.Column,
+ }
+ };
+
+ FlexLayout.SetFlexPositionType(view, FlexLayout.PositionType.Relative);
+ var result = FlexLayout.GetFlexPositionType(view);
+ Assert.AreEqual(FlexLayout.PositionType.Relative, result, "should be equal!");
+
+ view.Dispose();
+ tlog.Debug(tag, $"FlexLayoutGetFlexPositionType END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("FlexLayout SetFlexAspectRatio")]
+ [Property("SPEC", "Tizen.NUI.FlexLayout.SetFlexAspectRatio M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void FlexLayoutSetFlexAspectRatio()
+ {
+ tlog.Debug(tag, $"FlexLayoutSetFlexAspectRatio START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new FlexLayout()
+ {
+ Direction = FlexLayout.FlexDirection.Column,
+ }
+ };
+
+ try
+ {
+ FlexLayout.SetFlexAspectRatio(view, 0.3f);
+ }
+ catch (Exception e)
+ {
+ tlog.Error(tag, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ view.Dispose();
+ tlog.Debug(tag, $"FlexLayoutSetFlexAspectRatio END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("FlexLayout GetFlexAspectRatio")]
+ [Property("SPEC", "Tizen.NUI.FlexLayout.GetFlexAspectRatio M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void FlexLayoutGetFlexAspectRatio()
+ {
+ tlog.Debug(tag, $"FlexLayoutGetFlexAspectRatio START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new FlexLayout()
+ {
+ Direction = FlexLayout.FlexDirection.Column,
+ }
+ };
+
+ FlexLayout.SetFlexAspectRatio(view, 0.3f);
+ var result = FlexLayout.GetFlexAspectRatio(view);
+ Assert.AreEqual(0.3f, result, "should be equal!");
+
+ view.Dispose();
+ tlog.Debug(tag, $"FlexLayoutGetFlexAspectRatio END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("FlexLayout SetFlexBasis")]
+ [Property("SPEC", "Tizen.NUI.FlexLayout.SetFlexBasis M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void FlexLayoutSetFlexBasis()
+ {
+ tlog.Debug(tag, $"FlexLayoutSetFlexBasis START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new FlexLayout()
+ {
+ Direction = FlexLayout.FlexDirection.Column,
+ }
+ };
+
+ try
+ {
+ FlexLayout.SetFlexBasis(view, 0.6f);
+ }
+ catch (Exception e)
+ {
+ tlog.Error(tag, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ view.Dispose();
+ tlog.Debug(tag, $"FlexLayoutSetFlexBasis END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("FlexLayout GetFlexBasis")]
+ [Property("SPEC", "Tizen.NUI.FlexLayout.GetFlexBasis M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void FlexLayoutGetFlexBasis()
+ {
+ tlog.Debug(tag, $"FlexLayoutGetFlexBasis START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new FlexLayout()
+ {
+ Direction = FlexLayout.FlexDirection.Column,
+ }
+ };
+
+ FlexLayout.SetFlexBasis(view, 0.6f);
+ var result = FlexLayout.GetFlexBasis(view);
+ Assert.AreEqual(0.6f, result, "should be equal!");
+
+ view.Dispose();
+ tlog.Debug(tag, $"FlexLayoutGetFlexBasis END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("FlexLayout SetFlexShrink")]
+ [Property("SPEC", "Tizen.NUI.FlexLayout.SetFlexShrink M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void FlexLayoutSetFlexShrink()
+ {
+ tlog.Debug(tag, $"FlexLayoutSetFlexShrink START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new FlexLayout()
+ {
+ Direction = FlexLayout.FlexDirection.Column,
+ }
+ };
+
+ try
+ {
+ FlexLayout.SetFlexShrink(view, 0.9f);
+ }
+ catch (Exception e)
+ {
+ tlog.Error(tag, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ view.Dispose();
+ tlog.Debug(tag, $"FlexLayoutSetFlexShrink END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("FlexLayout GetFlexShrink")]
+ [Property("SPEC", "Tizen.NUI.FlexLayout.GetFlexShrink M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void FlexLayoutGetFlexShrink()
+ {
+ tlog.Debug(tag, $"FlexLayoutGetFlexShrink START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new FlexLayout()
+ {
+ Direction = FlexLayout.FlexDirection.Column,
+ }
+ };
+
+ FlexLayout.SetFlexShrink(view, 0.9f);
+ var result = FlexLayout.GetFlexShrink(view);
+ Assert.AreEqual(0.9f, result, "should be equal!");
+
+ view.Dispose();
+ tlog.Debug(tag, $"FlexLayoutGetFlexShrink END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("FlexLayout SetFlexGrow")]
+ [Property("SPEC", "Tizen.NUI.FlexLayout.SetFlexGrow M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void FlexLayoutSetFlexGrow()
+ {
+ tlog.Debug(tag, $"FlexLayoutSetFlexGrow START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new FlexLayout()
+ {
+ Direction = FlexLayout.FlexDirection.Column,
+ }
+ };
+
+ try
+ {
+ FlexLayout.SetFlexGrow(view, 0.2f);
+ }
+ catch (Exception e)
+ {
+ tlog.Error(tag, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ view.Dispose();
+ tlog.Debug(tag, $"FlexLayoutSetFlexGrow END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("FlexLayout GetFlexGrow")]
+ [Property("SPEC", "Tizen.NUI.FlexLayout.GetFlexGrow M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void FlexLayoutGetFlexGrow()
+ {
+ tlog.Debug(tag, $"FlexLayoutGetFlexGrow START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new FlexLayout()
+ {
+ Direction = FlexLayout.FlexDirection.Column,
+ }
+ };
+
+ FlexLayout.SetFlexGrow(view, 0.2f);
+ var result = FlexLayout.GetFlexGrow(view);
+ Assert.AreEqual(0.2f, result, "should be equal!");
+
+ view.Dispose();
+ tlog.Debug(tag, $"FlexLayoutGetFlexGrow END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("FlexLayout DownCast")]
+ [Property("SPEC", "Tizen.NUI.FlexLayout.DownCast M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void FlexLayoutDownCast()
+ {
+ tlog.Debug(tag, $"FlexLayoutDownCast START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new FlexLayout()
+ {
+ Direction = FlexLayout.FlexDirection.Column,
+ }
+ };
+
+ var testingTarget = FlexLayout.DownCast(view);
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<FlexLayout>(testingTarget, "Should return FlexLayout instance.");
+
+ view.Dispose();
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"FlexLayoutDownCast END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("FlexLayout Direction")]
+ [Property("SPEC", "Tizen.NUI.FlexLayout.Direction A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void FlexLayoutDirection()
+ {
+ tlog.Debug(tag, $"FlexLayoutDirection START");
+
+ var testingTarget = new FlexLayout();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<FlexLayout>(testingTarget, "Should return FlexLayout instance.");
+
+ testingTarget.Direction = FlexLayout.FlexDirection.Column;
+ Assert.AreEqual(testingTarget.Direction, FlexLayout.FlexDirection.Column, "Should be Column.");
+
+ testingTarget.Direction = FlexLayout.FlexDirection.Row;
+ Assert.AreEqual(testingTarget.Direction, FlexLayout.FlexDirection.Row, "Should be Row.");
+
+ testingTarget.Direction = FlexLayout.FlexDirection.ColumnReverse;
+ Assert.AreEqual(testingTarget.Direction, FlexLayout.FlexDirection.ColumnReverse, "Should be ColumnReverse.");
+
+ testingTarget.Direction = FlexLayout.FlexDirection.RowReverse;
+ Assert.AreEqual(testingTarget.Direction, FlexLayout.FlexDirection.RowReverse, "Should be RowReverse.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"FlexLayoutDirection END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("FlexLayout Justification")]
+ [Property("SPEC", "Tizen.NUI.FlexLayout.Justification A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void FlexLayoutJustification()
+ {
+ tlog.Debug(tag, $"FlexLayoutJustification START");
+
+ var testingTarget = new FlexLayout();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<FlexLayout>(testingTarget, "Should return FlexLayout instance.");
+
+ testingTarget.Justification = FlexLayout.FlexJustification.FlexStart;
+ Assert.AreEqual(testingTarget.Justification, FlexLayout.FlexJustification.FlexStart, "Should be FlexStart.");
+
+ testingTarget.Justification = FlexLayout.FlexJustification.FlexEnd;
+ Assert.AreEqual(testingTarget.Justification, FlexLayout.FlexJustification.FlexEnd, "Should be FlexEnd.");
+
+ testingTarget.Justification = FlexLayout.FlexJustification.Center;
+ Assert.AreEqual(testingTarget.Justification, FlexLayout.FlexJustification.Center, "Should be Center.");
+
+ testingTarget.Justification = FlexLayout.FlexJustification.SpaceBetween;
+ Assert.AreEqual(testingTarget.Justification, FlexLayout.FlexJustification.SpaceBetween, "Should be SpaceBetween.");
+
+ testingTarget.Justification = FlexLayout.FlexJustification.SpaceAround;
+ Assert.AreEqual(testingTarget.Justification, FlexLayout.FlexJustification.SpaceAround, "Should be SpaceAround.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"FlexLayoutJustification END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("FlexLayout WrapType")]
+ [Property("SPEC", "Tizen.NUI.FlexLayout.WrapType A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void FlexLayoutWrapType()
+ {
+ tlog.Debug(tag, $"FlexLayoutWrapType START");
+
+ var testingTarget = new FlexLayout();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<FlexLayout>(testingTarget, "Should return FlexLayout instance.");
+
+ testingTarget.WrapType = FlexLayout.FlexWrapType.NoWrap;
+ Assert.AreEqual(testingTarget.WrapType, FlexLayout.FlexWrapType.NoWrap, "Should be NoWrap.");
+
+ testingTarget.WrapType = FlexLayout.FlexWrapType.Wrap;
+ Assert.AreEqual(testingTarget.WrapType, FlexLayout.FlexWrapType.Wrap, "Should be Wrap.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"FlexLayoutWrapType END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("FlexLayout Alignment")]
+ [Property("SPEC", "Tizen.NUI.FlexLayout.Alignment A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void FlexLayoutAlignment()
+ {
+ tlog.Debug(tag, $"FlexLayoutAlignment START");
+
+ var testingTarget = new FlexLayout();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<FlexLayout>(testingTarget, "Should return FlexLayout instance.");
+
+ testingTarget.Alignment = FlexLayout.AlignmentType.FlexStart;
+ Assert.AreEqual(testingTarget.Alignment, FlexLayout.AlignmentType.FlexStart, "Should be FlexStart.");
+
+ testingTarget.Alignment = FlexLayout.AlignmentType.FlexEnd;
+ Assert.AreEqual(testingTarget.Alignment, FlexLayout.AlignmentType.FlexEnd, "Should be FlexEnd.");
+
+ testingTarget.Alignment = FlexLayout.AlignmentType.Auto;
+ Assert.AreEqual(testingTarget.Alignment, FlexLayout.AlignmentType.Auto, "Should be Auto.");
+
+ testingTarget.Alignment = FlexLayout.AlignmentType.Center;
+ Assert.AreEqual(testingTarget.Alignment, FlexLayout.AlignmentType.Center, "Should be Center.");
+
+ testingTarget.Alignment = FlexLayout.AlignmentType.Stretch;
+ Assert.AreEqual(testingTarget.Alignment, FlexLayout.AlignmentType.Stretch, "Should be Stretch.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"FlexLayoutAlignment END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("FlexLayout ItemsAlignment")]
+ [Property("SPEC", "Tizen.NUI.FlexLayout.ItemsAlignment A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void FlexLayoutItemsAlignment()
+ {
+ tlog.Debug(tag, $"FlexLayoutItemsAlignment START");
+
+ var testingTarget = new FlexLayout();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<FlexLayout>(testingTarget, "Should return FlexLayout instance.");
+
+ testingTarget.ItemsAlignment = FlexLayout.AlignmentType.FlexStart;
+ Assert.AreEqual(testingTarget.ItemsAlignment, FlexLayout.AlignmentType.FlexStart, "Should be FlexStart.");
+
+ testingTarget.ItemsAlignment = FlexLayout.AlignmentType.FlexEnd;
+ Assert.AreEqual(testingTarget.ItemsAlignment, FlexLayout.AlignmentType.FlexEnd, "Should be FlexEnd.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"FlexLayoutItemsAlignment END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("FlexLayout OnMeasure")]
+ [Property("SPEC", "Tizen.NUI.FlexLayout.OnMeasure M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void FlexLayoutOnMeasure()
+ {
+ tlog.Debug(tag, $"FlexLayoutOnMeasure START");
+
+ flagOnMeasureOverride = false;
+ Assert.False(flagOnMeasureOverride, "flagOnMeasureOverride should be false initial");
+
+ LayoutItem layoutItem = new LinearLayout();
+
+ View view = new View()
+ {
+ ExcludeLayouting = false,
+ Size = new Size(100, 150),
+ Layout = new FlexLayout()
+ };
+
+ layoutItem.AttachToOwner(view);
+
+ var testingTarget = new MyFlexLayout();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<FlexLayout>(testingTarget, "Should be an instance of FlexLayout type.");
+
+ testingTarget.AttachToOwner(view);
+ testingTarget.Add(layoutItem);
+
+ MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly);
+ MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.AtMost);
+
+ testingTarget.OnMeasureTest(measureWidth, measureHeight);
+ Assert.True(flagOnMeasureOverride, "FlexLayout overridden method not invoked.");
+
+ tlog.Debug(tag, $"FlexLayoutOnMeasure END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("FlexLayout OnLayout")]
+ [Property("SPEC", "Tizen.NUI.FlexLayout.OnLayout M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void FlexLayoutOnLayout()
+ {
+ tlog.Debug(tag, $"FlexLayoutOnLayout START");
+
+ flagOnLayoutOverride = false;
+ Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial");
+
+ LayoutItem layoutItem = new LinearLayout();
+
+ View view = new View()
+ {
+ ExcludeLayouting = false,
+ Size = new Size(100, 150),
+ Layout = new FlexLayout()
+ };
+
+ layoutItem.AttachToOwner(view);
+
+ var testingTarget = new MyFlexLayout();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<FlexLayout>(testingTarget, "Should be an instance of FlexLayout type.");
+
+ testingTarget.AttachToOwner(view);
+ testingTarget.Add(layoutItem);
+
+ testingTarget.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");
+ testingTarget.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.");
+
+ tlog.Debug(tag, $"FlexLayoutOnLayout END (OK)");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Collections.Generic;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("public/Layouting/GridLayout")]
+ public class PublicGridLayoutTest
+ {
+ private const string tag = "NUITEST";
+ private static bool flagOnMeasureOverride;
+ private static bool flagOnLayoutOverride;
+ internal class MyGridLayout : GridLayout
+ {
+ public MyGridLayout() : 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;
+ base.OnMeasure(widthMeasureSpec, heightMeasureSpec);
+ }
+
+ 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;
+ base.OnLayout(changed, left, top, right, bottom);
+ }
+ }
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("GridLayout constructor")]
+ [Property("SPEC", "Tizen.NUI.GridLayout.GridLayout C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void GridLayoutConstructor()
+ {
+ tlog.Debug(tag, $"GridLayoutConstructor START");
+
+ var testingTarget = new GridLayout();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<GridLayout>(testingTarget, "Should return GridLayout instance.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"GridLayoutConstructor END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("GridLayout SetColumn")]
+ [Property("SPEC", "Tizen.NUI.GridLayout.SetColumn M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void GridLayoutSetColumn()
+ {
+ tlog.Debug(tag, $"GridLayoutSetColumn START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new GridLayout()
+ {
+ GridOrientation = GridLayout.Orientation.Horizontal
+ }
+ };
+
+ try
+ {
+ GridLayout.SetColumn(view, 3);
+ }
+ catch (Exception e)
+ {
+ tlog.Error(tag, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ tlog.Debug(tag, $"GridLayoutSetColumn END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("GridLayout GetColumn")]
+ [Property("SPEC", "Tizen.NUI.GridLayout.GetColumn M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void GridLayoutGetColumn()
+ {
+ tlog.Debug(tag, $"GridLayoutGetColumn START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new GridLayout()
+ {
+ GridOrientation = GridLayout.Orientation.Horizontal
+ }
+ };
+
+ GridLayout.SetColumn(view, 3);
+ Assert.AreEqual(3, GridLayout.GetColumn(view), "should be equal!");
+
+ tlog.Debug(tag, $"GridLayoutGetColumn END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("GridLayout SetColumnSpan")]
+ [Property("SPEC", "Tizen.NUI.GridLayout.SetColumnSpan M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void GridLayoutSetColumnSpan()
+ {
+ tlog.Debug(tag, $"GridLayoutSetColumnSpan START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new GridLayout()
+ {
+ GridOrientation = GridLayout.Orientation.Horizontal
+ }
+ };
+
+ try
+ {
+ GridLayout.SetColumnSpan(view, 10);
+ }
+ catch (Exception e)
+ {
+ tlog.Error(tag, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ tlog.Debug(tag, $"GridLayoutSetColumnSpan END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("GridLayout GetColumnSpan")]
+ [Property("SPEC", "Tizen.NUI.GridLayout.GetColumnSpan M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void GridLayoutGetColumnSpan()
+ {
+ tlog.Debug(tag, $"GridLayoutGetColumnSpan START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new GridLayout()
+ {
+ GridOrientation = GridLayout.Orientation.Horizontal
+ }
+ };
+
+ GridLayout.SetColumnSpan(view, 10);
+ Assert.AreEqual(10, GridLayout.GetColumnSpan(view), "should be equal!");
+
+ tlog.Debug(tag, $"GridLayoutGetColumnSpan END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("GridLayout SetRow")]
+ [Property("SPEC", "Tizen.NUI.GridLayout.SetRow M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void GridLayoutSetRow()
+ {
+ tlog.Debug(tag, $"GridLayoutSetRow START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new GridLayout()
+ {
+ GridOrientation = GridLayout.Orientation.Horizontal
+ }
+ };
+
+ try
+ {
+ GridLayout.SetRow(view, 2);
+ }
+ catch (Exception e)
+ {
+ tlog.Error(tag, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ tlog.Debug(tag, $"GridLayoutSetRow END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("GridLayout GetRow")]
+ [Property("SPEC", "Tizen.NUI.GridLayout.GetRow M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void GridLayoutGetRow()
+ {
+ tlog.Debug(tag, $"GridLayoutGetRow START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new GridLayout()
+ {
+ GridOrientation = GridLayout.Orientation.Horizontal
+ }
+ };
+
+ GridLayout.SetRow(view, 2);
+ Assert.AreEqual(2, GridLayout.GetRow(view), "should be equal!");
+
+ tlog.Debug(tag, $"GridLayoutGetRow END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("GridLayout SetRowSpan")]
+ [Property("SPEC", "Tizen.NUI.GridLayout.SetRowSpan M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void GridLayoutSetRowSpan()
+ {
+ tlog.Debug(tag, $"GridLayoutSetRowSpan START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new GridLayout()
+ {
+ GridOrientation = GridLayout.Orientation.Horizontal
+ }
+ };
+
+ try
+ {
+ GridLayout.SetRowSpan(view, 5);
+ }
+ catch (Exception e)
+ {
+ tlog.Error(tag, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ tlog.Debug(tag, $"GridLayoutSetRowSpan END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("GridLayout GetRowSpan")]
+ [Property("SPEC", "Tizen.NUI.GridLayout.GetRowSpan M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void GridLayoutGetRowSpan()
+ {
+ tlog.Debug(tag, $"GridLayoutGetRowSpan START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new GridLayout()
+ {
+ GridOrientation = GridLayout.Orientation.Horizontal
+ }
+ };
+
+ GridLayout.SetRowSpan(view, 5);
+ Assert.AreEqual(5, GridLayout.GetRowSpan(view), "should be equal!");
+
+ tlog.Debug(tag, $"GridLayoutGetRowSpan END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("GridLayout SetHorizontalStretch")]
+ [Property("SPEC", "Tizen.NUI.GridLayout.SetHorizontalStretch M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void GridLayoutSetHorizontalStretch()
+ {
+ tlog.Debug(tag, $"GridLayoutSetHorizontalStretch START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new GridLayout()
+ {
+ GridOrientation = GridLayout.Orientation.Horizontal
+ }
+ };
+
+ try
+ {
+ GridLayout.SetHorizontalStretch(view, GridLayout.StretchFlags.Fill);
+ }
+ catch (Exception e)
+ {
+ tlog.Error(tag, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ tlog.Debug(tag, $"GridLayoutSetHorizontalStretch END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("GridLayout GetHorizontalStretch")]
+ [Property("SPEC", "Tizen.NUI.GridLayout.GetHorizontalStretch M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void GridLayoutGetHorizontalStretch()
+ {
+ tlog.Debug(tag, $"GridLayoutGetHorizontalStretch START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new GridLayout()
+ {
+ GridOrientation = GridLayout.Orientation.Horizontal
+ }
+ };
+
+ GridLayout.SetHorizontalStretch(view, GridLayout.StretchFlags.Fill);
+ Assert.AreEqual(GridLayout.StretchFlags.Fill, GridLayout.GetHorizontalStretch(view), "should be equal!");
+
+ tlog.Debug(tag, $"GridLayoutGetHorizontalStretch END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("GridLayout SetVerticalStretch")]
+ [Property("SPEC", "Tizen.NUI.GridLayout.SetVerticalStretch M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void GridLayoutSetVerticalStretch()
+ {
+ tlog.Debug(tag, $"GridLayoutSetVerticalStretch START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new GridLayout()
+ {
+ GridOrientation = GridLayout.Orientation.Horizontal
+ }
+ };
+
+ try
+ {
+ GridLayout.SetVerticalStretch(view, GridLayout.StretchFlags.Expand);
+ }
+ catch (Exception e)
+ {
+ tlog.Error(tag, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ tlog.Debug(tag, $"GridLayoutSetVerticalStretch END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("GridLayout GetVerticalStretch")]
+ [Property("SPEC", "Tizen.NUI.GridLayout.GetVerticalStretch M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void GridLayoutGetVerticalStretch()
+ {
+ tlog.Debug(tag, $"GridLayoutGetVerticalStretch START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new GridLayout()
+ {
+ GridOrientation = GridLayout.Orientation.Horizontal
+ }
+ };
+
+ GridLayout.SetVerticalStretch(view, GridLayout.StretchFlags.Expand);
+ Assert.AreEqual(GridLayout.StretchFlags.Expand, GridLayout.GetVerticalStretch(view), "should be equal!");
+
+ tlog.Debug(tag, $"GridLayoutGetVerticalStretch END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("GridLayout SetHorizontalAlignment")]
+ [Property("SPEC", "Tizen.NUI.GridLayout.SetHorizontalAlignment M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void GridLayoutSetHorizontalAlignment()
+ {
+ tlog.Debug(tag, $"GridLayoutSetHorizontalAlignment START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new GridLayout()
+ {
+ GridOrientation = GridLayout.Orientation.Horizontal
+ }
+ };
+
+ try
+ {
+ GridLayout.SetHorizontalAlignment(view, GridLayout.Alignment.Start);
+ }
+ catch (Exception e)
+ {
+ tlog.Error(tag, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ tlog.Debug(tag, $"GridLayoutSetHorizontalAlignment END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("GridLayout GetHorizontalAlignment")]
+ [Property("SPEC", "Tizen.NUI.GridLayout.GetHorizontalAlignment M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void GridLayoutGetHorizontalAlignment()
+ {
+ tlog.Debug(tag, $"GridLayoutGetHorizontalAlignment START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new GridLayout()
+ {
+ GridOrientation = GridLayout.Orientation.Horizontal
+ }
+ };
+
+ GridLayout.SetHorizontalAlignment(view, GridLayout.Alignment.Start);
+ Assert.AreEqual(GridLayout.Alignment.Start, GridLayout.GetHorizontalAlignment(view), "should be equal!");
+
+ tlog.Debug(tag, $"GridLayoutGetHorizontalAlignment END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("GridLayout SetVerticalAlignment")]
+ [Property("SPEC", "Tizen.NUI.GridLayout.SetVerticalAlignment M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void GridLayoutSetVerticalAlignment()
+ {
+ tlog.Debug(tag, $"GridLayoutSetVerticalAlignment START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new GridLayout()
+ {
+ GridOrientation = GridLayout.Orientation.Horizontal
+ }
+ };
+
+ try
+ {
+ GridLayout.SetVerticalAlignment(view, GridLayout.Alignment.Center);
+ }
+ catch (Exception e)
+ {
+ tlog.Error(tag, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ tlog.Debug(tag, $"GridLayoutSetVerticalAlignment END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("GridLayout GetVerticalAlignment")]
+ [Property("SPEC", "Tizen.NUI.GridLayout.GetVerticalAlignment M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void GridLayoutGetVerticalAlignment()
+ {
+ tlog.Debug(tag, $"GridLayoutGetVerticalAlignment START");
+
+ View view = new View()
+ {
+ Size = new Size(400, 400),
+ BackgroundColor = Color.White,
+ Layout = new GridLayout()
+ {
+ GridOrientation = GridLayout.Orientation.Horizontal
+ }
+ };
+
+ GridLayout.SetVerticalAlignment(view, GridLayout.Alignment.Center);
+ Assert.AreEqual(GridLayout.Alignment.Center, GridLayout.GetVerticalAlignment(view), "should be equal!");
+
+ tlog.Debug(tag, $"GridLayoutGetVerticalAlignment END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("GridLayout Columns")]
+ [Property("SPEC", "Tizen.NUI.GridLayout.Columns A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void GridLayoutColumns()
+ {
+ tlog.Debug(tag, $"GridLayoutColumns START");
+
+ var testingTarget = new GridLayout();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutGroup>(testingTarget, "Should return GridLayout instance.");
+
+ testingTarget.Columns = 2;
+ Assert.AreEqual(2, testingTarget.Columns, "Should be 2.");
+
+ testingTarget.Columns = 1;
+ Assert.AreEqual(1, testingTarget.Columns, "Should be 1.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"GridLayoutColumns END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("GridLayout ColumnSpacing")]
+ [Property("SPEC", "Tizen.NUI.GridLayout.ColumnSpacing A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void GridLayoutColumnSpacing()
+ {
+ tlog.Debug(tag, $"GridLayoutColumns START");
+
+ var testingTarget = new GridLayout();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutGroup>(testingTarget, "Should return GridLayout instance.");
+
+ testingTarget.Columns = 2;
+ Assert.AreEqual(2, testingTarget.Columns, "Should be 2.");
+
+ testingTarget.ColumnSpacing = 1;
+ Assert.AreEqual(1, testingTarget.ColumnSpacing, "Should be 1.");
+
+ testingTarget.ColumnSpacing = 2;
+ Assert.AreEqual(2, testingTarget.ColumnSpacing, "Should be 1.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"GridLayoutColumns END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("GridLayout Rows")]
+ [Property("SPEC", "Tizen.NUI.GridLayout.Rows A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void GridLayoutRows()
+ {
+ tlog.Debug(tag, $"GridLayoutRows START");
+
+ var testingTarget = new GridLayout();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutGroup>(testingTarget, "Should return GridLayout instance.");
+
+ testingTarget.Rows = 2;
+ Assert.AreEqual(2, testingTarget.Rows, "Should be 2.");
+
+ testingTarget.Rows = 1;
+ Assert.AreEqual(1, testingTarget.Rows, "Should be 1.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"GridLayoutRows END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("GridLayout RowSpacing")]
+ [Property("SPEC", "Tizen.NUI.GridLayout.RowSpacing A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void GridLayoutRowSpacing()
+ {
+ tlog.Debug(tag, $"GridLayoutRowSpacing START");
+
+ var testingTarget = new GridLayout();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutGroup>(testingTarget, "Should return GridLayout instance.");
+
+ testingTarget.RowSpacing = 10.0f;
+ Assert.AreEqual(10.0f, testingTarget.RowSpacing, "Should be 10.0f.");
+
+ testingTarget.RowSpacing = 20.0f;
+ Assert.AreEqual(20.0f, testingTarget.RowSpacing, "Should be 20.0f.");
+
+ testingTarget.RowSpacing = -10.0f;
+ Assert.AreEqual(0.0f, testingTarget.RowSpacing, "Should be 0.0f.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"GridLayoutRowSpacing END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("GridLayout GridOrientation")]
+ [Property("SPEC", "Tizen.NUI.GridLayout.GridOrientation A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void GridLayoutGridOrientation()
+ {
+ tlog.Debug(tag, $"GridLayoutGridOrientation START");
+
+ var testingTarget = new GridLayout();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutGroup>(testingTarget, "Should return GridLayout instance.");
+
+ testingTarget.GridOrientation = GridLayout.Orientation.Horizontal;
+ Assert.AreEqual(GridLayout.Orientation.Horizontal, testingTarget.GridOrientation, "Should be equal!");
+
+ testingTarget.GridOrientation = GridLayout.Orientation.Horizontal;
+ Assert.AreEqual(GridLayout.Orientation.Horizontal, testingTarget.GridOrientation, "Should be equal!");
+
+ testingTarget.GridOrientation = GridLayout.Orientation.Vertical;
+ Assert.AreEqual(GridLayout.Orientation.Vertical, testingTarget.GridOrientation, "Should be equal!");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"GridLayoutGridOrientation END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("GridLayout OnMeasure")]
+ [Property("SPEC", "Tizen.NUI.GridLayout.OnMeasure M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void GridLayoutOnMeasure()
+ {
+ tlog.Debug(tag, $"GridLayoutOnMeasure START");
+
+ flagOnMeasureOverride = false;
+ Assert.False(flagOnMeasureOverride, "flagOnMeasureOverride should be false initial");
+
+ var testingTarget = new MyGridLayout();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<GridLayout>(testingTarget, "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);
+
+ testingTarget.OnMeasureTest(measureWidth, measureHeight);
+ Assert.True(flagOnMeasureOverride, "GridLayout overridden method not invoked.");
+
+ // !MeasureSpecification.ModeType.Exactly
+ flagOnMeasureOverride = false;
+ Assert.False(flagOnMeasureOverride, "flagOnMeasureOverride should be false initial");
+
+ MeasureSpecification measureWidth2 = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.AtMost);
+ MeasureSpecification measureHeight2 = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Unspecified);
+
+ testingTarget.OnMeasureTest(measureWidth2, measureHeight2);
+ Assert.True(flagOnMeasureOverride, "GridLayout overridden method not invoked.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"GridLayoutOnMeasure END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("GridLayout OnLayout")]
+ [Property("SPEC", "Tizen.NUI.GridLayout.OnLayout M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void GridLayoutOnLayout()
+ {
+ tlog.Debug(tag, $"GridLayoutOnLayout START");
+
+ flagOnLayoutOverride = false;
+ Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial");
+
+ LayoutItem layoutItem = new LinearLayout();
+
+ View view = new View()
+ {
+ ExcludeLayouting = false,
+ Size = new Size(100, 150),
+ Layout = new AbsoluteLayout()
+ };
+
+ layoutItem.AttachToOwner(view);
+
+ var testingTarget = new MyGridLayout();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<GridLayout>(testingTarget, "Should be an instance of GridLayout type.");
+
+ testingTarget.AttachToOwner(view);
+ testingTarget.Add(layoutItem);
+
+ MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly);
+ MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly);
+
+ testingTarget.OnMeasureTest(measureWidth, measureHeight);
+
+ testingTarget.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");
+ testingTarget.OnLayoutTest(false, new LayoutLength(10), new LayoutLength(10), new LayoutLength(20), new LayoutLength(20));
+ Assert.True(flagOnLayoutOverride, "GridLayout overridden method not invoked.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"GridLayoutOnLayout END (OK)");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Collections.Generic;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("public/Layouting/ILayoutParent")]
+ public class PublicILayoutParentTest
+ {
+ private const string tag = "NUITEST";
+ private static bool flagOnILayoutParentAdd;
+ private static bool flagOnILayoutParentRemove;
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ internal class MyILayoutParent : ILayoutParent
+ {
+ public MyILayoutParent() : base()
+ { }
+
+ public void Add(LayoutItem layoutItem)
+ {
+ flagOnILayoutParentAdd = true;
+ }
+
+ public void Remove(LayoutItem layoutItem)
+ {
+ flagOnILayoutParentRemove = true;
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("ILayoutParent Add")]
+ [Property("SPEC", "Tizen.NUI.ILayoutParent.Add M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void ILayoutParentAdd()
+ {
+ tlog.Debug(tag, $"ILayoutParentAdd START");
+
+ flagOnILayoutParentAdd = false;
+ Assert.False(flagOnILayoutParentAdd, "flagOnILayoutParentAdd should be false initial");
+
+ var testingTarget = new MyILayoutParent();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<ILayoutParent>(testingTarget, "Should be an instance of ILayoutParent type.");
+
+ using (LayoutItem layoutItem = new LayoutItem())
+ {
+ testingTarget.Add(layoutItem);
+ Assert.IsTrue(flagOnILayoutParentAdd);
+ }
+
+ tlog.Debug(tag, $"ILayoutParentAdd END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("ILayoutParent Remove")]
+ [Property("SPEC", "Tizen.NUI.ILayoutParent.Remove M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void ILayoutParentRemove()
+ {
+ tlog.Debug(tag, $"ILayoutParentRemove START");
+
+ flagOnILayoutParentAdd = false;
+ Assert.False(flagOnILayoutParentAdd, "flagOnILayoutParentAdd should be false initial");
+
+ flagOnILayoutParentRemove = false;
+ Assert.False(flagOnILayoutParentRemove, "flagOnILayoutParentRemove should be false initial");
+
+ var testingTarget = new MyILayoutParent();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<ILayoutParent>(testingTarget, "Should be an instance of ILayoutParent type.");
+
+ using (LayoutItem layoutItem = new LayoutItem())
+ {
+ testingTarget.Add(layoutItem);
+ Assert.IsTrue(flagOnILayoutParentAdd);
+
+ testingTarget.Remove(layoutItem);
+ Assert.IsTrue(flagOnILayoutParentRemove);
+ }
+
+ tlog.Debug(tag, $"ILayoutParentRemove END (OK)");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("public/Layouting/LayoutGroup")]
+ public class PublicLayoutGroupTest
+ {
+ private const string tag = "NUITEST";
+ 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 MyLayoutGroup : LayoutGroup
+ {
+ public MyLayoutGroup() : base()
+ { }
+
+ public int ChildCount()
+ {
+ return LayoutChildren.Count;
+ }
+
+ public IEnumerable<LayoutItem> ForeachLayoutChildren()
+ {
+ List<LayoutItem> LinearChildren = IterateLayoutChildren().ToList();
+ return LinearChildren;
+ }
+
+ // 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;
+ base.OnMeasure(widthMeasureSpec, heightMeasureSpec);
+ }
+
+ 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;
+ base.OnLayout(changed, left, top, right, bottom);
+ }
+
+ public void OnChildAddTest(LayoutItem child)
+ {
+ OnChildAdd(child);
+ }
+ protected override void OnChildAdd(LayoutItem child)
+ {
+ flagOnChildAddOverride = true;
+ base.OnChildAdd(child);
+ }
+
+ public void OnChildRemoveTest(LayoutItem child)
+ {
+ OnChildRemove(child);
+ }
+ protected override void OnChildRemove(LayoutItem child)
+ {
+ flagOnChildRemoveOverride = true;
+ base.OnChildRemove(child);
+ }
+
+ 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;
+ base.MeasureChild(child, parentWidth, parentHeight);
+ }
+
+ public void MeasureChildrenTest(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
+ {
+ MeasureChildren(widthMeasureSpec, heightMeasureSpec);
+ }
+ protected override void MeasureChildren(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
+ {
+ flagOnMeasureChild = true;
+ base.MeasureChildren(widthMeasureSpec, heightMeasureSpec);
+ }
+
+ 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;
+ base.MeasureChildWithMargins(child, parentWidthMeasureSpec, widthUsed, parentHeightMeasureSpec, heightUsed);
+ }
+
+ public void MeasureChildWithoutPaddingTest(LayoutItem child, MeasureSpecification parentWidthMeasureSpec, MeasureSpecification parentHeightMeasureSpec)
+ {
+ MeasureChildWithoutPadding(child, parentWidthMeasureSpec, parentHeightMeasureSpec);
+ }
+
+ public void OnAttachedToOwnerTest()
+ {
+ OnAttachedToOwner();
+ }
+ protected override void OnAttachedToOwner()
+ {
+ flagOnAttachedToOwner = true;
+ base.OnAttachedToOwner();
+ }
+ }
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutGroup constructor")]
+ [Property("SPEC", "Tizen.NUI.LayoutGroup.LayoutGroup C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutGroupConstructor()
+ {
+ tlog.Debug(tag, $"LayoutGroupConstructor START");
+
+ var layoutGroup = new LayoutGroup();
+ Assert.IsNotNull(layoutGroup, "null handle");
+ Assert.IsInstanceOf<LayoutGroup>(layoutGroup, "Should return LayoutGroup instance.");
+
+ layoutGroup.Dispose();
+ tlog.Debug(tag, $"LayoutGroupConstructor END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutGroup IterateLayoutChildren")]
+ [Property("SPEC", "Tizen.NUI.LayoutGroup.IterateLayoutChildren M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutGroupIterateLayoutChildren()
+ {
+ tlog.Debug(tag, $"LayoutGroupIterateLayoutChildren START");
+
+ LayoutItem layoutItem = new LinearLayout();
+
+ View view = new View()
+ {
+ ExcludeLayouting = false,
+ };
+ layoutItem.AttachToOwner(view);
+
+ var testingTarget = new MyLayoutGroup();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutGroup>(testingTarget, "Should return LayoutGroup instance.");
+
+ testingTarget.Add(layoutItem);
+
+ var result = testingTarget.ForeachLayoutChildren();
+ Assert.AreEqual(1, result.Count(), "should be equal!");
+
+ tlog.Debug(tag, $"LayoutGroupIterateLayoutChildren END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutGroup Add")]
+ [Property("SPEC", "Tizen.NUI.LayoutGroup.Add M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutGroupAdd()
+ {
+ tlog.Debug(tag, $"LayoutGroupAdd START");
+
+ var testingTarget = new MyLayoutGroup();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutGroup>(testingTarget, "Should return LayoutGroup instance.");
+
+ using (LayoutItem layoutItem = new LayoutItem())
+ {
+ testingTarget.Add(layoutItem);
+ Assert.AreEqual(testingTarget.ChildCount(), 1, "Should 1 for the added child.");
+ }
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutGroupAdd END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutGroup Add. With null argument")]
+ [Property("SPEC", "Tizen.NUI.LayoutGroup.Add M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutGroupAddWithNullArgument()
+ {
+ tlog.Debug(tag, $"LayoutGroupAddWithNullArgument START");
+
+ var testingTarget = new MyLayoutGroup();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutGroup>(testingTarget, "Should return LayoutGroup instance.");
+
+ try
+ {
+ testingTarget.Add(null);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutGroupAddWithNullArgument END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutGroup RemoveAll")]
+ [Property("SPEC", "Tizen.NUI.LayoutGroup.RemoveAll M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutGroupRemoveAll()
+ {
+ tlog.Debug(tag, $"LayoutGroupRemoveAll START");
+
+ var testingTarget = new MyLayoutGroup();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutGroup>(testingTarget, "Should return LayoutGroup instance.");
+
+ using (LayoutItem layoutItem = new LayoutItem())
+ {
+ testingTarget.Add(layoutItem);
+ Assert.AreEqual(testingTarget.ChildCount(), 1, "Should 1 for the added child.");
+
+ testingTarget.RemoveAll();
+ Assert.AreEqual(testingTarget.ChildCount(), 0, "Should 0 as child removed.");
+ }
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutGroupRemoveAll END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutGroup Remove")]
+ [Property("SPEC", "Tizen.NUI.LayoutGroup.Remove M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutGroupRemove()
+ {
+ tlog.Debug(tag, $"LayoutGroupRemove START");
+
+ var testingTarget = new MyLayoutGroup();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutGroup>(testingTarget, "Should return LayoutGroup instance.");
+
+ using (LayoutItem layoutItem = new LayoutItem())
+ {
+ testingTarget.LayoutWithTransition = true;
+
+ testingTarget.Add(layoutItem);
+ Assert.AreEqual(testingTarget.ChildCount(), 1, "Should 1 for the added child.");
+
+ using (LayoutItem siblingLayoutItem = new LayoutItem())
+ {
+ testingTarget.Add(siblingLayoutItem);
+ Assert.AreEqual(testingTarget.ChildCount(), 2, "Should 1 for the added child.");
+
+ testingTarget.Remove(layoutItem);
+ Assert.AreEqual(testingTarget.ChildCount(), 1, "Should 0 as child removed");
+ }
+ }
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutGroupRemove END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutGroup ChangeLayoutSiblingOrder")]
+ [Property("SPEC", "Tizen.NUI.LayoutGroup.ChangeLayoutSiblingOrder M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutGroupChangeLayoutSiblingOrder()
+ {
+ tlog.Debug(tag, $"LayoutGroupChangeLayoutSiblingOrder START");
+
+ View parent = new View()
+ {
+ Layout = new AbsoluteLayout()
+ };
+
+ View child = new View()
+ {
+ Layout = new AbsoluteLayout(),
+ };
+
+ parent.Add(child);
+
+ LayoutItem layout = new LayoutItem();
+ layout.AttachToOwner(child);
+
+ var testingTarget = layout.Owner.Layout as LayoutGroup;
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutGroup>(testingTarget, "Should return LayoutGroup instance.");
+
+ testingTarget.ChangeLayoutSiblingOrder(0);
+
+ child.Dispose();
+ parent.Dispose();
+ layout.Dispose();
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutGroupChangeLayoutSiblingOrder END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutGroup LayoutChildren")]
+ [Property("SPEC", "Tizen.NUI.LayoutGroup.LayoutChildren A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutGroupLayoutChildren()
+ {
+ tlog.Debug(tag, $"LayoutGroupLayoutChildren START");
+
+ var testingTarget = new MyLayoutGroup();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutGroup>(testingTarget, "Should return LayoutGroup instance.");
+
+ using (LayoutItem layoutItem = new LayoutItem())
+ {
+ testingTarget.Add(layoutItem);
+ Assert.AreEqual(1, testingTarget.ChildCount(), "Should number of children added");
+ }
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutGroupLayoutChildren END (OK)");
+ }
+
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutGroup Get measure specification")]
+ [Property("SPEC", "Tizen.NUI.LayoutGroup.GetChildMeasureSpecification M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutGroupGetChildMeasureSpecification()
+ {
+ tlog.Debug(tag, $"LayoutGroupGetChildMeasureSpecification START");
+
+ 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.GetSize().AsRoundedValue()), 10.0f, "Should be the value set.");
+ Assert.AreEqual(measureSpec.GetMode(), MeasureSpecification.ModeType.Exactly, "ModeType should match.");
+
+ tlog.Debug(tag, $"LayoutGroupGetChildMeasureSpecification END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutGroup OnMeasure")]
+ [Property("SPEC", "Tizen.NUI.LayoutGroup.OnMeasure M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutGroupOnMeasure()
+ {
+ tlog.Debug(tag, $"LayoutGroupOnMeasure START");
+
+ flagOnMeasureOverride = false;
+ Assert.False(flagOnMeasureOverride, "flagOnMeasureOverride should be false initial");
+
+ LayoutItem layoutItem = new LinearLayout();
+
+ View view = new View()
+ {
+ ExcludeLayouting = false,
+ Size = new Size(100, 150)
+ };
+ layoutItem.AttachToOwner(view);
+
+ var testingTarget = new MyLayoutGroup();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutGroup>(testingTarget, "Should be an instance of LayoutGroup type.");
+
+ testingTarget.AttachToOwner(view);
+ testingTarget.Add(layoutItem);
+
+ MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.AtMost);
+ MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.AtMost);
+
+ testingTarget.OnMeasureTest(measureWidth, measureHeight);
+ Assert.True(flagOnMeasureOverride, "LayoutGroup overridden method not invoked.");
+
+ // Test LayoutChildren.Count == 0
+ flagOnMeasureOverride = false;
+ Assert.False(flagOnMeasureOverride, "flagOnMeasureOverride should be false initial");
+
+ testingTarget.Remove(layoutItem);
+
+ testingTarget.OnMeasureTest(measureWidth, measureHeight);
+ Assert.True(flagOnMeasureOverride, "LayoutGroup overridden method not invoked.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutGroupOnMeasure END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutGroup OnLayout")]
+ [Property("SPEC", "Tizen.NUI.LayoutGroup.OnLayout M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutGroupOnLayout()
+ {
+ tlog.Debug(tag, $"LayoutGroupOnLayout START");
+
+ flagOnLayoutOverride = false;
+ Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial");
+
+ var testingTarget = new MyLayoutGroup();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutGroup>(testingTarget, "Should be an instance of LayoutGroup type.");
+
+ using (LayoutItem child = new LayoutItem())
+ {
+ testingTarget.Add(child);
+
+ View view = new View()
+ {
+ Position = new Position(100, 150)
+ };
+ child.AttachToOwner(view);
+
+ testingTarget.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");
+ testingTarget.OnLayoutTest(false, new LayoutLength(10), new LayoutLength(10), new LayoutLength(20), new LayoutLength(20));
+ Assert.True(flagOnLayoutOverride, "LayoutGroup overridden method not invoked.");
+ }
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutGroupOnLayout END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutGroup OnChildAdd")]
+ [Property("SPEC", "Tizen.NUI.LayoutGroup.OnChildAdd M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutGroupOnChildAdd()
+ {
+ tlog.Debug(tag, $"LayoutGroupOnChildAdd START");
+
+ flagOnChildAddOverride = false;
+ Assert.False(flagOnChildAddOverride, "flagOnChildAddOverride should be false initial");
+
+ var testingTarget = new MyLayoutGroup();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutGroup>(testingTarget, "Should be an instance of LayoutGroup type.");
+
+ using (LayoutItem child = new LayoutItem())
+ {
+ testingTarget.OnChildAddTest(child);
+ Assert.True(flagOnChildAddOverride, "LayoutGroup overridden method not invoked.");
+ }
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutGroupOnChildAdd END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutGroup OnChildRemove")]
+ [Property("SPEC", "Tizen.NUI.LayoutGroup.OnChildRemove M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutGroupOnChildRemove()
+ {
+ tlog.Debug(tag, $"LayoutGroupOnChildRemove START");
+
+ flagOnChildRemoveOverride = false;
+ Assert.False(flagOnChildRemoveOverride, "flagOnChildRemoveOverride should be false initially");
+
+ var testingTarget = new MyLayoutGroup();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutGroup>(testingTarget, "Should be an instance of LayoutGroup type.");
+
+ using (LayoutItem child = new LayoutItem())
+ {
+ testingTarget.OnChildRemoveTest(child);
+ Assert.True(flagOnChildRemoveOverride, "LayoutGroup overridden method not invoked.");
+ }
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutGroupOnChildRemove END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutGroup MeasureChild")]
+ [Property("SPEC", "Tizen.NUI.LayoutGroup.MeasureChild M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutGroupMeasureChild()
+ {
+ tlog.Debug(tag, $"LayoutGroupMeasureChild START");
+
+ flagOnMeasureChild = false;
+ Assert.False(flagOnMeasureChild, "flagOnMeasureChild should be false initially");
+
+ var testingTarget = new MyLayoutGroup();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutGroup>(testingTarget, "Should be an instance of LayoutGroup type.");
+
+ View view = new View()
+ {
+ Size = new Size(100, 150),
+ };
+
+ // MeasureSpecification.ModeType.Exactly
+ using (LayoutItem child = new LayoutItem())
+ {
+ child.AttachToOwner(view);
+ MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly);
+ MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly);
+
+ testingTarget.MeasureChildTest(child, measureWidth, measureHeight);
+ Assert.True(flagOnMeasureChild, "LayoutGroup overridden method not invoked.");
+ }
+
+ // MeasureSpecification.ModeType.AtMost
+ using (LayoutItem child = new LayoutItem())
+ {
+ child.AttachToOwner(view);
+ MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.AtMost);
+ MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.AtMost);
+
+ testingTarget.MeasureChildTest(child, measureWidth, measureHeight);
+ Assert.True(flagOnMeasureChild, "LayoutGroup overridden method not invoked.");
+ }
+
+ // MeasureSpecification.ModeType.Unspecified
+ using (LayoutItem child = new LayoutItem())
+ {
+ child.AttachToOwner(view);
+ MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Unspecified);
+ MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Unspecified);
+
+ testingTarget.MeasureChildTest(child, measureWidth, measureHeight);
+ Assert.True(flagOnMeasureChild, "LayoutGroup overridden method not invoked.");
+ }
+
+ view.Dispose();
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutGroupMeasureChild END (OK)");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("LayoutGroup MeasureChild. With null argument.")]
+ [Property("SPEC", "Tizen.NUI.LayoutGroup.MeasureChild M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutGroupMeasureChildWithNullArgument()
+ {
+ tlog.Debug(tag, $"LayoutGroupMeasureChildWithNullArgument START");
+
+ flagOnMeasureChild = false;
+ Assert.False(flagOnMeasureChild, "flagOnMeasureChild should be false initially");
+
+ var testingTarget = new MyLayoutGroup();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutGroup>(testingTarget, "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);
+
+ try
+ {
+ testingTarget.MeasureChildTest(null, measureWidth, measureHeight);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutGroupMeasureChildWithNullArgument END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutGroup MeasureChildren")]
+ [Property("SPEC", "Tizen.NUI.LayoutGroup.MeasureChildren M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutGroupMeasureChildren()
+ {
+ tlog.Debug(tag, $"LayoutGroupMeasureChildren START");
+
+ flagOnMeasureChild = false;
+ Assert.False(flagOnMeasureChild, "flagOnMeasureChild should be false initially");
+
+ var testingTarget = new MyLayoutGroup();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutGroup>(testingTarget, "Should be an instance of LayoutGroup type.");
+
+ View view = new View()
+ {
+ ExcludeLayouting = false,
+ Size = new Size(100, 150)
+ };
+
+ using (LayoutItem child = new LayoutItem())
+ {
+ child.AttachToOwner(view);
+ testingTarget.Add(child);
+
+ MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly);
+ MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly);
+
+ testingTarget.MeasureChildrenTest(measureWidth, measureHeight);
+ Assert.True(flagOnMeasureChild, "LayoutGroup MeasureChild method not invoked when children measured.");
+ }
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutGroupMeasureChildren END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutGroup MeasureChildWithMargins")]
+ [Property("SPEC", "Tizen.NUI.LayoutGroup.MeasureChildWithMargins M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutGroupMeasureChildWithMargins()
+ {
+ tlog.Debug(tag, $"LayoutGroupMeasureChildWithMargins START");
+
+ flagOnMeasureChild = false;
+ Assert.False(flagOnMeasureChild, "flagOnMeasureChild should be false initially");
+
+ var testingTarget = new MyLayoutGroup();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutGroup>(testingTarget, "Should be an instance of LayoutGroup type.");
+
+ View view = new View()
+ {
+ ExcludeLayouting = false,
+ Size = new Size(100, 150)
+ };
+
+ using (LayoutItem child = new LayoutItem())
+ {
+ child.AttachToOwner(view);
+ testingTarget.Add(child);
+
+ MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly);
+ MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly);
+
+ testingTarget.MeasureChildWithMarginsTest(child, measureWidth, new LayoutLength(10), measureHeight, new LayoutLength(10));
+ Assert.True(flagOnMeasureChild, "LayoutGroup MeasureChild method not invoked when children measured.");
+ }
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutGroupMeasureChildWithMargins END (OK)");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("LayoutGroup MeasureChildWithMargins. With null argument.")]
+ [Property("SPEC", "Tizen.NUI.LayoutGroup.MeasureChildWithMargins M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutGroupMeasureChildWithMarginsWithNullArgument()
+ {
+ tlog.Debug(tag, $"LayoutGroupMeasureChildWithMarginsWithNullArgument START");
+
+ flagOnMeasureChild = false;
+ Assert.False(flagOnMeasureChild, "flagOnMeasureChild should be false initially");
+
+ var testingTarget = new MyLayoutGroup();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutGroup>(testingTarget, "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);
+
+ try
+ {
+ testingTarget.MeasureChildWithMarginsTest(null, measureWidth, new LayoutLength(10), measureHeight, new LayoutLength(10));
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutGroupMeasureChildWithMarginsWithNullArgument END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutGroup MeasureChildWithoutPadding")]
+ [Property("SPEC", "Tizen.NUI.LayoutGroup.MeasureChildWithoutPadding M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutGroupMeasureChildWithoutPadding()
+ {
+ tlog.Debug(tag, $"LayoutGroupMeasureChildWithoutPadding START");
+
+ var testingTarget = new MyLayoutGroup();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutGroup>(testingTarget, "Should be an instance of LayoutGroup type.");
+
+ View view = new View()
+ {
+ ExcludeLayouting = false,
+ Size = new Size(100, 150)
+ };
+
+ using (LayoutItem child = new LayoutItem())
+ {
+ child.AttachToOwner(view);
+ testingTarget.Add(child);
+
+ MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly);
+ MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly);
+
+ try
+ {
+ testingTarget.MeasureChildWithoutPaddingTest(child, measureWidth, measureHeight);
+ }
+ catch (Exception e)
+ {
+ tlog.Error(tag, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ }
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutGroupMeasureChildWithoutPadding END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutGroup OnAttachedToOwner")]
+ [Property("SPEC", "Tizen.NUI.LayoutGroup.OnAttachedToOwner M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutGroupOnAttachedToOwner()
+ {
+ tlog.Debug(tag, $"LayoutGroupOnAttachedToOwner START");
+
+ using (View owner = new View())
+ {
+ TextLabel textLabel = new TextLabel()
+ {
+ ExcludeLayouting = false,
+ Size = new Size(100, 150),
+ Layout = new AbsoluteLayout(),
+ };
+
+ owner.Add(textLabel);
+
+ using (MyLayoutGroup testingTarget = new MyLayoutGroup())
+ {
+ try
+ {
+ testingTarget.AttachToOwner(owner);
+ }
+ catch (Exception e)
+ {
+ tlog.Error(tag, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ }
+
+ textLabel.Dispose();
+ }
+
+ tlog.Debug(tag, $"LayoutGroupOnAttachedToOwner END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutGroup OnLayoutIndependentChildren")]
+ [Property("SPEC", "Tizen.NUI.LayoutGroup.OnLayoutIndependentChildren M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutGroupOnLayoutIndependentChildren()
+ {
+ tlog.Debug(tag, $"LayoutGroupOnLayoutIndependentChildren START");
+
+ using (View owner = new View())
+ {
+ TextLabel textLabel = new TextLabel()
+ {
+ ExcludeLayouting = false,
+ Size = new Size(100, 150),
+ Layout = new AbsoluteLayout(),
+ };
+
+ owner.Add(textLabel);
+
+ using (MyLayoutGroup testingTarget = new MyLayoutGroup())
+ {
+ testingTarget.AttachToOwner(owner);
+ try
+ {
+ testingTarget.OnLayoutIndependentChildren(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(5), new LayoutLength(5));
+ }
+ catch (Exception e)
+ {
+ tlog.Error(tag, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ }
+
+ textLabel.Dispose();
+ }
+
+ tlog.Debug(tag, $"LayoutGroupOnLayoutIndependentChildren END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutGroup RemoveChildFromLayoutGroup")]
+ [Property("SPEC", "Tizen.NUI.LayoutGroup.RemoveChildFromLayoutGroup M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutGroupRemoveChildFromLayoutGroup()
+ {
+ tlog.Debug(tag, $"LayoutGroupRemoveChildFromLayoutGroup START");
+
+ LayoutItem layoutItem = new AbsoluteLayout();
+
+ View parent = new View();
+
+ View child = new View()
+ {
+ ExcludeLayouting = false,
+ Layout = new AbsoluteLayout()
+ };
+
+ parent.Add(child);
+
+ layoutItem.AttachToOwner(child);
+
+ var testingTarget = new MyLayoutGroup();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutGroup>(testingTarget, "Should be an instance of LayoutGroup type.");
+
+ testingTarget.Add(layoutItem);
+
+ try
+ {
+ testingTarget.RemoveChildFromLayoutGroup(child);
+ }
+ catch (Exception e)
+ {
+ tlog.Error(tag, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ tlog.Debug(tag, $"LayoutGroupRemoveChildFromLayoutGroup END (OK)");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Collections.Generic;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("public/Layouting/LayoutItem")]
+ public class PublicLayoutItemTest
+ {
+ private const string tag = "NUITEST";
+ 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 MyLayoutItem : LayoutItem
+ {
+ public MyLayoutItem() : 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;
+ base.OnMeasure(widthMeasureSpec, heightMeasureSpec);
+ }
+
+ 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;
+ base.OnLayout(changed, left, top, right, bottom);
+ }
+
+ public void OnUnparentTest()
+ {
+ OnUnparent();
+ }
+ protected override void OnUnparent()
+ {
+ flagOnUnparentOverride = true;
+ base.OnUnparent();
+ }
+
+ public void OnAttachedToOwnerTest()
+ {
+ OnAttachedToOwner();
+ }
+ protected override void OnAttachedToOwner()
+ {
+ flagOnAttachedToOwnerOverride = true;
+ base.OnAttachedToOwner();
+ }
+
+ 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 MyLayoutGroup : LayoutGroup
+ {
+ public MyLayoutGroup() : 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;
+ base.OnMeasure(widthMeasureSpec, heightMeasureSpec);
+ }
+
+ 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;
+ base.OnLayout(changed, left, top, right, bottom);
+ }
+ }
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutItem constructor")]
+ [Property("SPEC", "Tizen.NUI.LayoutItem.LayoutItem C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutItemConstructor()
+ {
+ tlog.Debug(tag, $"LayoutItemConstructor START");
+
+ var testingTarget = new LayoutItem();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutItem>(testingTarget, "Should return LayoutItem instance.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutItemConstructor END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutItem Owner")]
+ [Property("SPEC", "Tizen.NUI.LayoutItem.Owner A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutItemOwner()
+ {
+ tlog.Debug(tag, $"LayoutItemOwner START");
+
+ var testingTarget = new LayoutItem();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutItem>(testingTarget, "Should return LayoutItem instance.");
+
+ View view = new View()
+ {
+ Layout = testingTarget,
+ Name = "parentView"
+ };
+ Assert.AreEqual(testingTarget.Owner.Name, "parentView", "Should be the parent View.");
+
+ view.Dispose();
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutItemOwner END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutItem SetPositionByLayout")]
+ [Property("SPEC", "Tizen.NUI.LayoutItem.SetPositionByLayout A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutItemSetPositionByLayout()
+ {
+ tlog.Debug(tag, $"LayoutItemSetPositionByLayout START");
+
+ var testingTarget = new LayoutItem();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutItem>(testingTarget, "Should return LayoutItem instance.");
+
+ Assert.IsTrue(testingTarget.SetPositionByLayout);
+
+ View view = new View()
+ {
+ ExcludeLayouting = false,
+ Size = new Size(100, 150),
+ Layout = new LinearLayout()
+ {
+ LayoutWithTransition = true
+ }
+ };
+ testingTarget.AttachToOwner(view);
+
+ testingTarget.SetPositionByLayout = false;
+ Assert.IsFalse(testingTarget.SetPositionByLayout);
+ Assert.IsTrue(testingTarget.Owner.ExcludeLayouting);
+
+ view.Dispose();
+ testingTarget?.Dispose();
+ tlog.Debug(tag, $"LayoutItemSetPositionByLayout END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutItem Margin")]
+ [Property("SPEC", "Tizen.NUI.LayoutItem.Margin A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutItemMargin()
+ {
+ tlog.Debug(tag, $"LayoutItemMargin START");
+
+ var testingTarget = new LayoutItem();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutItem>(testingTarget, "Should return LayoutItem instance.");
+
+ testingTarget.Margin = new Extents(5, 10, 15, 0);
+ Assert.AreEqual(testingTarget.Margin.End, 10, "Should be 10.");
+ Assert.AreEqual(testingTarget.Margin.Start, 5, "Should be 5.");
+ Assert.AreEqual(testingTarget.Margin.Top, 15, "Should be 15.");
+ Assert.AreEqual(testingTarget.Margin.Bottom, 0, "Should be 0.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutItemMargin END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutItem Padding")]
+ [Property("SPEC", "Tizen.NUI.LayoutItem.Padding A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutItemPadding()
+ {
+ tlog.Debug(tag, $"LayoutItemPadding START");
+
+ var testingTarget = new LayoutItem();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutItem>(testingTarget, "Should return LayoutItem instance.");
+
+ testingTarget.Padding = new Extents(5, 10, 15, 0);
+ Assert.AreEqual(testingTarget.Padding.End, 10, "Should be 10.");
+ Assert.AreEqual(testingTarget.Padding.Start, 5, "Should be 5.");
+ Assert.AreEqual(testingTarget.Padding.Top, 15, "Should be 15.");
+ Assert.AreEqual(testingTarget.Padding.Bottom, 0, "Should be 0.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutItemPadding END (OK)");
+ }
+
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutItem SuggestedMinimumWidth")]
+ [Property("SPEC", "Tizen.NUI.LayoutItem.SuggestedMinimumWidth A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutItemSuggestedMinimumWidth()
+ {
+ tlog.Debug(tag, $"LayoutItemSuggestedMinimumWidth START");
+
+ var testingTarget = new LayoutItem();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutItem>(testingTarget, "Should return LayoutItem instance.");
+
+ View view = new View()
+ {
+ Layout = testingTarget,
+ Name = "parentView",
+ MinimumSize = new Size2D(10, 10)
+ };
+
+ float suggestedMinimumWidth = testingTarget.SuggestedMinimumWidth.AsRoundedValue();
+ Assert.AreEqual(suggestedMinimumWidth, 10, "Should be 10.");
+
+ view.Dispose();
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutItemSuggestedMinimumWidth END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutItem SuggestedMinimumHeight")]
+ [Property("SPEC", "Tizen.NUI.LayoutItem.SuggestedMinimumHeight A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutItemSuggestedMinimumHeight()
+ {
+ tlog.Debug(tag, $"LayoutItemSuggestedMinimumHeight START");
+
+ var testingTarget = new LayoutItem();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutItem>(testingTarget, "Should return LayoutItem instance.");
+
+ View view = new View()
+ {
+ Layout = testingTarget,
+ Name = "parentView",
+ MinimumSize = new Size2D(10, 10)
+ };
+
+ float suggestedMinimumHeight = testingTarget.SuggestedMinimumHeight.AsRoundedValue();
+ Assert.AreEqual(suggestedMinimumHeight, 10, "Should be 10.");
+
+ view.Dispose();
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutItemSuggestedMinimumHeight END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutItem MeasuredWidth")]
+ [Property("SPEC", "Tizen.NUI.LayoutItem.MeasuredWidth A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutItemMeasuredWidth()
+ {
+ tlog.Debug(tag, $"LayoutItemMeasuredWidth START");
+
+ var testingTarget = new LayoutItem();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutItem>(testingTarget, "Should return LayoutItem instance.");
+
+ testingTarget.MeasuredWidth = new MeasuredSize(new LayoutLength(100), MeasuredSize.StateType.MeasuredSizeOK);
+ Assert.AreEqual(testingTarget.MeasuredWidth.Size.AsRoundedValue(), 100.0, "Should be value set");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutItemMeasuredWidth END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutItem MeasuredHeight")]
+ [Property("SPEC", "Tizen.NUI.LayoutItem.MeasuredHeight A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutItemMeasuredHeight()
+ {
+ tlog.Debug(tag, $"LayoutItemMeasuredHeight START");
+
+ var testingTarget = new LayoutItem();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutItem>(testingTarget, "Should return LayoutItem instance.");
+
+ testingTarget.MeasuredHeight = new MeasuredSize(new LayoutLength(100), MeasuredSize.StateType.MeasuredSizeOK);
+ Assert.AreEqual(testingTarget.MeasuredHeight.Size.AsRoundedValue(), 100.0, "Should be value set");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutItemMeasuredHeight END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutItem GetDefaultSize")]
+ [Property("SPEC", "Tizen.NUI.LayoutItem.GetDefaultSize M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutItemGetDefaultSize()
+ {
+ tlog.Debug(tag, $"LayoutItemGetDefaultSize START");
+
+ 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");
+
+ tlog.Debug(tag, $"LayoutItemGetDefaultSize END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutItem GetParent")]
+ [Property("SPEC", "Tizen.NUI.LayoutItem.GetParent M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutItemGetParent()
+ {
+ tlog.Debug(tag, $"LayoutItemGetParent START");
+
+ var testingTarget = new LayoutItem();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutItem>(testingTarget, "Should return LayoutItem instance.");
+
+ Assert.AreEqual(null, testingTarget.GetParent(), "Should be null if not set");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutItemGetParent END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutItem OnMeasure")]
+ [Property("SPEC", "Tizen.NUI.LayoutItem.OnMeasure M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutItemOnMeasure()
+ {
+ tlog.Debug(tag, $"LayoutItemOnMeasure START");
+
+ flagOnMeasureOverride = false;
+ Assert.False(flagOnMeasureOverride, "flagOnMeasureOverride should be false initial");
+
+ var testingTarget = new MyLayoutItem();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutItem>(testingTarget, "Should be an instance of LayoutItem type.");
+
+ View view = new View()
+ {
+ ExcludeLayouting = false,
+ Size = new Size(100, 150)
+ };
+
+ testingTarget.AttachToOwner(view);
+
+ MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly);
+ MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly);
+
+ testingTarget.OnMeasureTest(measureWidth, measureHeight);
+ Assert.True(flagOnMeasureOverride, "LayoutItem overridden method not invoked.");
+
+ /** MeasureSpecification.ModeType.Atmost & Unspecified */
+ flagOnMeasureOverride = false;
+ Assert.False(flagOnMeasureOverride, "flagOnMeasureOverride should be false initial");
+
+ MeasureSpecification measureWidth2 = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.AtMost);
+ MeasureSpecification measureHeight2 = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Unspecified);
+
+ testingTarget.OnMeasureTest(measureWidth2, measureHeight2);
+ Assert.True(flagOnMeasureOverride, "LayoutItem overridden method not invoked.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutItemOnMeasure END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutItem OnLayout")]
+ [Property("SPEC", "Tizen.NUI.LayoutItem.OnLayout M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutItemOnLayout()
+ {
+ tlog.Debug(tag, $"LayoutItemOnLayout START");
+
+ flagOnLayoutOverride = false;
+ Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initially");
+
+ var testingTarget = new MyLayoutItem();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutItem>(testingTarget, "Should be an instance of LayoutItem type.");
+
+ testingTarget.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");
+
+ testingTarget.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.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutItemOnLayout END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutItem OnUnparent")]
+ [Property("SPEC", "Tizen.NUI.LayoutItem.OnUnparent M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutItemOnUnparent()
+ {
+ tlog.Debug(tag, $"LayoutItemOnUnparent START");
+
+ flagOnUnparentOverride = false;
+ Assert.False(flagOnUnparentOverride, "flag should be false initially");
+
+ var testingTarget = new MyLayoutItem();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutItem>(testingTarget, "Should be an instance of LayoutItem type.");
+
+ testingTarget.OnUnparentTest();
+ Assert.True(flagOnUnparentOverride, "LayoutItem overridden method not invoked.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutItemOnUnparent END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutItem OnAttachedToOwner")]
+ [Property("SPEC", "Tizen.NUI.LayoutItem.OnAttachedToOwner M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutItemOnAttachedToOwner()
+ {
+ tlog.Debug(tag, $"LayoutItemOnAttachedToOwner START");
+
+ flagOnAttachedToOwnerOverride = false;
+ Assert.False(flagOnAttachedToOwnerOverride, "flag should be false initially");
+
+ var testingTarget = new MyLayoutItem();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutItem>(testingTarget, "Should be an instance of LayoutItem type.");
+
+ testingTarget.OnAttachedToOwnerTest();
+ Assert.True(flagOnAttachedToOwnerOverride, "LayoutItem overridden method not invoked.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutItemOnAttachedToOwner END (OK)");
+ }
+
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutItem ResolveSizeAndSize")]
+ [Property("SPEC", "Tizen.NUI.LayoutItem.ResolveSizeAndState M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutItemResolveSizeAndState()
+ {
+ tlog.Debug(tag, $"LayoutItemResolveSizeAndState START");
+
+ var testingTarget = new MyLayoutItem();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutItem>(testingTarget, "Should be an instance of LayoutItem type.");
+
+ MeasureSpecification measureSpec = new MeasureSpecification(new LayoutLength(10), MeasureSpecification.ModeType.Exactly);
+
+ MeasuredSize measuredSize = testingTarget.ResolveSizeAndState(new LayoutLength(50), measureSpec, MeasuredSize.StateType.MeasuredSizeOK);
+
+ Assert.AreEqual(measureSpec.GetSize().AsRoundedValue(), 10, "measuredSize not resolved correctly");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutItemResolveSizeAndState END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutItem SetMeasuredDimensions")]
+ [Property("SPEC", "Tizen.NUI.LayoutItem.SetMeasuredDimensions M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutItemSetMeasuredDimensions()
+ {
+ tlog.Debug(tag, $"LayoutItemSetMeasuredDimensions START");
+
+ var testingTarget = new MyLayoutItem();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutItem>(testingTarget, "Should be an instance of LayoutItem type.");
+
+ MeasuredSize measuredWidth = new MeasuredSize(new LayoutLength(100), MeasuredSize.StateType.MeasuredSizeOK);
+ MeasuredSize measuredHeight = new MeasuredSize(new LayoutLength(50), MeasuredSize.StateType.MeasuredSizeOK);
+
+ testingTarget.SetMeasuredDimensions(measuredWidth, measuredHeight);
+
+ Assert.AreEqual(100, testingTarget.MeasuredWidth.Size.AsRoundedValue(), "Should be value set");
+ Assert.AreEqual(50, testingTarget.MeasuredHeight.Size.AsRoundedValue(), "Should be value set");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutItemSetMeasuredDimensions END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutItem RequestLayout")]
+ [Property("SPEC", "Tizen.NUI.LayoutItem.RequestLayout M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutItemRequestLayout()
+ {
+ tlog.Debug(tag, $"LayoutItemRequestLayout START");
+
+ var testingTarget = new LayoutItem();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutItem>(testingTarget, "Should be an instance of LayoutGroup type.");
+
+ LayoutGroup layoutGroup = new LayoutGroup();
+ testingTarget.SetParent(layoutGroup);
+
+ try
+ {
+ testingTarget.RequestLayout(); // Ensures a layout pass is needed.
+ }
+ catch (Exception e)
+ {
+ tlog.Error(tag, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ layoutGroup.Dispose();
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LayoutItemRequestLayout END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutItem Measure")]
+ [Property("SPEC", "Tizen.NUI.LayoutItem.Measure M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutItemMeasure()
+ {
+ tlog.Debug(tag, $"LayoutItemMeasure START");
+
+ var testingTarget = new MyLayoutItem();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutItem>(testingTarget, "Should be an instance of LayoutGroup type.");
+
+ View view = new View()
+ {
+ ExcludeLayouting = false,
+ Size = new Size(100, 150)
+ };
+ testingTarget.AttachToOwner(view);
+
+ LayoutGroup layoutGroup = new LayoutGroup();
+ testingTarget.SetParent(layoutGroup);
+
+ testingTarget.RequestLayout(); // Ensures a layout pass is needed.
+
+ MeasureSpecification imposedWidth = new MeasureSpecification(new LayoutLength(300.0f), MeasureSpecification.ModeType.Exactly);
+ MeasureSpecification imposedHeight = new MeasureSpecification(new LayoutLength(300.0f), MeasureSpecification.ModeType.Exactly);
+ try
+ {
+ testingTarget.Measure(imposedWidth, imposedHeight);
+ }
+ catch (Exception e)
+ {
+ tlog.Error(tag, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ layoutGroup.Dispose();
+ testingTarget.Dispose();
+ view.Dispose();
+ tlog.Debug(tag, $"LayoutItemMeasure END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutItem Layout")]
+ [Property("SPEC", "Tizen.NUI.LayoutItem.Layout M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutItemLayout()
+ {
+ tlog.Debug(tag, $"LayoutItemLayout START");
+
+ var testingTarget = new MyLayoutItem();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutItem>(testingTarget, "Should be an instance of LayoutGroup type.");
+
+ View view = new View()
+ {
+ ExcludeLayouting = false,
+ Size = new Size(100, 150),
+ Layout = new LinearLayout()
+ {
+ LayoutWithTransition = true
+ }
+ };
+ testingTarget.AttachToOwner(view);
+
+ try
+ {
+ testingTarget.Layout(new LayoutLength(0), new LayoutLength(10), new LayoutLength(0), new LayoutLength(5));
+ }
+ catch (Exception e)
+ {
+ tlog.Error(tag, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ view.Dispose();
+ testingTarget?.Dispose();
+ tlog.Debug(tag, $"LayoutItemLayout END (OK)");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Collections.Generic;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("public/Layouting/LayoutLength")]
+ public class PublicLayoutLengthTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutLength int constructor")]
+ [Property("SPEC", "Tizen.NUI.LayoutLength.LayoutLength C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("COVPARAM", "int")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutLengthConstructorWithInt()
+ {
+ tlog.Debug(tag, $"LayoutLengthConstructorWithInt START");
+
+ var testingTarget = new LayoutLength(10);
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutLength>(testingTarget, "Should be an instance of LayoutLength type.");
+
+ Assert.AreEqual(testingTarget.AsDecimal(), 10.0f, "Should be 10.0f.");
+
+ tlog.Debug(tag, $"LayoutLengthConstructorWithInt END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutLength float constructor")]
+ [Property("SPEC", "Tizen.NUI.LayoutLength.LayoutLength C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("COVPARAM", "Single")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutLengthConstructorWithFloat()
+ {
+ tlog.Debug(tag, $"LayoutLengthConstructorWithFloat START");
+
+ var testingTarget = new LayoutLength(10.0f);
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutLength>(testingTarget, "Should be an instance of LayoutLength type.");
+
+ Assert.AreEqual(testingTarget.AsDecimal(), 10.0f, "Should be 10.0f.");
+
+ tlog.Debug(tag, $"LayoutLengthConstructorWithFloat END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutLength constructor. With LayoutLength instance")]
+ [Property("SPEC", "Tizen.NUI.LayoutLength.LayoutLength C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("COVPARAM", "LayoutLength")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutLengthConstructorWithLayoutLength()
+ {
+ tlog.Debug(tag, $"LayoutLengthConstructorWithLayoutLength START");
+
+ LayoutLength layoutLength = new LayoutLength(10.0f);
+
+ var testingTarget = new LayoutLength(layoutLength);
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutLength>(testingTarget, "Should be an instance of LayoutLength type.");
+
+ Assert.AreEqual(testingTarget.AsDecimal(), 10.0f, "Should be 10.0f.");
+
+ tlog.Debug(tag, $"LayoutLengthConstructorWithLayoutLength END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutLength AsRoundedValue")]
+ [Property("SPEC", "Tizen.NUI.LayoutLength.AsRoundedValue M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutLengthAsRoundedValue()
+ {
+ tlog.Debug(tag, $"LayoutLengthAsRoundedValue START");
+
+ var testingTarget = new LayoutLength(10.1f);
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutLength>(testingTarget, "Should be an instance of LayoutLength type.");
+
+ Assert.AreEqual(testingTarget.AsRoundedValue(), 10.0f, "Should be 10.0f.");
+
+ tlog.Debug(tag, $"LayoutLengthAsRoundedValue END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutLength AsDecimal")]
+ [Property("SPEC", "Tizen.NUI.LayoutLength.AsDecimal M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutLengthAsDecimal()
+ {
+ tlog.Debug(tag, $"LayoutLengthAsDecimal START");
+
+ var testingTarget = new LayoutLength(10.1f);
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutLength>(testingTarget, "Should be an instance of LayoutLength type.");
+
+ Assert.AreEqual(testingTarget.AsDecimal(), 10.1f, "Should be 10.0f.");
+
+ tlog.Debug(tag, $"LayoutLengthAsDecimal END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutLength ==")]
+ [Property("SPEC", "Tizen.NUI.LayoutLength.== M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutLengthEquality()
+ {
+ tlog.Debug(tag, $"LayoutLengthEquality START");
+
+ var testingTarget = new LayoutLength(10.0f);
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutLength>(testingTarget, "Should be an instance of LayoutLength type.");
+
+ Assert.IsTrue(testingTarget == new LayoutLength(10.0f), "Should be equal.");
+
+ tlog.Debug(tag, $"LayoutLengthEquality END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutLength !=")]
+ [Property("SPEC", "Tizen.NUI.LayoutLength.!= M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutLengthNotEquals()
+ {
+ tlog.Debug(tag, $"LayoutLengthNotEquals START");
+
+ var testingTarget = new LayoutLength(10.0f);
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutLength>(testingTarget, "Should be an instance of LayoutLength type.");
+
+ Assert.IsTrue(testingTarget != new LayoutLength(11.0f), "Should not be equal.");
+
+ tlog.Debug(tag, $"LayoutLengthNotEquals END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutLength Equals. With Object")]
+ [Property("SPEC", "Tizen.NUI.LayoutLength.Equals M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutLengthEqualsWithObject()
+ {
+ tlog.Debug(tag, $"LayoutLengthEqualsWithObject START");
+
+ var testingTarget = new LayoutLength(10.0f);
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutLength>(testingTarget, "Should be an instance of LayoutLength type.");
+
+ object obj = new LayoutLength(10.0f);
+ Assert.IsTrue(testingTarget.Equals(obj), "Should be equal.");
+
+ object obj2 = new Size(100, 150);
+ Assert.IsFalse(testingTarget.Equals(obj2), "Should be equal.");
+
+ tlog.Debug(tag, $"LayoutLengthEqualsWithObject END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutLength Equals. With LayoutLength")]
+ [Property("SPEC", "Tizen.NUI.LayoutLength.Equals M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutLengthEqualsWithLayoutLength()
+ {
+ tlog.Debug(tag, $"LayoutLengthEqualsWithLayoutLength START");
+
+ var testingTarget = new LayoutLength(10.0f);
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutLength>(testingTarget, "Should be an instance of LayoutLength type.");
+
+ Assert.IsTrue(testingTarget.Equals(new LayoutLength(10.0f)), "Should be equal.");
+
+ tlog.Debug(tag, $"LayoutLengthEqualsWithLayoutLength END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutLength GetHashCode")]
+ [Property("SPEC", "Tizen.NUI.LayoutLength.GetHashCode M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutLengthGetHashCode()
+ {
+ tlog.Debug(tag, $"LayoutLengthGetHashCode START");
+
+ var testingTarget = new LayoutLength(10.0f);
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutLength>(testingTarget, "Should be an instance of LayoutLength type.");
+
+ Assert.AreEqual(testingTarget.GetHashCode(), 10, "Should be .");
+
+ tlog.Debug(tag, $"LayoutLengthGetHashCode END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutLength addition operator. Addition with LayoutLength")]
+ [Property("SPEC", "Tizen.NUI.LayoutLength.+ M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("COVPARAM", "LayoutLength, LayoutLength")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutLengthAdditionWithLayoutLength()
+ {
+ tlog.Debug(tag, $"LayoutLengthAdditionWithLayoutLength START");
+
+ var testingTarget1 = new LayoutLength(10.0f);
+ Assert.IsNotNull(testingTarget1, "null handle");
+ Assert.IsInstanceOf<LayoutLength>(testingTarget1, "Should be an instance of LayoutLength type.");
+
+ var testingTarget2 = new LayoutLength(10.0f);
+ Assert.IsNotNull(testingTarget2, "null handle");
+ Assert.IsInstanceOf<LayoutLength>(testingTarget2, "Should be an instance of LayoutLength type.");
+
+ var result = testingTarget1 + testingTarget2;
+ Assert.AreEqual(result.AsDecimal(), 20.0f, "Should be the sum.");
+
+ tlog.Debug(tag, $"LayoutLengthAdditionWithLayoutLength END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutLength addition operator. Addition with int")]
+ [Property("SPEC", "Tizen.NUI.LayoutLength.+ M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutLengthAdditionWithInt()
+ {
+ tlog.Debug(tag, $"LayoutLengthAdditionWithInt START");
+
+ var testingTarget = new LayoutLength(10.0f);
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutLength>(testingTarget, "Should be an instance of LayoutLength type.");
+
+ var result = testingTarget + 10;
+ Assert.AreEqual(result.AsDecimal(), 20.0f, "Should be the sum.");
+
+ tlog.Debug(tag, $"LayoutLengthAdditionWithInt END (OK)");
+ }
+
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutLength subtraction operator. Subtraction with LayoutLength")]
+ [Property("SPEC", "Tizen.NUI.LayoutLength.- M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutLengthSubtractionWithLayoutLength()
+ {
+ tlog.Debug(tag, $"LayoutLengthSubtractionWithLayoutLength START");
+
+ var testingTarget1 = new LayoutLength(10.0f);
+ Assert.IsNotNull(testingTarget1, "null handle");
+ Assert.IsInstanceOf<LayoutLength>(testingTarget1, "Should be an instance of LayoutLength type.");
+
+ var testingTarget2 = new LayoutLength(5.0f);
+ Assert.IsNotNull(testingTarget2, "null handle");
+ Assert.IsInstanceOf<LayoutLength>(testingTarget2, "Should be an instance of LayoutLength type.");
+
+ var result = testingTarget1 - testingTarget2;
+ Assert.AreEqual(result.AsDecimal(), 5.0f, "Should be the substract of B from A.");
+
+ tlog.Debug(tag, $"LayoutLengthSubtractionWithLayoutLength END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutLength subtraction operator. Subtraction with int")]
+ [Property("SPEC", "Tizen.NUI.LayoutLength.- M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutLengthSubtractionWithInt()
+ {
+ tlog.Debug(tag, $"LayoutLengthSubtractionWithInt START");
+
+ var testingTarget = new LayoutLength(10.0f);
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutLength>(testingTarget, "Should be an instance of LayoutLength type.");
+
+ var result = testingTarget - 5;
+ Assert.AreEqual(result.AsDecimal(), 5.0f, "Should be the substraction of 5.0f.");
+
+ tlog.Debug(tag, $"LayoutLengthSubtractionWithInt END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutLength multiply operator. Multiply with LayoutLength")]
+ [Property("SPEC", "Tizen.NUI.LayoutLength.* M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutLengthMultiplyWithLayoutLength()
+ {
+ tlog.Debug(tag, $"LayoutLengthMultiplyWithLayoutLength START");
+
+ var testingTarget1 = new LayoutLength(10.0f);
+ Assert.IsNotNull(testingTarget1, "null handle");
+ Assert.IsInstanceOf<LayoutLength>(testingTarget1, "Should be an instance of LayoutLength type.");
+
+ var testingTarget2 = new LayoutLength(2.0f);
+ Assert.IsNotNull(testingTarget2, "null handle");
+ Assert.IsInstanceOf<LayoutLength>(testingTarget2, "Should be an instance of LayoutLength type.");
+
+ var result = testingTarget1 * testingTarget2;
+ Assert.AreEqual(result.AsDecimal(), 20.0f, "Should be the multiplication of A x B.");
+
+ tlog.Debug(tag, $"LayoutLengthMultiplyWithLayoutLength END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutLength multiply operator. Multiply with int")]
+ [Property("SPEC", "Tizen.NUI.LayoutLength.* M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutLengthMultiplyWithInt()
+ {
+ tlog.Debug(tag, $"LayoutLengthMultiplyWithInt START");
+
+ var testingTarget = new LayoutLength(10.0f);
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutLength>(testingTarget, "Should be an instance of LayoutLength type.");
+
+ var result = testingTarget * 2;
+ Assert.AreEqual(result.AsDecimal(), 20.0f, "Should be the multiplication of A x 2");
+
+ tlog.Debug(tag, $"LayoutLengthMultiplyWithInt END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutLength division operator. Division with LayoutLength")]
+ [Property("SPEC", "Tizen.NUI.LayoutLength./ M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutLengthDivisionWithLayoutLength()
+ {
+ tlog.Debug(tag, $"LayoutLengthDivisionWithLayoutLength START");
+
+ var testingTarget1 = new LayoutLength(10.0f);
+ Assert.IsNotNull(testingTarget1, "null handle");
+ Assert.IsInstanceOf<LayoutLength>(testingTarget1, "Should be an instance of LayoutLength type.");
+
+ var testingTarget2 = new LayoutLength(2.0f);
+ Assert.IsNotNull(testingTarget2, "null handle");
+ Assert.IsInstanceOf<LayoutLength>(testingTarget2, "Should be an instance of LayoutLength type.");
+
+ var result = testingTarget1 / testingTarget2;
+ Assert.AreEqual(result.AsDecimal(), 5.0f, "Should be the division of A by B.");
+
+ tlog.Debug(tag, $"LayoutLengthDivisionWithLayoutLength END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutLength division operator. Division with int")]
+ [Property("SPEC", "Tizen.NUI.LayoutLength./ M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutLengthDivisionWithInt()
+ {
+ tlog.Debug(tag, $"LayoutLengthDivisionWithInt START");
+
+ var testingTarget = new LayoutLength(10.0f);
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutLength>(testingTarget, "Should be an instance of LayoutLength type.");
+
+ var result = testingTarget / 2;
+ Assert.AreEqual(result.AsDecimal(), 5.0f, "Should be the multiplication of A x 2");
+
+ tlog.Debug(tag, $"LayoutLengthDivisionWithInt END (OK)");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Collections.Generic;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("public/Layouting/LayoutTransition")]
+ public class TSLayoutTransition
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TransitionComponents SetDuration.")]
+ [Property("SPEC", "Tizen.NUI.TransitionComponents.SetDuration M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void TransitionComponentsSetDuration()
+ {
+ tlog.Debug(tag, $"TransitionComponentsSetDuration START");
+
+ var testingTarget = new TransitionComponents();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<TransitionComponents>(testingTarget, "Should return TransitionComponents instance.");
+
+ testingTarget.SetDuration(300);
+ Assert.AreEqual(300, testingTarget.GetDuration(), "should be equal!");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"TransitionComponentsSetDuration END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TransitionComponents GetDuration.")]
+ [Property("SPEC", "Tizen.NUI.TransitionComponents.GetDuration M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void TransitionComponentsGetDuration()
+ {
+ tlog.Debug(tag, $"TransitionComponentsGetDuration START");
+
+ var testingTarget = new TransitionComponents();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<TransitionComponents>(testingTarget, "Should return TransitionComponents instance.");
+
+ Assert.AreEqual(100, testingTarget.GetDuration(), "should be equal!");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"TransitionComponentsGetDuration END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TransitionComponents SetDelay.")]
+ [Property("SPEC", "Tizen.NUI.TransitionComponents.SetDelay M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void TransitionComponentsSetDelay()
+ {
+ tlog.Debug(tag, $"TransitionComponentsSetDelay START");
+
+ var testingTarget = new TransitionComponents();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<TransitionComponents>(testingTarget, "Should return TransitionComponents instance.");
+
+ testingTarget.SetDelay(300);
+ Assert.AreEqual(300, testingTarget.GetDelay(), "should be equal!");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"TransitionComponentsSetDelay END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TransitionComponents GetDelay.")]
+ [Property("SPEC", "Tizen.NUI.TransitionComponents.GetDelay M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void TransitionComponentsGetDelay()
+ {
+ tlog.Debug(tag, $"TransitionComponentsGetDelay START");
+
+ var testingTarget = new TransitionComponents();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<TransitionComponents>(testingTarget, "Should return TransitionComponents instance.");
+
+ Assert.AreEqual(0, testingTarget.GetDelay(), "should be equal!");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"TransitionComponentsGetDelay END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TransitionComponents SetAlphaFunction.")]
+ [Property("SPEC", "Tizen.NUI.TransitionComponents.SetAlphaFunction M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void TransitionComponentsSetAlphaFunction()
+ {
+ tlog.Debug(tag, $"TransitionComponentsSetAlphaFunction START");
+
+ var testingTarget = new TransitionComponents();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<TransitionComponents>(testingTarget, "Should return TransitionComponents instance.");
+
+ testingTarget.SetAlphaFunction(new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseIn));
+ var result = testingTarget.GetAlphaFunction().GetBuiltinFunction();
+ Assert.AreEqual(AlphaFunction.BuiltinFunctions.EaseIn, result, "should be equal!");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"TransitionComponentsSetAlphaFunction END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TransitionComponents GetAlphaFunction.")]
+ [Property("SPEC", "Tizen.NUI.TransitionComponents.GetAlphaFunction M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void TransitionComponentsGetAlphaFunction()
+ {
+ tlog.Debug(tag, $"TransitionComponentsGetAlphaFunction START");
+
+ var testingTarget = new TransitionComponents();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<TransitionComponents>(testingTarget, "Should return TransitionComponents instance.");
+
+ var result = testingTarget.GetAlphaFunction().GetBuiltinFunction();
+ Assert.AreEqual(AlphaFunction.BuiltinFunctions.Linear, result, "should be equal!");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"TransitionComponentsGetAlphaFunction END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutTransition constructor")]
+ [Property("SPEC", "Tizen.NUI.LayoutTransition.LayoutTransition C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutTransitionConstructor()
+ {
+ tlog.Debug(tag, $"LayoutTransitionConstructor START");
+
+ var testingTarget = new LayoutTransition();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutTransition>(testingTarget, "Should return LayoutTransition instance.");
+
+ tlog.Debug(tag, $"LayoutTransitionConstructor END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutTransition constructor. With parameters")]
+ [Property("SPEC", "Tizen.NUI.LayoutTransition.LayoutTransition C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("COVPARAM", "TransitionCondition, AnimatableProperties, object, TransitionComponents")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutTransitionContructorWithParameters()
+ {
+ tlog.Debug(tag, $"LayoutTransitionContructorWithParameters START");
+
+ TransitionComponents transitionComponents = new TransitionComponents();
+
+ var testingTarget = new LayoutTransition(TransitionCondition.Unspecified,
+ AnimatableProperties.Position,
+ 0.0f,
+ transitionComponents
+ );
+
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutTransition>(testingTarget, "Should return LayoutTransition instance.");
+
+ transitionComponents.Dispose();
+ tlog.Debug(tag, $"LayoutTransitionContructorWithParameters END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutTransition Condition")]
+ [Property("SPEC", "Tizen.NUI.LayoutTransition.Condition A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutTransitionCondition()
+ {
+ tlog.Debug(tag, $"LayoutTransitionCondition START");
+
+ var testingTarget = new LayoutTransition();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutTransition>(testingTarget, "Should return LayoutTransition instance.");
+
+ Assert.AreEqual(testingTarget.Condition, TransitionCondition.Unspecified, "Should be value set.");
+
+ testingTarget.Condition = TransitionCondition.LayoutChanged;
+ Assert.AreEqual(testingTarget.Condition, TransitionCondition.LayoutChanged, "Should be value set.");
+
+ testingTarget.Condition = TransitionCondition.Add;
+ Assert.AreEqual(testingTarget.Condition, TransitionCondition.Add, "Should be value set.");
+
+ testingTarget.Condition = TransitionCondition.Remove;
+ Assert.AreEqual(testingTarget.Condition, TransitionCondition.Remove, "Should be value set.");
+
+ testingTarget.Condition = TransitionCondition.ChangeOnAdd;
+ Assert.AreEqual(testingTarget.Condition, TransitionCondition.ChangeOnAdd, "Should be value set.");
+
+ testingTarget.Condition = TransitionCondition.ChangeOnRemove;
+ Assert.AreEqual(testingTarget.Condition, TransitionCondition.ChangeOnRemove, "Should be value set.");
+
+ tlog.Debug(tag, $"LayoutTransitionCondition END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutTransition AnimatableProperty")]
+ [Property("SPEC", "Tizen.NUI.LayoutTransition.AnimatableProperty A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang")]
+ public void LayoutTransitionAnimatableProperty()
+ {
+ tlog.Debug(tag, $"LayoutTransitionAnimatableProperty START");
+
+ var testingTarget = new LayoutTransition();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutTransition>(testingTarget, "Should return LayoutTransition instance.");
+
+ testingTarget.AnimatableProperty = AnimatableProperties.Position;
+ Assert.AreEqual(testingTarget.AnimatableProperty, AnimatableProperties.Position, "Should be value set.");
+
+ testingTarget.AnimatableProperty = AnimatableProperties.Size;
+ Assert.AreEqual(testingTarget.AnimatableProperty, AnimatableProperties.Size, "Should be value set.");
+
+ testingTarget.AnimatableProperty = AnimatableProperties.Opacity;
+ Assert.AreEqual(testingTarget.AnimatableProperty, AnimatableProperties.Opacity, "Should be value set.");
+
+ tlog.Debug(tag, $"LayoutTransitionAnimatableProperty END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutTransition Animator")]
+ [Property("SPEC", "Tizen.NUI.LayoutTransition.Animator A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutTransitionAnimator()
+ {
+ tlog.Debug(tag, $"LayoutTransitionAnimator START");
+
+ AlphaFunction alphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Linear);
+ TransitionComponents transitionComponents = new TransitionComponents(0, 64, alphaFunction);
+
+ var testingTarget = new LayoutTransition();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutTransition>(testingTarget, "Should return LayoutTransition instance.");
+
+ testingTarget.Animator = transitionComponents;
+ Assert.AreEqual(testingTarget.Animator.GetDuration(), transitionComponents.GetDuration(), "Should be value set.");
+ Assert.AreEqual(testingTarget.Animator.GetDelay(), transitionComponents.GetDelay(), "Should be value set.");
+
+ tlog.Debug(tag, $"LayoutTransitionAnimator END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutTransition TargetValue")]
+ [Property("SPEC", "Tizen.NUI.LayoutTransition.TargetValue A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutTransitionTargetValue()
+ {
+ tlog.Debug(tag, $"LayoutTransitionTargetValue START");
+
+ var testingTarget = new LayoutTransition();
+ Assert.IsNotNull(testingTarget, "null handle");
+ Assert.IsInstanceOf<LayoutTransition>(testingTarget, "Should return LayoutTransition instance.");
+
+ testingTarget.TargetValue = 1.0f;
+ Assert.AreEqual(testingTarget.TargetValue, 1.0f, "Should be value set.");
+
+ tlog.Debug(tag, $"LayoutTransitionTargetValue END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutTransitionsHelper AddTransitionForCondition")]
+ [Property("SPEC", "Tizen.NUI.LayoutTransitionsHelper.AddTransitionForCondition A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutTransitionsHelperAddTransitionForCondition()
+ {
+ tlog.Debug(tag, $"LayoutTransitionsHelperAddTransitionForCondition START");
+
+ Dictionary<TransitionCondition, TransitionList> targetTransitionList = new Dictionary<TransitionCondition, TransitionList>();
+
+ TransitionList transitionList = new TransitionList();
+
+ var addTransition = new LayoutTransition(TransitionCondition.Add,
+ AnimatableProperties.Position,
+ 0.3f,
+ new TransitionComponents()
+ );
+ transitionList.Add(addTransition);
+
+ var layoutChangedTransition = new LayoutTransition(TransitionCondition.LayoutChanged,
+ AnimatableProperties.Opacity,
+ 0.2f,
+ new TransitionComponents()
+ );
+ transitionList.Add(layoutChangedTransition);
+
+
+ targetTransitionList.Add(TransitionCondition.Add, transitionList);
+ targetTransitionList.Add(TransitionCondition.LayoutChanged, transitionList);
+
+ /**
+ * conditionNotInDictionary = false
+ */
+ LayoutTransitionsHelper.AddTransitionForCondition(targetTransitionList,
+ TransitionCondition.LayoutChanged,
+ addTransition,
+ true);
+
+ /**
+ * conditionNotInDictionary = true
+ * replaced
+ */
+ LayoutTransitionsHelper.AddTransitionForCondition(targetTransitionList,
+ TransitionCondition.Add,
+ addTransition,
+ false);
+
+ /**
+ * conditionNotInDictionary = true
+ * new entry
+ */
+ LayoutTransitionsHelper.AddTransitionForCondition(targetTransitionList,
+ TransitionCondition.ChangeOnAdd,
+ addTransition,
+ false);
+
+ tlog.Debug(tag, $"LayoutTransitionsHelperAddTransitionForCondition END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LayoutTransitionsHelper GetTransitionsListForCondition")]
+ [Property("SPEC", "Tizen.NUI.LayoutTransitionsHelper.GetTransitionsListForCondition A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LayoutTransitionsHelperGetTransitionsListForCondition()
+ {
+ tlog.Debug(tag, $"LayoutTransitionsHelperGetTransitionsListForCondition START");
+
+ TransitionList transitionList = new TransitionList();
+
+ LayoutTransition addTransition = new LayoutTransition(TransitionCondition.Add,
+ AnimatableProperties.Position,
+ 0.3f,
+ new TransitionComponents()
+ );
+
+ LayoutTransition removeTransition = new LayoutTransition(TransitionCondition.Remove,
+ AnimatableProperties.Position,
+ 0.0f,
+ new TransitionComponents()
+ );
+
+ Dictionary<TransitionCondition, TransitionList> targetTransitionList = new Dictionary<TransitionCondition, TransitionList>();
+
+ targetTransitionList.Add(TransitionCondition.Unspecified, transitionList);
+ targetTransitionList.Add(TransitionCondition.LayoutChanged, transitionList);
+
+ TransitionList transitionsForCondition = new TransitionList();
+
+ var result = LayoutTransitionsHelper.GetTransitionsListForCondition(targetTransitionList,
+ TransitionCondition.LayoutChanged,
+ transitionsForCondition);
+ Assert.AreEqual(true, result, "should be equal!");
+
+ result = LayoutTransitionsHelper.GetTransitionsListForCondition(targetTransitionList,
+ TransitionCondition.Add,
+ transitionsForCondition);
+ Assert.AreEqual(false, result, "should be equal!");
+
+ tlog.Debug(tag, $"LayoutTransitionsHelperGetTransitionsListForCondition END (OK)");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Collections.Generic;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("public/Layouting/LinearLayout")]
+ public class PublicLinearLayoutTest
+ {
+ private const string tag = "NUITEST";
+ private static bool flagOnMeasureOverride;
+ private static bool flagOnLayoutOverride;
+ public class MyLinearLayout : LinearLayout
+ {
+ public MyLinearLayout() : 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;
+ base.OnMeasure(widthMeasureSpec, heightMeasureSpec);
+ }
+
+ 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;
+ base.OnLayout(changed, left, top, right, bottom);
+ }
+ }
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LinearLayout constructor")]
+ [Property("SPEC", "Tizen.NUI.LinearLayout.LinearLayout C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LinearLayoutConstructor()
+ {
+ tlog.Debug(tag, $"LinearLayoutConstructor START");
+
+ var testingTarget = new LinearLayout();
+ Assert.IsNotNull(testingTarget, "null handle returned");
+ Assert.IsInstanceOf<LinearLayout>(testingTarget, "Should return LinearLayout instance.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LinearLayoutConstructor END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LinearLayout LinearOrientation")]
+ [Property("SPEC", "Tizen.NUI.LinearLayout.LinearOrientation A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LinearLayoutLinearOrientation()
+ {
+ tlog.Debug(tag, $"LinearLayoutLinearOrientation START");
+
+ var testingTarget = new LinearLayout();
+ Assert.IsNotNull(testingTarget, "null handle returned");
+ Assert.IsInstanceOf<LinearLayout>(testingTarget, "Should return LinearLayout instance.");
+
+ testingTarget.LinearOrientation = LinearLayout.Orientation.Vertical;
+ Assert.AreEqual(testingTarget.LinearOrientation, LinearLayout.Orientation.Vertical, "Should be Vertical.");
+
+ testingTarget.LinearOrientation = LinearLayout.Orientation.Horizontal;
+ Assert.AreEqual(testingTarget.LinearOrientation, LinearLayout.Orientation.Horizontal, "Should be Horizontal.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LinearLayoutLinearOrientation END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LinearLayout LinearAlignment")]
+ [Property("SPEC", "Tizen.NUI.LinearLayout.LinearAlignment A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LinearLayoutLinearAlignment()
+ {
+ tlog.Debug(tag, $"LinearLayoutLinearAlignment START");
+
+ var testingTarget = new LinearLayout();
+ Assert.IsNotNull(testingTarget, "null handle returned");
+ Assert.IsInstanceOf<LinearLayout>(testingTarget, "Should return LinearLayout instance.");
+
+ testingTarget.LinearAlignment = LinearLayout.Alignment.End;
+ Assert.AreEqual(testingTarget.LinearAlignment, LinearLayout.Alignment.End, "Should be End.");
+
+ testingTarget.LinearAlignment = LinearLayout.Alignment.Center;
+ Assert.AreEqual(testingTarget.LinearAlignment, LinearLayout.Alignment.Center, "Should be Center.");
+
+ testingTarget.LinearAlignment = LinearLayout.Alignment.Begin;
+ Assert.AreEqual(testingTarget.LinearAlignment, LinearLayout.Alignment.Begin, "Should be Begin.");
+
+ testingTarget.LinearAlignment = LinearLayout.Alignment.CenterHorizontal;
+ Assert.AreEqual(testingTarget.LinearAlignment, LinearLayout.Alignment.CenterHorizontal, "Should be CenterHorizontal.");
+
+ testingTarget.LinearAlignment = LinearLayout.Alignment.Top;
+ Assert.AreEqual(testingTarget.LinearAlignment, LinearLayout.Alignment.Top, "Should be Top.");
+
+ testingTarget.LinearAlignment = LinearLayout.Alignment.Bottom;
+ Assert.AreEqual(testingTarget.LinearAlignment, LinearLayout.Alignment.Bottom, "Should be Bottom.");
+
+ testingTarget.LinearAlignment = LinearLayout.Alignment.CenterVertical;
+ Assert.AreEqual(testingTarget.LinearAlignment, LinearLayout.Alignment.CenterVertical, "Should be CenterVertical.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LinearLayoutLinearAlignment END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LinearLayout cell padding")]
+ [Property("SPEC", "Tizen.NUI.LinearLayout.CellPadding A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LinearLayoutCellPadding()
+ {
+ tlog.Debug(tag, $"LinearLayoutCellPadding START");
+
+ var testingTarget = new LinearLayout();
+ Assert.IsNotNull(testingTarget, "null handle returned");
+ Assert.IsInstanceOf<LinearLayout>(testingTarget, "Should return LinearLayout instance.");
+
+ testingTarget.CellPadding = new Size2D(6, 8);
+ Assert.AreEqual(testingTarget.CellPadding.Width, 6, "Should be equal.");
+ Assert.AreEqual(testingTarget.CellPadding.Height, 8, "Should be equal.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LinearLayoutCellPadding END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LinearLayout OnMeasure")]
+ [Property("SPEC", "Tizen.NUI.LinearLayout.OnMeasure M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LinearLayoutOnMeasure()
+ {
+ tlog.Debug(tag, $"LinearLayoutOnMeasure START");
+
+ flagOnMeasureOverride = false;
+ Assert.False(flagOnMeasureOverride, "flagOnMeasureOverride should be false initial");
+
+ LayoutItem layoutItem = new LinearLayout();
+
+ View view = new View()
+ {
+ ExcludeLayouting = false,
+ Weight = 10,
+ WidthSpecification = 0,
+ HeightSpecification = 0,
+ Layout = new LinearLayout()
+ };
+
+ layoutItem.AttachToOwner(view);
+
+ var testingTarget = new MyLinearLayout();
+ Assert.IsNotNull(testingTarget, "null handle returned");
+ Assert.IsInstanceOf<LinearLayout>(testingTarget, "Should be an instance of LinearLayout type.");
+
+ testingTarget.AttachToOwner(view);
+ testingTarget.Add(layoutItem);
+
+ MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly);
+ MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly);
+
+ /**
+ * isExactly is true
+ * useExcessSpace is true :(childLayout.Owner.WidthSpecification == 0) && (childWeight > 0)
+ */
+ testingTarget.OnMeasureTest(measureWidth, measureHeight);
+ Assert.True(flagOnMeasureOverride, "LinearLayout overridden method not invoked.");
+
+ /**
+ * isExactly is false
+ * useExcessSpace is true :(childLayout.Owner.WidthSpecification == 0) && (childWeight > 0)
+ */
+ flagOnMeasureOverride = false;
+ Assert.False(flagOnMeasureOverride, "flagOnMeasureOverride should be false initial");
+
+ MeasureSpecification measureWidth2 = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.AtMost);
+ MeasureSpecification measureHeight2 = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Unspecified);
+
+ testingTarget.OnMeasureTest(measureWidth2, measureHeight2);
+ Assert.True(flagOnMeasureOverride, "LinearLayout overridden method not invoked.");
+
+ /**
+ * matchHeight
+ * heightMode != MeasureSpecification.ModeType.Exactly && childDesiredHeight == LayoutParamPolicies.MatchParent
+ */
+ view.HeightSpecification = LayoutParamPolicies.MatchParent;
+ testingTarget.OnMeasureTest(measureWidth2, measureHeight2);
+
+ /**Test LinearLayout.Orientation.Vertical */
+ testingTarget.LinearOrientation = LinearLayout.Orientation.Vertical;
+ view.HeightSpecification = 0;
+
+ flagOnMeasureOverride = false;
+ Assert.False(flagOnMeasureOverride, "flagOnMeasureOverride should be false initial");
+
+ /**
+ * isExactly is true
+ * useExcessSpace is true :(childLayout.Owner.HeightSpecification == 0) && (childWeight > 0)
+ */
+ testingTarget.OnMeasureTest(measureWidth, measureHeight);
+ Assert.True(flagOnMeasureOverride, "LinearLayout overridden method not invoked.");
+
+ flagOnMeasureOverride = false;
+ Assert.False(flagOnMeasureOverride, "flagOnMeasureOverride should be false initial");
+
+ /**
+ * isExactly is true
+ * useExcessSpace is true :(childLayout.Owner.HeightSpecification == 0) && (childWeight > 0)
+ *
+ * matchWidth
+ * widthMode != MeasureSpecification.ModeType.Exactly && childDesiredWidth == LayoutParamPolicies.MatchParent
+ */
+ view.WidthSpecification = LayoutParamPolicies.MatchParent;
+ testingTarget.OnMeasureTest(measureWidth2, measureHeight2);
+ Assert.True(flagOnMeasureOverride, "LinearLayout overridden method not invoked.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LinearLayoutOnMeasure END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("LinearLayout OnLayout")]
+ [Property("SPEC", "Tizen.NUI.LinearLayout.OnLayout M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void LinearLayoutOnLayout()
+ {
+ tlog.Debug(tag, $"LinearLayoutOnLayout START");
+
+ flagOnLayoutOverride = false;
+ Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial");
+
+ LayoutItem layoutItem = new LinearLayout();
+
+ View view = new View()
+ {
+ ExcludeLayouting = false,
+ Weight = 10,
+ WidthSpecification = 0,
+ HeightSpecification = 0,
+ Layout = new LinearLayout(),
+ LayoutDirection = ViewLayoutDirectionType.RTL
+ };
+
+ layoutItem.AttachToOwner(view);
+
+ var testingTarget = new MyLinearLayout()
+ {
+ LinearAlignment = LinearLayout.Alignment.Begin,
+ };
+ Assert.IsNotNull(testingTarget, "null handle returned");
+ Assert.IsInstanceOf<LinearLayout>(testingTarget, "Should be an instance of LinearLayout type.");
+
+ testingTarget.AttachToOwner(view);
+ testingTarget.Add(layoutItem);
+
+ testingTarget.OnLayoutTest(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10));
+ Assert.True(flagOnLayoutOverride, "LinearLayout overridden method not invoked.");
+
+ /** Alignment.End */
+ flagOnLayoutOverride = false;
+ Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial");
+
+ testingTarget.LinearAlignment = LinearLayout.Alignment.End;
+
+ testingTarget.OnLayoutTest(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10));
+ Assert.True(flagOnLayoutOverride, "LinearLayout overridden method not invoked.");
+
+ /** Alignment.CenterHorizontal */
+ flagOnLayoutOverride = false;
+ Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial");
+
+ testingTarget.LinearAlignment = LinearLayout.Alignment.CenterHorizontal;
+
+ testingTarget.OnLayoutTest(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10));
+ Assert.True(flagOnLayoutOverride, "LinearLayout overridden method not invoked.");
+
+ /** Alignment.Center */
+ flagOnLayoutOverride = false;
+ Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial");
+
+ testingTarget.LinearAlignment = LinearLayout.Alignment.Center;
+
+ testingTarget.OnLayoutTest(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10));
+ Assert.True(flagOnLayoutOverride, "LinearLayout overridden method not invoked.");
+
+ /** Alignment.CenterVertical */
+ flagOnLayoutOverride = false;
+ Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial");
+
+ testingTarget.LinearAlignment = LinearLayout.Alignment.CenterVertical;
+
+ testingTarget.OnLayoutTest(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10));
+ Assert.True(flagOnLayoutOverride, "LinearLayout overridden method not invoked.");
+
+ /** Alignment.Bottom */
+ flagOnLayoutOverride = false;
+ Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial");
+
+ testingTarget.LinearAlignment = LinearLayout.Alignment.Bottom;
+
+ testingTarget.OnLayoutTest(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10));
+ Assert.True(flagOnLayoutOverride, "LinearLayout overridden method not invoked.");
+
+ /** Alignment.Top */
+ flagOnLayoutOverride = false;
+ Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial");
+
+ testingTarget.LinearAlignment = LinearLayout.Alignment.Top;
+
+ testingTarget.OnLayoutTest(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10));
+ Assert.True(flagOnLayoutOverride, "LinearLayout overridden method not invoked.");
+
+ /** Owner.LayoutDirection == ViewLayoutDirectionType.LTR */
+ view.LayoutDirection = ViewLayoutDirectionType.LTR;
+
+ flagOnLayoutOverride = false;
+ Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial");
+
+ testingTarget.OnLayoutTest(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10));
+ Assert.True(flagOnLayoutOverride, "LinearLayout overridden method not invoked.");
+
+ /** Alignment.End */
+ flagOnLayoutOverride = false;
+ Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial");
+
+ testingTarget.LinearAlignment = LinearLayout.Alignment.End;
+
+ testingTarget.OnLayoutTest(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10));
+ Assert.True(flagOnLayoutOverride, "LinearLayout overridden method not invoked.");
+
+ /** Alignment.CenterHorizontal */
+ flagOnLayoutOverride = false;
+ Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial");
+
+ testingTarget.LinearAlignment = LinearLayout.Alignment.CenterHorizontal;
+
+ testingTarget.OnLayoutTest(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10));
+ Assert.True(flagOnLayoutOverride, "LinearLayout overridden method not invoked.");
+
+ /** Alignment.Center */
+ flagOnLayoutOverride = false;
+ Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial");
+
+ testingTarget.LinearAlignment = LinearLayout.Alignment.Center;
+
+ testingTarget.OnLayoutTest(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10));
+ Assert.True(flagOnLayoutOverride, "LinearLayout overridden method not invoked.");
+
+ /** Alignment.CenterVertical */
+ flagOnLayoutOverride = false;
+ Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial");
+
+ testingTarget.LinearAlignment = LinearLayout.Alignment.CenterVertical;
+
+ testingTarget.OnLayoutTest(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10));
+ Assert.True(flagOnLayoutOverride, "LinearLayout overridden method not invoked.");
+
+ /** Alignment.Bottom */
+ flagOnLayoutOverride = false;
+ Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial");
+
+ testingTarget.LinearAlignment = LinearLayout.Alignment.Bottom;
+
+ testingTarget.OnLayoutTest(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10));
+ Assert.True(flagOnLayoutOverride, "LinearLayout overridden method not invoked.");
+
+ /** Alignment.Begin */
+ flagOnLayoutOverride = false;
+ Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial");
+
+ testingTarget.LinearAlignment = LinearLayout.Alignment.Begin;
+
+ testingTarget.OnLayoutTest(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10));
+ Assert.True(flagOnLayoutOverride, "LinearLayout overridden method not invoked.");
+
+ /**
+ * Test LinearLayout.Orientation.Vertical
+ */
+ flagOnLayoutOverride = false;
+ Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial");
+
+ testingTarget.LinearOrientation = LinearLayout.Orientation.Vertical;
+
+ /** Alignment.Bottom */
+ flagOnLayoutOverride = false;
+ Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial");
+
+ testingTarget.LinearAlignment = LinearLayout.Alignment.Bottom;
+
+ testingTarget.OnLayoutTest(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10));
+ Assert.True(flagOnLayoutOverride, "LinearLayout overridden method not invoked.");
+
+ /** Alignment.Center */
+ flagOnLayoutOverride = false;
+ Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial");
+
+ testingTarget.LinearAlignment = LinearLayout.Alignment.Center;
+
+ testingTarget.OnLayoutTest(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10));
+ Assert.True(flagOnLayoutOverride, "LinearLayout overridden method not invoked.");
+
+ /** Alignment.End */
+ flagOnLayoutOverride = false;
+ Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial");
+
+ testingTarget.LinearAlignment = LinearLayout.Alignment.End;
+
+ testingTarget.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");
+
+ testingTarget.OnLayoutTest(false, new LayoutLength(10), new LayoutLength(10), new LayoutLength(20), new LayoutLength(20));
+ Assert.True(flagOnLayoutOverride, "LinearLayout overridden method not invoked.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"LinearLayoutOnLayout END (OK)");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Collections.Generic;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("public/Layouting/MeasureSpecification")]
+ public class PublicMeasureSpecificationTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("MeasureSpecification constructor")]
+ [Property("SPEC", "Tizen.NUI.MeasureSpecification.MeasureSpecification C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void MeasureSpecificationConstructor()
+ {
+ tlog.Debug(tag, $"MeasureSpecificationConstructor START");
+
+ var testingTarget = new MeasureSpecification(new LayoutLength(10), MeasureSpecification.ModeType.Exactly);
+ Assert.IsNotNull(testingTarget, "null handle returned");
+ Assert.IsInstanceOf<MeasureSpecification>(testingTarget, "Should return MeasureSpecification instance.");
+
+ tlog.Debug(tag, $"MeasureSpecificationConstructor END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("MeasureSpecification Size")]
+ [Property("SPEC", "Tizen.NUI.MeasureSpecification.Size A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void MeasureSpecificationSize()
+ {
+ tlog.Debug(tag, $"MeasureSpecificationSize START");
+
+ var testingTarget = new MeasureSpecification(new LayoutLength(10), MeasureSpecification.ModeType.Exactly);
+ Assert.IsNotNull(testingTarget, "null handle returned");
+ Assert.IsInstanceOf<MeasureSpecification>(testingTarget, "Should return MeasureSpecification instance.");
+
+ Assert.AreEqual(testingTarget.GetSize().AsRoundedValue(), 10, "Should be 10.");
+
+ var testValue = 20.0f;
+ testingTarget.SetSize(new LayoutLength(testValue));
+
+ Assert.AreEqual(testingTarget.GetSize().AsRoundedValue(), testValue, "Should be TestValue.");
+
+ tlog.Debug(tag, $"MeasureSpecificationSize END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("MeasureSpecification Mode")]
+ [Property("SPEC", "Tizen.NUI.MeasureSpecification.Mode A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void MeasureSpecificationMode()
+ {
+ tlog.Debug(tag, $"MeasureSpecificationMode START");
+
+ var testingTarget = new MeasureSpecification(new LayoutLength(10), MeasureSpecification.ModeType.Exactly);
+ Assert.IsNotNull(testingTarget, "null handle returned");
+ Assert.IsInstanceOf<MeasureSpecification>(testingTarget, "Should return MeasureSpecification instance.");
+
+ Assert.AreEqual(testingTarget.GetMode(), MeasureSpecification.ModeType.Exactly, "Should be Exactly.");
+
+ var mode = MeasureSpecification.ModeType.AtMost;
+ testingTarget.SetMode(mode);
+ Assert.AreEqual(testingTarget.GetMode(), mode, "Should be TestValue.");
+
+ mode = MeasureSpecification.ModeType.Unspecified;
+ testingTarget.SetMode(mode);
+ Assert.AreEqual(testingTarget.GetMode(), mode, "Should be TestValue.");
+
+ mode = MeasureSpecification.ModeType.Exactly;
+ testingTarget.SetMode(mode);
+ Assert.AreEqual(testingTarget.GetMode(), mode, "Should be TestValue.");
+
+ tlog.Debug(tag, $"MeasureSpecificationMode END (OK)");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Collections.Generic;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("public/Layouting/MeasuredSize")]
+ public class PublicMeasuredSizeTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("MeasuredSize constructor")]
+ [Property("SPEC", "Tizen.NUI.MeasuredSize.MeasuredSize C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("COVPARAM", "LayoutLength, MeasuredSize.StateType")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void MeasuredSizeConstructor()
+ {
+ tlog.Debug(tag, $"MeasuredSizeConstructor START");
+
+ var testingTarget = new MeasuredSize(new LayoutLength(10), MeasuredSize.StateType.MeasuredSizeOK);
+ Assert.IsNotNull(testingTarget, "null handle returned");
+ Assert.IsInstanceOf<MeasuredSize>(testingTarget, "Should return MeasuredSize instance.");
+
+ tlog.Debug(tag, $"MeasuredSizeConstructor END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("MeasuredSize Size")]
+ [Property("SPEC", "Tizen.NUI.MeasuredSize.Size A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void MeasuredSizeSize()
+ {
+ tlog.Debug(tag, $"MeasuredSizeSize START");
+
+ var testingTarget = new MeasuredSize(new LayoutLength(10), MeasuredSize.StateType.MeasuredSizeOK);
+ Assert.IsNotNull(testingTarget, "null handle returned");
+ Assert.IsInstanceOf<MeasuredSize>(testingTarget, "Should return MeasuredSize instance.");
+
+ float length = testingTarget.Size.AsRoundedValue();
+ Assert.AreEqual(length, 10.0f, "Should be value set.");
+
+ testingTarget.Size = new LayoutLength(20);
+
+ length = testingTarget.Size.AsRoundedValue();
+ Assert.AreEqual(length, 20.0f, "Should be value set.");
+
+ tlog.Debug(tag, $"MeasuredSizeSize END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("MeasuredSize State")]
+ [Property("SPEC", "Tizen.NUI.MeasuredSize.State A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void MeasuredSizeState()
+ {
+ tlog.Debug(tag, $"MeasuredSizeState START");
+
+ var testingTarget = new MeasuredSize(new LayoutLength(10), MeasuredSize.StateType.MeasuredSizeOK);
+ Assert.IsNotNull(testingTarget, "null handle returned");
+ Assert.IsInstanceOf<MeasuredSize>(testingTarget, "Should return MeasuredSize instance.");
+
+ Assert.AreEqual(testingTarget.State, MeasuredSize.StateType.MeasuredSizeOK, "Should match default state");
+
+ testingTarget.State = MeasuredSize.StateType.MeasuredSizeTooSmall;
+ Assert.AreEqual(testingTarget.State, MeasuredSize.StateType.MeasuredSizeTooSmall, "Should state set");
+
+ tlog.Debug(tag, $"MeasuredSizeState END (OK)");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Collections.Generic;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("public/Layouting/PaddingType")]
+
+ public class PublicPaddingTypeTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("PaddingType constructor")]
+ [Property("SPEC", "Tizen.NUI.PaddingType.PaddingType C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void PaddingTypeConstructor()
+ {
+ tlog.Debug(tag, $"PaddingTypeConstructor START");
+
+ var testingTarget = new PaddingType();
+ Assert.IsNotNull(testingTarget, "Can't create success object PaddingType");
+ Assert.IsInstanceOf<PaddingType>(testingTarget, "Should be an instance of PaddingType type.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"PaddingTypeConstructor END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("PaddingType constructor. With parameters")]
+ [Property("SPEC", "Tizen.NUI.PaddingType.PaddingType C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void PaddingTypeConstructorWithParameters()
+ {
+ tlog.Debug(tag, $"PaddingTypeConstructorWithParameters START");
+
+ var testingTarget = new PaddingType(0.0f, 0.0f, 0.0f, 0.0f);
+ Assert.IsNotNull(testingTarget, "Can't create success object PaddingType");
+ Assert.IsInstanceOf<PaddingType>(testingTarget, "Should be an instance of PaddingType type.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"PaddingTypeConstructorWithParameters END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("PaddingType Start")]
+ [Property("SPEC", "Tizen.NUI.PaddingType.Start A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void PaddingTypeStart()
+ {
+ tlog.Debug(tag, $"PaddingTypeStart START");
+
+ var testingTarget = new PaddingType();
+ Assert.IsNotNull(testingTarget, "Can't create success object PaddingType");
+ Assert.IsInstanceOf<PaddingType>(testingTarget, "Should be an instance of PaddingType type.");
+
+ testingTarget.Start = 20.0f;
+ Assert.AreEqual(20.0f, testingTarget.Start, "Should be equal!");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"PaddingTypeStart END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("PaddingType End")]
+ [Property("SPEC", "Tizen.NUI.PaddingType.End A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void PaddingTypeEnd()
+ {
+ tlog.Debug(tag, $"PaddingTypeEnd START");
+
+ var testingTarget = new PaddingType();
+ Assert.IsNotNull(testingTarget, "Can't create success object PaddingType");
+ Assert.IsInstanceOf<PaddingType>(testingTarget, "Should be an instance of PaddingType type.");
+
+ testingTarget.End = 20.0f;
+ Assert.AreEqual(20.0f, testingTarget.End, "Should be equal!");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"PaddingTypeEnd END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("PaddingType Bottom")]
+ [Property("SPEC", "Tizen.NUI.PaddingType.Bottom A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void PaddingTypeBottom()
+ {
+ tlog.Debug(tag, $"PaddingTypeEnd START");
+
+ var testingTarget = new PaddingType();
+ Assert.IsNotNull(testingTarget, "Can't create success object PaddingType");
+ Assert.IsInstanceOf<PaddingType>(testingTarget, "Should be an instance of PaddingType type.");
+
+ testingTarget.Bottom = 20.0f;
+ Assert.AreEqual(20.0f, testingTarget.Bottom, "Should be equal!");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"PaddingTypeEnd END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("PaddingType Top")]
+ [Property("SPEC", "Tizen.NUI.PaddingType.Top A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void PaddingTypeTop()
+ {
+ tlog.Debug(tag, $"PaddingTypeTop START");
+
+ var testingTarget = new PaddingType();
+ Assert.IsNotNull(testingTarget, "Can't create success object PaddingType");
+ Assert.IsInstanceOf<PaddingType>(testingTarget, "Should be an instance of PaddingType type.");
+
+ testingTarget.Top = 20.0f;
+ Assert.AreEqual(20.0f, testingTarget.Top, "Should be equal!");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"PaddingTypeTop END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("PaddingType Equality")]
+ [Property("SPEC", "Tizen.NUI.PaddingType.== A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void PaddingTypeEquality()
+ {
+ tlog.Debug(tag, $"PaddingTypeEquality START");
+
+ var testingTarget1 = new PaddingType(0.0f, 0.0f, 20.0f, 30.0f);
+ Assert.IsNotNull(testingTarget1, "Can't create success object PaddingType");
+ Assert.IsInstanceOf<PaddingType>(testingTarget1, "Should be an instance of PaddingType type.");
+
+ var testingTarget2 = new PaddingType(0.0f, 0.0f, 20.0f, 30.0f);
+ Assert.IsNotNull(testingTarget2, "Can't create success object PaddingType");
+ Assert.IsInstanceOf<PaddingType>(testingTarget2, "Should be an instance of PaddingType type.");
+
+ bool flag = false;
+ if (testingTarget1 == testingTarget2)
+ {
+ flag = true;
+ }
+ Assert.IsTrue(flag, "Should be true!");
+
+ // If both are null
+ PaddingType testingTarget3 = null;
+ PaddingType testingTarget4 = null;
+ Assert.IsTrue(testingTarget3 == testingTarget4);
+
+ // If one is null, but not both
+ PaddingType testingTarget5 = null;
+ Assert.IsFalse(testingTarget5 == testingTarget1);
+
+ testingTarget1.Dispose();
+ testingTarget2.Dispose();
+ tlog.Debug(tag, $"PaddingTypeEquality END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("PaddingType Inequality")]
+ [Property("SPEC", "Tizen.NUI.PaddingType.!= A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void PaddingTypeInequality()
+ {
+ tlog.Debug(tag, $"PaddingTypeInequality START");
+
+ var testingTarget1 = new PaddingType(0.0f, 0.0f, 20.0f, 30.0f);
+ Assert.IsNotNull(testingTarget1, "Can't create success object PaddingType");
+ Assert.IsInstanceOf<PaddingType>(testingTarget1, "Should be an instance of PaddingType type.");
+
+ var testingTarget2 = new PaddingType(0.0f, 0.0f, 30.0f, 20.0f);
+ Assert.IsNotNull(testingTarget2, "Can't create success object PaddingType");
+ Assert.IsInstanceOf<PaddingType>(testingTarget2, "Should be an instance of PaddingType type.");
+
+ bool flag = false;
+ if (testingTarget1 != testingTarget2)
+ {
+ flag = true;
+ }
+ Assert.IsTrue(flag, "Should be true!");
+
+ testingTarget1.Dispose();
+ testingTarget2.Dispose();
+ tlog.Debug(tag, $"PaddingTypeInequality END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("PaddingType Set")]
+ [Property("SPEC", "Tizen.NUI.PaddingType.Set M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void PaddingTypeSet()
+ {
+ tlog.Debug(tag, $"PaddingTypeSet START");
+
+ var testingTarget = new PaddingType();
+ Assert.IsNotNull(testingTarget, "Can't create success object PaddingType");
+ Assert.IsInstanceOf<PaddingType>(testingTarget, "Should be an instance of PaddingType type.");
+
+ testingTarget.Set(0.0f, 0.0f, 20.0f, 30.0f);
+ Assert.AreEqual(testingTarget.Start, 0.0f, "should be equal.");
+ Assert.AreEqual(testingTarget.End, 0.0f, "should be equal.");
+ Assert.AreEqual(testingTarget.Top, 20.0f, "should be equal.");
+ Assert.AreEqual(testingTarget.Bottom, 30.0f, "should be equal.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"PaddingTypeSet END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("PaddingType Dispose")]
+ [Property("SPEC", "Tizen.NUI.PaddingType.Dispose M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void PaddingTypeDispose()
+ {
+ tlog.Debug(tag, $"PaddingTypeDispose START");
+
+ var testingTarget = new PaddingType();
+ Assert.IsNotNull(testingTarget, "Can't create success object PaddingType");
+ Assert.IsInstanceOf<PaddingType>(testingTarget, "Should be an instance of PaddingType type.");
+
+ try
+ {
+ testingTarget.Dispose();
+ }
+ catch (Exception e)
+ {
+ tlog.Error(tag, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ tlog.Debug(tag, $"PaddingTypeDispose END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("PaddingType Equals")]
+ [Property("SPEC", "Tizen.NUI.PaddingType.Equals M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void Equals_CHECK_RETURN_VALUE()
+ {
+ tlog.Debug(tag, $"PaddingTypeDispose START");
+
+ var testingTarget1 = new PaddingType(0.0f, 0.0f, 20.0f, 30.0f);
+ Assert.IsNotNull(testingTarget1, "Can't create success object PaddingType");
+ Assert.IsInstanceOf<PaddingType>(testingTarget1, "Should be an instance of PaddingType type.");
+
+ var testingTarget2 = new PaddingType(0.0f, 0.0f, 20.0f, 30.0f);
+ Assert.IsNotNull(testingTarget2, "Can't create success object PaddingType");
+ Assert.IsInstanceOf<PaddingType>(testingTarget2, "Should be an instance of PaddingType type.");
+
+ var testingTarget3 = new PaddingType(10.0f, 0.0f, 20.0f, 30.0f);
+ Assert.IsNotNull(testingTarget3, "Can't create success object PaddingType");
+ Assert.IsInstanceOf<PaddingType>(testingTarget3, "Should be an instance of PaddingType type.");
+
+ bool flagTrue = testingTarget1.Equals(testingTarget2);
+ Assert.IsTrue(flagTrue, "Should be true!");
+
+ bool flagFalse = testingTarget1.Equals(testingTarget3);
+ Assert.IsFalse(flagFalse, "Should be false!");
+
+ // object is null
+ Assert.IsFalse(testingTarget1.Equals(null));
+
+ // object is not a PaddingType
+ using (Size size = new Size(100, 200))
+ {
+ Assert.IsFalse(testingTarget1.Equals(size));
+ }
+
+ testingTarget1.Dispose();
+ testingTarget2.Dispose();
+ testingTarget3.Dispose();
+ tlog.Debug(tag, $"PaddingTypeDispose END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("PaddingType GetHashCode")]
+ [Property("SPEC", "Tizen.NUI.PaddingType.GetHashCode M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void PaddingTypeGetHashCode()
+ {
+ tlog.Debug(tag, $"PaddingTypeGetHashCode START");
+
+ var testingTarget = new PaddingType();
+ Assert.IsNotNull(testingTarget, "Can't create success object PaddingType");
+ Assert.IsInstanceOf<PaddingType>(testingTarget, "Should be an instance of PaddingType type.");
+
+ Assert.GreaterOrEqual(testingTarget.GetHashCode(), 0, "Should be true");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"PaddingTypeGetHashCode END (OK)");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Collections.Generic;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("public/Layouting/RelativeLayout")]
+
+ public class PublicRelativeLayoutTest
+ {
+ private const string tag = "NUITEST";
+ private static bool flagOnMeasureOverride;
+ private static bool flagOnLayoutOverride;
+ internal class MyRelativeLayout : RelativeLayout
+ {
+ public MyRelativeLayout() : 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;
+ base.OnMeasure(widthMeasureSpec, heightMeasureSpec);
+ }
+
+ 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;
+ base.OnLayout(changed, left, top, right, bottom);
+ }
+ }
+
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout constructor")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.RelativeLayout C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutConstructor()
+ {
+ tlog.Debug(tag, $"RelativeLayoutConstructor START");
+
+ var testingTarget = new RelativeLayout();
+ Assert.IsNotNull(testingTarget, "Can't create success object PaddingType");
+ Assert.IsInstanceOf<RelativeLayout>(testingTarget, "Should be an instance of RelativeLayout type.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"RelativeLayoutConstructor END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout SetLeftTarget.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetLeftTarget M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetLeftTarget()
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetLeftTarget START");
+
+ using (View child = new View())
+ {
+ using (View target = new View())
+ {
+ RelativeLayout.SetLeftTarget(child, target);
+ Assert.AreEqual(RelativeLayout.GetLeftTarget(child), target, $"Should be {target}.");
+
+ RelativeLayout.SetLeftTarget(child, null);
+ Assert.AreEqual(RelativeLayout.GetLeftTarget(child), null, "Should be null.");
+ }
+ }
+
+ tlog.Debug(tag, $"RelativeLayoutSetLeftTarget END (OK)");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout SetLeftTarget. With null argument.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetLeftTarget M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetLeftTargetWithNullArgument()
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetLeftTargetWithNullArgument START");
+
+ View target = new View();
+ try
+ {
+ RelativeLayout.SetLeftTarget(null, target);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ target.Dispose();
+ tlog.Debug(tag, $"RelativeLayoutSetLeftTargetWithNullArgument END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout SetLeftTarget. With null argument and null reference.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetLeftTarget M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetLeftTargetWithNullArgumentReference()
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetLeftTargetWithNullArgumentReference START");
+
+ try
+ {
+ RelativeLayout.SetLeftTarget(null, null);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetLeftTargetWithNullArgumentReference END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout GetLeftTarget.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.GetLeftTarget M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutGetLeftTarget()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetLeftTarget START");
+
+ using (View child = new View())
+ {
+ using (View target = new View())
+ {
+ RelativeLayout.SetLeftTarget(child, target);
+ Assert.AreEqual(RelativeLayout.GetLeftTarget(child), target, $"Should be {target}.");
+ }
+ }
+
+ tlog.Debug(tag, $"RelativeLayoutGetLeftTarget END (OK)");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout GetLeftTarget. With null argument.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.GetLeftTarget M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutGetLeftTargetWithNullArgument()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetLeftTargetWithNullArgument START");
+
+ try
+ {
+ RelativeLayout.GetLeftTarget(null);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetLeftTargetWithNullArgument END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout SetRightTarget.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetRightTarget M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetRightTarget()
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetRightTarget START");
+
+ using (View child = new View())
+ {
+ using (View target = new View())
+ {
+ RelativeLayout.SetRightTarget(child, target);
+ Assert.AreEqual(RelativeLayout.GetRightTarget(child), target, $"Should be {target}.");
+
+ RelativeLayout.SetRightTarget(child, null);
+ Assert.AreEqual(RelativeLayout.GetRightTarget(child), null, "Should be null.");
+ }
+ }
+
+ tlog.Debug(tag, $"RelativeLayoutSetRightTarget END (OK)");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout SetRightTarget. With null argument.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetRightTarget M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetRightTargetWithNullArgument()
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetRightTargetWithNullArgument START");
+
+ View target = new View();
+ try
+ {
+ RelativeLayout.SetRightTarget(null, target);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ target.Dispose();
+ tlog.Debug(tag, $"RelativeLayoutSetRightTargetWithNullArgument END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout SetRightTarget. With null argument and null reference.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetRightTarget M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetRightTargetWithNullArgumentReference()
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetRightTargetWithNullArgumentReference START");
+
+ try
+ {
+ RelativeLayout.SetRightTarget(null, null);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetRightTargetWithNullArgumentReference END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout GetRightTarget.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.GetRightTarget M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutGetRightTarget()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetRightTarget START");
+
+ using (View child = new View())
+ {
+ using (View target = new View())
+ {
+ RelativeLayout.SetRightTarget(child, target);
+ Assert.AreEqual(RelativeLayout.GetRightTarget(child), target, $"Should be {target}.");
+ }
+ }
+
+ tlog.Debug(tag, $"RelativeLayoutGetRightTarget END (OK)");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout GetRightTarget. With null argument.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.GetRightTarget M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutGetRightTargetWithNullArgument()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetRightTargetWithNullArgument START");
+
+ try
+ {
+ RelativeLayout.GetRightTarget(null);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetRightTargetWithNullArgument END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout SetTopTarget.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetTopTarget M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetTopTarget()
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetTopTarget START");
+
+ using (View child = new View())
+ {
+ using (View target = new View())
+ {
+ RelativeLayout.SetTopTarget(child, target);
+ Assert.AreEqual(RelativeLayout.GetTopTarget(child), target, $"Should be {target}.");
+
+ RelativeLayout.SetTopTarget(child, null);
+ Assert.AreEqual(RelativeLayout.GetTopTarget(child), null, "Should be null.");
+ }
+ }
+
+ tlog.Debug(tag, $"RelativeLayoutSetTopTarget END (OK)");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout SetTopTarget. With null argument.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetTopTarget M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetTopTargetWithNullArgument()
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetTopTarget START");
+
+ View target = new View();
+ try
+ {
+ RelativeLayout.SetTopTarget(null, target);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ target.Dispose();
+ tlog.Debug(tag, $"RelativeLayoutSetTopTarget END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout SetTopTarget. With null argument and null reference.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetTopTarget M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetTopTargetWithNullArgumentReference()
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetTopTargetWithNullArgumentReference START");
+
+ try
+ {
+ RelativeLayout.SetTopTarget(null, null);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetTopTargetWithNullArgumentReference END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout GetTopTarget.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.GetTopTarget M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutGetTopTarget()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetTopTarget START");
+
+ using (View child = new View())
+ {
+ using (View target = new View())
+ {
+ RelativeLayout.SetTopTarget(child, target);
+ Assert.AreEqual(RelativeLayout.GetTopTarget(child), target, $"Should be {target}.");
+
+ }
+ }
+
+ tlog.Debug(tag, $"RelativeLayoutGetTopTarget END (OK)");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout GetTopTarget. With null argument.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.GetTopTarget M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutGetTopTargetWithNullArgument()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetTopTargetWithNullArgument START");
+
+ try
+ {
+ RelativeLayout.GetTopTarget(null);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetTopTargetWithNullArgument END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout SetBottomTarget.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetBottomTarget M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetBottomTarget()
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetBottomTarget START");
+
+ using (View child = new View())
+ {
+ using (View target = new View())
+ {
+ RelativeLayout.SetBottomTarget(child, target);
+ Assert.AreEqual(RelativeLayout.GetBottomTarget(child), target, $"Should be {target}.");
+
+ RelativeLayout.SetBottomTarget(child, null);
+ Assert.AreEqual(RelativeLayout.GetBottomTarget(child), null, "Should be null.");
+ }
+ }
+
+ tlog.Debug(tag, $"RelativeLayoutSetBottomTarget END (OK)");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout SetBottomTarget. With null argument.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetBottomTarget M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetBottomTargetWithNullArgument()
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetBottomTargetWithNullArgument START");
+
+ View target = new View();
+ try
+ {
+ RelativeLayout.SetBottomTarget(null, target);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ target.Dispose();
+ tlog.Debug(tag, $"RelativeLayoutSetBottomTargetWithNullArgument END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout SetBottomTarget. With null argument and null reference.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetBottomTarget M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetBottomTargetWithNullArgumentReference()
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetBottomTargetWithNullArgumentReference START");
+
+ try
+ {
+ RelativeLayout.SetBottomTarget(null, null);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetBottomTargetWithNullArgumentReference END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout GetBottomTarget.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.GetBottomTarget M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutGetBottomTarget()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetBottomTarget START");
+
+ using (View child = new View())
+ {
+ using (View target = new View())
+ {
+ RelativeLayout.SetBottomTarget(child, target);
+ Assert.AreEqual(RelativeLayout.GetBottomTarget(child), target, $"Should be {target}.");
+ }
+ }
+
+ tlog.Debug(tag, $"RelativeLayoutGetBottomTarget END (OK)");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout GetBottomTarget. With null argument.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.GetBottomTarget M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutGetBottomTargetWithNullArgument()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetBottomTargetWithNullArgument START");
+
+ try
+ {
+ RelativeLayout.GetBottomTarget(null);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetBottomTargetWithNullArgument END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout SetLeftRelativeOffset.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetLeftRelativeOffset M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetLeftRelativeOffset()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetBottomTargetWithNullArgument START");
+
+ using (View child = new View())
+ {
+ RelativeLayout.SetLeftRelativeOffset(child, 0.0f);
+ Assert.AreEqual(RelativeLayout.GetLeftRelativeOffset(child), 0.0f, "Should be 0.0.");
+
+ RelativeLayout.SetLeftRelativeOffset(child, -1.0f);
+ Assert.AreEqual(RelativeLayout.GetLeftRelativeOffset(child), -1.0f, "Should be -1.0f.");
+ }
+
+ tlog.Debug(tag, $"RelativeLayoutGetBottomTargetWithNullArgument END (OK)");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout SetLeftRelativeOffset. With null argument.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetLeftRelativeOffset M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetLeftRelativeOffsetWithNullArgument()
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetLeftRelativeOffsetWithNullArgument START");
+
+ try
+ {
+ RelativeLayout.SetLeftRelativeOffset(null, 0.0f);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetLeftRelativeOffsetWithNullArgument END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout GetLeftRelativeOffset.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.GetLeftRelativeOffset M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutGetLeftRelativeOffset()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetLeftRelativeOffset START");
+
+ using (View child = new View())
+ {
+ RelativeLayout.SetLeftRelativeOffset(child, 0.0f);
+ Assert.AreEqual(RelativeLayout.GetLeftRelativeOffset(child), 0.0f, "Should be 0.0.");
+ }
+
+ tlog.Debug(tag, $"RelativeLayoutGetLeftRelativeOffset END (OK)");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout GetLeftRelativeOffset. With null argument.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.GetLeftRelativeOffset M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutGetLeftRelativeOffsetWithNullArgument()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetLeftRelativeOffsetWithNullArgument START");
+
+ try
+ {
+ RelativeLayout.GetLeftRelativeOffset(null);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetLeftRelativeOffsetWithNullArgument END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout SetRightRelativeOffset.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetRightRelativeOffset M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetRightRelativeOffset()
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetRightRelativeOffset START");
+
+ using (View child = new View())
+ {
+ RelativeLayout.SetRightRelativeOffset(child, 0.0f);
+ Assert.AreEqual(RelativeLayout.GetRightRelativeOffset(child), 0.0f, "Should be 0.0.");
+
+ RelativeLayout.SetRightRelativeOffset(child, -1.0f);
+ Assert.AreEqual(RelativeLayout.GetRightRelativeOffset(child), -1.0f, "Should be -1.0f.");
+ }
+
+ tlog.Debug(tag, $"RelativeLayoutSetRightRelativeOffset END (OK)");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout SetRightRelativeOffset. With null argument.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetRightRelativeOffset M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetRightRelativeOffsetWithNullArgument()
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetRightRelativeOffsetWithNullArgument START");
+
+ try
+ {
+ RelativeLayout.SetRightRelativeOffset(null, 0.0f);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetRightRelativeOffsetWithNullArgument END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout GetRightRelativeOffset.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.GetRightRelativeOffset M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutGetRightRelativeOffset()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetRightRelativeOffset START");
+
+ using (View child = new View())
+ {
+ RelativeLayout.SetRightRelativeOffset(child, 0.0f);
+ Assert.AreEqual(RelativeLayout.GetRightRelativeOffset(child), 0.0f, "Should be 0.0.");
+ }
+
+ tlog.Debug(tag, $"RelativeLayoutGetRightRelativeOffset END (OK)");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout GetRightRelativeOffset. With null argument.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.GetRightRelativeOffset M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutGetRightRelativeOffsetWithNullArgument()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetRightRelativeOffsetWithNullArgument START");
+
+ try
+ {
+ RelativeLayout.GetRightRelativeOffset(null);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetRightRelativeOffsetWithNullArgument END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout SetTopRelativeOffset.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetTopRelativeOffset M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetTopRelativeOffset()
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetTopRelativeOffset START");
+
+ using (View child = new View())
+ {
+ RelativeLayout.SetTopRelativeOffset(child, 0.0f);
+ Assert.AreEqual(RelativeLayout.GetTopRelativeOffset(child), 0.0f, "Should be 0.0.");
+
+ RelativeLayout.SetTopRelativeOffset(child, -1.0f);
+ Assert.AreEqual(RelativeLayout.GetTopRelativeOffset(child), -1.0f, "Should be -1.0f.");
+ }
+
+ tlog.Debug(tag, $"RelativeLayoutSetTopRelativeOffset END (OK)");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout SetTopRelativeOffset. With null argument.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetTopRelativeOffset M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetTopRelativeOffsetWithNullArgument()
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetTopRelativeOffsetWithNullArgument START");
+
+ try
+ {
+ RelativeLayout.SetTopRelativeOffset(null, 0.0f);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetTopRelativeOffsetWithNullArgument END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout GetTopRelativeOffset.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.GetTopRelativeOffset M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutGetTopRelativeOffset()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetTopRelativeOffset START");
+
+ using (View child = new View())
+ {
+ RelativeLayout.SetTopRelativeOffset(child, 0.0f);
+ Assert.AreEqual(RelativeLayout.GetTopRelativeOffset(child), 0.0f, "Should be 0.0.");
+ }
+
+ tlog.Debug(tag, $"RelativeLayoutGetTopRelativeOffset END (OK)");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout GetTopRelativeOffset. With null argument.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.GetTopRelativeOffset M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutGetTopRelativeOffsetWithNullArgument()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetTopRelativeOffsetWithNullArgument START");
+
+ try
+ {
+ RelativeLayout.GetTopRelativeOffset(null);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetTopRelativeOffsetWithNullArgument END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout SetBottomRelativeOffset.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetBottomRelativeOffset M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetBottomRelativeOffset()
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetBottomRelativeOffset START");
+
+ using (View child = new View())
+ {
+ RelativeLayout.SetBottomRelativeOffset(child, 0.0f);
+ Assert.AreEqual(RelativeLayout.GetBottomRelativeOffset(child), 0.0f, "Should be 0.0.");
+
+ RelativeLayout.SetBottomRelativeOffset(child, -1.0f);
+ Assert.AreEqual(RelativeLayout.GetBottomRelativeOffset(child), -1.0f, "Should be -1.0f.");
+ }
+
+ tlog.Debug(tag, $"RelativeLayoutSetBottomRelativeOffset END (OK)");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout SetBottomRelativeOffset. With null argument.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetBottomRelativeOffset M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetBottomRelativeOffsetWithNullArgument()
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetBottomRelativeOffsetWithNullArgument START");
+
+ try
+ {
+ RelativeLayout.SetBottomRelativeOffset(null, 0.0f);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetBottomRelativeOffsetWithNullArgument END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout GetBottomRelativeOffset.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.GetBottomRelativeOffset M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutGetBottomRelativeOffset()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetBottomRelativeOffset START");
+
+ using (View child = new View())
+ {
+ RelativeLayout.SetBottomRelativeOffset(child, 0.0f);
+ Assert.AreEqual(RelativeLayout.GetBottomRelativeOffset(child), 0.0f, "Should be 0.0.");
+ }
+
+ tlog.Debug(tag, $"RelativeLayoutGetBottomRelativeOffset END (OK)");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout GetBottomRelativeOffset. With null argument.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.GetBottomRelativeOffset M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutGetBottomRelativeOffsetWithNullArgument()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetBottomRelativeOffsetWithNullArgument START");
+
+ try
+ {
+ RelativeLayout.GetBottomRelativeOffset(null);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetBottomRelativeOffsetWithNullArgument END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout SetHorizontalAlignment.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetHorizontalAlignment M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetHorizontalAlignment()
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetHorizontalAlignment START");
+
+ using (View child = new View())
+ {
+ RelativeLayout.SetHorizontalAlignment(child, RelativeLayout.Alignment.Start);
+ Assert.AreEqual(RelativeLayout.GetHorizontalAlignment(child), RelativeLayout.Alignment.Start, "Should be RelativeLayout.Alignment.Start.");
+
+ RelativeLayout.SetHorizontalAlignment(child, RelativeLayout.Alignment.Center);
+ Assert.AreEqual(RelativeLayout.GetHorizontalAlignment(child), RelativeLayout.Alignment.Center, "Should be RelativeLayout.Alignment.Center.");
+
+ RelativeLayout.SetHorizontalAlignment(child, RelativeLayout.Alignment.End);
+ Assert.AreEqual(RelativeLayout.GetHorizontalAlignment(child), RelativeLayout.Alignment.End, "Should be RelativeLayout.Alignment.End.");
+ }
+
+ tlog.Debug(tag, $"RelativeLayoutSetHorizontalAlignment END (OK)");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout SetHorizontalAlignment. With null argument.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetHorizontalAlignment M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetHorizontalAlignmentWithNullArgument()
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetHorizontalAlignmentWithNullArgument START");
+
+ try
+ {
+ RelativeLayout.SetHorizontalAlignment(null, RelativeLayout.Alignment.End);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetHorizontalAlignmentWithNullArgument END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout GetHorizontalAlignment.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.GetHorizontalAlignment M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutGetHorizontalAlignment()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetHorizontalAlignment START");
+
+ using (View child = new View())
+ {
+ RelativeLayout.SetHorizontalAlignment(child, RelativeLayout.Alignment.Start);
+ Assert.AreEqual(RelativeLayout.GetHorizontalAlignment(child), RelativeLayout.Alignment.Start, "Should be RelativeLayout.Alignment.Start.");
+ }
+
+ tlog.Debug(tag, $"RelativeLayoutGetHorizontalAlignment END (OK)");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout GetHorizontalAlignment. With null argument.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.GetHorizontalAlignment M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutGetHorizontalAlignmentWithNullArgument()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetHorizontalAlignmentWithNullArgument START");
+
+ try
+ {
+ RelativeLayout.GetHorizontalAlignment(null);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetHorizontalAlignmentWithNullArgument END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout SetVerticalAlignment.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetVerticalAlignment M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetVerticalAlignment()
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetVerticalAlignment START");
+
+ using (View child = new View())
+ {
+ RelativeLayout.SetVerticalAlignment(child, RelativeLayout.Alignment.Start);
+ Assert.AreEqual(RelativeLayout.GetVerticalAlignment(child), RelativeLayout.Alignment.Start, "Should be RelativeLayout.Alignment.Start.");
+
+ RelativeLayout.SetVerticalAlignment(child, RelativeLayout.Alignment.Center);
+ Assert.AreEqual(RelativeLayout.GetVerticalAlignment(child), RelativeLayout.Alignment.Center, "Should be RelativeLayout.Alignment.Center.");
+
+ RelativeLayout.SetVerticalAlignment(child, RelativeLayout.Alignment.End);
+ Assert.AreEqual(RelativeLayout.GetVerticalAlignment(child), RelativeLayout.Alignment.End, "Should be RelativeLayout.Alignment.End.");
+ }
+
+ tlog.Debug(tag, $"RelativeLayoutSetVerticalAlignment END (OK)");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout SetVerticalAlignment. With null argument.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetVerticalAlignment M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetVerticalAlignmentWithNullArgument()
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetVerticalAlignmentWithNullArgument START");
+
+ try
+ {
+ RelativeLayout.SetVerticalAlignment(null, RelativeLayout.Alignment.End);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetVerticalAlignmentWithNullArgument END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout GetVerticalAlignment.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.GetVerticalAlignment M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutGetVerticalAlignment()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetVerticalAlignment START");
+
+ using (View child = new View())
+ {
+ RelativeLayout.SetVerticalAlignment(child, RelativeLayout.Alignment.Start);
+ Assert.AreEqual(RelativeLayout.GetVerticalAlignment(child), RelativeLayout.Alignment.Start, "Should be RelativeLayout.Alignment.Start.");
+ }
+
+ tlog.Debug(tag, $"RelativeLayoutGetVerticalAlignment END (OK)");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout GetVerticalAlignment. With null argument.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.GetVerticalAlignment M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutGetVerticalAlignmentWithNullArgument()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetVerticalAlignmentWithNullArgument START");
+
+ try
+ {
+ RelativeLayout.GetVerticalAlignment(null);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetVerticalAlignmentWithNullArgument END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout SetFillHorizontal.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetFillHorizontal M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetFillHorizontal()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetVerticalAlignmentWithNullArgument START");
+
+ using (View child = new View())
+ {
+ RelativeLayout.SetFillHorizontal(child, true);
+ Assert.AreEqual(RelativeLayout.GetFillHorizontal(child), true, "Should be true");
+
+ RelativeLayout.SetFillHorizontal(child, false);
+ Assert.AreEqual(RelativeLayout.GetFillHorizontal(child), false, "Should be false");
+ }
+
+ tlog.Debug(tag, $"RelativeLayoutGetVerticalAlignmentWithNullArgument END (OK)");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout SetFillHorizontal. With null argument.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetFillHorizontal M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetFillHorizontalWithNullArgument()
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetFillHorizontalWithNullArgument START");
+
+ try
+ {
+ RelativeLayout.SetFillHorizontal(null, true);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetFillHorizontalWithNullArgument END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout GetFillHorizontal.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.GetFillHorizontal M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutGetFillHorizontal()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetFillHorizontal START");
+
+ using (View child = new View())
+ {
+ RelativeLayout.SetFillHorizontal(child, true);
+ Assert.AreEqual(RelativeLayout.GetFillHorizontal(child), true, "Should be true.");
+ }
+
+ tlog.Debug(tag, $"RelativeLayoutGetFillHorizontal END (OK)");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout GetFillHorizontal. With null argument.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.GetFillHorizontal M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutGetFillHorizontalWithNullArgument()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetFillHorizontalWithNullArgument START");
+
+ try
+ {
+ RelativeLayout.GetFillHorizontal(null);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetFillHorizontalWithNullArgument END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout SetFillVertical.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetFillVertical M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetFillVertical()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetFillHorizontalWithNullArgument START");
+
+ using (View child = new View())
+ {
+ RelativeLayout.SetFillVertical(child, true);
+ Assert.AreEqual(RelativeLayout.GetFillVertical(child), true, "Should be true");
+
+ RelativeLayout.SetFillVertical(child, false);
+ Assert.AreEqual(RelativeLayout.GetFillVertical(child), false, "Should be false");
+ }
+
+ tlog.Debug(tag, $"RelativeLayoutGetFillHorizontalWithNullArgument END (OK)");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout SetFillVertical. With null argument.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.SetFillVertical M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutSetFillVerticalWithNullArgument()
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetFillVerticalWithNullArgument START");
+
+ try
+ {
+ RelativeLayout.SetFillVertical(null, true);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ tlog.Debug(tag, $"RelativeLayoutSetFillVerticalWithNullArgument END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout GetFillVertical.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.GetFillVertical M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutGetFillVertical()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetFillVertical START");
+
+ using (View child = new View())
+ {
+ RelativeLayout.SetFillVertical(child, true);
+ Assert.AreEqual(RelativeLayout.GetFillVertical(child), true, "Should be true.");
+ }
+
+ tlog.Debug(tag, $"RelativeLayoutGetFillVertical END (OK)");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("RelativeLayout GetFillVertical. With null argument.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.GetFillVertical M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutGetFillVerticalWithNullArgument()
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetFillVerticalWithNullArgument START");
+
+ try
+ {
+ RelativeLayout.GetFillVertical(null);
+ Assert.Fail("Should return null argument exception");
+ }
+ catch (ArgumentNullException)
+ {
+ tlog.Debug(tag, $"RelativeLayoutGetFillVerticalWithNullArgument END (OK)");
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout OnMeasure.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.OnMeasure M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutOnMeasure()
+ {
+ tlog.Debug(tag, $"RelativeLayoutOnMeasure START");
+
+ flagOnMeasureOverride = false;
+ Assert.False(flagOnMeasureOverride, "flagOnMeasureOverride should be false initial");
+
+ LayoutItem layoutItem = new LinearLayout();
+
+ View view = new View()
+ {
+ ExcludeLayouting = false,
+ Size = new Size(100, 150),
+ Layout = new RelativeLayout()
+ };
+
+ layoutItem.AttachToOwner(view);
+
+ var testingTarget = new MyRelativeLayout();
+ Assert.IsNotNull(testingTarget, "Should not be null.");
+ Assert.IsInstanceOf<RelativeLayout>(testingTarget, "Should be an instance of RelativeLayout type.");
+
+ testingTarget.AttachToOwner(view);
+ testingTarget.Add(layoutItem);
+
+ MeasureSpecification measureWidth = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly);
+ MeasureSpecification measureHeight = new MeasureSpecification(new LayoutLength(50.0f), MeasureSpecification.ModeType.Exactly);
+
+ testingTarget.OnMeasureTest(measureWidth, measureHeight);
+ Assert.True(flagOnMeasureOverride, "RelativeLayout overridden method not invoked.");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"RelativeLayoutOnMeasure END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelativeLayout OnLayout.")]
+ [Property("SPEC", "Tizen.NUI.RelativeLayout.OnLayout M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public void RelativeLayoutOnLayout()
+ {
+ tlog.Debug(tag, $"RelativeLayoutOnLayout START");
+
+ flagOnLayoutOverride = false;
+ Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial");
+
+ LayoutItem layoutItem = new LinearLayout();
+
+ View view = new View()
+ {
+ ExcludeLayouting = false,
+ Size = new Size(100, 150),
+ Layout = new RelativeLayout()
+ };
+
+ layoutItem.AttachToOwner(view);
+
+ var testingTarget = new MyRelativeLayout();
+ Assert.IsNotNull(testingTarget, "Should not be null.");
+ Assert.IsInstanceOf<RelativeLayout>(testingTarget, "Should be an instance of RelativeLayout type.");
+
+ testingTarget.AttachToOwner(view);
+ testingTarget.Add(layoutItem);
+
+ testingTarget.OnLayoutTest(true, new LayoutLength(5), new LayoutLength(5), new LayoutLength(10), new LayoutLength(10));
+ Assert.True(flagOnLayoutOverride, "RelativeLayout overridden method not invoked.");
+
+ // Test with false parameter
+ flagOnLayoutOverride = false;
+ Assert.False(flagOnLayoutOverride, "flagOnLayoutOverride should be false initial");
+ testingTarget.OnLayoutTest(false, new LayoutLength(10), new LayoutLength(10), new LayoutLength(20), new LayoutLength(20));
+ Assert.True(flagOnLayoutOverride, "RelativeLayout overridden method not invoked.");
+
+ tlog.Debug(tag, $"RelativeLayoutOnLayout END (OK)");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("public/Layouting/RelayoutContainer")]
+ public class PublicRelayoutContainerTest
+ {
+ private const string tag = "NUITEST";
+ private static bool _flagAdd;
+ internal class MyView : CustomView
+ {
+ View view;
+ static CustomView CreateInstance()
+ {
+ return new MyView();
+ }
+ static MyView()
+ {
+ CustomViewRegistry.Instance.Register(CreateInstance, typeof(MyView));
+ }
+
+ public MyView() : base(typeof(MyView).FullName, CustomViewBehaviour.ViewBehaviourDefault)
+ {
+ }
+
+ public MyView(string typeName, CustomViewBehaviour behaviour) : base(typeName, behaviour)
+ {
+ }
+
+ public override void OnInitialize()
+ {
+ view = new BaseComponents.View();
+ view.Size = new Size(200, 200);
+ view.BackgroundColor = Color.Red;
+ this.Add(view);
+ }
+
+ public override Size2D GetNaturalSize()
+ {
+ return new Size2D(200, 200);
+ }
+
+ public override void OnRelayout(Vector2 size, RelayoutContainer container)
+ {
+ View view = new View();
+ view.Size = new Size(100, 100);
+ container.Add(view, new Size2D(100, 100));
+ _flagAdd = true;
+ base.OnRelayout(size, container);
+ }
+
+ public void AddVisual(PropertyMap propertyMap)
+ {
+ int visualIndex = RegisterProperty("MyVisual", new PropertyValue("MyVisual"), PropertyAccessMode.ReadWrite);
+ if (visualIndex > 0)
+ {
+ VisualBase visual = VisualFactory.Instance.CreateVisual(propertyMap); // Create a visual for the new one.
+ RegisterVisual(visualIndex, visual);
+
+ RelayoutRequest();
+ }
+ }
+ }
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RelayoutContainer Add")]
+ [Property("SPEC", "Tizen.NUI.RelayoutContainer.Add M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "guowei.wang@samsung.com")]
+ public async Task RelayoutContainerAdd()
+ {
+ tlog.Debug(tag, $"RelayoutContainerAdd START");
+
+ var myView = new MyView();
+ Assert.IsNotNull(myView, "Can't create success object PaddingType");
+ Assert.IsInstanceOf<MyView>(myView, "Should be an instance of MyView2 type.");
+
+ Window.Instance.Add(myView);
+
+ try
+ {
+ _flagAdd = false;
+ Assert.False(_flagAdd, "Should be false");
+
+ PropertyMap propertyMap = new PropertyMap();
+ propertyMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color));
+ propertyMap.Add(ColorVisualProperty.MixColor, new PropertyValue(Color.Blue));
+
+ myView.AddVisual(propertyMap);
+ await Task.Delay(1000);
+ Assert.True(_flagAdd, "Should be true");
+ }
+ catch (Exception e)
+ {
+ tlog.Error(tag, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ finally
+ {
+ Window.Instance.Remove(myView);
+ }
+
+ myView.Dispose();
+ tlog.Debug(tag, $"RelayoutContainerAdd END (OK)");
+ }
+ }
+}