+++ /dev/null
-/*
- * Copyright (c) 2019 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.Linq;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Threading.Tasks;
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using Tizen.NUI;
-using Tizen.NUI.Binding;
-using Tizen.NUI.BaseComponents;
-using Tizen.NUI.Components;
-
-namespace Tizen.NUI.Components.Tests
-{
- [TestFixture]
- [Description("Tizen.NUI.Components.CollectionView test")]
- public class CollectionViewTests
- {
- private ManualTestComponents _testPage;
- private WearableManualTestNUI _wearTestPage;
- private View _view;
- private CollectionView _colView;
- private float _pointSize = 20.0f;
- private TestItem _firstItem;
- private TestItem _secondItem;
- private TestItem _confirmItem;
- private ItemSelectionMode _mode;
- 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();
- if (_isWearable)
- {
- _pointSize = 2.0f;
- _wearTestPage = WearableManualTestNUI.GetInstance();
- }
- else
- {
- _pointSize = ManualTest.GetPointSize();
- _testPage = ManualTestComponents.GetInstance();
- }
-
- _view = new View();
- _view.Focusable = true;
- _view.Position = new Position(0, Window.Instance.Size.Height * 0.41f);
- _view.Size = new Size(Window.Instance.Size.Width , Window.Instance.Size.Height * 0.26f);
- _view.Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical };
- _view.BackgroundColor = Color.LightGray;
- }
-
- [TearDown]
- public void Destroy()
- {
- LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST");
- }
-
- private CollectionView CreateMyCollectionView()
- {
- var colView = new CollectionView();
- Assert.IsNotNull(colView, "Should be not null");
- Assert.IsInstanceOf<Components.CollectionView>(colView, "Should return CollectionView instance");
- var source = TestSource.GetSimpleSource(100);
- Assert.IsNotNull(source, "Should be not null");
-
- _firstItem = source[0];
- _secondItem = source[1];
- _confirmItem = source[2];
-
- colView.ItemsSource = source;
- var layouter = new LinearLayouter();
- Assert.IsNotNull(layouter, "Should be not null");
- colView.ItemsLayouter = layouter;
- var template = new Binding.DataTemplate(() => {
- var item = new DefaultLinearItem();
- Assert.IsNotNull(item, "Should be not null");
- item.Label.SetBinding(TextLabel.TextProperty, "Name");
- item.WidthSpecification = LayoutParamPolicies.MatchParent;
- item.Clicked += OnClicked;
-
- return item;
- });
- Assert.IsNotNull(template, "Should be not null");
- colView.ItemTemplate = template;
- colView.ScrollingDirection = ScrollableBase.Direction.Vertical;
- colView.WidthSpecification = LayoutParamPolicies.MatchParent;
- colView.HeightSpecification = LayoutParamPolicies.MatchParent;
-
- _view.Add(colView);
-
- return colView;
- }
-
- public void OnSelectionChangedSingle(object sender, EventArgs e)
- {
- SelectionChangedEventArgs selEvt = e as SelectionChangedEventArgs;
- Assert.IsNotNull(selEvt, "Should be not null");
- TestItem prevSelection = null, curSelection = null;
- //Get previous Selected Item.
- if (selEvt.PreviousSelection.Count == 0) prevSelection = null;
- else
- {
- foreach(var item in selEvt.PreviousSelection)
- prevSelection = item as TestItem;
-
- if (prevSelection != null)
- {
- if (_firstItem == prevSelection)
- prevSelection.Name = "First Item";
- if (_secondItem == prevSelection)
- prevSelection.Name = "Second Item";
- if (_confirmItem == prevSelection)
- prevSelection.Name = "Confirm";
- else
- prevSelection.Name = "Test Item";
- }
- }
-
- //Get previous Selected Item.
- if (selEvt.CurrentSelection.Count == 0) curSelection = null;
- else
- {
- foreach(var item in selEvt.CurrentSelection)
- curSelection = item as TestItem;
- if (curSelection != null)
- {
- curSelection.Name = "Selected";
-
- if (_confirmItem == curSelection)
- ManualTest.Confirm();
- }
- }
- }
-
- public void OnSelectionChangedMultiple(object sender, EventArgs e)
- {
- SelectionChangedEventArgs selEvt = e as SelectionChangedEventArgs;
- Assert.IsNotNull(selEvt, "Should be not null");
- var prevSelection = new List<object>(selEvt.PreviousSelection);
- var newSelection = new List<object>(selEvt.CurrentSelection);
- prevSelection.Except(selEvt.CurrentSelection);
- newSelection.Except(selEvt.CurrentSelection);
- //Get previous Selected Item.
- if (prevSelection.Count != 0)
- {
- foreach(TestItem item in prevSelection)
- {
- if (item != null)
- {
- if (_firstItem == item)
- item.Name = "First Item";
- if (_secondItem == item)
- item.Name = "Second Item";
- if (_confirmItem == item)
- item.Name = "Confirm";
- else
- item.Name = "Test Item";
- }
- }
- }
-
- //Get previous Selected Item.
- if (newSelection.Count != 0)
- {
- foreach(TestItem item in newSelection)
- {
- if (item != null)
- {
- if (_confirmItem == item) ManualTest.Confirm();
- item.Name = "Selected";
- }
- }
- }
- }
-
- public void OnSelectionChangedNone(object sender, EventArgs e)
- {
- Assert.Fail("Selection Should not be called in mode None!");
- }
-
- public void OnClicked(object sender, EventArgs e)
- {
- View clickedView = sender as View;
- if (clickedView != null && clickedView.BindingContext == _confirmItem)
- ManualTest.Confirm();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test: Selection Single. Check whether the event will be triggered when user click the item and check Selection works properly as Single")]
- [Property("SPEC", "Tizen.NUI.Components.CollectionView.SelectionChanged E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- [Precondition(1, "If test on TV, prepare mouse and connect to TV.")]
- [Step(1, "Click run TC")]
- [Step(2, "Click(Touch) the first recyclerviewitem and check text is changed as selected.")]
- [Step(3, "Click(Touch) the second recyclerviewitem and check text is changed selected and previous item is unselected")]
- [Step(4, "Click(Touch) the same recyclerviewitem again and check item is unselected.")]
- [Step(5, "Click(Touch) the confirm recyclerviewitem.")]
- [Step(6, "TC will pass after touch or click.")]
- [Postcondition(1, "NA")]
- public async Task SelectionChanged_CB_Single()
- {
- _colView = CreateMyCollectionView();
-
- _colView.SelectionMode = ItemSelectionMode.Single;
- _colView.SelectionChanged += OnSelectionChangedSingle;
- Tizen.Log.Fatal("NUI.Components", "CollectionView Single Created!");
- if (_isWearable)
- {
- _wearTestPage.ExecuteTC(_view);
- }
- else
- {
- _testPage.ExecuteTC(_view);
- }
- await ManualTest.WaitForConfirm();
- _colView.SelectionChanged -= OnSelectionChangedSingle;
- if (_isWearable)
- {
- _wearTestPage.ClearTestCase(_view);
- }
- else
- {
- _testPage.ClearTestCase(_view);
- }
- }
-
-
- [Test]
- [Category("P1")]
- [Description("Test: Selection SingleAlways. Check whether the event will be triggered when user click the item and check Selection works properly as SingleAlways")]
- [Property("SPEC", "Tizen.NUI.Components.CollectionView.SelectionChanged E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- [Precondition(1, "If test on TV, prepare mouse and connect to TV.")]
- [Step(1, "Click run TC")]
- [Step(2, "Click(Touch) the first recyclerviewitem and check text is changed as selected.")]
- [Step(3, "Click(Touch) the second recyclerviewitem and check text is changed as selected and previous item is unselected.")]
- [Step(4, "Click(Touch) the same recyclerviewitem again and check item is selected still.")]
- [Step(5, "Click(Touch) the confirm recyclerviewitem.")]
- [Step(6, "TC will pass after touch or click.")]
- [Postcondition(1, "NA")]
- public async Task SelectionChanged_CB_SingleAlways()
- {
- _colView = CreateMyCollectionView();
-
- _colView.SelectionMode = ItemSelectionMode.SingleAlways;
- _colView.SelectionChanged += OnSelectionChangedSingle;
- if (_isWearable)
- {
- _wearTestPage.ExecuteTC(_view);
- }
- else
- {
- _testPage.ExecuteTC(_view);
- }
- await ManualTest.WaitForConfirm();
- _colView.SelectionChanged -= OnSelectionChangedSingle;
- if (_isWearable)
- {
- _wearTestPage.ClearTestCase(_view);
- }
- else
- {
- _testPage.ClearTestCase(_view);
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test: Selection Multiple. Check whether the event will be triggered when user click the item and check Selection works properly as Multiple")]
- [Property("SPEC", "Tizen.NUI.Components.CollectionView.SelectionChanged E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- [Precondition(1, "If test on TV, prepare mouse and connect to TV.")]
- [Step(1, "Click run TC")]
- [Step(2, "Click(Touch) the first recyclerviewitem and check text is changed as selected.")]
- [Step(3, "Click(Touch) the second recyclerviewitem and check text is changed as selected and previous selected item still selected.")]
- [Step(4, "Click(Touch) the same recyclerviewitem again and check item is unselected.")]
- [Step(5, "Click(Touch) the confirm recyclerviewitem.")]
- [Step(6, "TC will pass after touch or click.")]
- [Postcondition(1, "NA")]
- public async Task SelectionChanged_CB_Multiple()
- {
- _colView = CreateMyCollectionView();
-
- _colView.SelectionMode = ItemSelectionMode.Multiple;
- _colView.SelectionChanged += OnSelectionChangedMultiple;
- if (_isWearable)
- {
- _wearTestPage.ExecuteTC(_view);
- }
- else
- {
- _testPage.ExecuteTC(_view);
- }
- await ManualTest.WaitForConfirm();
- _colView.SelectionChanged -= OnSelectionChangedMultiple;
- if (_isWearable)
- {
- _wearTestPage.ClearTestCase(_view);
- }
- else
- {
- _testPage.ClearTestCase(_view);
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test: Selection None. Check whether the event will not be triggered when user click the item and check Selection works properly as None")]
- [Property("SPEC", "Tizen.NUI.Components.CollectionView.SelectionChanged E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- [Precondition(1, "If test on TV, prepare mouse and connect to TV.")]
- [Step(1, "Click run TC")]
- [Step(2, "Click(Touch) the first recyclerviewitem and check selection is not happen.")]
- [Step(3, "Click(Touch) the confirm recyclerviewitem.")]
- [Step(4, "TC will pass after touch or click.")]
- [Postcondition(1, "NA")]
- public async Task SelectionChanged_CB_None()
- {
- _colView = CreateMyCollectionView();
-
- _colView.SelectionMode = ItemSelectionMode.None;
- _colView.SelectionChanged += OnSelectionChangedNone;
- if (_isWearable)
- {
- _wearTestPage.ExecuteTC(_view);
- }
- else
- {
- _testPage.ExecuteTC(_view);
- }
- await ManualTest.WaitForConfirm();
- _colView.SelectionChanged -= OnSelectionChangedNone;
- if (_isWearable)
- {
- _wearTestPage.ClearTestCase(_view);
- }
- else
- {
- _testPage.ClearTestCase(_view);
- }
- }
-
- public class TestItem : global::System.ComponentModel.INotifyPropertyChanged
- {
- int index;
- string name;
- public event global::System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
- private void OnPropertyChanged(string propertyName)
- {
- PropertyChanged?.Invoke(this, new global::System.ComponentModel.PropertyChangedEventArgs(propertyName));
- }
-
- public TestItem(int itemIndex, string itemName) { Index = itemIndex; Name = itemName; }
- public int Index {
- get => index;
- set
- {
- index = value;
- OnPropertyChanged("Name");
- }
- }
- public string Name {
- get => name;
- set
- {
- name = value;
- OnPropertyChanged("Name");
- }
- }
- }
-
- static internal class TestSource
- {
- public static ObservableCollection<TestItem> GetSimpleSource(int count)
- {
- var result = new ObservableCollection<TestItem>();
-
- result.Add(new TestItem(0, "First Item"));
- result.Add(new TestItem(1, "Second Item"));
- result.Add(new TestItem(2, "Confirm"));
-
- for (int i = 3; i < count; i++)
- result.Add(new TestItem(i, "Test Item"));
- return result;
- }
- }
- }
-}
-
-
+++ /dev/null
-/*
- * Copyright (c) 2019 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.RecyclerViewItem test")]
- public class RecyclerViewItemTests
- {
- private ManualTestComponents _testPage;
- private WearableManualTestNUI _wearTestPage;
- private View _view;
- private RecyclerViewItem _recyclerviewitem;
- private TextLabel _label;
- private float _pointSize = 20.0f;
- 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();
- if (_isWearable)
- {
- _pointSize = 2.0f;
- _wearTestPage = WearableManualTestNUI.GetInstance();
- }
- else
- {
- _pointSize = ManualTest.GetPointSize();
- _testPage = ManualTestComponents.GetInstance();
- }
-
- _view = new View();
- _view.Focusable = true;
- _view.Position = new Position(Window.Instance.Size.Width * 0.45f, Window.Instance.Size.Height * 0.5f);
- _view.Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Horizontal };
- }
-
- [TearDown]
- public void Destroy()
- {
- LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST");
- }
-
- public class MyRecyclerViewItem : RecyclerViewItem
- {
- public MyRecyclerViewItem(RecyclerViewItemStyle st) : base(st) { }
- public MyRecyclerViewItem() : base() { }
-
- protected override void OnClicked(ClickedEventArgs eventArgs)
- {
- ManualTest.Confirm();
- }
- }
-
- private void CreateMyRecyclerViewItem(RecyclerViewItem item)
- {
- Assert.IsNotNull(item, "Should be not null");
- Assert.IsInstanceOf<Components.RecyclerViewItem>(item, "Should return RecyclerViewItem instance");
- item.Focusable = true;
- item.Size = new Size(Window.Instance.Size.Width * 0.1f, Window.Instance.Size.Height * 0.0462f);
- item.BackgroundImage = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/rectangle_toggle_item_normal.png";
- item.BackgroundImageBorder = new Rectangle(5, 5, 5, 5);
- _view.Add(item);
- }
-
- public void OnClicked(object sender, EventArgs e)
- {
- _label.Text = "Clicked";
- ManualTest.Confirm();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test: Click. Check whether the event will be triggered when user click the recyclerviewitem")]
- [Property("SPEC", "Tizen.NUI.Components.RecyclerViewItem.Clicked E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- [Precondition(1, "If test on TV, prepare mouse and connect to TV.")]
- [Step(1, "Click run TC")]
- [Step(2, "Click(Touch) the recyclerviewitem.")]
- [Step(3, "TC will pass after touch or click.")]
- [Postcondition(1, "NA")]
- public async Task Clicked_CB()
- {
- _recyclerviewitem = new RecyclerViewItem(new RecyclerViewItemStyle());
- CreateMyRecyclerViewItem(_recyclerviewitem);
-
- _label = new TextLabel{
- PositionUsesPivotPoint = true,
- ParentOrigin = NUI.ParentOrigin.Center,
- PivotPoint = NUI.PivotPoint.Center,
- Text = "Click me!",
- PointSize = _pointSize
- };
- _recyclerviewitem.Add(_label);
- if (_isWearable)
- {
- _wearTestPage.ExecuteTC(_view);
- }
- else
- {
- _testPage.ExecuteTC(_view);
- }
- FocusManager.Instance.SetCurrentFocusView(_recyclerviewitem);
- _recyclerviewitem.Clicked += OnClicked;
- await ManualTest.WaitForConfirm();
- _recyclerviewitem.Clicked -= OnClicked;
- if (_isWearable)
- {
- _wearTestPage.ClearTestCase(_view);
- }
- else
- {
- _testPage.ClearTestCase(_view);
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test: OnClick. Check whether function will be triggered when user click the recyclerviewitem")]
- [Property("SPEC", "Tizen.NUI.Components.RecyclerViewItem.OnClicked M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- [Precondition(1, "If test on TV, prepare mouse and connect to TV.")]
- [Step(1, "Click run TC")]
- [Step(2, "Click(Touch) the recyclerviewitem.")]
- [Step(3, "TC will pass after touch or click.")]
- [Postcondition(1, "NA")]
- public async Task OnClicked_TEST()
- {
- _recyclerviewitem = new MyRecyclerViewItem();
- CreateMyRecyclerViewItem(_recyclerviewitem);
-
- _label = new TextLabel{
- PositionUsesPivotPoint = true,
- ParentOrigin = NUI.ParentOrigin.Center,
- PivotPoint = NUI.PivotPoint.Center,
- Text = "Click me!",
- PointSize = _pointSize
- };
- _recyclerviewitem.Add(_label);
- if (_isWearable)
- {
- _wearTestPage.ExecuteTC(_view);
- }
- else
- {
- _testPage.ExecuteTC(_view);
- }
- FocusManager.Instance.SetCurrentFocusView(_recyclerviewitem);
- await ManualTest.WaitForConfirm();
- if (_isWearable)
- {
- _wearTestPage.ClearTestCase(_view);
- }
- else
- {
- _testPage.ClearTestCase(_view);
- }
- }
-
- }
-}
-
-
-
+++ /dev/null
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using System;
-using System.Collections.Generic;
-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.CollectionView Tests")]
- public class CollectionViewTests
- {
- private const string TAG = "Components";
- private string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png";
-
- [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 CollectionView empty constructor. Check it has been triggered")]
- [Property("SPEC", "Tizen.NUI.Components.CollectionView.CollectionView C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void CollectionView_CHECK_VALUE()
- {
- /* TEST CODE */
- var CollectionView = new Components.CollectionView();
- Assert.IsNotNull(CollectionView, "Should be not null");
- Assert.IsInstanceOf<Components.CollectionView>(CollectionView, "Should be an instance of CollectionView!");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test CollectionView constructor using IEnumerable. Check it has been triggered")]
- [Property("SPEC", "Tizen.NUI.Components.CollectionView.CollectionView C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("COVPARAM", "IEnumerable")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void CollectionView_INIT_WITH_ITEMSSOURCE()
- {
- /* TEST CODE */
- var source = TestSource.GetSimpleSource(10);
- var CollectionView = new CollectionView(source);
- Assert.IsNotNull(CollectionView, "Should be not null!");
- Assert.IsInstanceOf<CollectionView>(CollectionView, "Should be an instance of CollectionView!");
- Assert.IsNotNull(CollectionView.ItemsSource, "Should be not null!");
- Assert.AreEqual(source, CollectionView.ItemsSource, "Should be equal!");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test CollectionView ItemsSource. Check it has been triggered")]
- [Property("SPEC", "Tizen.NUI.Components.CollectionView.ItemsSource A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void ItemsSource_SET_GET_VALUE()
- {
- /* TEST CODE */
- var CollectionView = new Components.CollectionView();
- Assert.IsNotNull(CollectionView, "Should be not null");
- Assert.IsInstanceOf<Components.CollectionView>(CollectionView, "Should be equal!");
- var source = TestSource.GetSimpleSource(10);
- Assert.IsNotNull(source, "Should be not null");
- CollectionView.ItemsSource = source;
- Assert.AreEqual(source, CollectionView.ItemsSource, "Should be equals to the set value");
- CollectionView.ItemsSource = null;
- Assert.AreEqual(null, CollectionView.ItemsSource, "Should be equals to the set value");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test CollectionView ItemsLayouter. Check it has been triggered")]
- [Property("SPEC", "Tizen.NUI.Components.CollectionView.ItemsLayouter A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void ItemsLayouter_SET_GET_VALUE()
- {
- /* TEST CODE */
- var CollectionView = new Components.CollectionView();
- Assert.IsNotNull(CollectionView, "Should be not null");
- Assert.IsInstanceOf<Components.CollectionView>(CollectionView, "Should be equal!");
- var Layouter = new Components.LinearLayouter();
- Assert.IsNotNull(Layouter, "Should be not null");
- Assert.IsInstanceOf<Components.LinearLayouter>(Layouter, "Should be LinearLayouter class");
- CollectionView.ItemsLayouter = Layouter;
- Assert.AreEqual(Layouter, CollectionView.ItemsLayouter, "Should be equals to the set value");
- CollectionView.ItemsLayouter = null;
- Assert.AreEqual(null, CollectionView.ItemsLayouter, "Should be equals to the set value");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test CollectionView ItemTemplate. Check it has been triggered")]
- [Property("SPEC", "Tizen.NUI.Components.CollectionView.ItemTemplate A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void ItemTemplate_SET_GET_VALUE()
- {
- /* TEST CODE */
- var CollectionView = new Components.CollectionView();
- Assert.IsNotNull(CollectionView, "Should be not null");
- Assert.IsInstanceOf<Components.CollectionView>(CollectionView, "Should be equal!");
- var itemTemplate = new Binding.DataTemplate(() => {
- return new Components.DefaultLinearItem();
- });
- Assert.IsNotNull(itemTemplate, "Should be not null");
- CollectionView.ItemTemplate = itemTemplate;
- Assert.AreEqual(itemTemplate, CollectionView.ItemTemplate, "Should be equals to the set value");
- CollectionView.ItemTemplate = null;
- Assert.AreEqual(null, CollectionView.ItemTemplate, "Should be equals to the set value");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test CollectionView Header. Check it has been triggered")]
- [Property("SPEC", "Tizen.NUI.Components.CollectionView.Header A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void Header_SET_GET_VALUE()
- {
- /* TEST CODE */
- var CollectionView = new Components.CollectionView();
- Assert.IsNotNull(CollectionView, "Should be not null");
- Assert.IsInstanceOf<Components.CollectionView>(CollectionView, "Should be equal!");
- var header = new Components.DefaultTitleItem();
- Assert.IsNotNull(header, "Should be not null");
- CollectionView.Header = header;
- Assert.AreEqual(header, CollectionView.Header, "Should be equals to the set value");
- CollectionView.Header = null;
- Assert.AreEqual(null, CollectionView.Header, "Should be equals to the set value");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test CollectionView Footer. Check it has been triggered")]
- [Property("SPEC", "Tizen.NUI.Components.CollectionView.Footer A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void Footer_SET_GET_VALUE()
- {
- /* TEST CODE */
- var CollectionView = new Components.CollectionView();
- Assert.IsNotNull(CollectionView, "Should be not null");
- Assert.IsInstanceOf<Components.CollectionView>(CollectionView, "Should be equal!");
- var footer = new Components.DefaultTitleItem();
- Assert.IsNotNull(footer, "Should be not null");
- CollectionView.Footer = footer;
- Assert.AreEqual(footer, CollectionView.Footer, "Should be equals to the set value");
- CollectionView.Footer = null;
- Assert.AreEqual(null, CollectionView.Footer, "Should be equals to the set value");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test CollectionView ScrollingDirection. Check it has been triggered")]
- [Property("SPEC", "Tizen.NUI.Components.CollectionView.ScrollingDirection A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void ScrollingDirection_SET_GET_VALUE()
- {
- /* TEST CODE */
- var CollectionView = new Components.CollectionView();
- Assert.IsNotNull(CollectionView, "Should be not null");
- Assert.IsInstanceOf<Components.CollectionView>(CollectionView, "Should be equal!");
- CollectionView.ScrollingDirection = Components.ScrollableBase.Direction.Horizontal;
- Assert.AreEqual(Components.ScrollableBase.Direction.Horizontal, CollectionView.ScrollingDirection, "Should be equals to the set value");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test CollectionView SelectionMode. Check it has been triggered")]
- [Property("SPEC", "Tizen.NUI.Components.CollectionView.SelectionMode A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void SelectionMode_GET_VALUE()
- {
- /* TEST CODE */
- var CollectionView = new Components.CollectionView();
- Assert.IsNotNull(CollectionView, "Should be not null");
- Assert.IsInstanceOf<Components.CollectionView>(CollectionView, "Should be equal!");
- CollectionView.SelectionMode = Components.ItemSelectionMode.Single;
- Assert.AreEqual(Components.ItemSelectionMode.Single, CollectionView.SelectionMode, "Should be equals to the set value");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test CollectionView SelectedItem. Check it has been triggered")]
- [Property("SPEC", "Tizen.NUI.Components.CollectionView.SelectedItem A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void SelectedItem_SET_GET_VALUE()
- {
- /* TEST CODE */
- var CollectionView = new Components.CollectionView();
- Assert.IsNotNull(CollectionView, "Should be not null");
- Assert.IsInstanceOf<Components.CollectionView>(CollectionView, "Should be equal!");
- var source = TestSource.GetSimpleSource(10);
- Assert.IsNotNull(source, "Should be not null");
- CollectionView.ItemsSource = source;
- var selectedItem = source[0];
- Assert.IsNotNull(selectedItem, "Should be not null");
- CollectionView.SelectedItem = selectedItem;
- Assert.AreEqual(selectedItem, CollectionView.SelectedItem, "Should be equals to the set value");
- CollectionView.SelectedItem = null;
- Assert.AreEqual(null, CollectionView.SelectedItem, "Should be equals to the set value");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test CollectionView SelectedItems. Check it has been triggered")]
- [Property("SPEC", "Tizen.NUI.Components.CollectionView.SelectedItems A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void SelectedItems_GET_VALUE()
- {
- /* TEST CODE */
- var CollectionView = new Components.CollectionView();
- Assert.IsNotNull(CollectionView, "Should be not null");
- Assert.IsInstanceOf<Components.CollectionView>(CollectionView, "Should be equal!");
- CollectionView.SelectionMode = Components.ItemSelectionMode.Multiple;
- var source = TestSource.GetSimpleSource(10);
- Assert.IsNotNull(source, "Should be not null");
- CollectionView.ItemsSource = source;
- IList<object> newSelection = new List<object>();
- for (int i = 0; i < 3; i++)
- {
- newSelection.Add(source[i]);
- }
- Assert.IsNotNull(newSelection, "Should be not null");
- CollectionView.UpdateSelectedItems(newSelection);
- Assert.IsNotNull(CollectionView.SelectedItems, "Should be not null");
- var selectedItems = CollectionView.SelectedItems;
- Assert.IsNotNull(selectedItems, "Should be not null");
- for (int i = 0; i < 3; i++)
- {
- Assert.AreEqual(newSelection[i], selectedItems[i], "Should be equals");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test CollectionView UpdateSelectedItems. Check it has been triggered")]
- [Property("SPEC", "Tizen.NUI.Components.CollectionView.UpdateSelectedItems M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void UpdateSelectedItems_SET_VALUE()
- {
- /* TEST CODE */
- var CollectionView = new Components.CollectionView();
- Assert.IsNotNull(CollectionView, "Should be not null");
- Assert.IsInstanceOf<Components.CollectionView>(CollectionView, "Should be equal!");
- CollectionView.SelectionMode = Components.ItemSelectionMode.Multiple;
- var source = TestSource.GetSimpleSource(10);
- Assert.IsNotNull(source, "Should be not null");
- CollectionView.ItemsSource = source;
- IList<object> newSelection = new List<object>();
- for (int i = 0; i < 3; i++)
- {
- newSelection.Add(source[i]);
- }
- Assert.IsNotNull(newSelection, "Should be not null");
- CollectionView.UpdateSelectedItems(newSelection);
- Assert.IsNotNull(CollectionView.SelectedItems, "Should be not null");
- var selectedItems = CollectionView.SelectedItems;
- Assert.IsNotNull(selectedItems, "Should be not null");
- for (int i = 0; i < 3; i++)
- {
- Assert.AreEqual(newSelection[i], selectedItems[i], "Should be equals");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test ScrollTo. Check whether target position of ScrollTo is same as real result.")]
- [Property("SPEC", "Tizen.NUI.Components.CollectionView.ScrollTo M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("COVPARAM", "Single, bool")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public async Task ScrollTo_TEST()
- {
- /* TEST CODE */
- var CollectionView = new Components.CollectionView();
- Assert.IsNotNull(CollectionView, "Should be not null");
- Assert.IsInstanceOf<Components.CollectionView>(CollectionView, "Should be equal!");
- CollectionView.Size = new Size(100, 100);
- CollectionView.ScrollingDirection = ScrollableBase.Direction.Vertical;
- var source = TestSource.GetSimpleSource(10);
- Assert.IsNotNull(source, "Should be not null");
- CollectionView.ItemsSource = source;
- var template = new Binding.DataTemplate(() =>
- {
- var item = new RecyclerViewItem();
- Assert.IsNotNull(item, "Should be not null");
- item.WidthSpecification = LayoutParamPolicies.MatchParent;
- item.HeightSpecification = 100;
- return item;
- });
- Assert.IsNotNull(template, "Should be not null");
- CollectionView.ItemTemplate = template;
- var layouter = new LinearLayouter();
- Assert.IsNotNull(layouter, "Should be not null");
- CollectionView.ItemsLayouter = layouter;
- Window.Instance.GetDefaultLayer().Add(CollectionView);
- await Task.Delay(900);
- CollectionView.ScrollTo(300.0f, false);
- await Task.Delay(2000);
- Assert.AreEqual(-300.0f, CollectionView.ContentContainer.PositionY, "Should be equals to the set value");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test ScrollTo Exception. Check Exception occurs when ItemsLayouter is null")]
- [Property("SPEC", "Tizen.NUI.Components.CollectionView.ScrollTo M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MEX")]
- [Property("COVPARAM", "Single, bool")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void ScrollTo_TEST_Exception()
- {
- /* TEST CODE */
- try
- {
- var CollectionView = new Components.CollectionView();
- Assert.IsNotNull(CollectionView, "Should be not null");
- Assert.IsInstanceOf<Components.CollectionView>(CollectionView, "Should be equal!");
- CollectionView.Size = new Size(100, 100);
- CollectionView.ScrollingDirection = ScrollableBase.Direction.Vertical;
- var source = TestSource.GetSimpleSource(10);
- Assert.IsNotNull(source, "Should be not null");
- CollectionView.ItemsSource = source;
- var template = new Binding.DataTemplate(() =>
- {
- var item = new RecyclerViewItem();
- Assert.IsNotNull(item, "Should be not null");
- item.WidthSpecification = LayoutParamPolicies.MatchParent;
- item.HeightSpecification = 100;
- return item;
- });
- Assert.IsNotNull(template, "Should be not null");
- CollectionView.ItemTemplate = template;
- Window.Instance.GetDefaultLayer().Add(CollectionView);
- CollectionView.ScrollTo(300.0f, false);
- }
- catch(Exception e)
- {
- Assert.Pass("Exception: passed!");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test ScrollTo on Item Index. Check whether target position of ScrollTo is same as real result.")]
- [Property("SPEC", "Tizen.NUI.Components.CollectionView.ScrollTo M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("COVPARAM", "int, bool, Tizen.NUI.Components.CollectionView.ItemScrollTo")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public async Task ScrollTo_TEST2()
- {
- /* TEST CODE */
- var CollectionView = new Components.CollectionView();
- Assert.IsNotNull(CollectionView, "Should be not null");
- Assert.IsInstanceOf<Components.CollectionView>(CollectionView, "Should be equal!");
- CollectionView.Size = new Size(100, 100);
- CollectionView.ScrollingDirection = ScrollableBase.Direction.Vertical;
- var source = TestSource.GetSimpleSource(10);
- Assert.IsNotNull(source, "Should be not null");
- CollectionView.ItemsSource = source;
- var template = new Binding.DataTemplate(() =>
- {
- var item = new RecyclerViewItem();
- Assert.IsNotNull(item, "Should be not null");
- item.WidthSpecification = LayoutParamPolicies.MatchParent;
- item.HeightSpecification = 100;
- return item;
- });
- Assert.IsNotNull(template, "Should be not null");
- CollectionView.ItemTemplate = template;
- var layouter = new LinearLayouter();
- Assert.IsNotNull(layouter, "Should be not null");
- CollectionView.ItemsLayouter = layouter;
- Window.Instance.GetDefaultLayer().Add(CollectionView);
- await Task.Delay(900);
- CollectionView.ScrollTo(3, false, Components.CollectionView.ItemScrollTo.Start); // 100 * 3 = 300
- await Task.Delay(2000);
- Assert.AreEqual(-300.0f, CollectionView.ContentContainer.PositionY, "Should be equals to the set value");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test ScrollTo on Item Index. Check whether target position of ScrollTo is same as real result.")]
- [Property("SPEC", "Tizen.NUI.Components.CollectionView.ScrollTo M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MEX")]
- [Property("COVPARAM", "int, bool, Tizen.NUI.Components.CollectionView.ItemScrollTo")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void ScrollTo_TEST2_Exception()
- {
- /* TEST CODE */
- try
- {
- var CollectionView = new Components.CollectionView();
- Assert.IsNotNull(CollectionView, "Should be not null");
- Assert.IsInstanceOf<Components.CollectionView>(CollectionView, "Should be equal!");
- CollectionView.Size = new Size(100, 100);
- CollectionView.ScrollingDirection = ScrollableBase.Direction.Vertical;
- var source = TestSource.GetSimpleSource(10);
- Assert.IsNotNull(source, "Should be not null");
- CollectionView.ItemsSource = source;
- var template = new Binding.DataTemplate(() =>
- {
- var item = new RecyclerViewItem();
- Assert.IsNotNull(item, "Should be not null");
- item.WidthSpecification = LayoutParamPolicies.MatchParent;
- item.HeightSpecification = 100;
- return item;
- });
- Assert.IsNotNull(template, "Should be not null");
- CollectionView.ItemTemplate = template;
- Window.Instance.GetDefaultLayer().Add(CollectionView);
- CollectionView.ScrollTo(3, false, Components.CollectionView.ItemScrollTo.Start); // 100 * 3 = 300
- }
- catch(Exception e)
- {
- Assert.Pass("Exception: passed!");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test OnRelayout. Check whether OnRelayout is called.")]
- [Property("SPEC", "Tizen.NUI.Components.CollectionView.OnRelayout M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public async Task OnRelayout_TEST()
- {
- /* TEST CODE */
- var CollectionView = new MyCollectionView();
- Assert.IsNotNull(CollectionView, "Should be not null");
- Assert.IsInstanceOf<Components.CollectionView>(CollectionView, "Should be equal!");
- CollectionView.Size = new Size(100, 100);
- CollectionView.ScrollingDirection = ScrollableBase.Direction.Vertical;
- var source = TestSource.GetSimpleSource(10);
- Assert.IsNotNull(source, "Should be not null");
- CollectionView.ItemsSource = source;
- var template = new Binding.DataTemplate(() =>
- {
- var item = new RecyclerViewItem();
- Assert.IsNotNull(item, "Should be not null");
- item.WidthSpecification = LayoutParamPolicies.MatchParent;
- item.HeightSpecification = 100;
- return item;
- });
- Assert.IsNotNull(template, "Should be not null");
- CollectionView.ItemTemplate = template;
- var layouter = new LinearLayouter();
- Assert.IsNotNull(layouter, "Should be not null");
- CollectionView.ItemsLayouter = layouter;
- Window.Instance.GetDefaultLayer().Add(CollectionView);
- await Task.Delay(900);
- Assert.AreEqual(true, CollectionView.IsOnRelayoutCalled, "Should be equals to the set value");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test OnScrolling. Check whether OnScrolling is called.")]
- [Property("SPEC", "Tizen.NUI.Components.CollectionView.OnScrolling M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public async Task OnScrolling_TEST()
- {
- /* TEST CODE */
- var CollectionView = new MyCollectionView();
- Assert.IsNotNull(CollectionView, "Should be not null");
- Assert.IsInstanceOf<Components.CollectionView>(CollectionView, "Should be equal!");
- CollectionView.Size = new Size(100, 100);
- CollectionView.ScrollingDirection = ScrollableBase.Direction.Vertical;
- var source = TestSource.GetSimpleSource(10);
- Assert.IsNotNull(source, "Should be not null");
- CollectionView.ItemsSource = source;
- var template = new Binding.DataTemplate(() =>
- {
- var item = new RecyclerViewItem();
- Assert.IsNotNull(item, "Should be not null");
- item.WidthSpecification = LayoutParamPolicies.MatchParent;
- item.HeightSpecification = 100;
- return item;
- });
- Assert.IsNotNull(template, "Should be not null");
- CollectionView.ItemTemplate = template;
- var layouter = new LinearLayouter();
- Assert.IsNotNull(layouter, "Should be not null");
- CollectionView.ItemsLayouter = layouter;
- Window.Instance.GetDefaultLayer().Add(CollectionView);
- await Task.Delay(900);
- CollectionView.ScrollTo(3, true, Components.CollectionView.ItemScrollTo.Start); // 100 * 3 = 300
- await Task.Delay(2000);
- Assert.AreEqual(true, CollectionView.IsOnScrollingCalled, "Should be equals to the set value");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test OnSelectionChanged. Check whether OnSelectionChanged is called.")]
- [Property("SPEC", "Tizen.NUI.Components.CollectionView.OnSelectionChanged M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public async Task OnSelectionChanged_TEST()
- {
- /* TEST CODE */
- var CollectionView = new MyCollectionView();
- Assert.IsNotNull(CollectionView, "Should be not null");
- Assert.IsInstanceOf<Components.CollectionView>(CollectionView, "Should be equal!");
- CollectionView.Size = new Size(100, 100);
- CollectionView.ScrollingDirection = ScrollableBase.Direction.Vertical;
- var source = TestSource.GetSimpleSource(10);
- Assert.IsNotNull(source, "Should be not null");
- CollectionView.ItemsSource = source;
- var template = new Binding.DataTemplate(() =>
- {
- var item = new RecyclerViewItem();
- Assert.IsNotNull(item, "Should be not null");
- item.WidthSpecification = LayoutParamPolicies.MatchParent;
- item.HeightSpecification = 100;
- return item;
- });
- Assert.IsNotNull(template, "Should be not null");
- CollectionView.ItemTemplate = template;
- var layouter = new LinearLayouter();
- Assert.IsNotNull(layouter, "Should be not null");
- CollectionView.ItemsLayouter = layouter;
- Window.Instance.GetDefaultLayer().Add(CollectionView);
- var selectedItem = source[0];
- await Task.Delay(900);
- Assert.IsNotNull(selectedItem, "Should be not null");
- CollectionView.SelectedItem = selectedItem;
- Assert.AreEqual(selectedItem, CollectionView.SelectedItem, "Should be equals to the set value");
- CollectionView.SelectedItem = null;
- Assert.AreEqual(null, CollectionView.SelectedItem, "Should be equals to the set value");
- Assert.AreEqual(true, CollectionView.IsOnSelectionChangedCalled, "Should be equals to the set value");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Dispose, try to dispose the CollectionView.")]
- [Property("SPEC", "Tizen.NUI.Components.CollectionView.Dispose M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MCST")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void Dispose_TEST()
- {
- /* TEST CODE */
- try
- {
- var CollectionView = new CollectionView();
- Assert.IsNotNull(CollectionView, "Should be not null");
- Assert.IsInstanceOf<Components.CollectionView>(CollectionView, "Should be equal!");
- CollectionView.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());
- }
- }
-
- public class MyCollectionView : CollectionView
- {
- public bool IsOnRelayoutCalled;
- public bool IsOnSelectionChangedCalled;
- public bool IsOnScrollingCalled;
-
- public override void OnRelayout(Vector2 size, RelayoutContainer container)
- {
- base.OnRelayout(size, container);
- IsOnRelayoutCalled = true;
- }
- protected override void OnSelectionChanged(SelectionChangedEventArgs args)
- {
- base.OnSelectionChanged(args);
- IsOnSelectionChangedCalled = true;
- }
-
- protected override void OnScrolling(object source, ScrollEventArgs args)
- {
- base.OnScrolling(source, args);
- IsOnScrollingCalled = true;
- }
- }
-
- public class TestItem
- {
- string name;
-
- public TestItem(string itemName)
- {
- Name = itemName;
- }
-
- public string Name
- {
- get
- {
- return name;
- }
- set
- {
- name = value;
- }
- }
- }
-
- public class TestGroup : List<TestItem>
- {
- string groupName;
-
- public TestGroup(string name)
- {
- groupName = name;
- }
-
- public string GroupName
- {
- get
- {
- return groupName;
- }
- set
- {
- groupName = value;
- }
- }
- }
-
- internal class TestSource
- {
- public static List<TestItem> GetSimpleSource(int count)
- {
- var result = new List<TestItem>();
- for (int i = 0; i < count; i++)
- {
- result.Add(new TestItem(i.ToString()));
- }
- return result;
- }
-
- public static List<TestGroup> GetGroupSource(int groupCount)
- {
- var result = new List<TestGroup>();
- for (int i = 0; i < groupCount; i++)
- {
- var group = new TestGroup(i.ToString());
- for (int j = 0; j < 5; j++)
- {
- group.Add(new TestItem(j.ToString()));
- }
- result.Add(group);
- }
- return result;
- }
- }
- }
-}
+++ /dev/null
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using System;
-using System.Collections.Generic;
-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.GridLayouter Tests")]
- public class GridLayouterTests
- {
- private const string TAG = "Components";
- private string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png";
-
- [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 GridLayouter empty constructor. Check it has been triggered")]
- [Property("SPEC", "Tizen.NUI.Components.GridLayouter.GridLayouter C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void GridLayouter_CHECK_VALUE()
- {
- /* TEST CODE */
- var GridLayouter = new Components.GridLayouter();
- Assert.IsNotNull(GridLayouter, "Should be not null");
- Assert.IsInstanceOf<Components.GridLayouter>(GridLayouter, "Should be an instance of GridLayouter!");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Initialize. Check GridLayouter is being initalized properly.")]
- [Property("SPEC", "Tizen.NUI.Components.GridLayouter.Initialize M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void Initialize_TEST()
- {
- /* TEST CODE */
- var collectionView = new Components.CollectionView();
- Assert.IsNotNull(collectionView, "Should be not null");
- Assert.IsInstanceOf<Components.CollectionView>(collectionView, "Should be an instance of CollectionView!");
- collectionView.Size = new Size(1000, 1000);
-
- var source = TestSource.GetSimpleSource(50);
- Assert.IsNotNull(source, "Should be not null");
- collectionView.ItemsSource = source;
-
- var template = new Binding.DataTemplate(() =>
- {
- var item = new RecyclerViewItem();
- Assert.IsNotNull(item, "Should be not null");
- item.WidthSpecification = 500;
- item.HeightSpecification = 500;
- return item;
- });
- Assert.IsNotNull(template, "Should be not null");
- collectionView.ItemTemplate = template;
- collectionView.ScrollingDirection = Components.ScrollableBase.Direction.Vertical;
-
- var GridLayouter = new MyGridLayouter();
- Assert.IsNotNull(GridLayouter, "Should be not null");
- collectionView.ItemsLayouter = GridLayouter;
-
- GridLayouter.Initialize(collectionView);
- View parentView = GridLayouter.GetParentView();
- Assert.AreEqual(parentView, collectionView, "Parent View must be same collectionView");
- bool isInit = GridLayouter.GetIsInitalized();
- Assert.AreEqual(isInit, true, "GridLayouter must be initialized!");
- }
-
- [Test]
- [Category("P2")]
- [Description("Test Initialize null input. check ArgumentException is occurs in Null input.")]
- [Property("SPEC", "Tizen.NUI.Components.GridLayouter.Initialize M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MEX")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void Initialize_TEST_Exception()
- {
- /* TEST CODE */
- try
- {
- var GridLayouter = new Components.GridLayouter();
- Assert.IsNotNull(GridLayouter, "Should be not null");
- Assert.IsInstanceOf<Components.GridLayouter>(GridLayouter, "Should be an instance of GridLayouter!");
- GridLayouter.Initialize(null);
- Assert.Fail("Should throw the ArgumentException!");
- }
- catch(ArgumentException e)
- {
- Assert.Pass("ArgumentException: passed!");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test RequestLayout. Check RequstLayout is done properly.")]
- [Property("SPEC", "Tizen.NUI.Components.GridLayouter.RequestLayout M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void RequestLayout_TEST()
- {
- /* TEST CODE */
- var collectionView = new Components.CollectionView();
- Assert.IsNotNull(collectionView, "Should be not null");
- Assert.IsInstanceOf<Components.CollectionView>(collectionView, "Should be an instance of CollectionView!");
- collectionView.Size = new Size(1000, 1000);
-
- var source = TestSource.GetSimpleSource(50);
- Assert.IsNotNull(source, "Should be not null");
- collectionView.ItemsSource = source;
-
- var template = new Binding.DataTemplate(() =>
- {
- var item = new RecyclerViewItem();
- Assert.IsNotNull(item, "Should be not null");
- item.WidthSpecification = LayoutParamPolicies.MatchParent;
- item.WidthSpecification = 500;
- item.HeightSpecification = 500;
- return item;
- });
- Assert.IsNotNull(template, "Should be not null");
- collectionView.ItemTemplate = template;
- collectionView.ScrollingDirection = Components.ScrollableBase.Direction.Vertical;
-
- var GridLayouter = new MyGridLayouter();
- Assert.IsNotNull(GridLayouter, "Should be not null");
- collectionView.ItemsLayouter = GridLayouter;
-
- GridLayouter.Initialize(collectionView);
- View parentView = GridLayouter.GetParentView();
- Assert.AreEqual(parentView, collectionView, "Parent View must be same collectionView");
- bool isInit = GridLayouter.GetIsInitalized();
- Assert.AreEqual(isInit, true, "GridLayouter must be initialized!");
-
- GridLayouter.RequestLayout(0.0f);
- (int first, int last) visible = GridLayouter.GetVisibleArea();
- Assert.GreaterOrEqual(visible.first, 0, "Should be bigger or equal than 0");
- Assert.GreaterOrEqual(visible.last, 0, "Should be bigger or equal than 0");
- }
-
-
- public class MyGridLayouter: Components.GridLayouter
- {
- internal RecyclerView GetParentView()
- {
- return ItemsView;
- }
-
- internal (int first, int last) GetVisibleArea()
- {
- return (FirstVisible, LastVisible);
- }
-
- internal bool GetIsInitalized()
- {
- return IsInitialized;
- }
- }
-
-
- public class TestItem
- {
- string name;
-
- public TestItem(string itemName)
- {
- Name = itemName;
- }
-
- public string Name
- {
- get
- {
- return name;
- }
- set
- {
- name = value;
- }
- }
- }
-
- static internal class TestSource
- {
- public static List<TestItem> GetSimpleSource(int count)
- {
- var result = new List<TestItem>();
- for (int i = 0; i < count; i++)
- {
- result.Add(new TestItem(i.ToString()));
- }
- return result;
- }
- }
- }
-}
+++ /dev/null
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using System;
-using System.Collections.Generic;
-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.ItemsLayouter Tests")]
- public class ItemsLayouterTests
- {
- private const string TAG = "Components";
- private string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png";
-
- [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 ItemsLayouter empty constructor. Check it has been triggered")]
- [Property("SPEC", "Tizen.NUI.Components.ItemsLayouter.ItemsLayouter C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void ItemsLayouter_CHECK_VALUE()
- {
- /* TEST CODE */
- var itemsLayouter = new MyItemsLayouter();
- Assert.IsNotNull(itemsLayouter, "Should be not null");
- Assert.IsInstanceOf<Components.ItemsLayouter>(itemsLayouter, "Should be an instance of ItemsLayouter!");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Initialize. Check ItemsLayouter is being initalized properly.")]
- [Property("SPEC", "Tizen.NUI.Components.ItemsLayouter.Initialize M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void Initialize_TEST()
- {
- /* TEST CODE */
- var itemsLayouter = new MyItemsLayouter();
- Assert.IsNotNull(itemsLayouter, "Should be not null");
- Assert.IsInstanceOf<Components.ItemsLayouter>(itemsLayouter, "Should be an instance of ItemsLayouter!");
-
- var colView = new CollectionView();
- Assert.IsNotNull(colView, "Should be not null");
- Assert.IsInstanceOf<Components.RecyclerView>(colView, "Should be an instance of RecyclerView!");
-
- itemsLayouter.Initialize(colView);
- Assert.AreEqual(itemsLayouter.InitializeCalled, true, "ItemsLayouter must be initialized!");
- }
-
- [Test]
- [Category("P2")]
- [Description("Test Initialize null input. check ArgumentException is occurs in Null input.")]
- [Property("SPEC", "Tizen.NUI.Components.ItemsLayouter.Initialize M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MEX")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void Initialize_TEST_Exception()
- {
- /* TEST CODE */
- try
- {
- var itemsLayouter = new MyItemsLayouter();
- Assert.IsNotNull(itemsLayouter, "Should be not null");
- Assert.IsInstanceOf<Components.ItemsLayouter>(itemsLayouter, "Should be an instance of ItemsLayouter!");
- itemsLayouter.Initialize(null);
- Assert.Fail("Should throw the ArgumentException!");
- }
- catch(ArgumentException e)
- {
- Assert.Pass("ArgumentException: passed!");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test RequestLayout. Check RequstLayout is done properly.")]
- [Property("SPEC", "Tizen.NUI.Components.ItemsLayouter.RequestLayout M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void RequestLayout_TEST()
- {
- /* TEST CODE */
- var itemsLayouter = new MyItemsLayouter();
- Assert.IsNotNull(itemsLayouter, "Should be not null");
- Assert.IsInstanceOf<Components.ItemsLayouter>(itemsLayouter, "Should be an instance of ItemsLayouter!");
-
- var colView = new CollectionView();
- Assert.IsNotNull(colView, "Should be not null");
- Assert.IsInstanceOf<Components.RecyclerView>(colView, "Should be an instance of RecyclerView!");
-
- itemsLayouter.Initialize(colView);
- Assert.AreEqual(itemsLayouter.InitializeCalled, true, "ItemsLayouter must be initialized!");
-
- itemsLayouter.RequestLayout(0.0f);
- Assert.AreEqual(itemsLayouter.RequestLayoutCalled, true, "ItemsLayouter must be requested layout!");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Clear. Check RequstLayout is done properly.")]
- [Property("SPEC", "Tizen.NUI.Components.ItemsLayouter.Clear M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void Clear_TEST()
- {
- /* TEST CODE */
- var itemsLayouter = new MyItemsLayouter();
- Assert.IsNotNull(itemsLayouter, "Should be not null");
- Assert.IsInstanceOf<Components.ItemsLayouter>(itemsLayouter, "Should be an instance of ItemsLayouter!");
- itemsLayouter.Clear();
- Assert.AreEqual(itemsLayouter.ClearCalled, true, "ItemsLayout must be cleared!");
- }
-
-
- public class MyItemsLayouter: Components.ItemsLayouter
- {
- public bool InitializeCalled;
- public bool RequestLayoutCalled;
- public bool ClearCalled;
-
- public override void Initialize(RecyclerView view)
- {
- base.Initialize(view);
- InitializeCalled = true;
- }
-
- public override void RequestLayout(float scrollPosition, bool force = false)
- {
- base.RequestLayout(scrollPosition, force);
- RequestLayoutCalled = true;
- }
-
- public override void Clear()
- {
- base.Clear();
- ClearCalled = true;
- }
- }
- }
-}
+++ /dev/null
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using System;
-using System.Collections.Generic;
-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.LinearLayouter Tests")]
- public class LinearLayouterTests
- {
- private const string TAG = "Components";
- private string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png";
-
- [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 LinearLayouter empty constructor. Check it has been triggered")]
- [Property("SPEC", "Tizen.NUI.Components.LinearLayouter.LinearLayouter C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void LinearLayouter_CHECK_VALUE()
- {
- /* TEST CODE */
- var LinearLayouter = new Components.LinearLayouter();
- Assert.IsNotNull(LinearLayouter, "Should be not null");
- Assert.IsInstanceOf<Components.LinearLayouter>(LinearLayouter, "Should be an instance of LinearLayouter!");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Initialize. Check LinearLayouter is being initalized properly.")]
- [Property("SPEC", "Tizen.NUI.Components.LinearLayouter.Initialize M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void Initialize_TEST()
- {
- /* TEST CODE */
- var collectionView = new Components.CollectionView();
- Assert.IsNotNull(collectionView, "Should be not null");
- Assert.IsInstanceOf<Components.CollectionView>(collectionView, "Should be an instance of CollectionView!");
- collectionView.Size = new Size(1000, 1000);
-
- var source = TestSource.GetSimpleSource(50);
- Assert.IsNotNull(source, "Should be not null");
- collectionView.ItemsSource = source;
-
- var template = new Binding.DataTemplate(() =>
- {
- var item = new RecyclerViewItem();
- Assert.IsNotNull(item, "Should be not null");
- item.WidthSpecification = LayoutParamPolicies.MatchParent;
- item.HeightSpecification = 100;
- return item;
- });
- Assert.IsNotNull(template, "Should be not null");
- collectionView.ItemTemplate = template;
- collectionView.ScrollingDirection = Components.ScrollableBase.Direction.Vertical;
-
- var LinearLayouter = new MyLinearLayouter();
- Assert.IsNotNull(LinearLayouter, "Should be not null");
- collectionView.ItemsLayouter = LinearLayouter;
-
- LinearLayouter.Initialize(collectionView);
- View parentView = LinearLayouter.GetParentView();
- Assert.AreEqual(parentView, collectionView, "Parent View must be same collectionView");
- bool isInit = LinearLayouter.GetIsInitalized();
- Assert.AreEqual(isInit, true, "LinearLayouter must be initialized!");
- }
-
- [Test]
- [Category("P2")]
- [Description("Test Initialize null input. check ArgumentException is occurs in Null input.")]
- [Property("SPEC", "Tizen.NUI.Components.LinearLayouter.Initialize M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MEX")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void Initialize_TEST_Exception()
- {
- /* TEST CODE */
- try
- {
- var LinearLayouter = new Components.LinearLayouter();
- Assert.IsNotNull(LinearLayouter, "Should be not null");
- Assert.IsInstanceOf<Components.LinearLayouter>(LinearLayouter, "Should be an instance of LinearLayouter!");
- LinearLayouter.Initialize(null);
- Assert.Fail("Should throw the ArgumentException!");
- }
- catch(ArgumentException e)
- {
- Assert.Pass("ArgumentException: passed!");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test RequestLayout. Check RequstLayout is done properly.")]
- [Property("SPEC", "Tizen.NUI.Components.LinearLayouter.RequestLayout M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void RequestLayout_TEST()
- {
- /* TEST CODE */
- var collectionView = new Components.CollectionView();
- Assert.IsNotNull(collectionView, "Should be not null");
- Assert.IsInstanceOf<Components.CollectionView>(collectionView, "Should be an instance of CollectionView!");
- collectionView.Size = new Size(1000, 1000);
-
- var source = TestSource.GetSimpleSource(50);
- Assert.IsNotNull(source, "Should be not null");
- collectionView.ItemsSource = source;
-
- var template = new Binding.DataTemplate(() =>
- {
- var item = new RecyclerViewItem();
- Assert.IsNotNull(item, "Should be not null");
- item.WidthSpecification = LayoutParamPolicies.MatchParent;
- item.HeightSpecification = 100;
- return item;
- });
- Assert.IsNotNull(template, "Should be not null");
- collectionView.ItemTemplate = template;
- collectionView.ScrollingDirection = Components.ScrollableBase.Direction.Vertical;
-
- var LinearLayouter = new MyLinearLayouter();
- Assert.IsNotNull(LinearLayouter, "Should be not null");
- collectionView.ItemsLayouter = LinearLayouter;
-
- LinearLayouter.Initialize(collectionView);
- View parentView = LinearLayouter.GetParentView();
- Assert.AreEqual(parentView, collectionView, "Parent View must be same collectionView");
- bool isInit = LinearLayouter.GetIsInitalized();
- Assert.AreEqual(isInit, true, "LinearLayouter must be initialized!");
-
- LinearLayouter.RequestLayout(0.0f);
- (int first, int last) visible = LinearLayouter.GetVisibleArea();
- Assert.GreaterOrEqual(visible.first, 0, "Should be bigger or equal than 0");
- Assert.GreaterOrEqual(visible.last, 0, "Should be bigger or equal than 0");
- }
-
- public class MyLinearLayouter: Components.LinearLayouter
- {
- internal RecyclerView GetParentView()
- {
- return ItemsView;
- }
-
- internal (int first, int last) GetVisibleArea()
- {
- return (FirstVisible, LastVisible);
- }
-
- internal bool GetIsInitalized()
- {
- return IsInitialized;
- }
- }
-
-
- public class TestItem
- {
- string name;
-
- public TestItem(string itemName)
- {
- Name = itemName;
- }
-
- public string Name
- {
- get
- {
- return name;
- }
- set
- {
- name = value;
- }
- }
- }
-
- static internal class TestSource
- {
- public static List<TestItem> GetSimpleSource(int count)
- {
- var result = new List<TestItem>();
- for (int i = 0; i < count; i++)
- {
- result.Add(new TestItem(i.ToString()));
- }
- return result;
- }
- }
- }
-}
+++ /dev/null
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using System;
-using System.Collections.Generic;
-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.RecyclerView Tests")]
- public class RecyclerViewTests
- {
- private const string TAG = "Components";
- private string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png";
-
- [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 RecyclerView empty constructor. Check it has been triggered")]
- [Property("SPEC", "Tizen.NUI.Components.RecyclerView.RecyclerView C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void RecyclerView_CHECK_VALUE()
- {
- /* TEST CODE */
- var recView = new MyRecyclerView();
- Assert.IsNotNull(recView, "Should be not null");
- Assert.IsInstanceOf<Components.RecyclerView>(recView, "Should be an instance of RecyclerView!");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test RecyclerView ItemsSource. Check it has been triggered")]
- [Property("SPEC", "Tizen.NUI.Components.RecyclerView.ItemsSource A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void ItemsSource_SET_GET_VALUE()
- {
- /* TEST CODE */
- var recView = new MyRecyclerView();
- Assert.IsNotNull(recView, "Should be not null");
- Assert.IsInstanceOf<Components.RecyclerView>(recView, "Should be an instance of RecyclerView!");
- var source = TestSource.GetSimpleSource(10);
- Assert.IsNotNull(source, "Should be not null");
- recView.ItemsSource = source;
- Assert.AreEqual(source, recView.ItemsSource, "Should be equals to the set value");
- recView.ItemsSource = null;
- Assert.AreEqual(null, recView.ItemsSource, "Should be equals to the set value");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test RecyclerView ItemTemplate. Check it has been triggered")]
- [Property("SPEC", "Tizen.NUI.Components.RecyclerView.ItemTemplate A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void ItemTemplate_SET_GET_VALUE()
- {
- /* TEST CODE */
- var recView = new MyRecyclerView();
- Assert.IsNotNull(recView, "Should be not null");
- Assert.IsInstanceOf<Components.RecyclerView>(recView, "Should be equal!");
- var itemTemplate = new Binding.DataTemplate(() => {
- return new Components.DefaultLinearItem();
- });
- Assert.IsNotNull(itemTemplate, "Should be not null");
- recView.ItemTemplate = itemTemplate;
- Assert.AreEqual(itemTemplate, recView.ItemTemplate, "Should be equals to the set value");
- recView.ItemTemplate = null;
- Assert.AreEqual(null, recView.ItemTemplate, "Should be equals to the set value");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test OnRelayout. Check whether OnRelayout is called.")]
- [Property("SPEC", "Tizen.NUI.Components.RecyclerView.OnRelayout M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public async Task OnRelayout_TEST()
- {
- /* TEST CODE */
- var recView = new MyRecyclerView();
- Assert.IsNotNull(recView, "Should be not null");
- Assert.IsInstanceOf<Components.RecyclerView>(recView, "Should be equal!");
- recView.Size = new Size(100, 100);
- Window.Instance.GetDefaultLayer().Add(recView);
- await Task.Delay(900);
- Assert.AreEqual(true, recView.IsOnRelayoutCalled, "Should be true");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test OnScrolling. Check whether OnScrolling is called.")]
- [Property("SPEC", "Tizen.NUI.Components.RecyclerView.OnScrolling M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public async Task OnScrolling_TEST()
- {
- /* TEST CODE */
- var recView = new MyRecyclerView2();
- Assert.IsNotNull(recView, "Should be not null");
- Assert.IsInstanceOf<Components.RecyclerView>(recView, "Should be equal!");
- recView.Size = new Size(100, 100);
- recView.ScrollingDirection = ScrollableBase.Direction.Vertical;
- var source = TestSource.GetSimpleSource(10);
- Assert.IsNotNull(source, "Should be not null");
- recView.ItemsSource = source;
- var template = new Binding.DataTemplate(() =>
- {
- var item = new RecyclerViewItem();
- Assert.IsNotNull(item, "Should be not null");
- item.WidthSpecification = LayoutParamPolicies.MatchParent;
- item.HeightSpecification = 100;
- return item;
- });
- Assert.IsNotNull(template, "Should be not null");
- recView.ItemTemplate = template;
- var layouter = new LinearLayouter();
- Assert.IsNotNull(layouter, "Should be not null");
- recView.ItemsLayouter = layouter;
- Window.Instance.GetDefaultLayer().Add(recView);
- await Task.Delay(900);
- recView.ScrollTo(300.0f, false);
- await Task.Delay(2000);
- Assert.AreEqual(true, recView.IsOnScrollingCalled, "Should be true");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Dispose, try to dispose the RecyclerView.")]
- [Property("SPEC", "Tizen.NUI.Components.RecyclerView.Dispose M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MCST")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void Dispose_TEST()
- {
- /* TEST CODE */
- try
- {
- var recView = new MyRecyclerView();
- Assert.IsNotNull(recView, "Should be not null");
- Assert.IsInstanceOf<Components.RecyclerView>(recView, "Should be equal!");
- recView.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());
- }
- }
-
- public class MyRecyclerView : RecyclerView
- {
- public bool IsOnRelayoutCalled;
- public override void OnRelayout(Vector2 size, RelayoutContainer container)
- {
- base.OnRelayout(size, container);
- IsOnRelayoutCalled = true;
- }
- }
-
- public class MyRecyclerView2 : CollectionView
- {
- public bool IsOnSelectionChangedCalled;
- public bool IsOnScrollingCalled;
-
- protected override void OnSelectionChanged(SelectionChangedEventArgs args)
- {
- base.OnSelectionChanged(args);
- IsOnSelectionChangedCalled = true;
- }
-
- protected override void OnScrolling(object source, ScrollEventArgs args)
- {
- base.OnScrolling(source, args);
- IsOnScrollingCalled = true;
- }
- }
-
- public class TestItem
- {
- string name;
-
- public TestItem(string itemName)
- {
- Name = itemName;
- }
-
- public string Name
- {
- get
- {
- return name;
- }
- set
- {
- name = value;
- }
- }
- }
-
- public class TestGroup : List<TestItem>
- {
- string groupName;
-
- public TestGroup(string name)
- {
- groupName = name;
- }
-
- public string GroupName
- {
- get
- {
- return groupName;
- }
- set
- {
- groupName = value;
- }
- }
- }
-
- internal class TestSource
- {
- public static List<TestItem> GetSimpleSource(int count)
- {
- var result = new List<TestItem>();
- for (int i = 0; i < count; i++)
- {
- result.Add(new TestItem(i.ToString()));
- }
- return result;
- }
-
- public static List<TestGroup> GetGroupSource(int groupCount)
- {
- var result = new List<TestGroup>();
- for (int i = 0; i < groupCount; i++)
- {
- var group = new TestGroup(i.ToString());
- for (int j = 0; j < 5; j++)
- {
- group.Add(new TestItem(j.ToString()));
- }
- result.Add(group);
- }
- return result;
- }
- }
- }
-}
+++ /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.RecyclerViewItem Tests")]
- public class RecyclerViewItemTests
- {
- private const string TAG = "Components";
- private string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png";
-
- [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 RecyclerViewItem empty constructor. Check it has been triggered")]
- [Property("SPEC", "Tizen.NUI.Components.RecyclerViewItem.RecyclerViewItem C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void RecyclerViewItem_CHECK_VALUE()
- {
- /* TEST CODE */
- var RecyclerViewItem = new Components.RecyclerViewItem();
- Assert.IsNotNull(RecyclerViewItem, "Should be not null");
- Assert.IsInstanceOf<Components.RecyclerViewItem>(RecyclerViewItem, "Should be an instance of RecyclerViewItem!");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test RecyclerViewItem constructor using string. Check it has been triggered")]
- [Property("SPEC", "Tizen.NUI.Components.RecyclerViewItem.RecyclerViewItem C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("COVPARAM", "string")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void RecyclerViewItem_INIT_WITH_STRING()
- {
- /* TEST CODE */
- StyleManager.Instance.Theme = "default";
- StyleManager.Instance.RegisterStyle("defaultRecyclerViewItem", "default", typeof(DefaultRecyclerViewItemStyle));
- var RecyclerViewItem = new RecyclerViewItem("defaultRecyclerViewItem");
- Assert.IsNotNull(RecyclerViewItem, "Should be not null!");
- Assert.IsInstanceOf<RecyclerViewItem>(RecyclerViewItem, "Should be an instance of RecyclerViewItem!");
- }
-
- [Test]
- [Category("P2")]
- [Description("Check exception when constructing a RecyclerViewItem with nonexistent style.")]
- [Property("SPEC", "Tizen.NUI.Components.RecyclerViewItem.RecyclerViewItem C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTX")]
- [Property("COVPARAM", "string")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void RecyclerViewItem_INIT_WITH_STRING_Exception()
- {
- /* TEST CODE */
- try
- {
- var RecyclerViewItem = new RecyclerViewItem("defaultRecyclerViewItemX");
- Assert.Fail("Should throw the Exception: There is no style of defaultRecyclerViewItemX !");
- }
- catch(InvalidOperationException e)
- {
- Assert.Pass("InvalidOperationException: passed!");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test RecyclerViewItem constructor using style. Check it has been triggered")]
- [Property("SPEC", "Tizen.NUI.Components.RecyclerViewItem.RecyclerViewItem C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("COVPARAM", "RecyclerViewItemStyle")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void RecyclerViewItem_INIT_WITH_STYLE()
- {
- /* TEST CODE */
- var style = new RecyclerViewItemStyle();
- Assert.IsNotNull(style, "Should be not null!");
- Assert.IsInstanceOf<RecyclerViewItemStyle>(style, "Should be an instance of RecyclerViewItemStyle!");
-
- var RecyclerViewItem = new RecyclerViewItem(style);
- Assert.IsNotNull(RecyclerViewItem, "Should be not null!");
- Assert.IsInstanceOf<RecyclerViewItem>(RecyclerViewItem, "Should be an instance of RecyclerViewItem!");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test IsSelectable. Check whether IsSelectable is readable and writable.")]
- [Property("SPEC", "Tizen.NUI.Components.RecyclerViewItem.IsSelectable A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void IsSelectable_SET_GET_VALUE()
- {
- /* TEST CODE */
- var RecyclerViewItem = new Components.RecyclerViewItem();
- Assert.IsNotNull(RecyclerViewItem, "Should be not null");
- Assert.IsInstanceOf<Components.RecyclerViewItem>(RecyclerViewItem, "Should be equal!");
- RecyclerViewItem.IsSelectable = true;
- Assert.AreEqual(true, RecyclerViewItem.IsSelectable, "Should be equals to the set value");
- RecyclerViewItem.IsSelectable = false;
- Assert.AreEqual(false, RecyclerViewItem.IsSelectable, "Should be equals to the set value");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test IsSelected. Check whether IsSelected is readable and writable.")]
- [Property("SPEC", "Tizen.NUI.Components.RecyclerViewItem.IsSelected A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void IsSelected_SET_GET_VALUE()
- {
- /* TEST CODE */
- var RecyclerViewItem = new Components.RecyclerViewItem();
- Assert.IsNotNull(RecyclerViewItem, "Should be not null");
- Assert.IsInstanceOf<Components.RecyclerViewItem>(RecyclerViewItem, "Should be equal!");
-
- RecyclerViewItem.IsSelectable = true;
- RecyclerViewItem.IsSelected = true;
- Assert.AreEqual(true, RecyclerViewItem.IsSelected, "Retrieved IsSelected should be equal to set value");
- RecyclerViewItem.IsSelected = false;
- Assert.AreEqual(false, RecyclerViewItem.IsSelected, "Retrieved IsSelected should be equal to set value");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test IsEnabled. Check whether IsEnabled is readable and writable.")]
- [Property("SPEC", "Tizen.NUI.Components.RecyclerViewItem.IsEnabled A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void IsEnabled_SET_GET_VALUE()
- {
- /* TEST CODE */
- var RecyclerViewItem = new Components.RecyclerViewItem();
- Assert.IsNotNull(RecyclerViewItem, "Should be not null");
- Assert.IsInstanceOf<Components.RecyclerViewItem>(RecyclerViewItem, "Should be equal!");
-
- RecyclerViewItem.IsEnabled = true;
- Assert.AreEqual(true, RecyclerViewItem.IsEnabled, "Retrieved IsEnabled should be equal to set value");
- RecyclerViewItem.IsEnabled = false;
- Assert.AreEqual(false, RecyclerViewItem.IsEnabled, "Retrieved IsEnabled should be equal to set value");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Dispose, try to dispose the RecyclerViewItem.")]
- [Property("SPEC", "Tizen.NUI.Components.RecyclerViewItem.Dispose M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MCST")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void Dispose_TEST()
- {
- /* TEST CODE */
- try
- {
- var RecyclerViewItem = new RecyclerViewItem();
- Assert.IsNotNull(RecyclerViewItem, "Should be not null");
- Assert.IsInstanceOf<Components.RecyclerViewItem>(RecyclerViewItem, "Should be equal!");
- RecyclerViewItem.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());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test ApplyStyle. Check whether ApplyStyle works or not.")]
- [Property("SPEC", "Tizen.NUI.Components.RecyclerViewItem.ApplyStyle M")]
- [Property("SPEC_URL", " - ")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void ApplyStyle_NO_RETURN_VALUE()
- {
- try
- {
- var RecyclerViewItem = new RecyclerViewItem();
- var style = new RecyclerViewItemStyle();
- RecyclerViewItem.ApplyStyle(style);
- }
- catch (Exception e)
- {
- Assert.Fail("Caught Exception" + e.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test CreateViewStyle. Check whether CreateViewStyle works or not.")]
- [Property("SPEC", "Tizen.NUI.Components.RecyclerViewItem.CreateViewStyle M")]
- [Property("SPEC_URL", " - ")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void CreateViewStyle_CHECK_RETURN_VALUE()
- {
- try
- {
- var RecyclerViewItem = new MyRecyclerViewItem();
- ViewStyle style = RecyclerViewItem.CreateMyViewStyle();
- Assert.IsNotNull(style, "Should be not null");
- }
- catch (Exception e)
- {
- Assert.Fail("Caught Exception" + e.ToString());
- }
- }
-
- public class MyRecyclerViewItem : RecyclerViewItem
- {
- public MyRecyclerViewItem() : base() {}
-
- public ViewStyle CreateMyViewStyle()
- {
- return base.CreateViewStyle();
- }
- }
-
- public class DefaultRecyclerViewItemStyle : StyleBase
- {
- protected override ViewStyle GetViewStyle()
- {
- return new RecyclerViewItemStyle();
- }
- }
- }
-}
+++ /dev/null
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using System;
-using Tizen.NUI;
-using Tizen.NUI.Test;
-
-namespace Tizen.NUI.Tests
-{
-
- [TestFixture]
- [Description("Tizen.NUI.Binding.DataTemplate Tests")]
- public class DataTemplateTests
- {
- private string TAG = "NUI";
-
- [SetUp]
- public void Init()
- {
- Tizen.Log.Info(TAG, "Init() is called!");
- App.MainTitleChangeText("DataTemplateTests");
- App.MainTitleChangeBackgroundColor(null);
-
- }
-
- [TearDown]
- public void Destroy()
- {
- Tizen.Log.Info(TAG, "Destroy() is called!");
- }
-
- [Test]
- [Category("P1")]
- [Description("DataTemplate constructor test. Check whether object is successfully created or not.")]
- [Property("SPEC", "Tizen.NUI.Binding.DataTemplate.DataTemplate C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void DataTemplate_INIT()
- {
- /* TEST CODE */
- var DataTemplate = new Binding.DataTemplate();
- Assert.IsNotNull(DataTemplate, "Should not null value.");
- Assert.IsInstanceOf<Binding.DataTemplate>(DataTemplate, "Should return DataTemplate instance.");
- }
-
- [Test]
- [Category("P1")]
- [Description("DataTemplate type constructor test. Check whether given type is properly created in CreateContent or not.")]
- [Property("SPEC", "Tizen.NUI.Binding.DataTemplate.DataTemplate C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("COVPARAM", "Type")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void DataTemplate_INIT_WITH_TYPE()
- {
- /* TEST CODE */
- var DataTemplate = new Binding.DataTemplate(typeof(TestType));
- Assert.IsNotNull(DataTemplate, "Should not null value.");
- Assert.IsInstanceOf<Binding.DataTemplate>(DataTemplate, "Should return DataTemplate instance.");
- var newContent = DataTemplate.CreateContent();
- Assert.IsInstanceOf<TestType>(newContent, "Should return TestType instance.");
- }
-
- [Test]
- [Category("P1")]
- [Description("DataTemplate func constructor test. Check whether given LoadTemplate function is well constructed or not.")]
- [Property("SPEC", "Tizen.NUI.Binding.DataTemplate.DataTemplate C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("COVPARAM", "Func<object>")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void DataTemplate_INIT_WITH_FUNC()
- {
- /* TEST CODE */
- var DataTemplate = new Binding.DataTemplate(() => {
- var content = new BaseComponents.TextLabel();
- Assert.IsNotNull(content, "Should not null value.");
- Assert.IsInstanceOf<BaseComponents.TextLabel>(content, "Should return TextLabel instance.");
- return content;
- });
- Assert.IsNotNull(DataTemplate, "Should not null value.");
- Assert.IsInstanceOf<Binding.DataTemplate>(DataTemplate, "Should return DataTemplate instance.");
- var newContent = DataTemplate.CreateContent();
- Assert.IsInstanceOf<BaseComponents.TextLabel>(newContent, "Should return TextLabel instance.");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Bindings. Check whether binding is updated or not.")]
- [Property("SPEC", "Tizen.NUI.Binding.DataTemplate.Bindings A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void Bindings_GET_VALUE()
- {
- /* TEST CODE */
- var DataTemplate = new Binding.DataTemplate(() => {
- var content = new BaseComponents.TextLabel();
- Assert.IsNotNull(content, "Should not null value.");
- Assert.IsInstanceOf<BaseComponents.TextLabel>(content, "Should return TextLabel instance.");
- return content;
- });
- Assert.IsNotNull(DataTemplate, "Should not null value.");
- Assert.IsInstanceOf<Binding.DataTemplate>(DataTemplate, "Should return DataTemplate instance.");
- var binding = new Binding.Binding("Name");
- Assert.IsNotNull(binding, "Should not null value.");
- DataTemplate.SetBinding(BaseComponents.TextLabel.TextProperty, binding);
- Assert.IsNotNull(DataTemplate.Bindings, "Should not null value.");
- var val = DataTemplate.Bindings[BaseComponents.TextLabel.TextProperty];
- Assert.AreEqual(binding, val, "Should be equal");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Values. Check whether value is updated or not.")]
- [Property("SPEC", "Tizen.NUI.Binding.DataTemplate.Values A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void Values_GET_VALUE()
- {
- /* TEST CODE */
- var DataTemplate = new Binding.DataTemplate(() => {
- var content = new BaseComponents.TextLabel();
- Assert.IsNotNull(content, "Should not null value.");
- Assert.IsInstanceOf<BaseComponents.TextLabel>(content, "Should return TextLabel instance.");
- return content;
- });
- Assert.IsNotNull(DataTemplate, "Should not null value.");
- Assert.IsInstanceOf<Binding.DataTemplate>(DataTemplate, "Should return DataTemplate instance.");
- var value = new object();
- Assert.IsNotNull(value, "Should not null value.");
- DataTemplate.SetValue(BaseComponents.TextLabel.TextProperty, value);
- Assert.IsNotNull(DataTemplate.Values, "Should not null value.");
- var val = DataTemplate.Values[BaseComponents.TextLabel.TextProperty];
- Assert.AreEqual(value, val, "Should be equal");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test SetBinding. Check whether binding is updated or not.")]
- [Property("SPEC", "Tizen.NUI.Binding.DataTemplate.SetBinding M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void SetBinding_TEST()
- {
- /* TEST CODE */
- var DataTemplate = new Binding.DataTemplate(() => {
- var content = new BaseComponents.TextLabel();
- Assert.IsNotNull(content, "Should not null value.");
- Assert.IsInstanceOf<BaseComponents.TextLabel>(content, "Should return TextLabel instance.");
- return content;
- });
- Assert.IsNotNull(DataTemplate, "Should not null value.");
- Assert.IsInstanceOf<Binding.DataTemplate>(DataTemplate, "Should return DataTemplate instance.");
- var binding = new Binding.Binding("Name");
- Assert.IsNotNull(binding, "Should not null value.");
- DataTemplate.SetBinding(BaseComponents.TextLabel.TextProperty, binding);
- Assert.IsNotNull(DataTemplate.Bindings, "Should not null value.");
- var val = DataTemplate.Bindings[BaseComponents.TextLabel.TextProperty];
- Assert.AreEqual(binding, val, "Should be equal");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test SetValue. Check whether value is updated or not.")]
- [Property("SPEC", "Tizen.NUI.Binding.DataTemplate.SetValue M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void SetValue_TEST()
- {
- /* TEST CODE */
- var DataTemplate = new Binding.DataTemplate(() => {
- var content = new BaseComponents.TextLabel();
- Assert.IsNotNull(content, "Should not null value.");
- Assert.IsInstanceOf<BaseComponents.TextLabel>(content, "Should return TextLabel instance.");
- return content;
- });
- Assert.IsNotNull(DataTemplate, "Should not null value.");
- Assert.IsInstanceOf<Binding.DataTemplate>(DataTemplate, "Should return DataTemplate instance.");
- var value = new object();
- Assert.IsNotNull(value, "Should not null value.");
- DataTemplate.SetValue(BaseComponents.TextLabel.TextProperty, value);
- Assert.IsNotNull(DataTemplate.Values, "Should not null value.");
- var val = DataTemplate.Values[BaseComponents.TextLabel.TextProperty];
- Assert.AreEqual(value, val, "Should be equal");
- }
-
- public class TestType
- {
- public TestType() {}
- }
- }
-}
+++ /dev/null
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using System;
-using Tizen.NUI;
-using Tizen.NUI.Test;
-
-namespace Tizen.NUI.Tests
-{
-
- [TestFixture]
- [Description("Tizen.NUI.Binding.DataTemplateSelector Tests")]
- public class DataTemplateSelectorTests
- {
- private string TAG = "NUI";
-
- [SetUp]
- public void Init()
- {
- Tizen.Log.Info(TAG, "Init() is called!");
- App.MainTitleChangeText("DataTemplateSelectorTests");
- App.MainTitleChangeBackgroundColor(null);
-
- }
-
- [TearDown]
- public void Destroy()
- {
- Tizen.Log.Info(TAG, "Destroy() is called!");
- }
-
- [Test]
- [Category("P1")]
- [Description("DataTemplateSelector constructor test. Check whether object is successfully created or not.")]
- [Property("SPEC", "Tizen.NUI.Binding.DataTemplateSelector.DataTemplateSelector C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void DataTemplateSelector_INIT()
- {
- /* TEST CODE */
- var DataTemplateSelector = new MyTemplateSelector();
- Assert.IsNotNull(DataTemplateSelector, "Should not null value.");
- Assert.IsInstanceOf<Binding.DataTemplateSelector>(DataTemplateSelector, "Should return DataTemplateSelector instance.");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test SelectTemplate. Check whether template returns properly as given item.")]
- [Property("SPEC", "Tizen.NUI.Binding.DataTemplateSelector.SelectTemplate M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void SelectTemplate_RETURN_VALUE()
- {
- /* TEST CODE */
- var TemplateSelector = new MyTemplateSelector();
- Assert.IsNotNull(TemplateSelector, "Should not null value.");
- var myView = new BaseComponents.View();
- Assert.IsNotNull(myView, "Should not null value.");
- var item1 = new TestItem1("test");
- Assert.IsNotNull(item1, "Should not null value.");
-
- var template1 = TemplateSelector.SelectTemplate(item1, myView);
- Assert.IsNotNull(template1, "Should not null value.");
- Assert.IsInstanceOf<MyTemplate1>(template1, "Should return MyTemplate1 instance.");
-
- var item2 = new TestItem2("test", "second");
- Assert.IsNotNull(item2, "Should not null value.");
-
- var template2 = TemplateSelector.SelectTemplate(item2, myView);
- Assert.IsNotNull(template2, "Should not null value.");
- Assert.IsInstanceOf<MyTemplate2>(template2, "Should return MyTemplate2 instance.");
- }
-
-
- [Test]
- [Category("P1")]
- [Description("Test OnSelectTemplate. Check whether template returns properly as given item.")]
- [Property("SPEC", "Tizen.NUI.Binding.DataTemplateSelector.OnSelectTemplate M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void OnSelectTemplate_RETURN_VALUE()
- {
- /* TEST CODE */
- var TemplateSelector = new MyTemplateSelector();
- Assert.IsNotNull(TemplateSelector, "Should not null value.");
- var myView = new BaseComponents.View();
- Assert.IsNotNull(myView, "Should not null value.");
- var item1 = new TestItem1("test");
- Assert.IsNotNull(item1, "Should not null value.");
-
- var template1 = TemplateSelector.SelectTemplate(item1, myView);
-
- Assert.IsNotNull(template1, "Should not null value.");
- Assert.IsInstanceOf<MyTemplate1>(template1, "Should return MyTemplate1 instance.");
-
- var item2 = new TestItem2("test", "second");
- Assert.IsNotNull(item2, "Should not null value.");
-
- var template2 = TemplateSelector.SelectTemplate(item2, myView);
- Assert.IsNotNull(template2, "Should not null value.");
- Assert.IsInstanceOf<MyTemplate2>(template2, "Should return MyTemplate2 instance.");
- }
-
- public class TestItem1
- {
- string name;
- string Name { get => name; set => name = value; }
- public TestItem1(string _name) { Name = _name; }
- }
-
- public class TestItem2
- {
- string name;
- string subname;
- string Name { get => name; set => name = value; }
- string SubName { get => subname; set => subname = value; }
-
- public TestItem2(string _name, string _subname) { Name = _name; SubName = _subname; }
- }
-
- public class MyTemplate1: Binding.DataTemplate
- {
- public MyTemplate1() : base(() => { BaseComponents.View myView = new BaseComponents.View(); return myView;}) {}
- }
-
- public class MyTemplate2: Binding.DataTemplate
- {
- public MyTemplate2() : base(() => { BaseComponents.View myView = new BaseComponents.View(); return myView;}) {}
-
- }
-
- public class MyTemplateSelector: Binding.DataTemplateSelector
- {
- MyTemplate1 template1;
- MyTemplate2 template2;
-
- public MyTemplateSelector() : base()
- {
- template1 = new MyTemplate1();
- template2 = new MyTemplate2();
- }
-
- protected override Binding.DataTemplate OnSelectTemplate(object item, Binding.BindableObject container)
- {
- if (item is TestItem1)
- {
- return template1;
- }
- else if (item is TestItem2)
- {
- return template2;
- }
- else return null;
- }
- }
- }
-}
+++ /dev/null
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using System;
-using Tizen.NUI;
-using Tizen.NUI.Test;
-
-namespace Tizen.NUI.Tests
-{
-
- [TestFixture]
- [Description("Tizen.NUI.Binding.ElementTemplate Tests")]
- public class ElementTemplateTests
- {
- private string TAG = "NUI";
-
- [SetUp]
- public void Init()
- {
- Tizen.Log.Info(TAG, "Init() is called!");
- App.MainTitleChangeText("ElementTemplateTests");
- App.MainTitleChangeBackgroundColor(null);
-
- }
-
- [TearDown]
- public void Destroy()
- {
- Tizen.Log.Info(TAG, "Destroy() is called!");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test CreateContent. Check whether content is successfully created or not.")]
- [Property("SPEC", "Tizen.NUI.Binding.ElementTemplate.CreateContent M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "SangHyeon Lee, sh10233.lee@samsung.com")]
- public void CreateContent_GET_VALUE()
- {
- /* TEST CODE */
- var DataTemplate = new Binding.DataTemplate(() => {
- var content = new BaseComponents.TextLabel();
- Assert.IsNotNull(content, "Should not null value.");
- Assert.IsInstanceOf<BaseComponents.TextLabel>(content, "Should return TextLabel instance.");
- return content;
- });
- Assert.IsNotNull(DataTemplate, "Should not null value.");
- Assert.IsInstanceOf<Binding.DataTemplate>(DataTemplate, "Should return DataTemplate instance.");
- var newContent = DataTemplate.CreateContent();
- Assert.IsInstanceOf<BaseComponents.TextLabel>(newContent, "Should return TextLabel instance.");
- }
- }
-}