--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+using System;
+using System.Threading.Tasks;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+
+namespace Tizen.NUI.Components.Tests
+{
+ [TestFixture]
+ [Description("Tizen.NUI.Components.ScrollableBase test")]
+ public class ScrollableBaseTests
+ {
+ private ManualTestComponents _testPage;
+ private WearableManualTestNUI _wearTestPage;
+ private Window _window;
+ private View _view;
+ private TextLabel _information;
+ private float _pointSize = 20.0f;
+ private TextLabel _label;
+ private ScrollableBase _scroll;
+ private bool _isMobile = false;
+ private bool _isWearable = false;
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST");
+ _isMobile = ManualTest.IsMobile();
+ _isWearable = ManualTest.IsWearable();
+ _window = Window.Instance;
+ if (_isWearable)
+ {
+ _label = ManualTest.CreateLabel("This case is unsuitable for wearable, please press PASS button to continue!");
+ _wearTestPage = WearableManualTestNUI.GetInstance();
+ }
+ else
+ {
+ _testPage = ManualTestComponents.GetInstance();
+ }
+ _pointSize = ManualTest.GetPointSize();
+
+ _view = new View();
+ _view.Size = new Size2D(360, (int)(Window.Instance.Size.Height * 0.8));
+ _view.PositionUsesPivotPoint = true;
+ _view.ParentOrigin = Tizen.NUI.ParentOrigin.TopCenter;
+ _view.Position = new Position(0.0f, 0.0f, 0.0f);
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST");
+ }
+
+ private void OnScrolling(object source, ScrollEventArgs args)
+ {
+ Tizen.Log.Fatal("NUI.Components", "OnScrolling event !!!!!");
+ ManualTest.Confirm();
+ _window.Remove(_scroll);
+ }
+
+ private void OnScrollAnimationStarted(object source, ScrollEventArgs args)
+ {
+ Tizen.Log.Fatal("NUI.Components", "OnScrollAnimationStarted event !!!!!");
+ ManualTest.Confirm();
+ _window.Remove(_scroll);
+ }
+
+ private void OnScrollAnimationEnded(object source, ScrollEventArgs args)
+ {
+ Tizen.Log.Fatal("NUI.Components", "OnScrollAnimationEnded event !!!!!");
+ ManualTest.Confirm();
+ _window.Remove(_scroll);
+ }
+
+ private void OnScrollDragStarted(object source, ScrollEventArgs args)
+ {
+ Tizen.Log.Fatal("NUI.Components", "OnScrollDragStarted event !!!!!");
+ ManualTest.Confirm();
+ _window.Remove(_scroll);
+ }
+
+ private void OnScrollDragEnded(object source, ScrollEventArgs args)
+ {
+ Tizen.Log.Fatal("NUI.Components", "OnScrollDragEnded event !!!!!");
+ ManualTest.Confirm();
+ _window.Remove(_scroll);
+ }
+
+ private void CreateScrollableBase(ScrollableBase scroll)
+ {
+ scroll.WidthSpecification = 360;
+ scroll.HeightSpecification = 200;
+ scroll.ScrollingDirection = ScrollableBase.Direction.Horizontal;
+
+ scroll.Layout = new LinearLayout()
+ {
+ LinearOrientation = LinearLayout.Orientation.Horizontal,
+ };
+ _view.Add(scroll);
+
+ for(int i = 0; i <5 ; i++)
+ {
+ scroll.Add(new TextLabel()
+ {
+ Text = "Page["+i+"]",
+ VerticalAlignment = VerticalAlignment.Center,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ WidthSpecification = 360,
+ HeightSpecification = LayoutParamPolicies.MatchParent,
+ BackgroundColor = i % 2 == 0 ? Color.Cyan : Color.Magenta,
+ });
+ }
+ }
+
+ private void CreateView(string information)
+ {
+ _information = new TextLabel();
+ _information.Text = information;
+ _information.PointSize = _pointSize;
+ _information.PositionUsesPivotPoint = true;
+ _information.PivotPoint = Tizen.NUI.PivotPoint.Center;
+ _information.ParentOrigin = Tizen.NUI.ParentOrigin.Center;
+ _information.WidthSpecification = 360;
+ _information.MultiLine = true;
+ _information.BackgroundColor = Color.Cyan;
+ _view.Add(_information);
+ _testPage.ExecuteTC(_view);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test: Scrolling. Check whether the Scrolling event will be triggered or not when user try scrolling")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.Scrolling E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Minho Sun, minho.sun@samsung.com")]
+ [Precondition(1, "If test on TV, prepare mouse and connect to TV.")]
+ [Step(1, "If test on TV, connect the mouse to the TV")]
+ [Step(2, "Click run button to run TC")]
+ [Step(3, "Scrolling ScrollalbleBase left or right")]
+ [Step(4, "TC will pass when Scrolling is started")]
+ [Postcondition(1, "NA")]
+ public async Task Scrolling_CB()
+ {
+ if (_isWearable)
+ {
+ _wearTestPage.ExecuteTC(_label);
+ await ManualTest.WaitForConfirm();
+ _wearTestPage.ClearTestCase(_label);
+ }
+ else
+ {
+ CreateView("Scroll Horizontally");
+ _scroll = new ScrollableBase();
+ CreateScrollableBase(_scroll);
+ _scroll.Scrolling += OnScrolling;
+ // Waits for user confirmation.
+ await ManualTest.WaitForConfirm();
+ _scroll.Scrolling -= OnScrolling;
+ _testPage.ClearTestCase(_view);
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test: ScrollAnimationStarted. Check whether the ScrollAnimationStarted event will be triggered or not when ScrollableBase plays ScrollAnimation after user panning")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.ScrollAnimationStarted E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Minho Sun, minho.sun@samsung.com")]
+ [Precondition(1, "If test on TV, prepare mouse and connect to TV.")]
+ [Step(1, "If test on TV, connect the mouse to the TV")]
+ [Step(2, "Click run button to run TC")]
+ [Step(3, "Flick ScrollableBase once right to left.")]
+ [Step(4, "TC will pass when ScrollAnimation is started")]
+ [Postcondition(1, "NA")]
+ public async Task ScrollAnimationStarted_CB()
+ {
+ if (_isWearable)
+ {
+ _wearTestPage.ExecuteTC(_label);
+ await ManualTest.WaitForConfirm();
+ _wearTestPage.ClearTestCase(_label);
+ }
+ else
+ {
+ CreateView("Flick Horizontally");
+ _scroll = new ScrollableBase();
+ CreateScrollableBase(_scroll);
+ _scroll.ScrollAnimationStarted += OnScrollAnimationStarted;
+ // Waits for user confirmation.
+ await ManualTest.WaitForConfirm();
+ _scroll.ScrollAnimationStarted -= OnScrollAnimationStarted;
+ _testPage.ClearTestCase(_view);
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test: ScrollAnimationEnded. Check whether the ScrollAnimationEnded event will be triggered or not when ScrollableBase stops ScrollAnimation")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.ScrollAnimationEnded E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Minho Sun, minho.sun@samsung.com")]
+ [Precondition(1, "If test on TV, prepare mouse and connect to TV.")]
+ [Step(1, "If test on TV, connect the mouse to the TV")]
+ [Step(2, "Click run button to run TC")]
+ [Step(3, "Flick ScrollableBase once right to left.")]
+ [Step(4, "TC will pass when ScrollAnimation is finished")]
+ [Postcondition(1, "NA")]
+ public async Task ScrollAnimationEnded_CB()
+ {
+ if (_isWearable)
+ {
+ _wearTestPage.ExecuteTC(_label);
+ await ManualTest.WaitForConfirm();
+ _wearTestPage.ClearTestCase(_label);
+ }
+ else
+ {
+ CreateView("Flick Horizontally");
+ _scroll = new ScrollableBase();
+ CreateScrollableBase(_scroll);
+ _scroll.ScrollAnimationEnded += OnScrollAnimationEnded;
+ // Waits for user confirmation.
+ await ManualTest.WaitForConfirm();
+ _scroll.ScrollAnimationEnded -= OnScrollAnimationEnded;
+ _testPage.ClearTestCase(_view);
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test: ScrollDragStarted. Check whether the ScrollDragStarted event will be triggered or not when user starts panning")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.ScrollDragStarted E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Minho Sun, minho.sun@samsung.com")]
+ [Precondition(1, "If test on TV, prepare mouse and connect to TV.")]
+ [Step(1, "If test on TV, connect the mouse to the TV")]
+ [Step(2, "Click run button to run TC")]
+ [Step(3, "Try scrolling")]
+ [Step(4, "TC will pass when Scrolling is started")]
+ [Postcondition(1, "NA")]
+ public async Task ScrollDragStarted_CB()
+ {
+ if (_isWearable)
+ {
+ _wearTestPage.ExecuteTC(_label);
+ await ManualTest.WaitForConfirm();
+ _wearTestPage.ClearTestCase(_label);
+ }
+ else
+ {
+ CreateView("Scroll Horizontally");
+ _scroll = new ScrollableBase();
+ CreateScrollableBase(_scroll);
+ _scroll.ScrollDragStarted += OnScrollDragStarted;
+ // Waits for user confirmation.
+ await ManualTest.WaitForConfirm();
+ _scroll.ScrollDragStarted -= OnScrollDragStarted;
+ _testPage.ClearTestCase(_view);
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test: ScrollDragEnded. Check whether the ScrollDragEnded event will be triggered or not when user ends panning")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.ScrollDragEnded E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Minho Sun, minho.sun@samsung.com")]
+ [Precondition(1, "If test on TV, prepare mouse and connect to TV.")]
+ [Step(1, "If test on TV, connect the mouse to the TV")]
+ [Step(2, "Click run button to run TC")]
+ [Step(3, "Try scrolling")]
+ [Step(4, "TC will pass when finger is detached from display")]
+ [Postcondition(1, "NA")]
+ public async Task ScrollDragEnded_CB()
+ {
+ if (_isWearable)
+ {
+ _wearTestPage.ExecuteTC(_label);
+ await ManualTest.WaitForConfirm();
+ _wearTestPage.ClearTestCase(_label);
+ }
+ else
+ {
+ CreateView("Scroll Horizontally");
+ _scroll = new ScrollableBase();
+ CreateScrollableBase(_scroll);
+ _scroll.ScrollDragEnded += OnScrollDragEnded;
+ // Waits for user confirmation.
+ await ManualTest.WaitForConfirm();
+ _scroll.ScrollDragEnded -= OnScrollDragEnded;
+ _testPage.ClearTestCase(_view);
+ }
+ }
+ }
+}
+
+
+
--- /dev/null
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using Tizen.NUI;
+using Tizen.NUI.Components;
+using System.Runtime.InteropServices;
+using System.Threading.Tasks;
+using Tizen.NUI.Components.Test;
+using Tizen.NUI.BaseComponents;
+using global::System.Resources;
+
+namespace Tizen.NUI.Components.Tests
+{
+ [TestFixture]
+ [Description("Tizen.NUI.Components. ScrollableBase Tests")]
+ public class ScrollableBaseTests
+ {
+ private const string TAG = "Components";
+ private string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png";
+ private static bool _flagOnThemeChangedEvent = false;
+
+ [SetUp]
+ public void Init()
+ {
+ Tizen.Log.Info(TAG, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ Tizen.Log.Info(TAG, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test ScrollableBase empty constructor. Check it has been created")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.ScrollableBase C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("COVPARAM", "")]
+ [Property("AUTHOR", "Minho Sun, minho.sun@samsung.com")]
+ public void ScrollableBase_CHECK_VALUE()
+ {
+ /* TEST CODE */
+ var scrollableBase = new Components.ScrollableBase();
+ Assert.IsNotNull(scrollableBase, "Should be not null");
+ Assert.IsInstanceOf<Components.ScrollableBase>(scrollableBase, "Should be an instance of ScrollableBase!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test ScrollEnabled. Check whether ScrollEnabled is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.ScrollEnabled A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Minho Sun, minho.sun@samsung.com")]
+ public void ScrollEnabled_SET_GET_VALUE()
+ {
+ /* TEST CODE */
+ var scrollable = new Components.ScrollableBase();
+ Assert.IsNotNull(scrollable, "Should be not null");
+ Assert.IsInstanceOf<Components.ScrollableBase>(scrollable, "Should be equal!");
+ scrollable.ScrollEnabled = true;
+ Assert.AreEqual(true, scrollable.ScrollEnabled, "Should be equals to the set value");
+ scrollable.ScrollEnabled = false;
+ Assert.AreEqual(false, scrollable.ScrollEnabled, "Should be equals to the set value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test SnapToPage. Check whether SnapToPage is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.SnapToPage A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Minho Sun, minho.sun@samsung.com")]
+ public void SnapToPage_SET_GET_VALUE()
+ {
+ /* TEST CODE */
+ var scrollable = new Components.ScrollableBase();
+ Assert.IsNotNull(scrollable, "Should be not null");
+ Assert.IsInstanceOf<Components.ScrollableBase>(scrollable, "Should be equal!");
+ Assert.AreEqual(false, scrollable.SnapToPage, "Should be equals to the set value");
+ scrollable.SnapToPage = true;
+ Assert.AreEqual(true, scrollable.SnapToPage, "Should be equals to the set value");
+ scrollable.SnapToPage = false;
+ Assert.AreEqual(false, scrollable.SnapToPage, "Should be equals to the set value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Text. Check whether Text is readable.")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.CurrentPage A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Minho Sun, minho.sun@samsung.com")]
+ public void CurrentPage_CHECK_GET_VALUE()
+ {
+ /* TEST CODE */
+ var scrollable = new Components.ScrollableBase();
+ Assert.IsNotNull(scrollable, "Should be not null");
+ Assert.IsInstanceOf<Components.ScrollableBase>(scrollable, "Should be equal!");
+
+ var currentPage = scrollable.CurrentPage;
+ Assert.AreEqual(0, currentPage, "Should be equals to 0");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test ScrollDuration. Check whether ScrollDuration is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.ScrollDuration A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Minho Sun, minho.sun@samsung.com")]
+ public void ScrollDuration_SET_GET_VALUE()
+ {
+ /* TEST CODE */
+ var scrollable = new Components.ScrollableBase();
+ Assert.IsNotNull(scrollable, "Should be not null");
+ Assert.IsInstanceOf<Components.ScrollableBase>(scrollable, "Should be equal!");
+ Assert.AreEqual(125, scrollable.ScrollDuration, "Should be equals to the set value");
+ scrollable.ScrollDuration = 400;
+ Assert.AreEqual(400, scrollable.ScrollDuration, "Should be equals to the set value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Verify ScrollDuration with out of bound value.")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.ScrollDuration A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PDV")]
+ [Property("AUTHOR", "Minho Sun, minho.sun@samsung.com")]
+ public void ScrollDuration_BELOW_MIN_VALUE()
+ {
+ var scrollable = new Components.ScrollableBase();
+ Assert.IsNotNull(scrollable, "Should be not null");
+ Assert.IsInstanceOf<Components.ScrollableBase>(scrollable, "Should be equal!");
+ scrollable.ScrollDuration = -1;
+ Assert.AreEqual(125, scrollable.ScrollDuration, "Should be equals to the default value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test ScrollAvailableArea. Check whether ScrollAvailableArea is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.ScrollAvailableArea A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Minho Sun, minho.sun@samsung.com")]
+ public void ScrollAvailableArea_SET_GET_VALUE()
+ {
+ /* TEST CODE */
+ var scrollable = new Components.ScrollableBase();
+ Assert.IsNotNull(scrollable, "Should be not null");
+ Assert.IsInstanceOf<Components.ScrollableBase>(scrollable, "Should be equal!");
+ scrollable.ScrollAvailableArea = new Vector2(0.0f, 100.0f);
+ Assert.AreEqual(0.0f, scrollable.ScrollAvailableArea.X, "Should be equals to the set value of ScrollAvailableArea.X");
+ Assert.AreEqual(100.0f, scrollable.ScrollAvailableArea.Y, "Should be equals to the set value of ScrollAvailableArea.Y");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Scrollbar. Check whether Scrollbar is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.Scrollbar A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Minho Sun, minho.sun@samsung.com")]
+ public void Scrollbar_SET_GET_VALUE()
+ {
+ /* TEST CODE */
+ var scrollable = new Components.ScrollableBase();
+ Assert.IsNotNull(scrollable, "Should be not null");
+ Assert.IsInstanceOf<Components.ScrollableBase>(scrollable, "Should be equal!");
+ var newScrollbar = new Scrollbar();
+ scrollable.Scrollbar = newScrollbar;
+ Assert.AreEqual(newScrollbar, scrollable.Scrollbar, "Should be equals to the set value of Scrollbar");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test HideScrollbar. Check whether HideScrollbar is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.HideScrollbar A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Minho Sun, minho.sun@samsung.com")]
+ public void HideScrollbar_SET_GET_VALUE()
+ {
+ /* TEST CODE */
+ var scrollable = new Components.ScrollableBase();
+ Assert.IsNotNull(scrollable, "Should be not null");
+ Assert.IsInstanceOf<Components.ScrollableBase>(scrollable, "Should be equal!");
+ scrollable.HideScrollbar = true;
+ Assert.AreEqual(true, scrollable.HideScrollbar, "Should be equals to the set value");
+ scrollable.HideScrollbar = false;
+ Assert.AreEqual(false, scrollable.HideScrollbar, "Should be equals to the set value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test ContentContainer. Check whether ContentContainer is readable.")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.ContentContainer A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Minho Sun, minho.sun@samsung.com")]
+ public void ContentContainer_CHECK_GET_VALUE()
+ {
+ /* TEST CODE */
+ var scrollable = new Components.ScrollableBase();
+ Assert.IsNotNull(scrollable, "Should be not null");
+ Assert.IsInstanceOf<Components.ScrollableBase>(scrollable, "Should be equal!");
+
+ Assert.IsNotNull(scrollable.ContentContainer, "Should be not null");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test DecelerationRate. Check whether DecelerationRate is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.DecelerationRate A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Minho Sun, minho.sun@samsung.com")]
+ public void DecelerationRate_SET_GET_VALUE()
+ {
+ /* TEST CODE */
+ var scrollable = new Components.ScrollableBase();
+ Assert.IsNotNull(scrollable, "Should be not null");
+ Assert.IsInstanceOf<Components.ScrollableBase>(scrollable, "Should be equal!");
+ Assert.AreEqual(0.998f, scrollable.DecelerationRate, "Should be equals to the set value");
+ scrollable.DecelerationRate = 0.99f;
+ Assert.AreEqual(0.99f, scrollable.DecelerationRate, "Should be equals to the set value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Verify DecelerationRate with out of bound value.")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.DecelerationRate A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PBM")]
+ [Property("AUTHOR", "Minho Sun, minho.sun@samsung.com")]
+ public void DecelerationRate_BELOW_MIN_VALUE()
+ {
+ var scrollable = new Components.ScrollableBase();
+ Assert.IsNotNull(scrollable, "Should be not null");
+ Assert.IsInstanceOf<Components.ScrollableBase>(scrollable, "Should be equal!");
+
+ scrollable.DecelerationRate = 0f;
+ Assert.AreEqual(0.998f, scrollable.DecelerationRate, "Should be equals to the default value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Verify DecelerationRate with out of bound value.")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.DecelerationRate A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PAM")]
+ [Property("AUTHOR", "Minho Sun, minho.sun@samsung.com")]
+ public void DecelerationRate_ABOVE_MAX_VALUE()
+ {
+ var scrollable = new Components.ScrollableBase();
+ Assert.IsNotNull(scrollable, "Should be not null");
+ Assert.IsInstanceOf<Components.ScrollableBase>(scrollable, "Should be equal!");
+
+ scrollable.DecelerationRate = 1.0f;
+ Assert.AreEqual(0.998f, scrollable.DecelerationRate, "Should be equals to the default value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test PageFlickThreshold. Check whether the default value of PageFlickThreshold is 0.4f.")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.PageFlickThreshold A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PDV")]
+ [Property("AUTHOR", "Zhou Lei, zhouleon.lei@samsung.com")]
+ public void PageFlickThreshold_DEFAULT_VALUE()
+ {
+ /* TEST CODE */
+ var scrollable = new Components.ScrollableBase();
+ Assert.IsNotNull(scrollable, "Should be not null");
+ Assert.IsInstanceOf<Components.ScrollableBase>(scrollable, "Should be equal!");
+ Assert.AreEqual(0.4f, scrollable.PageFlickThreshold, "Should be equals to the set value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test PageFlickThreshold. Check whether PageFlickThreshold is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.PageFlickThreshold A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Minho Sun, minho.sun@samsung.com")]
+ public void PageFlickThreshold_SET_GET_VALUE()
+ {
+ /* TEST CODE */
+ var scrollable = new Components.ScrollableBase();
+ Assert.IsNotNull(scrollable, "Should be not null");
+ Assert.IsInstanceOf<Components.ScrollableBase>(scrollable, "Should be equal!");
+ scrollable.PageFlickThreshold = 0.3f;
+ Assert.AreEqual(0.3f, scrollable.PageFlickThreshold, "Should be equals to the set value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Verify PageFlickThreshold with out of bound value.")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.PageFlickThreshold A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PAM")]
+ [Property("AUTHOR", "Minho Sun, minho.sun@samsung.com")]
+ public void PageFlickThreshold_ABOVE_MAX_VALUE()
+ {
+ var scrollable = new Components.ScrollableBase();
+ Assert.IsNotNull(scrollable, "Should be not null");
+ Assert.IsInstanceOf<Components.ScrollableBase>(scrollable, "Should be equal!");
+
+ scrollable.PageFlickThreshold = -1.0f;
+ Assert.AreEqual(0.4f, scrollable.PageFlickThreshold, "Should be equals to the default value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Layout. Check whether Layout is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.Layout A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Zhou Lei, zhouleon.lei@samsung.com")]
+ public void Layout_SET_GET_VALUE()
+ {
+ /* TEST CODE */
+ var scrollable = new Components.ScrollableBase();
+ Assert.IsNotNull(scrollable, "Should be not null");
+ Assert.IsInstanceOf<Components.ScrollableBase>(scrollable, "Should be equal!");
+ scrollable.Layout = new LayoutItem();
+ Assert.IsInstanceOf<NUI.LayoutItem>(scrollable.Layout, "Should be equal!");
+ Assert.IsNotNull(scrollable.Layout.MeasuredHeight, "Should be not null");
+ Assert.IsNotNull(scrollable.Layout.MeasuredWidth, "Should be not null");
+ Assert.IsNotNull(scrollable.Layout.Padding, "Should be not null");
+ Assert.IsNotNull(scrollable.Layout.Margin, "Should be not null");
+ Assert.IsNotNull(scrollable.Layout.Owner, "Should be not null");
+ Assert.IsNotNull(scrollable.Layout.SuggestedMinimumWidth, "Should be not null");
+ Assert.IsNotNull(scrollable.Layout.SuggestedMinimumHeight, "Should be not null");
+ Assert.AreEqual(false, scrollable.Layout.SetPositionByLayout, "Should be equals to the default value");
+ Assert.AreEqual(false, scrollable.Layout.LayoutWithTransition, "Should be equals to the default value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Children. Check whether Children is readable.")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.Children A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Zhou Lei, zhouleon.lei@samsung.com")]
+ public void Children_GET_VALUE()
+ {
+ /* TEST CODE */
+ var scrollable = new Components.ScrollableBase();
+ Assert.IsNotNull(scrollable, "Should be not null");
+ Assert.IsInstanceOf<Components.ScrollableBase>(scrollable, "Should be equal!");
+ Assert.IsNotNull(scrollable.Children, "Should be not null");
+ Assert.AreEqual(0, scrollable.Children.Count, "Should be equals to the set value");
+ scrollable.Add(new View());
+ Assert.AreEqual(1, scrollable.Children.Count, "Should be equals to the set value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test ScrollingDirection. Check whether the default value of Children is Vertical.")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.ScrollingDirection A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PDV")]
+ [Property("AUTHOR", "Zhou Lei, zhouleon.lei@samsung.com")]
+ public void ScrollingDirection_DEFAULT_VALUE()
+ {
+ /* TEST CODE */
+ var scrollable = new Components.ScrollableBase();
+ Assert.IsNotNull(scrollable, "Should be not null");
+ Assert.IsInstanceOf<Components.ScrollableBase>(scrollable, "Should be equal!");
+ Assert.AreEqual(ScrollableBase.Direction.Vertical, scrollable.ScrollingDirection, "Should be equals to the set value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test ScrollingDirection. Check whether Children is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.ScrollingDirection A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Zhou Lei, zhouleon.lei@samsung.com")]
+ public void ScrollingDirection_SET_GET_VALUE()
+ {
+ /* TEST CODE */
+ var scrollable = new Components.ScrollableBase();
+ Assert.IsNotNull(scrollable, "Should be not null");
+ Assert.IsInstanceOf<Components.ScrollableBase>(scrollable, "Should be equal!");
+ scrollable.ScrollingDirection = ScrollableBase.Direction.Vertical;
+ Assert.AreEqual(ScrollableBase.Direction.Vertical, scrollable.ScrollingDirection, "Should be equals to the set value");
+ scrollable.ScrollingDirection = ScrollableBase.Direction.Horizontal;
+ Assert.AreEqual(ScrollableBase.Direction.Horizontal, scrollable.ScrollingDirection, "Should be equals to the set value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Add. Check whether the count of child views is same as real result.")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.Add M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Zhou Lei, zhouleon.lei@samsung.com")]
+ public void Add_TEST()
+ {
+ /* TEST CODE */
+ try
+ {
+ var scrollable = new Components.ScrollableBase();
+ Assert.IsNotNull(scrollable, "Should be not null");
+ Assert.IsInstanceOf<Components.ScrollableBase>(scrollable, "Should be equal!");
+ Assert.AreEqual(0, scrollable.Children.Count, "Should be equals to 0");
+ scrollable.Add(new View());
+ Assert.AreEqual(1, scrollable.Children.Count, "Should be equals to 1");
+ }
+ catch (Exception e)
+ {
+ Tizen.Log.Error(TAG, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Remove. Check whether the count of child views is same as real result.")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.Remove M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Zhou Lei, zhouleon.lei@samsung.com")]
+ public void Remove_TEST()
+ {
+ /* TEST CODE */
+ try
+ {
+ var scrollable = new Components.ScrollableBase();
+ Assert.IsNotNull(scrollable, "Should be not null");
+ Assert.IsInstanceOf<Components.ScrollableBase>(scrollable, "Should be equal!");
+ var view = new View();
+ scrollable.Add(view);
+ Assert.AreEqual(1, scrollable.Children.Count, "Should be equals to 1");
+ scrollable.Remove(view);
+ Assert.AreEqual(0, scrollable.Children.Count, "Should be equals to 0");
+ }
+ catch (Exception e)
+ {
+ Tizen.Log.Error(TAG, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test ScrollTo. Check whether target position of ScrollTo is same as real result.")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.ScrollTo M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Minho Sun, minho.sun@samsung.com")]
+ public async Task ScrollTo_GET_VALUE()
+ {
+ /* TEST CODE */
+ var scrollable = new Components.ScrollableBase();
+ Assert.IsNotNull(scrollable, "Should be not null");
+ Assert.IsInstanceOf<Components.ScrollableBase>(scrollable, "Should be equal!");
+ scrollable.Add(new View(){
+ WidthSpecification = LayoutParamPolicies.MatchParent,
+ HeightSpecification = 800,
+ BackgroundColor = Color.Red,
+ });
+ Window.Instance.GetDefaultLayer().Add(scrollable);
+ await Task.Delay(900);
+
+ scrollable.ScrollTo(300.0f,true);
+
+ await Task.Delay(2000);
+ Assert.AreEqual(-300.0f, scrollable.ContentContainer.PositionY, "Should be equals to the set value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test ScrollToIndex. Check whether target position of ScrollToIndex is same as real result.")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.ScrollToIndex M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Minho Sun, minho.sun@samsung.com")]
+ public async Task ScrollToIndex_GET_VALUE()
+ {
+ /* TEST CODE */
+ var scrollable = new Components.ScrollableBase();
+ Assert.IsNotNull(scrollable, "Should be not null");
+ Assert.IsInstanceOf<Components.ScrollableBase>(scrollable, "Should be equal!");
+
+ scrollable.ScrollingDirection = ScrollableBase.Direction.Horizontal;
+ scrollable.Layout = new LinearLayout(){ LinearOrientation = LinearLayout.Orientation.Horizontal };
+ scrollable.SnapToPage = true;
+
+ for(int i = 0 ; i < 3 ; i++)
+ {
+ scrollable.Add(new View(){
+ Size = scrollable.Size,
+ BackgroundColor = i%2 == 0 ? Color.Red : Color.Blue,
+ });
+ }
+ Window.Instance.GetDefaultLayer().Add(scrollable);
+ await Task.Delay(900);
+
+ scrollable.ScrollToIndex(2);
+
+ await Task.Delay(2000);
+ Assert.AreEqual( -scrollable.Size.Width*2.0f, scrollable.ContentContainer.PositionY, "Should be equals to the set value");
+ }
+
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Dispose, try to dispose the ScrollableBase.")]
+ [Property("SPEC", "Tizen.NUI.Components.ScrollableBase.Dispose M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Minho Sun, minho.sun@samsung.com")]
+ public void Dispose_TEST()
+ {
+ /* TEST CODE */
+ try
+ {
+ ScrollableBase scrollable = new ScrollableBase();
+ Assert.IsNotNull(scrollable, "Should be not null");
+ Assert.IsInstanceOf<Components.ScrollableBase>(scrollable, "Should be equal!");
+ scrollable.Dispose();
+ }
+ catch (Exception e)
+ {
+ Tizen.Log.Error(TAG, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ }
+ }
+}