From: Feng Jin Date: Thu, 25 Jul 2019 10:53:35 +0000 (+0800) Subject: [NUI.Components][ACR-248][Create auto and manual TCT project] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aa94c936beabae6dac43a98f156609dc66ed3512;p=test%2Ftct%2Fcsharp%2Fapi.git [NUI.Components][ACR-248][Create auto and manual TCT project] Change-Id: Ib44b88bb03b814af22a4f8720bb71dad55fa3536 --- diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/ManualTestPage.cs b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/ManualTestPage.cs new file mode 100755 index 000000000..4babaf097 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/ManualTestPage.cs @@ -0,0 +1,744 @@ +/* +* Copyright (c) 2019 Samsung Electronics Co., Ltd. +* +* 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.Runtime.InteropServices; +using System.Collections.Generic; +using NUnitLite.TUnit; +using NUnit.Framework.Interfaces; +using NUnit.Framework.TUnit; +using System.Reflection; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.UIComponents; +using Tizen.Applications; + +namespace Tizen.NUI.Components.Tests +{ + class ManualTestComponents + { + private List _tcIDList; + private List _listItem; + private TSettings _tsettings; + private TRunner _tRunner; + private NavigationButton _pressButton = NavigationButton.NA; + private PushButton _passButton, _failButton, _blockButton, _homeButton, _preButton, _nextButton, _doneButton; + private TextLabel _notRun; + private const string STEP_ATTRIBUTE_NAME = "NUnit.Framework.StepAttribute"; + private const string PRECONDITION_ATTRIBUTE_NAME = "NUnit.Framework.PreconditionAttribute"; + private const string POSTCONDITION_ATTRIBUTE_NAME = "NUnit.Framework.PostconditionAttribute"; + private List _listNotPass; + private ToastMessage _toastMessage; + //For TV KantM + //private static float PointSize = 30.0f; + //private static float ButtonSizeWidth = 200; + private float _pointSize = 5.0f; + private float _pixelSize = 20.0f; + + + //Save the information of every single test case + private List _tcInfoList; + private List _currentTCInfo; + + private static ManualTestComponents _instance; + private static Object _lockObject = new object(); + + //Show the result of all the test case + private TextLabel _summaryLabel; + ScrollView _scrollView; + private View _initView; + private View _detailView; + private TableView _initList; + private TableView _detailList; + private View _caseView; + private TableView _buttonContainer; + private TableView _firstPageContainer; + private PushButton _run; + private PushButton _runButton; + private PushButton[] _buttonList; + + //Always save the current TC number; + private int _currentTCNum = 0; + + public static ManualTestComponents GetInstance() + { + lock (_lockObject) + { + if (_instance == null) + { + _instance = new ManualTestComponents(); + } + } + return _instance; + } + + private ManualTestComponents() + { + Initialize(); + } + public void Initialize() + { + Tizen.Log.Fatal("NUI.Components", "Initialize========================================="); + _toastMessage = new ToastMessage(); + _pointSize = (1.0f / Window.Instance.Dpi.Length()) * 2000.0f; + RunType.Value = RunType.MANUAL; + _tRunner = new TRunner(); + _tRunner.LoadTestsuite(); + _tRunner.SingleTestDone += OnSingleTestDone; + _listNotPass = new List(); + _tcIDList = new List(); + _listItem = new List(); + _listNotPass = TSettings.GetInstance().GetNotPassListManual(); + int count = 0; + foreach (var tc in _listNotPass) + { + _listItem.Add(new ItemData { No = count, TCName = tc, Result = StrResult.NOTRUN }); + _tcIDList.Add(tc); + count++; + } + Tizen.Log.Fatal("NUI.Components", "TCT : count:" + count.ToString()); + foreach (String nameTc in _tcIDList) + { + Tizen.Log.Fatal("NUI.Components", "TCT : TCName:" + nameTc.ToString()); + } + + + _tsettings = TSettings.GetInstance(); + _tsettings.IsManual = true; + + InitData(); + _caseView = new View(); + Window.Instance.GetDefaultLayer().Add(_caseView); + Window window = Window.Instance; + window.BackgroundColor = Color.White; + + _summaryLabel = new TextLabel(); + _summaryLabel.PixelSize = _pixelSize; + _summaryLabel.Size2D = new Size2D((int)Window.Instance.Size.Width, 60); + _summaryLabel.ParentOrigin = Position.ParentOriginTopLeft; + _summaryLabel.PivotPoint = PivotPoint.TopLeft; + _summaryLabel.Position = new Position(0, 5, 0); + _summaryLabel.HorizontalAlignment = HorizontalAlignment.Center; + _summaryLabel.VerticalAlignment = VerticalAlignment.Center; + + SetSummaryResult(); + window.GetDefaultLayer().Add(_summaryLabel); + + _initView = new View(); + _initView.Size2D = new Size2D((int)Window.Instance.Size.Width, (int)Window.Instance.Size.Height - 65); + _initView.ParentOrigin = Position.ParentOriginTopLeft; + _initView.PivotPoint = PivotPoint.TopLeft; + _initView.Position = new Position(0.0f, 70.0f, 0.0f); + InitializeFirstPage(); + _initView.Show(); + + _detailView = new View(); + _initView.Size2D = new Size2D((int)Window.Instance.Size.Width, (int)Window.Instance.Size.Height - 65); + _detailView.ParentOrigin = Position.ParentOriginTopLeft; + _detailView.PivotPoint = PivotPoint.TopLeft; + _detailView.Position = new Position(0.0f, 70.0f, 0.0f); + InitializeDetailPage(); + _detailView.Hide(); + + window.GetDefaultLayer().Add(_initView); + window.GetDefaultLayer().Add(_detailView); + + FocusManager.Instance.SetCurrentFocusView(_run); + } + + void InitializeFirstPage() + { + //Create Run Button, when you Click it, then the first test case will be executed. + _doneButton = new PushButton(); + _doneButton.Focusable = true; + _doneButton.LabelText = "Done"; + _doneButton.Clicked += (obj, ee) => + { + TSettings.GetInstance().SubmitManualResult(); + return false; + }; + + _run = new PushButton(); + _run.LabelText = "Runner"; + _run.Clicked += (obj, ee) => + { + Tizen.Log.Fatal("NUI.Components", "Check all the test case from the first one."); + _currentTCNum = 0; + _initView.Hide(); + _caseView.Hide(); + UpdateDetailPage(); + _detailView.Show(); + FocusManager.Instance.SetCurrentFocusView(_runButton); + return false; + }; + + _run.RightFocusableView = _doneButton; + _doneButton.LeftFocusableView = _run; + + //To show all the test case information(Number _className._TCName [result]). + _initList = new TableView((uint)_tcIDList.Count, 1); + _initList.Focusable = true; + _initList.CellPadding = new Vector2(0, 0); + _initList.Size2D = new Size2D(Window.Instance.Size.Width - 50, _tcIDList.Count * 50); + _initList.ParentOrigin = Position.ParentOriginTopLeft; + _initList.PivotPoint = PivotPoint.TopLeft; + _initList.Position = new Position(0.0f, 0.0f, 0.0f); + CreateInitList(); + + _run.DownFocusableView = _initList; + _doneButton.DownFocusableView = _initList; + _initList.UpFocusableView = _run; + + _firstPageContainer = new TableView(2, 2); + _firstPageContainer.PivotPoint = Position.PivotPointTopLeft; + _firstPageContainer.ParentOrigin = Position.ParentOriginTopLeft; + _firstPageContainer.Position = new Position(0, 3, 0); + _firstPageContainer.Size2D = new Size2D((int)Window.Instance.Size.Width - 200, 200); + _firstPageContainer.Focusable = (true); + _firstPageContainer.SetCellAlignment(new TableView.CellPosition(0, 0), HorizontalAlignmentType.Right, VerticalAlignmentType.Center); + _firstPageContainer.SetCellAlignment(new TableView.CellPosition(0, 1), HorizontalAlignmentType.Center, VerticalAlignmentType.Center); + _firstPageContainer.SetCellAlignment(new TableView.CellPosition(1), HorizontalAlignmentType.Center, VerticalAlignmentType.Center); + _firstPageContainer.CellPadding = new Vector2(0, 0); + + _firstPageContainer.AddChild(_doneButton, new TableView.CellPosition(0, 0)); + _firstPageContainer.AddChild(_run, new TableView.CellPosition(0, 1)); + + + _scrollView = new ScrollView(); + _scrollView.ClippingMode = ClippingModeType.ClipChildren; + _scrollView.BackgroundColor = Color.Transparent; + _scrollView.Size2D = new Size2D(Window.Instance.Size.Width, Window.Instance.Size.Height); + _scrollView.Position2D = new Position2D(0, 0); + _scrollView.Scrolling = true; + + PropertyMap rulerMap = new PropertyMap(); + rulerMap.Add((int)ScrollModeType.XAxisScrollEnabled, new PropertyValue(false)); + rulerMap.Add((int)ScrollModeType.YAxisScrollEnabled, new PropertyValue(true)); + rulerMap.Add((int)ScrollModeType.YAxisSnapToInterval, new PropertyValue(100)); + rulerMap.Add((int)ScrollModeType.YAxisScrollBoundary, new PropertyValue(60 * (_tcIDList.Count+1))); + _scrollView.ScrollMode = rulerMap; + + _scrollView.Add(_initList); + _firstPageContainer.AddChild(_scrollView, new TableView.CellPosition(1, 0, 1, 2)); + + _initView.Add(_firstPageContainer); + Tizen.Log.Fatal("NUI.Components", "TCT : InitializeFirstPage:"); + FocusManager.Instance.SetCurrentFocusView(_run); + } + + //Update the Test Page before you want to show it(Click Run/Pre/nect Button, or Click on item in the List). + void UpdateDetailPage() + { + UpdateCurrentTCInfo(); + Tizen.Log.Fatal("NUI.Components", "UpdateDetailPage:"); + CreateTestCase(); + } + + void InitializeDetailPage() + { + _detailList = new TableView(23, 1); + _detailList.Focusable = true; + _detailList.Size2D = new Size2D(Window.Instance.Size.Width - 50, 500); + _detailList.ParentOrigin = Position.ParentOriginTopLeft; + _detailList.PivotPoint = PivotPoint.TopLeft; + _detailList.Position = new Position(0.0f, 0.0f, 0.0f); + CreateDetailList(); + _detailView.Add(_detailList); + + //To Place the function button, such as PASS, FAIL..... + _buttonContainer = new TableView(2, 4); + _buttonContainer.SetSizeModeFactor(new Vector3(0.0f, 0.9f, 0.0f)); + _buttonContainer.PivotPoint = PivotPoint.TopCenter; + _buttonContainer.ParentOrigin = Position.ParentOriginTopLeft; + _buttonContainer.Position = new Position(0, Window.Instance.Size.Height * 0.6f, 0); + _buttonContainer.Size2D = new Size2D((int)Window.Instance.Size.Width, 300); + _buttonContainer.Focusable = (true); + CreateButtons(); + _detailView.Add(_buttonContainer); + } + + //To show the detail information of the test case + //Preconditions + //Steps + //PostConditions + void CreateTestCase() + { + if(_detailList) + { + _detailView.Remove(_detailList); + _detailList.Dispose(); + } + Tizen.Log.Fatal("NUI.Components", "Print the CurrentTCNum here::" + _currentTCNum); + _detailList = new TableView(10, 1); + _detailList.Focusable = true; + _detailList.Size2D = new Size2D(Window.Instance.Size.Width - 50, 400); + _detailList.ParentOrigin = Position.ParentOriginTopLeft; + _detailList.PivotPoint = PivotPoint.TopLeft; + _detailList.Position = new Position(0.0f, 0.0f, 0.0f); + CreateDetailList(); + _detailView.Add(_detailList); + if (_notRun) + { + _notRun.Text = _listItem[_currentTCNum].Result; + } + } + + //Create all the function buttons here, such as PASS, FAIL..... + void CreateButtons() + { + + _notRun = new TextLabel(); + _notRun.SizeWidth = 200; + _notRun.PixelSize = _pixelSize; + _notRun.HorizontalAlignment = HorizontalAlignment.Begin; + _notRun.Text = "Not Run"; + + _passButton = new PushButton(); + _passButton.Focusable = true; + _passButton.LabelText = "Pass"; + _passButton.Clicked += (obj, ee) => + { + + Clear(); + if (!ManualTest.IsConfirmed()) + { + _tsettings.TCResult = StrResult.PASS; + ManualTest.Confirm(); + } + Tizen.Log.Fatal("TBT", "Pass Button clicked!"); + return true; + }; + + _failButton = new PushButton(); + _failButton.Focusable = true; + _failButton.LabelText = "Fail"; + _failButton.Clicked += (obj, ee) => + { + Clear(); + if (!ManualTest.IsConfirmed()) + { + _tsettings.TCResult = StrResult.FAIL; + ManualTest.Confirm(); + } + Tizen.Log.Fatal("TBT", "Fail Button clicked!"); + return true; + }; + + _blockButton = new PushButton(); + _blockButton.Focusable = true; + _blockButton.LabelText = "Block"; + _blockButton.Clicked += (obj, ee) => + { + Clear(); + if (!ManualTest.IsConfirmed()) + { + _tsettings.TCResult = StrResult.BLOCK; + ManualTest.Confirm(); + } + return true; + }; + + _runButton = new PushButton(); + _runButton.Focusable = true; + _runButton.LabelText = "Run"; + _runButton.Clicked += (obj, ee) => + { + Clear(); + //should update the _caseView by the test case + _pressButton = NavigationButton.NA; + _tsettings.Testcase_ID = _tcIDList[_currentTCNum]; + _tsettings.TCResult = ""; + _tRunner.Execute(); + return true; + }; + + _homeButton = new PushButton(); + _homeButton.Focusable = true; + _homeButton.LabelText = "Home"; + _homeButton.Clicked += (obj, ee) => + { + Clear(); + _pressButton = NavigationButton.Home; + if (!ManualTest.IsConfirmed()) + { + _tsettings.TCResult = StrResult.NOTRUN; + ManualTest.Confirm(); + } + else + { + _detailView.Hide(); + _initView.Show(); + FocusManager.Instance.SetCurrentFocusView(_run); + } + return true; + }; + + _preButton = new PushButton(); + _preButton.Focusable = true; + _preButton.LabelText = "<<"; + _preButton.Clicked += (obj, ee) => + { + Clear(); + if (!ManualTest.IsConfirmed()) + { + _tsettings.TCResult = StrResult.NOTRUN; + ManualTest.Confirm(); + } + else + { + if (_currentTCNum != 0) + { + _currentTCNum--; + _notRun.Text = _listItem[_currentTCNum].Result; + ManualTest.Confirm(); + UpdateDetailPage(); + } + else if (_currentTCNum == 0) + { + _toastMessage.Message = "This is first testcase"; + _toastMessage.Post(); + } + } + return true; + }; + _nextButton = new PushButton(); + _nextButton.Focusable = true; + _nextButton.LabelText = ">>"; + _nextButton.Clicked += (obj, ee) => + { + Clear(); + if (!ManualTest.IsConfirmed()) + { + _tsettings.TCResult = StrResult.NOTRUN; + ManualTest.Confirm(); + } + if (_currentTCNum + 1 != ResultNumber.Total) + { + Tizen.Log.Fatal("NUI.Components", "Print the [not run] CurrentTCNum::" + _currentTCNum); + _currentTCNum++; + _notRun.Text = _listItem[_currentTCNum].Result; + UpdateDetailPage(); + } + else if (_currentTCNum + 1 == ResultNumber.Total) + { + _toastMessage.Message = "This is last testcase"; + _toastMessage.Post(); + } + return true; + }; + + _buttonContainer.AddChild(_passButton, new TableView.CellPosition(0, 0)); + _buttonContainer.AddChild(_failButton, new TableView.CellPosition(0, 1)); + _buttonContainer.AddChild(_blockButton, new TableView.CellPosition(0, 2)); + _buttonContainer.AddChild(_runButton, new TableView.CellPosition(0, 3)); + _buttonContainer.AddChild(_homeButton, new TableView.CellPosition(1, 0)); + _buttonContainer.AddChild(_notRun, new TableView.CellPosition(1, 1)); + _buttonContainer.AddChild(_preButton, new TableView.CellPosition(1, 2)); + _buttonContainer.AddChild(_nextButton, new TableView.CellPosition(1, 3)); + } + + public void ExecuteTC(View view) + { + Tizen.Log.Fatal("NUI.Components", "Execute the manual test case!"); + + _caseView = view; + _caseView.ParentOrigin = Position.ParentOriginTopLeft; + _caseView.PivotPoint = PivotPoint.TopLeft; + _caseView.Position = new Position(20.0f, 700.0f, 0.0f); + _detailView.Add(_caseView); + _caseView.KeyEvent += OnKeyPressed; + _caseView.Show(); + FocusManager.Instance.SetCurrentFocusView(_caseView); + } + + private bool OnKeyPressed(object source, View.KeyEventArgs e) + { + Tizen.Log.Fatal("NUI.Components", "CaseView OnKeyPressed 1 Down..." + e.Key.KeyPressedName); + + if (e.Key.State == Key.StateType.Down) + { + if (e.Key.KeyPressedName == "Down") + { + FocusManager.Instance.SetCurrentFocusView(_passButton); + + } + } + return false; + } + + private bool OnRunnerKeyPressed(object source, View.KeyEventArgs e) + { + Tizen.Log.Fatal("NUI.Components", "Runner OnKeyPressed Down..." + e.Key.KeyPressedName); + + if (e.Key.State == Key.StateType.Down) + { + if (e.Key.KeyPressedName == "Up") + { + Tizen.Log.Fatal("NUI.Components", "Set current focus view :: doneButton"); + FocusManager.Instance.SetCurrentFocusView(_doneButton); + } + } + return false; + } + + private bool OnDownButtonKeyPressed(object source, View.KeyEventArgs e) + { + Tizen.Log.Fatal("NUI.Components", "DownButton OnKeyPressed Down..." + e.Key.KeyPressedName); + + if (e.Key.State == Key.StateType.Down) + { + if (e.Key.KeyPressedName == "Down") + { + Tizen.Log.Fatal("NUI.Components", "Set current focus view :: run"); + FocusManager.Instance.SetCurrentFocusView(_run); + } + } + return false; + } + + private void Clear() + { + if (_caseView.IsOnWindow == true) + { + _detailView.Remove(_caseView); + } + } + + public void ClearTestCase(View view) + { + FocusManager.Instance.SetCurrentFocusView(_runButton); + Tizen.Log.Fatal("NUI.Components", "Clear test case!"); + _detailView.Remove(view); + } + + //Use to update the _summaryLabel. + private void SetSummaryResult() + { + ResultNumber.NotRun = ResultNumber.Total - ResultNumber.Pass - ResultNumber.Fail - ResultNumber.Block; + _summaryLabel.Text = "Total : " + ResultNumber.Total + ", Pass : " + ResultNumber.Pass + ", Fail : " + ResultNumber.Fail + ", Block : " + ResultNumber.Block + ", Not Run : " + ResultNumber.NotRun; + } + + private PropertyMap CreateTextMap(float pointSize, string text) + { + PropertyMap map = new PropertyMap(); + map.Insert("visualType", new PropertyValue("TEXT")); + map.Insert("pointSize", new PropertyValue(pointSize)); + map.Insert("text", new PropertyValue(text)); + return map; + } + + private void CreateInitList() + { + int tcNum = _tcIDList.Count; + Tizen.Log.Fatal("NUI.Components", "_tcIDList.Count: " + _tcIDList.Count); + _buttonList = new PushButton[tcNum]; + for (int index = 0; index < tcNum; index++) + { + string name = _tcIDList[index]; + string testcaseName = "#." + (index + 1).ToString() + name; + string resultText = "[" + _listItem[(int)index].Result + "]"; + string text = testcaseName + resultText; + _buttonList[index] = new PushButton(); + _buttonList[index].CellIndex = new Vector2(index, 0); + _buttonList[index].Name = index.ToString(); + _buttonList[index].Focusable = true; + _buttonList[index].Label = CreateTextMap(_pointSize, text); + _buttonList[index].ParentOrigin = Position.ParentOriginTopLeft; + _buttonList[index].PivotPoint = PivotPoint.TopLeft; + _buttonList[index].Position = new Position(0.0f, 0.0f, 0.0f); + _buttonList[index].Clicked += (obj, e) => + { + PushButton button = obj as PushButton; + + Tizen.Log.Fatal("TBT", "Item clicked!!::" + button.Name); + _currentTCNum = int.Parse(button.Name); + _initView.Hide(); + UpdateDetailPage(); + _caseView.Hide(); + _detailView.Show(); + FocusManager.Instance.SetCurrentFocusView(_runButton); + return false; + }; + _buttonList[index].FocusGained += ManualTestNUI_FocusGained; + _initList.AddChild(_buttonList[index], new TableView.CellPosition((uint)index, 0)); + + } + } + + private void ManualTestNUI_FocusGained(object sender, EventArgs e) + { + var item = sender as PushButton; + if (item != null) + { + uint idx = UInt32.Parse(item.Name); + _scrollView.ScrollTo(new Vector2(0, 30 * idx)); + } + } + + private void CreateDetailList() + { + Tizen.Log.Fatal("NUI.Components", "Print the CreateDetailList::"); + int senNum = _currentTCInfo.Count; + for (int index = 0; index < senNum; index++) + { + TextLabel description = new TextLabel(); + description.ParentOrigin = Position.ParentOriginTopLeft; + description.PivotPoint = PivotPoint.TopLeft; + description.Position = new Position(0.0f, 0.0f, 0.0f); + description.Size2D = new Size2D((int)Window.Instance.Size.Width - 20, 50); + description.HorizontalAlignment = HorizontalAlignment.Begin; + description.PointSize = _pointSize; + description.Text = _currentTCInfo[(int)index]; + _detailList.AddChild(description, new TableView.CellPosition((uint)index, 0)); + } + } + + //Init all the data, should be offered by Test Framework + void InitData() + { + ResultNumber.Total = _tcIDList.Count; + ResultNumber.Pass = 0; + ResultNumber.Fail = 0; + ResultNumber.Block = 0; + _tcInfoList = new List(); + foreach (var testcaseItem in _listItem) + { + foreach (KeyValuePair pair in _tRunner.GetTestList()) + { + if (testcaseItem.TCName.Equals(pair.Key)) + { + List preconditions = new List(); + preconditions.Add("Preconditions:"); + List steps = new List(); + steps.Add("Steps:"); + List postconditions = new List(); + postconditions.Add("Postconditions:\n"); + IEnumerator customAttributes = pair.Value.Method.MethodInfo.CustomAttributes.GetEnumerator(); + while (customAttributes.MoveNext()) + { + if (customAttributes.Current.AttributeType.FullName.Equals(STEP_ATTRIBUTE_NAME)) + { + steps.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value); + } + else if (customAttributes.Current.AttributeType.FullName.Equals(PRECONDITION_ATTRIBUTE_NAME)) + { + preconditions.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value); + } + else if (customAttributes.Current.AttributeType.FullName.Equals(POSTCONDITION_ATTRIBUTE_NAME)) + { + postconditions.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value); + } + } + _tcInfoList.Add(new TestcaseInfo + { + TestcaseName = pair.Key, + Preconditions = preconditions, + Steps = steps, + Postconditions = postconditions, + }); + break; + } + } + UpdateCurrentTCInfo(); + } + } + + //The data in CurrentTCInfo list will be show in _detailList. + void UpdateCurrentTCInfo() + { + _currentTCInfo = new List(); + Tizen.Log.Fatal("NUI.Components", "Print the CurrentTCNum::" + _currentTCNum); + _currentTCInfo.Add("DESCRIPTION:#" + (_currentTCNum + 1)); + string[] str = _tcInfoList[_currentTCNum].TestcaseName.Split('.'); + _currentTCInfo.Add("CLASS:" + str[str.Length - 2]); + _currentTCInfo.Add("METHOD:" + str[str.Length - 1]); + for(int index = 0; index < _tcInfoList[_currentTCNum].Preconditions.Count; index++) + { + _currentTCInfo.Add(_tcInfoList[_currentTCNum].Preconditions[index]); + } + for(int index = 0; index < _tcInfoList[_currentTCNum].Steps.Count; index++ ) + { + _currentTCInfo.Add(_tcInfoList[_currentTCNum].Steps[index]); + } + for(int index = 0; index < _tcInfoList[_currentTCNum].Postconditions.Count; index++ ) + { + _currentTCInfo.Add(_tcInfoList[_currentTCNum].Postconditions[index]); + } + Tizen.Log.Fatal("NUI.Components", "The CurrentTCNum::" + _currentTCNum); + } + + private void OnSingleTestDone(object sender, SingleTestDoneEventArgs e) + { + //Test when will this event will be triggered + Tizen.Log.Fatal("NUI.Components", "OnSingleTestDone has been triggered!"); + // check old result + if (_listItem[_currentTCNum].Result.Contains(StrResult.FAIL)) + { + ResultNumber.Fail = ResultNumber.Fail - 1; + } + else if (_listItem[_currentTCNum].Result.Contains(StrResult.PASS)) + { + ResultNumber.Pass = ResultNumber.Pass - 1; + } + else if (_listItem[_currentTCNum].Result.Contains(StrResult.BLOCK)) + ResultNumber.Block = ResultNumber.Block - 1; + + // Update new result + _listItem[_currentTCNum].Result = e.Result; + if (e.Result.Contains(StrResult.PASS)) + { + ResultNumber.Pass += 1; + } + else if (e.Result.Contains(StrResult.FAIL)) + { + ResultNumber.Fail += 1; + } + else if (e.Result.Contains(StrResult.BLOCK)) + { + ResultNumber.Block += 1; + } + + _initList.RemoveChildAt(new TableView.CellPosition((uint)_currentTCNum, 0)); + string name = _tcIDList[_currentTCNum]; + string testcaseName = "#." + (_currentTCNum + 1).ToString() + name; + string resultText = "[" + _listItem[(int)_currentTCNum].Result + "]"; + string text = testcaseName + resultText; + PushButton button = new PushButton(); + button.CellIndex = new Vector2(_currentTCNum, 0); + button.Name = _currentTCNum.ToString(); + button.Focusable = true; + button.Label = CreateTextMap(_pointSize, text); + button.ParentOrigin = Position.ParentOriginTopLeft; + button.PivotPoint = PivotPoint.TopLeft; + button.Position = new Position(0.0f, 0.0f, 0.0f); + button.Clicked += (obj, ee) => + { + Tizen.Log.Fatal("NUI.Components", "Item clicked clicked!!::" + ((int)button.CellIndex.X).ToString()); + _currentTCNum = (int)button.CellIndex.X; + _initView.Hide(); + UpdateDetailPage(); + _caseView.Hide(); + _detailView.Show(); + FocusManager.Instance.SetCurrentFocusView(_runButton); + return false; + }; + _initList.AddChild(button, new TableView.CellPosition((uint)_currentTCNum, 0)); + SetSummaryResult(); + _notRun.Text = _listItem[_currentTCNum].Result; + } + } +} + diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/Program.cs b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/Program.cs new file mode 100755 index 000000000..910a7cf3b --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/Program.cs @@ -0,0 +1,48 @@ +/* + * 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 NUnitLite.TUnit; +using Tizen.NUI; + +namespace Tizen.NUI.Components.Tests +{ + + public class App : Tizen.NUI.NUIApplication + { + protected override void OnCreate() + { + Window window = Window.Instance; + if(ManualTest.IsWearable()) + { + WearableManualTestNUI.GetInstance(); + } + else + { + ManualTestComponents.GetInstance(); + } + } + + static void Main(string[] args) + { + Tizen.Log.Fatal("NUI.Components", "Manual TCT for NUI start!"); + App example = new App(); + example.Run(args); + } + + }; + +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/Tizen.NUI.Components.Manual.Tests.csproj b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/Tizen.NUI.Components.Manual.Tests.csproj new file mode 100755 index 000000000..b0d5bd863 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/Tizen.NUI.Components.Manual.Tests.csproj @@ -0,0 +1,41 @@ + + + + + Exe + tizen60 + + + + + true + + + + portable + + + None + + + + + + + + + + + + Runtime + + + + + + + + + + + diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/Tizen.NUI.Components.Manual.Tests.sln b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/Tizen.NUI.Components.Manual.Tests.sln new file mode 100755 index 000000000..f4b694909 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/Tizen.NUI.Components.Manual.Tests.sln @@ -0,0 +1,64 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26124.0 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.NUI.Components.Manual.Tests", "Tizen.NUI.Components.Manual.Tests.csproj", "{66D8A33C-59A0-4F95-86BB-D4B98DB350B8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.framework", "..\nunit.framework\nunit.framework.csproj", "{8537EA70-6272-4CCD-BCD4-EA8678519A42}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunitlite", "..\nunitlite\nunitlite.csproj", "{F125594F-E09F-4444-8DD7-ACAE72830C55}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {66D8A33C-59A0-4F95-86BB-D4B98DB350B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {66D8A33C-59A0-4F95-86BB-D4B98DB350B8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {66D8A33C-59A0-4F95-86BB-D4B98DB350B8}.Debug|x64.ActiveCfg = Debug|Any CPU + {66D8A33C-59A0-4F95-86BB-D4B98DB350B8}.Debug|x64.Build.0 = Debug|Any CPU + {66D8A33C-59A0-4F95-86BB-D4B98DB350B8}.Debug|x86.ActiveCfg = Debug|Any CPU + {66D8A33C-59A0-4F95-86BB-D4B98DB350B8}.Debug|x86.Build.0 = Debug|Any CPU + {66D8A33C-59A0-4F95-86BB-D4B98DB350B8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {66D8A33C-59A0-4F95-86BB-D4B98DB350B8}.Release|Any CPU.Build.0 = Release|Any CPU + {66D8A33C-59A0-4F95-86BB-D4B98DB350B8}.Release|x64.ActiveCfg = Release|Any CPU + {66D8A33C-59A0-4F95-86BB-D4B98DB350B8}.Release|x64.Build.0 = Release|Any CPU + {66D8A33C-59A0-4F95-86BB-D4B98DB350B8}.Release|x86.ActiveCfg = Release|Any CPU + {66D8A33C-59A0-4F95-86BB-D4B98DB350B8}.Release|x86.Build.0 = Release|Any CPU + {8537EA70-6272-4CCD-BCD4-EA8678519A42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8537EA70-6272-4CCD-BCD4-EA8678519A42}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8537EA70-6272-4CCD-BCD4-EA8678519A42}.Debug|x64.ActiveCfg = Debug|Any CPU + {8537EA70-6272-4CCD-BCD4-EA8678519A42}.Debug|x64.Build.0 = Debug|Any CPU + {8537EA70-6272-4CCD-BCD4-EA8678519A42}.Debug|x86.ActiveCfg = Debug|Any CPU + {8537EA70-6272-4CCD-BCD4-EA8678519A42}.Debug|x86.Build.0 = Debug|Any CPU + {8537EA70-6272-4CCD-BCD4-EA8678519A42}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8537EA70-6272-4CCD-BCD4-EA8678519A42}.Release|Any CPU.Build.0 = Release|Any CPU + {8537EA70-6272-4CCD-BCD4-EA8678519A42}.Release|x64.ActiveCfg = Release|Any CPU + {8537EA70-6272-4CCD-BCD4-EA8678519A42}.Release|x64.Build.0 = Release|Any CPU + {8537EA70-6272-4CCD-BCD4-EA8678519A42}.Release|x86.ActiveCfg = Release|Any CPU + {8537EA70-6272-4CCD-BCD4-EA8678519A42}.Release|x86.Build.0 = Release|Any CPU + {F125594F-E09F-4444-8DD7-ACAE72830C55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F125594F-E09F-4444-8DD7-ACAE72830C55}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F125594F-E09F-4444-8DD7-ACAE72830C55}.Debug|x64.ActiveCfg = Debug|Any CPU + {F125594F-E09F-4444-8DD7-ACAE72830C55}.Debug|x64.Build.0 = Debug|Any CPU + {F125594F-E09F-4444-8DD7-ACAE72830C55}.Debug|x86.ActiveCfg = Debug|Any CPU + {F125594F-E09F-4444-8DD7-ACAE72830C55}.Debug|x86.Build.0 = Debug|Any CPU + {F125594F-E09F-4444-8DD7-ACAE72830C55}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F125594F-E09F-4444-8DD7-ACAE72830C55}.Release|Any CPU.Build.0 = Release|Any CPU + {F125594F-E09F-4444-8DD7-ACAE72830C55}.Release|x64.ActiveCfg = Release|Any CPU + {F125594F-E09F-4444-8DD7-ACAE72830C55}.Release|x64.Build.0 = Release|Any CPU + {F125594F-E09F-4444-8DD7-ACAE72830C55}.Release|x86.ActiveCfg = Release|Any CPU + {F125594F-E09F-4444-8DD7-ACAE72830C55}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {70518B32-7051-446F-9251-03D863BBD75E} + EndGlobalSection +EndGlobal diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/Utils.cs b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/Utils.cs new file mode 100755 index 000000000..0c6141719 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/Utils.cs @@ -0,0 +1,246 @@ +/* + * 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 System.Runtime.InteropServices; +using System.Collections.Generic; +using System.ComponentModel; +using Tizen.NUI.BaseComponents; +using Tizen.NUI; + +namespace Tizen.NUI.Components.Tests +{ + + public class ResultNumber + { + public static int Total { get; set; } + public static int Pass { get; set; } + public static int Fail { get; set; } + public static int NotRun { get; set; } + public static int Block { get; set; } + } + + public class TestcaseInfo + { + private string _tescaseName; + public string TestcaseName + { + get + { + return _tescaseName; + } + set + { + _tescaseName = value; + } + } + + private List _preconditions; + public List Preconditions + { + get + { + return _preconditions; + } + set + { + _preconditions = value; + } + } + + private List _steps; + public List Steps + { + get + { + return _steps; + } + set + { + _steps = value; + } + } + + private List _postconditions; + public List Postconditions + { + get + { + return _postconditions; + } + set + { + _postconditions = value; + } + } + } + public class ItemData : INotifyPropertyChanged + { + public event PropertyChangedEventHandler PropertyChanged; + private void OnPropertyChanged(object sender, string propertyName) + { + if (this.PropertyChanged != null) + { + PropertyChanged(sender, new PropertyChangedEventArgs(propertyName)); + } + } + public int No { get; set; } + + public string TCName { get; set; } + + private string _result; + public string Result + { + get + { + return _result; + } + set + { + _result = value; + if (_result.Equals(StrResult.PASS)) + { + ResultColor = Color.Green; + } + else if (_result.Equals(StrResult.FAIL)) + { + ResultColor = Color.Red; + } + else if (_result.Equals(StrResult.BLOCK)) + { + ResultColor = Color.Red; + } + else + { + ResultColor = Color.Black; + } + OnPropertyChanged(this, "Result"); + } + } + + private Color _resultColor; + public Color ResultColor + { + get { return _resultColor; } + set + { + _resultColor = value; + OnPropertyChanged(this, "ResultColor"); + } + } + } + + public class StrResult + { + public static string PASS = "PASS"; + public static string FAIL = "FAIL"; + public static string NOTRUN = "NOT RUN"; + public static string BLOCK = "BLOCK"; + } + + public class RunType + { + public static string AUTO = "AUTO"; + public static string MANUAL = "MANUAL"; + + public static string Value { get; set; } + } + + public class ManualTest + { + private static bool Confirmed = true; + + public static async Task WaitForConfirm() + { + Confirmed = false; + //ManualTestNUI.GetInstance().UnlockUIButton(); + while (true) + { + await Task.Delay(200); + if (Confirmed) + break; + } + } + + public static bool IsConfirmed() + { + return Confirmed; + } + + public static void Confirm() + { + Confirmed = true; + } + + public static bool IsMobile() + { + string value; + var result = Tizen.System.Information.TryGetValue("tizen.org/feature/profile", out value); + if (result && value.Equals("mobile")) + { + return true; + } + + return false; + } + + public static bool IsWearable() + { + string value; + var result = Tizen.System.Information.TryGetValue("tizen.org/feature/profile", out value); + if (result && value.Equals("wearable")) + { + return true; + } + + return false; + } + + public static bool IsEmulator() + { + string value; + var result = Tizen.System.Information.TryGetValue("tizen.org/system/model_name", out value); + if (result && value.Equals("Emulator")) + { + return true; + } + + return false; + } + + public static TextLabel CreateLabel(string information) + { + TextLabel mLabel = new TextLabel(); + mLabel.TextColor = Color.White; + mLabel.PointSize = 4.0f; + mLabel.VerticalAlignment = VerticalAlignment.Center; + mLabel.HorizontalAlignment = HorizontalAlignment.Begin; + mLabel.MultiLine = true; + mLabel.Text = information; + mLabel.Size2D = new Size2D(300, 50); + return mLabel; + } + } + + enum NavigationButton + { + Next, + Previous, + Home, + NA + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/WearableManualTestPage.cs b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/WearableManualTestPage.cs new file mode 100755 index 000000000..9ed89cd7c --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/WearableManualTestPage.cs @@ -0,0 +1,760 @@ +/* +* Copyright (c) 2019 Samsung Electronics Co., Ltd. +* +* 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.Runtime.InteropServices; +using System.Collections.Generic; +using NUnitLite.TUnit; +using NUnit.Framework.Interfaces; +using NUnit.Framework.TUnit; +using System.Reflection; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.UIComponents; + +namespace Tizen.NUI.Components.Tests +{ + class WearableManualTestNUI + { + private List _tcIDList; + private List _listItem; + private TSettings _tsettings; + private TRunner _tRunner; + private NavigationButton _pressButton = NavigationButton.NA; + private PushButton _passButton, _failButton, _blockButton, _homeButton, _preButton, _nextButton, _doneButton; + private TextLabel _notRun; + private const string STEP_ATTRIBUTE_NAME = "NUnit.Framework.StepAttribute"; + private const string PRECONDITION_ATTRIBUTE_NAME = "NUnit.Framework.PreconditionAttribute"; + private const string POSTCONDITION_ATTRIBUTE_NAME = "NUnit.Framework.PostconditionAttribute"; + private List _listNotPass; + private float _pointSize = 5.0f; + + //Save the information of every single test case + private List _tcInfoList; + private List _currentTCInfo; + + private static WearableManualTestNUI _instance; + private static Object _lockObject = new object(); + + //Show the result of all the test case + private TextLabel _summaryLabel1, _summaryLabel2, _description; + private View _initView; + private View _detailView; + + private ScrollView _initList; + private ScrollView _detailList; + + private View _caseView; + + private PushButton _run; + private PushButton _runButton; + private PushButton[] _buttonList; + + private TextLabel[] _resultList; + + //Always save the current TC number; + private int _currentTCNum = 0; + + private static int _scrollWidth = Window.Instance.Size.Width; + private static int _scrollHeight = 120; + + private static int _detailScrollHeight = 60; + + public static WearableManualTestNUI GetInstance() + { + lock (_lockObject) + { + if (_instance == null) + { + _instance = new WearableManualTestNUI(); + } + } + return _instance; + } + + private WearableManualTestNUI() + { + Initialize(); + } + public void Initialize() + { + Window.Instance.BackgroundColor = new Color(0.1f, 0.1f, 0.1f, 1.0f); + Tizen.Log.Fatal("NUI.Components", "Initialize========================================="); + _pointSize = (1.0f / Window.Instance.Dpi.Length()) * 2000.0f; + RunType.Value = RunType.MANUAL; + _tRunner = new TRunner(); + _tRunner.LoadTestsuite(); + _tRunner.SingleTestDone += OnSingleTestDone; + _listNotPass = new List(); + _tcIDList = new List(); + _listItem = new List(); + _listNotPass = TSettings.GetInstance().GetNotPassListManual(); + int count = 0; + foreach (var tc in _listNotPass) + { + _listItem.Add(new ItemData { No = count, TCName = tc, Result = StrResult.NOTRUN }); + _tcIDList.Add(tc); + count++; + } + Tizen.Log.Fatal("NUI.Components", "TCT : count:" + count.ToString()); + foreach (String nameTc in _tcIDList) + { + Tizen.Log.Fatal("NUI.Components", "TCT : TCName:" + nameTc.ToString()); + } + + + _tsettings = TSettings.GetInstance(); + _tsettings.IsManual = true; + + InitData(); + _caseView = new View(); + Window.Instance.GetDefaultLayer().Add(_caseView); + Window window = Window.Instance; + + _summaryLabel1 = new TextLabel(); + _summaryLabel1.TextColor = Color.White; + _summaryLabel1.PointSize = 5.0f; + _summaryLabel1.Size2D = new Size2D(200, 30); + _summaryLabel1.ParentOrigin = ParentOrigin.TopLeft; + _summaryLabel1.PivotPoint = PivotPoint.TopLeft; + _summaryLabel1.Position = new Position(70, 12, 0); + _summaryLabel1.HorizontalAlignment = HorizontalAlignment.Center; + _summaryLabel1.VerticalAlignment = VerticalAlignment.Center; + + _summaryLabel2 = new TextLabel(); + _summaryLabel2.TextColor = Color.White; + _summaryLabel2.PointSize = 5.0f; + _summaryLabel2.Size2D = new Size2D(300, 30); + _summaryLabel2.ParentOrigin = ParentOrigin.TopLeft; + _summaryLabel2.PivotPoint = PivotPoint.TopLeft; + _summaryLabel2.Position = new Position(20, 33, 0); + _summaryLabel2.HorizontalAlignment = HorizontalAlignment.Center; + _summaryLabel2.VerticalAlignment = VerticalAlignment.Center; + + SetSummaryResult(); + Window.Instance.GetDefaultLayer().Add(_summaryLabel1); + Window.Instance.GetDefaultLayer().Add(_summaryLabel2); + + _initView = new View(); + _initView.Size2D = new Size2D((int)Window.Instance.Size.Width, 200); + _initView.ParentOrigin = ParentOrigin.TopLeft; + _initView.PivotPoint = PivotPoint.TopLeft; + _initView.Position = new Position(0.0f, 60.0f, 0.0f); + InitializeFirstPage(); + _initView.Show(); + + _detailView = new View(); + _detailView.Size2D = new Size2D((int)Window.Instance.Size.Width, (int)Window.Instance.Size.Height - 65); + _detailView.ParentOrigin = ParentOrigin.TopLeft; + _detailView.PivotPoint = PivotPoint.TopLeft; + _detailView.Position = new Position(0.0f, 70.0f, 0.0f); + InitializeDetailPage(); + _detailView.Hide(); + + window.GetDefaultLayer().Add(_initView); + window.GetDefaultLayer().Add(_detailView); + } + + void InitializeFirstPage() + { + //Create Run Button, when you Click it, then the first test case will be executed. + _doneButton = new PushButton(); + _doneButton.Size2D = new Size2D(120, 60); + _doneButton.Position2D = new Position2D(-150, -200); + //doneButton.Position2D = new Position2D(50, 0); + _doneButton.Label = CreateTextVisual("Done", Color.White); + _doneButton.Clicked += (obj, ee) => + { + TSettings.GetInstance().SubmitManualResult(); + return false; + }; + + _run = new PushButton(); + _run.Size2D = new Size2D(120, 60); + _run.Position2D = new Position2D(20, -200); + //run.Position2D = new Position2D(180, 0); + _run.Label = CreateTextVisual("Runner", Color.White); ; + _run.Clicked += (obj, ee) => + { + Tizen.Log.Fatal("NUI.Components", "Check all the test case from the first one."); + _currentTCNum = 0; + _initView.Hide(); + _caseView.Hide(); + UpdateDetailPage(); + _detailView.Show(); + return false; + }; + + _initList = new ScrollView(); + _initList.Size2D = new Size2D(_scrollWidth, _scrollHeight); + _initList.ParentOrigin = ParentOrigin.TopLeft; + _initList.PivotPoint = PivotPoint.TopLeft; + _initList.Position2D = new Position2D(0, 80); + _initList.ClippingMode = ClippingModeType.ClipChildren; + CreateInitList(); + + _initView.Add(_doneButton); + _initView.Add(_run); + _initView.Add(_initList); + Tizen.Log.Fatal("NUI.Components", "TCT : InitializeFirstPage:"); + } + + //Update the Test Page before you want to show it(Click Run/Pre/nect Button, or Click on item in the List). + void UpdateDetailPage() + { + UpdateCurrentTCInfo(); + Tizen.Log.Fatal("NUI.Components", "UpdateDetailPage::::::::::::::::::::::"); + CreateTestCase(); + } + + void InitializeDetailPage() + { + _detailList = new ScrollView(); + _detailList.BackgroundColor = Color.Black; + _detailList.Size2D = new Size2D(_scrollWidth - 100, _detailScrollHeight); + _detailList.ParentOrigin = ParentOrigin.TopLeft; + _detailList.PivotPoint = PivotPoint.TopLeft; + _detailList.Position2D = new Position2D(30, 20); + _detailList.ClippingMode = ClippingModeType.ClipChildren; + + _description = new TextLabel(); + _description.TextColor = Color.White; + _description.PointSize = 3.0f; + _description.ParentOrigin = ParentOrigin.TopLeft; + _description.PivotPoint = PivotPoint.TopLeft; + _description.Size2D = new Size2D(200, 20); + _description.Position2D = new Position2D(50, 0); + _detailView.Add(_description); + + CreateDetailList(); + _detailView.Add(_detailList); + + //To Place the function button, such as PASS, FAIL..... + CreateButtons(); + } + + //To show the detail information of the test case + //Preconditions + //Steps + //PostConditions + void CreateTestCase() + { + if(_detailList) + { + _detailView.Remove(_detailList); + _detailList.Dispose(); + } + Tizen.Log.Fatal("NUI.Components", "Print the CurrentTCNum here::" + _currentTCNum); + + _detailList = new ScrollView(); + _detailList.BackgroundColor = Color.Black; + _detailList.Size2D = new Size2D(_scrollWidth - 100, _detailScrollHeight); + _detailList.ParentOrigin = ParentOrigin.TopLeft; + _detailList.PivotPoint = PivotPoint.TopLeft; + _detailList.Position2D = new Position2D(30, 20); + _detailList.ClippingMode = ClippingModeType.ClipChildren; + CreateDetailList(); + _detailView.Add(_detailList); + if (_notRun) + { + _notRun.Text = _listItem[_currentTCNum].Result; + } + } + private TextLabel CreateTextLabel(string textStr, int left) + { + TextLabel text = new TextLabel(); + text.TextColor = Color.White; + text.ParentOrigin = ParentOrigin.TopLeft; + text.PivotPoint = PivotPoint.TopLeft; + text.Text = textStr; + text.PointSize = 5.0f; + text.VerticalAlignment = VerticalAlignment.Bottom; + text.HorizontalAlignment = HorizontalAlignment.Center; + text.Size2D = new Size2D(30, 30); + text.Position2D = new Position2D(left, 0); + return text; + } + //Create all the function buttons here, such as PASS, FAIL..... + void CreateButtons() + { + + _notRun = new TextLabel(); + _notRun.TextColor = Color.White; + _notRun.Size2D = new Size2D(40, 30); + _notRun.PointSize = 2.5f; + _notRun.Position2D = new Position2D(260, 118); + _notRun.HorizontalAlignment = HorizontalAlignment.Center; + _notRun.VerticalAlignment = VerticalAlignment.Center; + _notRun.MultiLine = true; + _notRun.Text = "Not Run"; + + TextLabel pass = CreateTextLabel("P", 20); + _passButton = new PushButton(); + _passButton.Size2D = new Size2D(70, 30); + _passButton.Position2D = new Position2D(0, 0); + _passButton.LabelText = ""; + _passButton.Add(pass); + _passButton.Clicked += (obj, ee) => + { + + Clear(); + if (!ManualTest.IsConfirmed()) + { + _tsettings.TCResult = StrResult.PASS; + ManualTest.Confirm(); + } + Tizen.Log.Fatal("TBT", "Pass Button clicked!"); + return true; + }; + + TextLabel fail = CreateTextLabel("F", 20); + _failButton = new PushButton(); + _failButton.Size2D = new Size2D(70, 30); + _failButton.Position2D = new Position2D(72, 0); + _failButton.LabelText = ""; + _failButton.Add(fail); + _failButton.Clicked += (obj, ee) => + { + Clear(); + if (!ManualTest.IsConfirmed()) + { + _tsettings.TCResult = StrResult.FAIL; + ManualTest.Confirm(); + } + Tizen.Log.Fatal("TBT", "Fail Button clicked!"); + return true; + }; + + TextLabel block = CreateTextLabel("B", 20); + _blockButton = new PushButton(); + _blockButton.Size2D = new Size2D(70, 30); + _blockButton.Position2D = new Position2D(144, 0); + _blockButton.LabelText = ""; + _blockButton.Add(block); + _blockButton.Clicked += (obj, ee) => + { + Clear(); + if (!ManualTest.IsConfirmed()) + { + _tsettings.TCResult = StrResult.BLOCK; + ManualTest.Confirm(); + } + return true; + }; + + TextLabel run = CreateTextLabel("R", 20); + _runButton = new PushButton(); + _runButton.Size2D = new Size2D(70, 30); + _runButton.Position2D = new Position2D(216, 0); + _runButton.LabelText = ""; + _runButton.Add(run); + _runButton.Clicked += (obj, ee) => + { + Clear(); + //should update the _caseView by the test case + _pressButton = NavigationButton.NA; + _tsettings.Testcase_ID = _tcIDList[_currentTCNum]; + _tsettings.TCResult = ""; + _tRunner.Execute(); + return true; + }; + + TextLabel home = CreateTextLabel("H", 15); + _homeButton = new PushButton(); + _homeButton.Size2D = new Size2D(60, 30); + _homeButton.Position2D = new Position2D(15, 32); + _homeButton.LabelText = ""; + _homeButton.Add(home); + _homeButton.Clicked += (obj, ee) => + { + Clear(); + _pressButton = NavigationButton.Home; + if (!ManualTest.IsConfirmed()) + { + _tsettings.TCResult = StrResult.NOTRUN; + ManualTest.Confirm(); + } + else + { + _detailView.Hide(); + _initView.Show(); + } + return true; + }; + + TextLabel pre = CreateTextLabel("<<", 15); + _preButton = new PushButton(); + _preButton.Size2D = new Size2D(60, 30); + _preButton.Position2D = new Position2D(128, 32); + _preButton.LabelText = ""; + _preButton.Add(pre); + _preButton.Clicked += (obj, ee) => + { + Clear(); + if (!ManualTest.IsConfirmed()) + { + _tsettings.TCResult = StrResult.NOTRUN; + ManualTest.Confirm(); + } + else + { + if (_currentTCNum != 0) + { + _currentTCNum--; + _notRun.Text = _listItem[_currentTCNum].Result; + ManualTest.Confirm(); + UpdateDetailPage(); + } + } + return true; + }; + + TextLabel next = CreateTextLabel(">>", 15); + _nextButton = new PushButton(); + _nextButton.Size2D = new Size2D(60, 30); + _nextButton.Position2D = new Position2D(193, 32); + _nextButton.Add(next); + _nextButton.LabelText = ""; + _nextButton.Clicked += (obj, ee) => + { + Clear(); + if (!ManualTest.IsConfirmed()) + { + _tsettings.TCResult = StrResult.NOTRUN; + ManualTest.Confirm(); + } + if (_currentTCNum + 1 != ResultNumber.Total) + { + Tizen.Log.Fatal("NUI.Components", "Print the [not run] CurrentTCNum::" + _currentTCNum); + _currentTCNum++; + _notRun.Text = _listItem[_currentTCNum].Result; + UpdateDetailPage(); + } + return true; + }; + + View buttonView = new View(); + buttonView.ParentOrigin = ParentOrigin.TopLeft; + buttonView.PivotPoint = PivotPoint.TopLeft; + buttonView.Size2D = new Size2D(Window.Instance.Size.Width, 80); + buttonView.Position2D = new Position2D(-140, 120); + + buttonView.Add(_passButton); + buttonView.Add(_failButton); + buttonView.Add(_blockButton); + buttonView.Add(_runButton); + buttonView.Add(_homeButton); + buttonView.Add(_notRun); + buttonView.Add(_preButton); + buttonView.Add(_nextButton); + _detailView.Add(buttonView); + } + + public void ExecuteTC(View view) + { + Tizen.Log.Fatal("ManualTCT", "Execute the manual test case!"); + + _caseView = view; + _caseView.ParentOrigin = Position.ParentOriginTopLeft; + _caseView.PivotPoint = PivotPoint.TopLeft; + _caseView.Position = new Position(40.0f, 120.0f, 0.0f); + _detailView.Add(_caseView); + _caseView.Show(); + } + + private void Clear() + { + if (_caseView.IsOnWindow == true) + { + _detailView.Remove(_caseView); + } + } + + public void ClearTestCase(View view) + { + Tizen.Log.Fatal("NUI.Components", "Clear test case!"); + _detailView.Remove(view); + } + + //Use to update the _summaryLabel. + private void SetSummaryResult() + { + ResultNumber.NotRun = ResultNumber.Total - ResultNumber.Pass - ResultNumber.Fail - ResultNumber.Block; + _summaryLabel1.Text = "T : " + ResultNumber.Total + ", P : " + ResultNumber.Pass; + _summaryLabel2.Text = "F : " + ResultNumber.Fail + ", B : " + ResultNumber.Block + ", NR: " + ResultNumber.NotRun; + Tizen.Log.Fatal("ManualTCT", "Set the result Text"); + } + + private PropertyMap CreateTextMap(float pointSize, string text) + { + PropertyMap map = new PropertyMap(); + map.Insert("visualType", new PropertyValue("TEXT")); + map.Insert("pointSize", new PropertyValue(pointSize)); + map.Insert("text", new PropertyValue(text)); + return map; + } + + private void CreateInitList() + { + int tcNum = _tcIDList.Count; + _buttonList = new PushButton[tcNum]; + _resultList = new TextLabel[tcNum]; + for (int index = 0; index < tcNum; index++) + { + string name = _tcIDList[index]; + string testcaseName = "#." + (index + 1).ToString(); + Tizen.Log.Fatal("ManualTCT", "name: " + name); + TextLabel label = new TextLabel(); + label.TextColor = Color.White; + label.Text = testcaseName; + label.PointSize = 4.0f; + label.VerticalAlignment = VerticalAlignment.Center; + label.ParentOrigin = ParentOrigin.TopLeft; + label.PivotPoint = PivotPoint.TopLeft; + label.Size2D = new Size2D(40, _scrollHeight); + label.Position2D = new Position2D(0, 0); + + + TextLabel nameLabel = new TextLabel(); + nameLabel.ParentOrigin = ParentOrigin.TopLeft; + nameLabel.PivotPoint = PivotPoint.TopLeft; + nameLabel.Text = name; + nameLabel.VerticalAlignment = VerticalAlignment.Bottom; + nameLabel.PointSize = 4.0f; + nameLabel.TextColor = Color.White; + nameLabel.MultiLine = true; + nameLabel.Size2D = new Size2D(245, _scrollHeight); + nameLabel.Position2D = new Position2D(5, 0); + nameLabel.TextColor = Color.White; + + string resultText = "[" + _listItem[(int)index].Result + "]"; + _buttonList[index] = new PushButton(); + _buttonList[index].Name = index.ToString(); + _buttonList[index].ParentOrigin = ParentOrigin.TopLeft; + _buttonList[index].PivotPoint = PivotPoint.TopLeft; + _buttonList[index].Position = new Position(33, 0.0f, 0.0f); + _buttonList[index].Size2D = new Size2D(255, _scrollHeight); + _buttonList[index].LabelText = ""; + _buttonList[index].Add(nameLabel); + _buttonList[index].Clicked += (obj, e) => + { + PushButton button = obj as PushButton; + + Tizen.Log.Fatal("TBT", "Item clicked!!!!!!!!!!!!!!::" + button.Name); + _currentTCNum = int.Parse(button.Name); + _initView.Hide(); + UpdateDetailPage(); + _caseView.Hide(); + _detailView.Show(); + return false; + }; + + _resultList[index] = new TextLabel(); + _resultList[index].TextColor = Color.White; + _resultList[index].PointSize = 3.0f; + _resultList[index].Name = index.ToString(); + _resultList[index].Text = resultText; + _resultList[index].ParentOrigin = ParentOrigin.TopLeft; + _resultList[index].PivotPoint = PivotPoint.TopLeft; + _resultList[index].Position = new Position(285.0f, 0.0f, 0.0f); + _resultList[index].Size2D = new Size2D(65, _scrollHeight); + _resultList[index].VerticalAlignment = VerticalAlignment.Center; + _resultList[index].HorizontalAlignment = HorizontalAlignment.Center; + + View pageActor = new View(); + pageActor.WidthResizePolicy = ResizePolicyType.FillToParent; + pageActor.HeightResizePolicy = ResizePolicyType.FillToParent; + pageActor.ParentOrigin = ParentOrigin.TopLeft; + pageActor.PivotPoint = PivotPoint.TopLeft; + pageActor.Position = new Position(0, index * _scrollHeight, 0.0f); + + pageActor.Add(label); + pageActor.Add(_buttonList[index]); + pageActor.Add(_resultList[index]); + _initList.Add(pageActor); + } + _initList.SetAxisAutoLock(false); + PropertyMap rulerMapY = new PropertyMap(); + rulerMapY.Add((int)ScrollModeType.XAxisScrollEnabled, new PropertyValue(false)); + rulerMapY.Add((int)ScrollModeType.YAxisScrollEnabled, new PropertyValue(true)); + rulerMapY.Add((int)ScrollModeType.YAxisSnapToInterval, new PropertyValue(_scrollHeight)); + rulerMapY.Add((int)ScrollModeType.YAxisScrollBoundary, new PropertyValue(_scrollHeight * tcNum)); + _initList.ScrollMode = rulerMapY; + + Tizen.Log.Fatal("ManualTCT", "Initial ScrollView"); + } + + private void CreateDetailList() + { + Tizen.Log.Fatal("NUI.Components", "Print the CreateDetailList::count: " + _currentTCInfo.Count); + int senNum = _currentTCInfo.Count; + _description.Text = _currentTCInfo[0]; + for (int index = 1; index < senNum; index++) + { + TextLabel description = new TextLabel(); + description.TextColor = Color.White; + description.ParentOrigin = ParentOrigin.TopLeft; + description.PivotPoint = PivotPoint.TopLeft; + description.Position = new Position(0.0f, 0.0f, 0.0f); + description.Size2D = new Size2D((int)Window.Instance.Size.Width - 100, _detailScrollHeight); + description.HorizontalAlignment = HorizontalAlignment.Begin; + description.VerticalAlignment = VerticalAlignment.Center; + description.PointSize = 3.0f; + description.MultiLine = true; + description.Text = _currentTCInfo[(int)index]; + + View pageActor = new View(); + pageActor.WidthResizePolicy = ResizePolicyType.FillToParent; + pageActor.HeightResizePolicy = ResizePolicyType.FillToParent; + pageActor.ParentOrigin = ParentOrigin.TopLeft; + pageActor.PivotPoint = PivotPoint.TopLeft; + pageActor.Position = new Position(0, (index - 1) * _detailScrollHeight, 0.0f); + pageActor.Add(description); + _detailList.Add(pageActor); + } + _detailList.SetAxisAutoLock(false); + PropertyMap rulerMapY = new PropertyMap(); + rulerMapY.Add((int)ScrollModeType.XAxisScrollEnabled, new PropertyValue(false)); + rulerMapY.Add((int)ScrollModeType.YAxisScrollEnabled, new PropertyValue(true)); + rulerMapY.Add((int)ScrollModeType.YAxisSnapToInterval, new PropertyValue(_detailScrollHeight)); + rulerMapY.Add((int)ScrollModeType.YAxisScrollBoundary, new PropertyValue(_detailScrollHeight * (senNum - 1))); + _detailList.ScrollMode = rulerMapY; + } + + //Init all the data, should be offered by Test Framework + void InitData() + { + ResultNumber.Total = _tcIDList.Count; + ResultNumber.Pass = 0; + ResultNumber.Fail = 0; + ResultNumber.Block = 0; + _tcInfoList = new List(); + foreach (var testcaseItem in _listItem) + { + foreach (KeyValuePair pair in _tRunner.GetTestList()) + { + if (testcaseItem.TCName.Equals(pair.Key)) + { + List preconditions = new List(); + preconditions.Add("Preconditions:"); + List steps = new List(); + steps.Add("Steps:"); + List postconditions = new List(); + postconditions.Add("Postconditions:\n"); + IEnumerator customAttributes = pair.Value.Method.MethodInfo.CustomAttributes.GetEnumerator(); + while (customAttributes.MoveNext()) + { + if (customAttributes.Current.AttributeType.FullName.Equals(STEP_ATTRIBUTE_NAME)) + { + steps.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value); + } + else if (customAttributes.Current.AttributeType.FullName.Equals(PRECONDITION_ATTRIBUTE_NAME)) + { + preconditions.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value); + } + else if (customAttributes.Current.AttributeType.FullName.Equals(POSTCONDITION_ATTRIBUTE_NAME)) + { + postconditions.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value); + } + } + _tcInfoList.Add(new TestcaseInfo + { + TestcaseName = pair.Key, + Preconditions = preconditions, + Steps = steps, + Postconditions = postconditions, + }); + break; + } + } + UpdateCurrentTCInfo(); + } + } + + //The data in CurrentTCInfo list will be show in _detailList. + void UpdateCurrentTCInfo() + { + _currentTCInfo = new List(); + Tizen.Log.Fatal("NUI.Components", "Print the CurrentTCNum::" + _currentTCNum); + _currentTCInfo.Add("DESCRIPTION:#" + (_currentTCNum + 1)); + string[] str = _tcInfoList[_currentTCNum].TestcaseName.Split('.'); + _currentTCInfo.Add("CLASS:" + str[str.Length - 2]); + _currentTCInfo.Add("METHOD:" + str[str.Length - 1]); + for(int index = 0; index < _tcInfoList[_currentTCNum].Preconditions.Count; index++) + { + _currentTCInfo.Add(_tcInfoList[_currentTCNum].Preconditions[index]); + } + for(int index = 0; index < _tcInfoList[_currentTCNum].Steps.Count; index++ ) + { + _currentTCInfo.Add(_tcInfoList[_currentTCNum].Steps[index]); + } + for(int index = 0; index < _tcInfoList[_currentTCNum].Postconditions.Count; index++ ) + { + _currentTCInfo.Add(_tcInfoList[_currentTCNum].Postconditions[index]); + } + Tizen.Log.Fatal("NUI.Components", "Ppppppppppppppppppppppprint the CurrentTCNum::" + _currentTCNum); + } + + private void OnSingleTestDone(object sender, SingleTestDoneEventArgs e) + { + //Test when will this event will be triggered + Tizen.Log.Fatal("NUI.Components", "OnSingleTestDone has been triggered!"); + // check old result + if (_listItem[_currentTCNum].Result.Contains(StrResult.FAIL)) + { + ResultNumber.Fail = ResultNumber.Fail - 1; + } + else if (_listItem[_currentTCNum].Result.Contains(StrResult.PASS)) + { + ResultNumber.Pass = ResultNumber.Pass - 1; + } + else if (_listItem[_currentTCNum].Result.Contains(StrResult.BLOCK)) + ResultNumber.Block = ResultNumber.Block - 1; + + // Update new result + _listItem[_currentTCNum].Result = e.Result; + if (e.Result.Contains(StrResult.PASS)) + { + ResultNumber.Pass += 1; + } + else if (e.Result.Contains(StrResult.FAIL)) + { + ResultNumber.Fail += 1; + } + else if (e.Result.Contains(StrResult.BLOCK)) + { + ResultNumber.Block += 1; + } + TextLabel label = _resultList[_currentTCNum]; + label.Text = _listItem[(int)_currentTCNum].Result; + SetSummaryResult(); + _notRun.Text = _listItem[_currentTCNum].Result; + } + + private PropertyMap CreateTextVisual(string text, Color color) + { + PropertyMap map = new PropertyMap(); + map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Text)); + map.Add(TextVisualProperty.Text, new PropertyValue(text)); + map.Add(TextVisualProperty.TextColor, new PropertyValue(color)); + map.Add(TextVisualProperty.PointSize, new PropertyValue(6.0f)); + map.Add(TextVisualProperty.HorizontalAlignment, new PropertyValue("CENTER")); + map.Add(TextVisualProperty.VerticalAlignment, new PropertyValue("BOTTOM")); + return map; + } + } +} + diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/controller_btn_check.png b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/controller_btn_check.png new file mode 100755 index 000000000..4d228584b Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/controller_btn_check.png differ diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/controller_btn_check_off.png b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/controller_btn_check_off.png new file mode 100755 index 000000000..fd709688a Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/controller_btn_check_off.png differ diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/controller_btn_check_on.png b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/controller_btn_check_on.png new file mode 100755 index 000000000..9a3af3a09 Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/controller_btn_check_on.png differ diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/controller_btn_check_shadow.png b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/controller_btn_check_shadow.png new file mode 100755 index 000000000..5c9318876 Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/controller_btn_check_shadow.png differ diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/controller_switch_bg_off.png b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/controller_switch_bg_off.png new file mode 100755 index 000000000..93fd2c432 Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/controller_switch_bg_off.png differ diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/controller_switch_bg_on.png b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/controller_switch_bg_on.png new file mode 100755 index 000000000..128f236cc Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/controller_switch_bg_on.png differ diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/controller_switch_handler.png b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/controller_switch_handler.png new file mode 100755 index 000000000..edafdc1d6 Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/controller_switch_handler.png differ diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/dropdown_bg.png b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/dropdown_bg.png new file mode 100755 index 000000000..3b2255bfb Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/dropdown_bg.png differ diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/dropdown_checkbox_on.png b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/dropdown_checkbox_on.png new file mode 100755 index 000000000..5955c9f6f Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/dropdown_checkbox_on.png differ diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/list_ic_dropdown.png b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/list_ic_dropdown.png new file mode 100755 index 000000000..e87c800f1 Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/list_ic_dropdown.png differ diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/popup_background.png b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/popup_background.png new file mode 100755 index 000000000..950dbba9b Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/popup_background.png differ diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/popup_background_shadow.png b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/popup_background_shadow.png new file mode 100755 index 000000000..c302f687b Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/popup_background_shadow.png differ diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/rectangle_btn_normal.png b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/rectangle_btn_normal.png new file mode 100755 index 000000000..5f0e30441 Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/res/images/rectangle_btn_normal.png differ diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/shared/res/Tizen.NUI.Manual.Tests.png b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/shared/res/Tizen.NUI.Manual.Tests.png new file mode 100755 index 000000000..9765b1bda Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/shared/res/Tizen.NUI.Manual.Tests.png differ diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSButton.cs b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSButton.cs new file mode 100755 index 000000000..c80d3fd9e --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSButton.cs @@ -0,0 +1,204 @@ +/* + * 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.UIComponents; +using Tizen.NUI.Components; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Button test")] + public class ButtonTests + { + private ManualTestComponents _testPage; + private WearableManualTestNUI _wearTestPage; + private Components.Button _button; + private float _pointSize = 5.0f; + + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST"); + if (Window.Instance.Size.Width > 1000) + { + _pointSize = 20.0f; + } + + if(ManualTest.IsWearable()) + { + _pointSize = 4.0f; + _wearTestPage = WearableManualTestNUI.GetInstance(); + } + else + { + _testPage = ManualTestComponents.GetInstance(); + } + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST"); + } + + private void CreateButton(string buttonText) + { + _button = new Components.Button(); + _button.Text = buttonText; + _button.PointSize = _pointSize; + _button.BackgroundColor = Color.Cyan; + if(ManualTest.IsWearable()) + { + _button.Size2D = new Size2D(200, 50); + _wearTestPage.ExecuteTC(_button); + } + else + { + _testPage.ExecuteTC(_button); + } + } + + private void CreateMyButton(string buttonText) + { + _button = new MyButton(); + _button.Text = buttonText; + _button.PointSize = _pointSize; + _button.BackgroundColor = Color.Cyan; + _button.Size2D = new Size2D(200, 50); + _button.Focusable = true; + if (ManualTest.IsWearable()) + { + _button.Size2D = new Size2D(200, 50); + _wearTestPage.ExecuteTC(_button); + } + else + { + _testPage.ExecuteTC(_button); + } + } + + public void OnClicked(object sender, EventArgs e) + { + Tizen.Log.Fatal("Components", "Button OnClicked!!!!!!!!!!!!!!!!!!!!!"); + _button.Text = "Clicked"; + ManualTest.Confirm(); + } + + [Test] + [Category("P1")] + [Description("Test OnTapGestureDetected. Check whether the method will be called when user tap the button")] + [Property("SPEC", "Tizen.NUI.Components.Button.OnTapGestureDetected M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + [Precondition(1, "NA")] + [Step(1, "Click run TC")] + [Step(2, "Press Key-Down while the test button is focusd")] + [Postcondition(1, "NA")] + public async Task OnTapGestureDetected_CHECK_VALUE() + { + CreateMyButton("Click me!"); + await ManualTest.WaitForConfirm(); + if (ManualTest.IsWearable()) + { + _wearTestPage.ClearTestCase(_button); + } + else + { + _testPage.ClearTestCase(_button); + } + + } + + [Test] + [Category("P1")] + [Description("Test OnTouch. Check whether the method will be called when user touch the button")] + [Property("SPEC", "Tizen.NUI.Components.Button.OnTouch M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + [Precondition(1, "NA")] + [Step(1, "Click run TC")] + [Step(2, "Press Key-Down while the test button is focusd")] + [Postcondition(1, "NA")] + public async Task OnTouch_CHECK_VALUE() + { + CreateMyButton("Click me!"); + await ManualTest.WaitForConfirm(); + if (ManualTest.IsWearable()) + { + _wearTestPage.ClearTestCase(_button); + } + else + { + _testPage.ClearTestCase(_button); + } + + } + + [Test] + [Category("P1")] + [Description("Test: Click. Check whether the event will be triggered when user click the button")] + [Property("SPEC", "Tizen.NUI.Components.Button.ClickEvent E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + [Precondition(1, "NA")] + [Step(1, "Click run TC")] + [Step(2, "Press Key-Down while the test button is focusd")] + [Postcondition(1, "NA")] + public async Task ClickEvent_CB() + { + CreateMyButton("Click me!"); + _button.ClickEvent += OnClicked; + await ManualTest.WaitForConfirm(); + _button.ClickEvent -= OnClicked; + if (ManualTest.IsWearable()) + { + _wearTestPage.ClearTestCase(_button); + } + else + { + _testPage.ClearTestCase(_button); + } + } + + public class MyButton : Components.Button + { + protected override void OnTapGestureDetected(object source, TapGestureDetector.DetectedEventArgs e) + { + base.OnTapGestureDetected(source, e); + ManualTest.Confirm(); + } + + public override bool OnTouch(Touch touch) + { + ManualTest.Confirm(); + return base.OnTouch(touch); + } + + } + } +} + + + diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSControl.cs b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSControl.cs new file mode 100755 index 000000000..3ea3f95bc --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSControl.cs @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Threading.Tasks; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI; +using Tizen.NUI.Components; +using Tizen.NUI.UIComponents; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Control test")] + public class ControlTests + { + private ManualTestComponents _testPage; + private WearableManualTestNUI _wearTestPage; + private Components.Button _button; + private float _pointSize = 5.0f; + private TextLabel _label; + + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST"); + if (Window.Instance.Size.Width > 1000) + { + _pointSize = 20.0f; + } + + if (ManualTest.IsWearable()) + { + _pointSize = 2.0f; + _label = ManualTest.CreateLabel("This case is unsuitable for wearable, please press PASS button to continue!"); + _wearTestPage = WearableManualTestNUI.GetInstance(); + } + else + { + _testPage = ManualTestComponents.GetInstance(); + } + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST"); + } + + private void CreateView(string information) + { + _button = new Components.Button(); + _button.BackgroundImageURL = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "c_basic_button_white_bg_normal_9patch.png"; + _button.BackgroundImageBorder = new Rectangle(4, 4, 5, 5); + _button.Size2D = new Size2D(300, 80); + _button.Text = information; + + // Invoke ExecuteTC() method to add UI to test area. + _testPage.ExecuteTC(_button); + } + + public bool OnClickEvent(object sender, EventArgs e) + { + Tizen.Log.Fatal("NUI.CommonNUI", "TUnit OnTapGestureDetected!!!!!!!!!!!!!!!!!!!!!"); + ManualTest.Confirm(); + return false; + } + + [Test] + [Category("P1")] + [Description("Test: OnTapGestureDetected. Try to click the button to call this function.")] + [Property("SPEC", "Tizen.NUI.Components.Control.OnTapGestureDetected M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + [Precondition(1, "If test on TV, prepare mouse and connect to TV.")] + [Step(1, "If test on TV, connect the mouse to the TV")] + [Step(2, "Click run button to run TC")] + [Step(3, "Touch the Button. If on the TV, click left mouse on the Button.")] + [Step(4, "TC will pass after touch or click.")] + [Postcondition(1, "NA")] + public async Task OnTapGestureDetected_TEST() + { + if (ManualTest.IsWearable()) + { + _wearTestPage.ExecuteTC(_label); + await ManualTest.WaitForConfirm(); + _wearTestPage.ClearTestCase(_label); + } + else + { + CreateView("Touch or click me"); + _button.TouchEvent += OnClickEvent; + // Waits for user confirmation. + await ManualTest.WaitForConfirm(); + _button.TouchEvent -= OnClickEvent; + _testPage.ClearTestCase(_button); + } + } + + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSDropDown.cs b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSDropDown.cs new file mode 100755 index 000000000..d30d6be16 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSDropDown.cs @@ -0,0 +1,153 @@ +/* + * 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.UIComponents; +using Tizen.NUI.Components; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.DropDown test")] + public class DropDownTests + { + private ManualTestComponents _testPage; + private WearableManualTestNUI _wearTestPage; + private DropDown _dropDown; + private float _pointSize = 5.0f; + private string _resourcePath = Tizen.Applications.Application.Current.DirectoryInfo.Resource; + + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST"); + if (Window.Instance.Size.Width > 1000) + { + _pointSize = 20.0f; + } + + if (ManualTest.IsWearable()) + { + _pointSize = 4.0f; + _wearTestPage = WearableManualTestNUI.GetInstance(); + } + else + { + _testPage = ManualTestComponents.GetInstance(); + } + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST"); + } + + private void CreateDropDown() + { + _dropDown = new DropDown(); + _dropDown.Size2D = new Size2D(900, 108); + _dropDown.HeaderText = "TitleArea"; + _dropDown.HeaderTextColor = new Color(0, 0, 0, 1); + _dropDown.HeaderTextPointSize = _pointSize; + _dropDown.HeaderTextFontFamily = "SamsungOneUI 500C"; + _dropDown.ButtonText = "DropDown Text"; + _dropDown.ButtonTextColor = new Color(0, 0, 0, 1); + _dropDown.ButtonTextPointSize = _pointSize; + _dropDown.ButtonTextFontFamily = "SamsungOneUI 500"; + _dropDown.ButtonIconImageURL = _resourcePath + "/images/list_ic_dropdown.png"; + _dropDown.ButtonIconSize2D = new Size2D(18, 18); + _dropDown.LeftSpace = 56; + _dropDown.SpaceBetweenButtonTextAndIcon = 8; + _dropDown.ListBackgroundImageURL = _resourcePath + "/images/dropdown_bg.png"; + _dropDown.ListLeftMargin = 20; + _dropDown.ListTopMargin = 20; + _dropDown.BackgroundColor = new Color(1, 1, 1, 1); + _dropDown.ListSize2D = new Size2D(360, 500); + _dropDown.ListPadding = new Extents(4, 4, 4, 4); + + for (int i = 0; i < 8; i++) + { + DropDown.DropDownItemData item = new DropDown.DropDownItemData(); + item.Size2D = new Size2D(360, 96); + item.BackgroundColorSelector = new ColorSelector + { + Pressed = new Color(0, 0, 0, 0.4f), + Other = new Color(1, 1, 1, 0), + }; + item.Text = "Normal list " + i; + item.PointSize = 18; + item.FontFamily = "SamsungOne 500"; + item.TextPosition2D = new Position2D(28, 0); + item.CheckImageSize2D = new Size2D(40, 40); + item.CheckImageResourceUrl = _resourcePath + "images/dropdown_checkbox_on.png"; + item.CheckImageRightSpace = 16; + _dropDown.AddItem(item); + } + + _dropDown.SelectedItemIndex = 0; + + if (ManualTest.IsWearable()) + { + _dropDown.Size2D = new Size2D(200, 50); + _wearTestPage.ExecuteTC(_dropDown); + } + else + { + _testPage.ExecuteTC(_dropDown); + } + } + + public void OnItemClicked(object sender, EventArgs e) + { + Tizen.Log.Fatal("Components", "Item OnClicked!!!!!!!!!!!!!!!!!!!!!"); + ManualTest.Confirm(); + } + + [Test] + [Category("P1")] + [Description("Test: ItemClickEvent. Check whether the ItemClickEvent will be triggered or not when user click the item.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.ItemClickEvent E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + [Precondition(1, "NA")] + [Step(1, "Click run TC")] + [Step(2, "Press Key-Down while the test DropDown is focusd")] + [Postcondition(1, "NA")] + public async Task ItemClickEvent_CB() + { + CreateDropDown(); + _dropDown.ItemClickEvent += OnItemClicked; + await ManualTest.WaitForConfirm(); + _dropDown.ItemClickEvent -= OnItemClicked; + if (ManualTest.IsWearable()) + { + _wearTestPage.ClearTestCase(_dropDown); + } + else + { + _testPage.ClearTestCase(_dropDown); + } + } + + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSFlexibleView.cs b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSFlexibleView.cs new file mode 100755 index 000000000..1932eab75 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSFlexibleView.cs @@ -0,0 +1,307 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Threading.Tasks; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI; +using Tizen.NUI.Components; +using Tizen.NUI.UIComponents; +using Tizen.NUI.BaseComponents; +using System.Collections.Generic; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.FlexibleView test")] + public class FlexibleViewTests + { + private ManualTestComponents _testPage; + private WearableManualTestNUI _wearTestPage; + private Components.FlexibleView _flexibleView; + private ListBridge _adapter; + private float _pointSize = 5.0f; + private TextLabel _label; + + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST"); + if (Window.Instance.Size.Width > 1000) + { + _pointSize = 20.0f; + } + + if (ManualTest.IsWearable()) + { + _pointSize = 2.0f; + _label = ManualTest.CreateLabel("This case is unsuitable for wearable, please press PASS button to continue!"); + _wearTestPage = WearableManualTestNUI.GetInstance(); + } + else + { + _testPage = ManualTestComponents.GetInstance(); + } + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST"); + } + + private void CreateView() + { + _flexibleView = new FlexibleView(); + _flexibleView.Name = "RecyclerView"; + _flexibleView.Size2D = new Size2D(200, 100); + _flexibleView.Padding = new Extents(10, 10, 10, 10); + _flexibleView.BackgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.4f); + + List dataList = new List(); + for (int i = 0; i < 20; ++i) + { + dataList.Add(new ListItemData(i)); + } + _adapter = new ListBridge(dataList); + _flexibleView.SetAdapter(_adapter); + + LinearLayoutManager layoutManager1 = new LinearLayoutManager(LinearLayoutManager.VERTICAL); + _flexibleView.SetLayoutManager(layoutManager1); + + // Invoke ExecuteTC() method to add UI to test area. + _testPage.ExecuteTC(_flexibleView); + } + + public void OnItemClickEvent(object sender, FlexibleView.ItemClickEventArgs e) + { + Tizen.Log.Fatal("NUI.CommonNUI", "TUnit ItemClickEvent!!!!!!!!!!!!!!!!!!!!!"); + ManualTest.Confirm(); + } + + public void OnItemTouchEvent(object sender, FlexibleView.ItemTouchEventArgs e) + { + Tizen.Log.Fatal("NUI.CommonNUI", "TUnit ItemTouchEvent!!!!!!!!!!!!!!!!!!!!!"); + ManualTest.Confirm(); + } + + [Test] + [Category("P1")] + [Description("Test: ItemClickEvent. Try to click the button to call this function.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.ItemClickEvent M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + [Precondition(1, "If test on TV, prepare mouse and connect to TV.")] + [Step(1, "If test on TV, connect the mouse to the TV")] + [Step(2, "Click run button to run TC")] + [Step(3, "Touch the Button. If on the TV, click left mouse on the Button.")] + [Step(4, "TC will pass after touch or click.")] + [Postcondition(1, "NA")] + public async Task ItemClickEvent_CB() + { + if (ManualTest.IsWearable()) + { + _wearTestPage.ExecuteTC(_label); + await ManualTest.WaitForConfirm(); + _wearTestPage.ClearTestCase(_label); + } + else + { + CreateView(); + _flexibleView.ItemClickEvent += OnItemClickEvent; + // Waits for user confirmation. + await ManualTest.WaitForConfirm(); + _flexibleView.ItemClickEvent -= OnItemClickEvent; + _testPage.ClearTestCase(_flexibleView); + } + } + + [Test] + [Category("P1")] + [Description("Test: ItemTouchEvent. Try to click the button to call this function.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.ItemTouchEvent M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + [Precondition(1, "If test on TV, prepare mouse and connect to TV.")] + [Step(1, "If test on TV, connect the mouse to the TV")] + [Step(2, "Click run button to run TC")] + [Step(3, "Touch the Button. If on the TV, click left mouse on the Button.")] + [Step(4, "TC will pass after touch or click.")] + [Postcondition(1, "NA")] + public async Task ItemTouchEvent_CB() + { + if (ManualTest.IsWearable()) + { + _wearTestPage.ExecuteTC(_label); + await ManualTest.WaitForConfirm(); + _wearTestPage.ClearTestCase(_label); + } + else + { + CreateView(); + _flexibleView.ItemTouchEvent += OnItemTouchEvent; + // Waits for user confirmation. + await ManualTest.WaitForConfirm(); + _flexibleView.ItemTouchEvent -= OnItemTouchEvent; + _testPage.ClearTestCase(_flexibleView); + } + } + } + + public class ListItemData + { + private string _str; + + public ListItemData(int i) + { + _str = "Text" + i.ToString(); + } + + public string TextString + { + get + { + return _str; + } + } + } + + public class ListItemView : View + { + private TextLabel _mText; + + public ListItemView() + { + _mText = new TextLabel(); + _mText.WidthResizePolicy = ResizePolicyType.FillToParent; + _mText.HeightResizePolicy = ResizePolicyType.FillToParent; + _mText.PointSize = 22; + _mText.HorizontalAlignment = HorizontalAlignment.Center; + _mText.VerticalAlignment = VerticalAlignment.Center; + Add(_mText); + } + + public string MainText + { + get + { + return _mText.Text; + } + set + { + _mText.Text = value; + } + } + } + + public class ListBridge : FlexibleView.Adapter + { + private List _mDatas; + + public ListBridge(List datas) + { + _mDatas = datas; + } + + public void InsertData(int position) + { + _mDatas.Insert(position, new ListItemData(1000 + position)); + NotifyItemInserted(position); + } + + public void RemoveData(int position) + { + _mDatas.RemoveAt(position); + NotifyItemRemoved(position); + } + + public override FlexibleView.ViewHolder OnCreateViewHolder(int viewType) + { + FlexibleView.ViewHolder viewHolder = new FlexibleView.ViewHolder(new ListItemView()); + //Console.WriteLine($"OnCreateViewHolder... viewType: {viewType} viewID: {viewHolder.ItemView.ID}"); + + return viewHolder; + } + + public override void OnBindViewHolder(FlexibleView.ViewHolder holder, int position) + { + //Console.WriteLine($"OnBindItemView... position: {position}"); + ListItemData listItemData = _mDatas[position]; + + ListItemView listItemView = holder.ItemView as ListItemView; + listItemView.Name = "Item" + position; + //Random rd = new Random(); + listItemView.SizeWidth = 100; + listItemView.SizeHeight = 40; + if (listItemView != null) + { + listItemView.MainText = String.Format("{0:D2}", position) + " : " + listItemData.TextString; + } + listItemView.Margin = new Extents(2, 2, 2, 2); + if (position % 2 == 0) + listItemView.BackgroundColor = Color.Cyan; + else + listItemView.BackgroundColor = Color.Yellow; + } + + public override void OnDestroyViewHolder(FlexibleView.ViewHolder holder) + { + //Console.WriteLine($"OnDestroyViewHolder... viewID: {holder.ItemView?.ID}"); + if (holder.ItemView != null) + { + holder.ItemView.Dispose(); + } + } + + public override int GetItemCount() + { + return _mDatas.Count; + } + + public override void OnFocusChange(FlexibleView flexibleView, int previousFocus, int currentFocus) + { + FlexibleView.ViewHolder previousFocusView = flexibleView.FindViewHolderForAdapterPosition(previousFocus); + if (previousFocusView != null) + { + //Console.WriteLine($"previousFocus {previousFocus.AdapterPosition}"); + if (previousFocusView.AdapterPosition % 2 == 0) + previousFocusView.ItemView.BackgroundColor = Color.Cyan; + else + previousFocusView.ItemView.BackgroundColor = Color.Yellow; + //previousFocus.SizeWidth = 150; + //previousFocus.SizeHeight = 60; + //NotifyItemChanged(previousFocus.AdapterPosition); + } + FlexibleView.ViewHolder currentFocusView = flexibleView.FindViewHolderForAdapterPosition(currentFocus); + if (currentFocusView != null) + { + //Console.WriteLine($"currentFocus {currentFocus.AdapterPosition}"); + currentFocusView.ItemView.BackgroundColor = Color.Magenta; + //currentFocus.SizeWidth = 200; + //currentFocus.SizeHeight = 100; + //NotifyItemChanged(currentFocus.AdapterPosition); + } + } + } + + +} + + + diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSInputField.cs b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSInputField.cs new file mode 100755 index 000000000..d79eed4b9 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSInputField.cs @@ -0,0 +1,299 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Threading.Tasks; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.InputField test")] + public class InputFieldTests + { + private ManualTestComponents _testPage; + private WearableManualTestNUI _wearTestPage; + private Window _window; + private PushButton _button; + private float _pointSize = 5.0f; + private TextLabel _label; + private static MyInputField _inputField; + + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST"); + _window = Window.Instance; + if (Window.Instance.Size.Width > 1000) + { + _pointSize = 20.0f; + } + if (ManualTest.IsWearable()) + { + _pointSize = 2.0f; + _label = ManualTest.CreateLabel("This case is unsuitable for wearable, please press PASS button to continue!"); + _wearTestPage = WearableManualTestNUI.GetInstance(); + } + else + { + _testPage = ManualTestComponents.GetInstance(); + } + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST"); + } + + private MyInputField CreateInputField() + { + InputFieldAttributes inputFieldAttributes = new InputFieldAttributes() + { + Space = 24, + BackgroundImageAttributes = new ImageAttributes + { + ResourceURL = new StringSelector { All = "1. Action bar/search_bg.png" }, + Border = new RectangleSelector { All = new Rectangle(45, 45, 0, 0) } + }, + + InputBoxAttributes = new TextFieldAttributes + { + TextColor = new ColorSelector + { + Normal = new Color(0, 0, 0, 1), + Pressed = new Color(0, 0, 0, 1), + Disabled = new Color(0, 0, 0, 0.4f) + }, + PlaceholderTextColor = new ColorSelector + { + All = new Color(0, 0, 0, 0.4f) + }, + HorizontalAlignment = HorizontalAlignment.Begin, + VerticalAlignment = VerticalAlignment.Center, + FontFamily = "SamsungOne 500", + PointSize = new FloatSelector + { + All = 38 + }, + CursorWidth = 2, + }, + }; + return new MyInputField(inputFieldAttributes); + } + + private PropertyMap CreateTextMap(float pointSize, string text) + { + PropertyMap map = new PropertyMap(); + map.Insert("visualType", new PropertyValue("TEXT")); + map.Insert("pointSize", new PropertyValue(pointSize)); + map.Insert("text", new PropertyValue(text)); + return map; + } + + private void CreateView(string information) + { + _button = new PushButton(); + _button.Label = CreateTextMap(_pointSize, information); + + _testPage.ExecuteTC(_button); + } + + [Test] + [Category("P1")] + [Description("Test OnTextFieldTextChanged. Check it has been triggered.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.OnTextFieldFocusGained M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + [Step(1, "If test on TV, connect the mouse to the TV")] + [Step(2, "Click run button to run TC")] + [Step(3, "Click input area on the input field.")] + [Step(4, "TC will pass when the input field focused")] + [Postcondition(1, "NA")] + public async Task OnTextFieldFocusGained_CB() + { + if (ManualTest.IsWearable()) + { + _wearTestPage.ExecuteTC(_label); + await ManualTest.WaitForConfirm(); + _wearTestPage.ClearTestCase(_label); + } + else + { + CreateView("Click InputField"); + _inputField = CreateInputField(); + _inputField.Size2D = new Size2D(1600, 95); + _inputField.Position2D = new Position2D(320, 300); + _inputField.BackgroundColor = Color.Green; + _window.Add(_inputField); + // Waits for user confirmation. + await ManualTest.WaitForConfirm(); + _testPage.ClearTestCase(_button); + } + } + + [Test] + [Category("P1")] + [Description("Test OnTextFieldFocusLost. Check it has been triggered.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.OnTextFieldFocusLost M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + [Step(1, "Connect the mouse to the TV (TM-1 don't need)")] + [Step(2, "Click run button to run TC")] + [Step(3, "Click input area of the input field.")] + [Step(4, "Click the outside area of the input field.")] + [Step(5, "When you stop click, TC will pass")] + [Postcondition(1, "NA")] + public async Task OnTextFieldFocusLost_CB() + { + if (ManualTest.IsWearable()) + { + _wearTestPage.ExecuteTC(_label); + await ManualTest.WaitForConfirm(); + _wearTestPage.ClearTestCase(_label); + } + else + { + CreateView("Click outside area of InputField"); + _inputField = CreateInputField(); + _inputField.Size2D = new Size2D(1600, 95); + _inputField.Position2D = new Position2D(320, 300); + _inputField.BackgroundColor = Color.Green; + _window.Add(_inputField); + // Waits for user confirmation. + await ManualTest.WaitForConfirm(); + _testPage.ClearTestCase(_button); + } + } + + [Test] + [Category("P1")] + [Description("Test OnTextFieldTextChanged. Check it has been triggered.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.OnTextFieldTextChanged M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + [Step(1, "Connect the mouse to the TV (TM-1 don't need)")] + [Step(2, "Click run button to run TC")] + [Step(3, "Click input area on the input field.")] + [Step(4, "When you enter a letter, TC will pass")] + [Postcondition(1, "NA")] + public async Task OnTextFieldTextChanged_CB() + { + if (ManualTest.IsWearable()) + { + _wearTestPage.ExecuteTC(_label); + await ManualTest.WaitForConfirm(); + _wearTestPage.ClearTestCase(_label); + } + else + { + CreateView("Enter a letter"); + _inputField = CreateInputField(); + _inputField.Size2D = new Size2D(1600, 95); + _inputField.Position2D = new Position2D(320, 300); + _inputField.BackgroundColor = Color.Green; + _window.Add(_inputField); + // Waits for user confirmation. + await ManualTest.WaitForConfirm(); + _testPage.ClearTestCase(_button); + } + } + + [Test] + [Category("P1")] + [Description("Test OnTextFieldKeyEvent. Check it has been triggered.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.OnTextFieldKeyEvent M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + [Step(1, "Connect the mouse to the TV (TM-1 don't need)")] + [Step(2, "Connect the keyboard to the TV (TM-1 don't need)")] + [Step(3, "Click run button to run TC")] + [Step(4, "Click input area on the input field.")] + [Step(5, "When you enter a letter, TC will pass")] + [Postcondition(1, "NA")] + public async Task OnTextFieldKeyEvent_CB() + { + if (ManualTest.IsWearable()) + { + _wearTestPage.ExecuteTC(_label); + await ManualTest.WaitForConfirm(); + _wearTestPage.ClearTestCase(_label); + } + else + { + CreateView("Enter a letter"); + _inputField = CreateInputField(); + _inputField.Size2D = new Size2D(1600, 95); + _inputField.Position2D = new Position2D(320, 300); + _inputField.BackgroundColor = Color.Green; + _window.Add(_inputField); + // Waits for user confirmation. + await ManualTest.WaitForConfirm(); + _testPage.ClearTestCase(_button); + } + } + + internal class MyInputField : InputField + { + public MyInputField() : base() + { } + + public MyInputField(InputFieldAttributes inputFieldAttributes) : base(inputFieldAttributes) + { } + + protected override void OnTextFieldFocusGained(object source, EventArgs e) + { + Tizen.Log.Fatal("NUI", "OnTextFieldFocusGained event !!!!!"); + ManualTest.Confirm(); + Window.Instance.Remove(_inputField); + } + + protected override void OnTextFieldFocusLost(object source, EventArgs e) + { + Tizen.Log.Fatal("NUI", "OnTextFieldFocusLost event !!!!!"); + ManualTest.Confirm(); + Window.Instance.Remove(_inputField); + } + + protected override void OnTextFieldTextChanged(object sender, Tizen.NUI.BaseComponents.TextField.TextChangedEventArgs e) + { + Tizen.Log.Fatal("NUI", "OnTextFieldTextChanged event !!!!!"); + ManualTest.Confirm(); + Window.Instance.Remove(_inputField); + } + + protected override bool OnTextFieldKeyEvent(object source, KeyEventArgs e) + { + Tizen.Log.Fatal("NUI", "OnTextFieldKeyEvent event !!!!!"); + ManualTest.Confirm(); + Window.Instance.Remove(_inputField); + return false; + } + } + } +} + + + diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSPopup.cs b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSPopup.cs new file mode 100755 index 000000000..2c177d4b5 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSPopup.cs @@ -0,0 +1,147 @@ +/* + * 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.UIComponents; +using Tizen.NUI.Components; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Popup test")] + public class PopupTests + { + private ManualTestComponents _testPage; + private WearableManualTestNUI _wearTestPage; + + private Popup _popup; + private float _pointSize = 5.0f; + private string _resourcePath = Tizen.Applications.Application.Current.DirectoryInfo.Resource; + + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST"); + if (Window.Instance.Size.Width > 1000) + { + _pointSize = 20.0f; + } + + if (ManualTest.IsWearable()) + { + _pointSize = 4.0f; + _wearTestPage = WearableManualTestNUI.GetInstance(); + } + else + { + _testPage = ManualTestComponents.GetInstance(); + } + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST"); + } + + private void CreatePopup() + { + _popup = new Popup(); + _popup.MinimumSize = new Size2D(232, 184); + _popup.Size2D = new Size2D(232, 200); + + _popup.TitlePointSize = _pointSize; + _popup.TitleTextColor = Color.Black; + _popup.TitleHeight = 68; + _popup.TitleTextHorizontalAlignment = HorizontalAlignment.Begin; + _popup.TitleTextPosition2D = new Position2D(64, 52); + _popup.TitleText = "Popup Title"; + + _popup.BackgroundImageURL = _resourcePath + "/images/popup_background.png"; + _popup.BackgroundImageBorder = new Rectangle(0, 0, 81, 81); + + _popup.ButtonBackgroundImageURL = _resourcePath + "/images/rectangle_btn_normal.png"; + _popup.ButtonBackgroundImageBorder = new Rectangle(5, 5, 5, 5); + _popup.ButtonOverLayBackgroundColorSelector = new ColorSelector + { + Normal = new Color(1.0f, 1.0f, 1.0f, 1.0f), + Pressed = new Color(0.0f, 0.0f, 0.0f, 0.1f), + Selected = new Color(1.0f, 1.0f, 1.0f, 1.0f), + }; + _popup.ButtonTextColor = new Color(0.05f, 0.63f, 0.9f, 1); + _popup.ButtonHeight = 132; + _popup.ButtonCount = 2; + _popup.SetButtonText(0, "Yes"); + _popup.SetButtonText(1, "Exit"); + + TextLabel contentText = new TextLabel(); + contentText.Size2D = new Size2D(104, 100); + contentText.PointSize = _pointSize; + contentText.HorizontalAlignment = HorizontalAlignment.Begin; + contentText.VerticalAlignment = VerticalAlignment.Center; + contentText.Text = "Popup"; + _popup.ContentView.Add(contentText); + + if (ManualTest.IsWearable()) + { + _popup.Size2D = new Size2D(200, 50); + _wearTestPage.ExecuteTC(_popup); + } + else + { + _testPage.ExecuteTC(_popup); + } + } + + public void OnPopupButtonClicked(object sender, Popup.ButtonClickEventArgs e) + { + Tizen.Log.Fatal("NUI", "Popup OnPopupButtonClicked!!!!!!!!!!!!!!!!!!!!!"); + ManualTest.Confirm(); + } + + [Test] + [Category("P1")] + [Description("Test: PopupButtonClickedEvent. Check whether the PopupButtonClickedEvent will be triggered when user click the button on the popup")] + [Property("SPEC", "Tizen.NUI.Components.Popup.PopupButtonClickedEvent E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + [Precondition(1, "NA")] + [Step(1, "Click run TC")] + [Step(2, "use mouse to click the ")] + [Postcondition(1, "NA")] + public async Task PopupButtonClickedEvent_CB() + { + CreatePopup(); + _popup.PopupButtonClickedEvent += OnPopupButtonClicked; + await ManualTest.WaitForConfirm(); + _popup.PopupButtonClickedEvent -= OnPopupButtonClicked; + if (ManualTest.IsWearable()) + { + _wearTestPage.ClearTestCase(_popup); + } + else + { + _testPage.ClearTestCase(_popup); + } + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSRadioButton.cs b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSRadioButton.cs new file mode 100755 index 000000000..b6a5b0a80 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSRadioButton.cs @@ -0,0 +1,139 @@ +/* + * 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.Components; +using Tizen.NUI.UIComponents; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.RadioButton test")] + public class RadioButtonTests + { + private ManualTestComponents _testPage; + private WearableManualTestNUI _wearTestPage; + private Components.Button _button; + private float _pointSize = 5.0f; + private MyRadioButton _radioButton; + private string _resourcePath = Tizen.Applications.Application.Current.DirectoryInfo.Resource; + private TextLabel _label; + + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST"); + if (Window.Instance.Size.Width > 1000) + { + _pointSize = 20.0f; + } + + if (ManualTest.IsWearable()) + { + _pointSize = 2.0f; + _label = ManualTest.CreateLabel("This case is unsuitable for wearable, please press PASS button to continue!"); + _wearTestPage = WearableManualTestNUI.GetInstance(); + } + else + { + _testPage = ManualTestComponents.GetInstance(); + } + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST"); + } + + private void CreateRadioButton() + { + _radioButton = new MyRadioButton(); + _radioButton.Size2D = new Size2D(150, 48); + _radioButton.CheckImageSize2D = new Size2D(48, 48); + _radioButton.CheckImagePaddingLeft = 0; + _radioButton.CheckImagePaddingRight = 0; + _radioButton.CheckImagePaddingTop = 0; + _radioButton.CheckImagePaddingBottom = 0; + _radioButton.CheckBackgroundImageURLSelector = new StringSelector + { + Normal = _resourcePath + "/images/controller_btn_check_off.png", + Selected = _resourcePath + "/images/controller_btn_check_on.png", + }; + _radioButton.CheckImageURLSelector = new StringSelector + { + Normal = "", + Selected = _resourcePath + "/images/controller_btn_check.png", + }; + _radioButton.CheckShadowImageURLSelector = new StringSelector + { + Normal = "", + Selected = _resourcePath + "/images/controller_btn_check_shadow.png", + }; + + if (ManualTest.IsWearable()) + { + _radioButton.Size2D = new Size2D(150, 48); + _wearTestPage.ExecuteTC(_radioButton); + } + else + { + _testPage.ExecuteTC(_radioButton); + } + } + + [Test] + [Category("P1")] + [Description("Test: OnSelected. Try to click the button to call this function.")] + [Property("SPEC", "Tizen.NUI.Components.RadioButton.OnSelected M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + [Precondition(1, "If test on TV, prepare mouse and connect to TV.")] + [Step(1, "If test on TV, connect the mouse to the TV")] + [Step(2, "Click run button to run TC")] + [Step(3, "Touch the RadioButton. If on the TV, click left mouse on the RadioButton.")] + [Step(4, "TC will pass after touch or click.")] + [Postcondition(1, "NA")] + public async Task OnSelected_TEST() + { + CreateRadioButton(); + await ManualTest.WaitForConfirm(); + if (ManualTest.IsWearable()) + { + _wearTestPage.ClearTestCase(_radioButton); + } + else + { + _testPage.ClearTestCase(_radioButton); + } + } + } + + public class MyRadioButton: RadioButton + { + protected override void OnSelected() + { + ManualTest.Confirm(); + base.OnSelected(); + } + } +} \ No newline at end of file diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSRadioButtonGroup.cs b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSRadioButtonGroup.cs new file mode 100755 index 000000000..bbfe457bc --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSRadioButtonGroup.cs @@ -0,0 +1,143 @@ +/* + * 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.Components; +using Tizen.NUI.UIComponents; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.RadioButtonGroup test")] + public class RadioButtonGroupTests + { + private ManualTestComponents _testPage; + private WearableManualTestNUI _wearTestPage; + private Components.Button _button; + private float _pointSize = 5.0f; + private MyRadioButtonGroup _radioButtonGroup; + private RadioButton _radioButton; + private string _resourcePath = Tizen.Applications.Application.Current.DirectoryInfo.Resource; + private TextLabel _label; + + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST"); + if (Window.Instance.Size.Width > 1000) + { + _pointSize = 20.0f; + } + + if (ManualTest.IsWearable()) + { + _pointSize = 2.0f; + _label = ManualTest.CreateLabel("This case is unsuitable for wearable, please press PASS button to continue!"); + _wearTestPage = WearableManualTestNUI.GetInstance(); + } + else + { + _testPage = ManualTestComponents.GetInstance(); + } + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST"); + } + + private void CreateRadioButtonGroup() + { + _radioButtonGroup = new MyRadioButtonGroup(); + _radioButton = new MyRadioButton(); + _radioButton.Size2D = new Size2D(150, 48); + _radioButton.CheckImageSize2D = new Size2D(48, 48); + _radioButton.CheckImagePaddingLeft = 0; + _radioButton.CheckImagePaddingRight = 0; + _radioButton.CheckImagePaddingTop = 0; + _radioButton.CheckImagePaddingBottom = 0; + _radioButton.CheckBackgroundImageURLSelector = new StringSelector + { + Normal = _resourcePath + "/images/controller_btn_check_off.png", + Selected = _resourcePath + "/images/controller_btn_check_on.png", + }; + _radioButton.CheckImageURLSelector = new StringSelector + { + Normal = "", + Selected = _resourcePath + "/images/controller_btn_check.png", + }; + _radioButton.CheckShadowImageURLSelector = new StringSelector + { + Normal = "", + Selected = _resourcePath + "/images/controller_btn_check_shadow.png", + }; + + _radioButtonGroup.Add(_radioButton); + + if (ManualTest.IsWearable()) + { + _radioButton.Size2D = new Size2D(150, 48); + _wearTestPage.ExecuteTC(_radioButton); + } + else + { + _testPage.ExecuteTC(_radioButton); + } + } + + [Test] + [Category("P1")] + [Description("Test: SelectionHandler. Try to click the button to call this function.")] + [Property("SPEC", "Tizen.NUI.Components.RadioButtonGroup.SelectionHandler M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + [Precondition(1, "If test on TV, prepare mouse and connect to TV.")] + [Step(1, "If test on TV, connect the mouse to the TV")] + [Step(2, "Click run button to run TC")] + [Step(3, "Touch the RadioButton. If on the TV, click left mouse on the RadioButton.")] + [Step(4, "TC will pass after touch or click.")] + [Postcondition(1, "NA")] + public async Task SelectionHandler_TEST() + { + CreateRadioButtonGroup(); + await ManualTest.WaitForConfirm(); + if (ManualTest.IsWearable()) + { + _wearTestPage.ClearTestCase(_radioButton); + } + else + { + _testPage.ClearTestCase(_radioButton); + } + } + } + + public class MyRadioButtonGroup : RadioButtonGroup + { + protected override void SelectionHandler(SelectButton selection) + { + ManualTest.Confirm(); + base.SelectionHandler(selection); + } + } +} \ No newline at end of file diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSSelectButton.cs b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSSelectButton.cs new file mode 100755 index 000000000..e9f689d90 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSSelectButton.cs @@ -0,0 +1,201 @@ +/* + * 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.UIComponents; +using Tizen.NUI.Components; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.SelectButton test")] + public class SelectButtonTests + { + private ManualTestComponents _testPage; + private WearableManualTestNUI _wearTestPage; + private MySelectButton _selectButton; + private float _pointSize = 5.0f; + private string _resourcePath = Tizen.Applications.Application.Current.DirectoryInfo.Resource; + + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST"); + if (Window.Instance.Size.Width > 1000) + { + _pointSize = 20.0f; + } + + if (ManualTest.IsWearable()) + { + _pointSize = 4.0f; + _wearTestPage = WearableManualTestNUI.GetInstance(); + } + else + { + _testPage = ManualTestComponents.GetInstance(); + } + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST"); + } + + private void CreateSelectButton() + { + _selectButton = new MySelectButton(); + _selectButton.Size2D = new Size2D(150, 48); + _selectButton.CheckImageSize2D = new Size2D(48, 48); + _selectButton.CheckImagePaddingLeft = 0; + _selectButton.CheckImagePaddingRight = 0; + _selectButton.CheckImagePaddingTop = 0; + _selectButton.CheckImagePaddingBottom = 0; + _selectButton.CheckBackgroundImageURLSelector = new StringSelector + { + Normal = _resourcePath + "/images/controller_btn_check_off.png", + Selected = _resourcePath + "/images/controller_btn_check_on.png", + }; + _selectButton.CheckImageURLSelector = new StringSelector + { + Normal = "", + Selected = _resourcePath + "/images/controller_btn_check.png", + }; + _selectButton.CheckShadowImageURLSelector = new StringSelector + { + Normal = "", + Selected = _resourcePath + "/images/controller_btn_check_shadow.png", + }; + + if (ManualTest.IsWearable()) + { + _selectButton.Size2D = new Size2D(150, 48); + _wearTestPage.ExecuteTC(_selectButton); + } + else + { + _testPage.ExecuteTC(_selectButton); + } + } + + private void OnSelectedEvent(object sender, SelectButton.SelectEventArgs e) + { + Tizen.Log.Fatal("Components", "SelectButton Selected!!!!!!!!!!!!!!!!!!!!!"); + ManualTest.Confirm(); + } + + [Test] + [Category("P1")] + [Description("Test: OnTouch. Check whether the OnTouch method will be called or not when the user touch the select button")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.OnTouch M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + [Precondition(1, "NA")] + [Step(1, "Click run TC")] + [Step(2, "Press Key-Down while the test button is focusd")] + [Postcondition(1, "NA")] + public async Task OnTouch_CHECK_VALUE() + { + CreateSelectButton(); + await ManualTest.WaitForConfirm(); + if (ManualTest.IsWearable()) + { + _wearTestPage.ClearTestCase(_selectButton); + } + else + { + _testPage.ClearTestCase(_selectButton); + } + + } + + [Test] + [Category("P1")] + [Description("Test: OnSelected. Check whether the OnSelected method will be called or not when the user touch the select button")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.OnSelected M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + [Precondition(1, "NA")] + [Step(1, "Click run TC")] + [Step(2, "Press Key-Down while the test button is focusd")] + [Postcondition(1, "NA")] + public async Task OnSelected_CHECK_VALUE() + { + CreateSelectButton(); + await ManualTest.WaitForConfirm(); + if (ManualTest.IsWearable()) + { + _wearTestPage.ClearTestCase(_selectButton); + } + else + { + _testPage.ClearTestCase(_selectButton); + } + + } + + [Test] + [Category("P1")] + [Description("Test: SelectedEvent. Check whether the SelectedEvent will be triggered or not when the user click the select button")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.SelectedEvent E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + [Precondition(1, "NA")] + [Step(1, "Click run TC")] + [Step(2, "Use mouse click to test SelectedEvent")] + [Postcondition(1, "NA")] + public async Task SelectedEvent_CB() + { + CreateSelectButton(); + _selectButton.SelectedEvent += OnSelectedEvent; + await ManualTest.WaitForConfirm(); + _selectButton.SelectedEvent -= OnSelectedEvent; + if (ManualTest.IsWearable()) + { + _wearTestPage.ClearTestCase(_selectButton); + } + else + { + _testPage.ClearTestCase(_selectButton); + } + } + + public class MySelectButton : SelectButton + { + public override bool OnTouch(Touch touch) + { + ManualTest.Confirm(); + return base.OnTouch(touch); + } + + protected override void OnSelected() + { + ManualTest.Confirm(); + base.OnSelected(); + } + + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSSelectGroup.cs b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSSelectGroup.cs new file mode 100755 index 000000000..a64931673 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSSelectGroup.cs @@ -0,0 +1,134 @@ +/* + * 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.Components; +using Tizen.NUI.UIComponents; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.SelectGroup test")] + public class SelectGroupTests + { + private ManualTestComponents _testPage; + private WearableManualTestNUI _wearTestPage; + private Components.Button _button; + private float _pointSize = 5.0f; + private MyRadioButtonGroup _radioButtonGroup; + private RadioButton _radioButton; + private string _resourcePath = Tizen.Applications.Application.Current.DirectoryInfo.Resource; + private TextLabel _label; + + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST"); + if (Window.Instance.Size.Width > 1000) + { + _pointSize = 20.0f; + } + + if (ManualTest.IsWearable()) + { + _pointSize = 2.0f; + _label = ManualTest.CreateLabel("This case is unsuitable for wearable, please press PASS button to continue!"); + _wearTestPage = WearableManualTestNUI.GetInstance(); + } + else + { + _testPage = ManualTestComponents.GetInstance(); + } + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST"); + } + + private void CreateRadioButtonGroup() + { + _radioButtonGroup = new MyRadioButtonGroup(); + _radioButton = new MyRadioButton(); + _radioButton.Size2D = new Size2D(150, 48); + _radioButton.CheckImageSize2D = new Size2D(48, 48); + _radioButton.CheckImagePaddingLeft = 0; + _radioButton.CheckImagePaddingRight = 0; + _radioButton.CheckImagePaddingTop = 0; + _radioButton.CheckImagePaddingBottom = 0; + _radioButton.CheckBackgroundImageURLSelector = new StringSelector + { + Normal = _resourcePath + "/images/controller_btn_check_off.png", + Selected = _resourcePath + "/images/controller_btn_check_on.png", + }; + _radioButton.CheckImageURLSelector = new StringSelector + { + Normal = "", + Selected = _resourcePath + "/images/controller_btn_check.png", + }; + _radioButton.CheckShadowImageURLSelector = new StringSelector + { + Normal = "", + Selected = _resourcePath + "/images/controller_btn_check_shadow.png", + }; + + _radioButtonGroup.Add(_radioButton); + + if (ManualTest.IsWearable()) + { + _radioButton.Size2D = new Size2D(150, 48); + _wearTestPage.ExecuteTC(_radioButton); + } + else + { + _testPage.ExecuteTC(_radioButton); + } + } + + [Test] + [Category("P1")] + [Description("Test: SelectionHandler. Try to click the button to call this function.")] + [Property("SPEC", "Tizen.NUI.Components.SelectGroup.SelectionHandler M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + [Precondition(1, "If test on TV, prepare mouse and connect to TV.")] + [Step(1, "If test on TV, connect the mouse to the TV")] + [Step(2, "Click run button to run TC")] + [Step(3, "Touch the RadioButton. If on the TV, click left mouse on the RadioButton.")] + [Step(4, "TC will pass after touch or click.")] + [Postcondition(1, "NA")] + public async Task SelectionHandler_TEST() + { + CreateRadioButtonGroup(); + await ManualTest.WaitForConfirm(); + if (ManualTest.IsWearable()) + { + _wearTestPage.ClearTestCase(_radioButton); + } + else + { + _testPage.ClearTestCase(_radioButton); + } + } + } +} \ No newline at end of file diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSSlider.cs b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSSlider.cs new file mode 100755 index 000000000..e50225ce5 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSSlider.cs @@ -0,0 +1,241 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Threading.Tasks; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Slider test")] + public class SliderTests + { + private ManualTestComponents _testPage; + private WearableManualTestNUI _wearTestPage; + private Window _window; + private PushButton _button; + private float _pointSize = 5.0f; + private TextLabel _label; + private Slider _slider; + + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST"); + _window = Window.Instance; + if (Window.Instance.Size.Width > 1000) + { + _pointSize = 20.0f; + } + if (ManualTest.IsWearable()) + { + _pointSize = 2.0f; + _label = ManualTest.CreateLabel("This case is unsuitable for wearable, please press PASS button to continue!"); + _wearTestPage = WearableManualTestNUI.GetInstance(); + } + else + { + _testPage = ManualTestComponents.GetInstance(); + } + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST"); + } + + private Slider CreateSlider() + { + _slider = new Slider() + { + BackgroundColor = Color.Magenta, + TrackThickness = 4, + BgTrackColor = new Color(0, 0, 0, 0.1f), + SlidedTrackColor = new Color(0.05f, 0.63f, 0.9f, 1), + ThumbImageURLSelector = new StringSelector + { + Normal = "9. Controller/controller_btn_slide_handler_normal.png", + Pressed = "9. Controller/controller_btn_slide_handler_press.png", + }, + ThumbSize = new Size2D(60, 60), + ThumbImageBackgroundURLSelector = new StringSelector + { + Normal = "", + Pressed = "9. Controller/controller_btn_slide_handler_effect.png", + }, + Direction = Slider.DirectionType.Horizontal, + MinValue = 0, + MaxValue = 100, + Position2D = new Position2D(10, 10), + Size2D = new Size2D(800, 50), + CurrentValue = 10, + }; + + return _slider; + } + + private PropertyMap CreateTextMap(float pointSize, string text) + { + PropertyMap map = new PropertyMap(); + map.Insert("visualType", new PropertyValue("TEXT")); + map.Insert("pointSize", new PropertyValue(pointSize)); + map.Insert("text", new PropertyValue(text)); + return map; + } + + private void CreateView(string information) + { + _button = new PushButton(); + _button.Label = CreateTextMap(_pointSize, information); + + _testPage.ExecuteTC(_button); + } + + private void OnValueChangedEvent(object sender, EventArgs e) + { + Tizen.Log.Fatal("NUI", "ValueChangedEvent event !!!!!"); + ManualTest.Confirm(); + _window.Remove(_slider); + } + + private void OnSlidingFinishedEvent(object sender, EventArgs e) + { + Tizen.Log.Fatal("NUI", "SlidingFinishedEvent event !!!!!"); + ManualTest.Confirm(); + _window.Remove(_slider); + } + + private void OnStateChangedEvent(object sender, EventArgs e) + { + Tizen.Log.Fatal("NUI", "StateChangedEvent event !!!!!"); + ManualTest.Confirm(); + _window.Remove(_slider); + } + + + [Test] + [Category("P1")] + [Description("Test: ValueChangedEvent. Check whether the ValueChangedEvent event will be triggered or not when the user sliding the slider")] + [Property("SPEC", "Tizen.NUI.Components.Slider.ValueChangedEvent E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + [Step(1, "If test on TV, connect the mouse to the TV")] + [Step(2, "Click run button to run TC")] + [Step(3, "Sliding the slider.")] + [Step(4, "TC will pass when stop sliding")] + [Postcondition(1, "NA")] + public async Task ValueChangedEvent_CB() + { + if (ManualTest.IsWearable()) + { + _wearTestPage.ExecuteTC(_label); + await ManualTest.WaitForConfirm(); + _wearTestPage.ClearTestCase(_label); + } + else + { + CreateView("Press Key-Down"); + _slider = CreateSlider(); + _window.Add(_slider); + + _slider.ValueChangedEvent += OnValueChangedEvent; + + // Waits for user confirmation. + await ManualTest.WaitForConfirm(); + _slider.ValueChangedEvent -= OnValueChangedEvent; + _testPage.ClearTestCase(_button); + } + } + + [Test] + [Category("P1")] + [Description("Test: SlidingFinishedEvent. Check whether the SlidingFinishedEvent event will be triggered or not when the user finish to slide the slider")] + [Property("SPEC", "Tizen.NUI.Components.Slider.SlidingFinishedEvent E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + [Step(1, "Connect the mouse to the TV (TM-1 don't need)")] + [Step(2, "Click run button to run TC")] + [Step(3, "Touch or use mouse(on TV) to drag the slider.")] + [Step(4, "When you stop sliding, TC will pass")] + [Postcondition(1, "NA")] + public async Task SlidingFinishedEvent_CB() + { + if (ManualTest.IsWearable()) + { + _wearTestPage.ExecuteTC(_label); + await ManualTest.WaitForConfirm(); + _wearTestPage.ClearTestCase(_label); + } + else + { + CreateView("Press Key-Down"); + _slider = CreateSlider(); + + _window.Add(_slider); + _slider.SlidingFinishedEvent += OnSlidingFinishedEvent; + // Waits for user confirmation. + await ManualTest.WaitForConfirm(); + _slider.SlidingFinishedEvent -= OnSlidingFinishedEvent; + _testPage.ClearTestCase(_button); + } + } + + [Test] + [Category("P1")] + [Description("Test: Handle event StateChangedEvent. Check whether the StateChangedEvent event will be triggered or not when the user finish to slide the slider")] + [Property("SPEC", "Tizen.NUI.Components.Slider.StateChangedEvent E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + [Step(1, "Connect the mouse to the TV (TM-1 don't need)")] + [Step(2, "Click run button to run TC")] + [Step(3, "Touch or use mouse(on TV) to drag the slider.")] + [Step(4, "When you stop sliding, TC will pass")] + [Postcondition(1, "NA")] + public async Task StateChangedEvent_CB() + { + if (ManualTest.IsWearable()) + { + _wearTestPage.ExecuteTC(_label); + await ManualTest.WaitForConfirm(); + _wearTestPage.ClearTestCase(_label); + } + else + { + CreateView("Press Key-Down"); + _slider = CreateSlider(); + _window.Add(_slider); + _slider.StateChangedEvent += OnStateChangedEvent; + // Waits for user confirmation. + await ManualTest.WaitForConfirm(); + _slider.StateChangedEvent -= OnStateChangedEvent; + _testPage.ClearTestCase(_button); + } + } + } +} + + + diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSSwitch.cs b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSSwitch.cs new file mode 100755 index 000000000..ed6eddb0c --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/testcase/TSSwitch.cs @@ -0,0 +1,151 @@ +/* + * 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.UIComponents; +using Tizen.NUI.Components; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Switch test")] + public class SwitchTests + { + private ManualTestComponents _testPage; + private WearableManualTestNUI _wearTestPage; + private MySwitch _switch; + private float _pointSize = 5.0f; + private string _resourcePath = Tizen.Applications.Application.Current.DirectoryInfo.Resource; + + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST"); + if (Window.Instance.Size.Width > 1000) + { + _pointSize = 20.0f; + } + + if (ManualTest.IsWearable()) + { + _pointSize = 4.0f; + _wearTestPage = WearableManualTestNUI.GetInstance(); + } + else + { + _testPage = ManualTestComponents.GetInstance(); + } + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST"); + } + + private void CreateSwitch() + { + _switch = new MySwitch(); + _switch.Size2D = new Size2D(96, 60); + _switch.SwitchHandlerImageSize2D = new Size2D(60, 60); + _switch.SwitchBackgroundImageURLSelector = new StringSelector + { + Normal = _resourcePath + "/images/controller_switch_bg_off.png", + Selected = _resourcePath + "/images/controller_switch_bg_on.png", + }; + _switch.SwitchHandlerImageURLSelector = new StringSelector + { + Normal = _resourcePath + "/images/controller_switch_handler.png", + Selected = _resourcePath + "/images/controller_switch_handler.png", + }; + + _testPage.ExecuteTC(_switch); + } + + private void OnSelectedEvent(object sender, Switch.SelectEventArgs e) + { + Tizen.Log.Fatal("Components", "SelectButton Selected!!!!!!!!!!!!!!!!!!!!!"); + ManualTest.Confirm(); + } + + [Test] + [Category("P1")] + [Description("Test: OnTouch. Check whether the OnTouch method will be called or not when the user touch the switch")] + [Property("SPEC", "Tizen.NUI.Components.Switch.OnTouch M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + [Precondition(1, "NA")] + [Step(1, "Click run TC")] + [Step(2, "Use mouse to click the Switch")] + [Postcondition(1, "NA")] + public async Task OnTouch_CHECK_VALUE() + { + CreateSwitch(); + await ManualTest.WaitForConfirm(); + if (ManualTest.IsWearable()) + { + _wearTestPage.ClearTestCase(_switch); + } + else + { + _testPage.ClearTestCase(_switch); + } + + } + + [Test] + [Category("P1")] + [Description("Test: SelectedEvent. Check whether the SelectedEvent event will be triggered or not when the user click the switch")] + [Property("SPEC", "Tizen.NUI.Components.Switch.SelectedEvent E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + [Precondition(1, "NA")] + [Step(1, "Click run TC")] + [Step(2, "Use mouse click to test SelectedEvent")] + [Postcondition(1, "NA")] + public async Task SelectedEvent_CB() + { + CreateSwitch(); + _switch.SelectedEvent += OnSelectedEvent; + await ManualTest.WaitForConfirm(); + _switch.SelectedEvent -= OnSelectedEvent; + if (ManualTest.IsWearable()) + { + _wearTestPage.ClearTestCase(_switch); + } + else + { + _testPage.ClearTestCase(_switch); + } + } + + public class MySwitch : Switch + { + public override bool OnTouch(Touch touch) + { + ManualTest.Confirm(); + return base.OnTouch(touch); + } + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/tizen-manifest.xml b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/tizen-manifest.xml new file mode 100755 index 000000000..dd14eeed8 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Manual.Tests/tizen-manifest.xml @@ -0,0 +1,16 @@ + + + + + Tizen.NUI.Components.Manual.Tests.png + + + + http://tizen.org/privilege/appmanager.launch + + diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/Program.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/Program.cs new file mode 100755 index 000000000..b47e3c157 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/Program.cs @@ -0,0 +1,153 @@ +/* + * 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 NUnitLite.TUnit; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using System.Threading; +using System.Diagnostics; +using System.Threading.Tasks; + +namespace Tizen.NUI.Components.Test +{ + + public class App : Tizen.NUI.NUIApplication + { + static TextLabel MainTitle; + static readonly string Title = "NUI.Components Auto TCT \n\n"; + static readonly float TextSize = 30.0f; + + private static Graphics.BackendType GraphicsBackend() + { + String DALI_VULKAN_BACKEND = Environment.GetEnvironmentVariable("DALI_VULKAN_BACKEND"); + int numVal = 0; + Int32.TryParse(DALI_VULKAN_BACKEND, out numVal); + + if ((Graphics.BackendType)numVal == Graphics.BackendType.Gles) + { + Log.Fatal("NUI.Components", "NUI Vulkan disabled~!"); + return Graphics.BackendType.Gles; + } + + Log.Fatal("NUI.Components", "NUI Vulkan enabled~!"); + return Graphics.BackendType.Vulkan; + } + + public App() : base(GraphicsBackend(), WindowMode.Opaque, null, null, "") + { + // : base(GraphicsBackend(), WindowMode.Opaque, null, null, "") + Log.Fatal("NUI.Components", "Call App()"); + } + + protected override void OnCreate() + { + base.OnCreate(); + + //Tizen.Log.Fatal("NUI", "### OnCreate() START!"); + Random rand = new Random(); + + Window window = Window.Instance; + window.BackgroundColor = Color.Green; + + MainTitle = new TextLabel(); + MainTitle.MultiLine = true; + MainTitle.Text = Title + $"Process ID: {Process.GetCurrentProcess().Id} \nThread ID: {Thread.CurrentThread.ManagedThreadId}\n\n" + "Backend: "; + if (GraphicsBackend() == Graphics.BackendType.Gles) + { + MainTitle.Text+="GL\n"; + } + else + { + MainTitle.Text+="Vulkan\n"; + } + MainTitle.PixelSize = TextSize; + MainTitle.BackgroundColor = new Color(rand.Next(250) / 255.0f, rand.Next(250) / 255.0f, rand.Next(250) / 255.0f, 1.0f); + MainTitle.Size2D = new Size2D(window.WindowSize.Width / 2, window.WindowSize.Height / 2); + MainTitle.PositionUsesPivotPoint = true; + MainTitle.ParentOrigin = ParentOrigin.Center; + MainTitle.PivotPoint = PivotPoint.Center; + window.Add(MainTitle); + + //TRunner t = new TRunner(); + //t.LoadTestsuite(); + //t.Execute(); + + //Tizen.Log.Fatal("NUI", "### OnCreate() END!"); + } + + static public async Task MainTitleChangeBackgroundColor(Color color) + { + //if (color == null) + //{ + // Random rand = new Random(); + // color = new Color(rand.Next(250) / 255.0f, rand.Next(250) / 255.0f, rand.Next(250) / 255.0f, 1.0f); + //} + //MainTitle.BackgroundColor = color; + //await Task.Delay(1000); + } + + static public async Task MainTitleChangeText(string title) + { + //MainTitle.Text = Title + title; + //MainTitle.PixelSize = TextSize; + //await Task.Delay(1000); + + //Tizen.Log.Fatal("NUI", $"{title} Process ID: {Process.GetCurrentProcess().Id} Thread ID: {Thread.CurrentThread.ManagedThreadId}"); + } + + protected override void OnResume() + { + base.OnResume(); + + //Tizen.Log.Fatal("NUI", $"### OnResume() START!"); + + TRunner t = new TRunner(); + t.LoadTestsuite(); + t.Execute(); + + //Tizen.Log.Fatal("NUI", $"### OnResume() END!"); + } + + protected override void OnPause() + { + base.OnPause(); + + //Tizen.Log.Fatal("NUI", $"### OnPause() START!"); + //TO DO! + //Tizen.Log.Fatal("NUI", $"### OnPause() END!"); + } + + protected override void OnTerminate() + { + //Tizen.Log.Fatal("NUI", "### OnTerminate() START!"); + + Exit(); + base.OnTerminate(); + + //Tizen.Log.Fatal("NUI", "### OnTerminate() END!"); + } + + static void Main(string[] args) + { + Tizen.Log.Fatal("NUI.Components", "NUI RUN!"); + App example = new App(); + example.Run(args); + } + + }; + +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/Tizen.NUI.Components.Tests.csproj b/tct-suite-vs/Tizen.NUI.Components.Tests/Tizen.NUI.Components.Tests.csproj new file mode 100755 index 000000000..999679522 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/Tizen.NUI.Components.Tests.csproj @@ -0,0 +1,39 @@ + + + + + Exe + tizen60 + + + + + true + + + + portable + + + None + + + + + + + + + + Runtime + + + + + + + + + + + diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/Tizen.NUI.Components.Tests.sln b/tct-suite-vs/Tizen.NUI.Components.Tests/Tizen.NUI.Components.Tests.sln new file mode 100755 index 000000000..21f2ede9f --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/Tizen.NUI.Components.Tests.sln @@ -0,0 +1,64 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26124.0 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.NUI.Components.Tests", "Tizen.NUI.Components.Tests.csproj", "{EDA7CE08-63F0-4D30-A8DC-000A32C39119}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.framework", "..\nunit.framework\nunit.framework.csproj", "{C3B4E786-5F63-4253-ABC5-DB2268FF3278}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunitlite", "..\nunitlite\nunitlite.csproj", "{1EE295D5-6D47-4279-89B2-3095EF49628B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EDA7CE08-63F0-4D30-A8DC-000A32C39119}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EDA7CE08-63F0-4D30-A8DC-000A32C39119}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EDA7CE08-63F0-4D30-A8DC-000A32C39119}.Debug|x64.ActiveCfg = Debug|Any CPU + {EDA7CE08-63F0-4D30-A8DC-000A32C39119}.Debug|x64.Build.0 = Debug|Any CPU + {EDA7CE08-63F0-4D30-A8DC-000A32C39119}.Debug|x86.ActiveCfg = Debug|Any CPU + {EDA7CE08-63F0-4D30-A8DC-000A32C39119}.Debug|x86.Build.0 = Debug|Any CPU + {EDA7CE08-63F0-4D30-A8DC-000A32C39119}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EDA7CE08-63F0-4D30-A8DC-000A32C39119}.Release|Any CPU.Build.0 = Release|Any CPU + {EDA7CE08-63F0-4D30-A8DC-000A32C39119}.Release|x64.ActiveCfg = Release|Any CPU + {EDA7CE08-63F0-4D30-A8DC-000A32C39119}.Release|x64.Build.0 = Release|Any CPU + {EDA7CE08-63F0-4D30-A8DC-000A32C39119}.Release|x86.ActiveCfg = Release|Any CPU + {EDA7CE08-63F0-4D30-A8DC-000A32C39119}.Release|x86.Build.0 = Release|Any CPU + {C3B4E786-5F63-4253-ABC5-DB2268FF3278}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C3B4E786-5F63-4253-ABC5-DB2268FF3278}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C3B4E786-5F63-4253-ABC5-DB2268FF3278}.Debug|x64.ActiveCfg = Debug|Any CPU + {C3B4E786-5F63-4253-ABC5-DB2268FF3278}.Debug|x64.Build.0 = Debug|Any CPU + {C3B4E786-5F63-4253-ABC5-DB2268FF3278}.Debug|x86.ActiveCfg = Debug|Any CPU + {C3B4E786-5F63-4253-ABC5-DB2268FF3278}.Debug|x86.Build.0 = Debug|Any CPU + {C3B4E786-5F63-4253-ABC5-DB2268FF3278}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C3B4E786-5F63-4253-ABC5-DB2268FF3278}.Release|Any CPU.Build.0 = Release|Any CPU + {C3B4E786-5F63-4253-ABC5-DB2268FF3278}.Release|x64.ActiveCfg = Release|Any CPU + {C3B4E786-5F63-4253-ABC5-DB2268FF3278}.Release|x64.Build.0 = Release|Any CPU + {C3B4E786-5F63-4253-ABC5-DB2268FF3278}.Release|x86.ActiveCfg = Release|Any CPU + {C3B4E786-5F63-4253-ABC5-DB2268FF3278}.Release|x86.Build.0 = Release|Any CPU + {1EE295D5-6D47-4279-89B2-3095EF49628B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1EE295D5-6D47-4279-89B2-3095EF49628B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1EE295D5-6D47-4279-89B2-3095EF49628B}.Debug|x64.ActiveCfg = Debug|Any CPU + {1EE295D5-6D47-4279-89B2-3095EF49628B}.Debug|x64.Build.0 = Debug|Any CPU + {1EE295D5-6D47-4279-89B2-3095EF49628B}.Debug|x86.ActiveCfg = Debug|Any CPU + {1EE295D5-6D47-4279-89B2-3095EF49628B}.Debug|x86.Build.0 = Debug|Any CPU + {1EE295D5-6D47-4279-89B2-3095EF49628B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1EE295D5-6D47-4279-89B2-3095EF49628B}.Release|Any CPU.Build.0 = Release|Any CPU + {1EE295D5-6D47-4279-89B2-3095EF49628B}.Release|x64.ActiveCfg = Release|Any CPU + {1EE295D5-6D47-4279-89B2-3095EF49628B}.Release|x64.Build.0 = Release|Any CPU + {1EE295D5-6D47-4279-89B2-3095EF49628B}.Release|x86.ActiveCfg = Release|Any CPU + {1EE295D5-6D47-4279-89B2-3095EF49628B}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B322CDDE-6430-4B68-AD4B-17E5761E3C20} + EndGlobalSection +EndGlobal diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/res/Test_Style_Manager.json b/tct-suite-vs/Tizen.NUI.Components.Tests/res/Test_Style_Manager.json new file mode 100755 index 000000000..f9ca411ab --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/res/Test_Style_Manager.json @@ -0,0 +1,34 @@ +{ + "styles": + { + "TextLabel": + { + "pointSize":10, + "enableAutoScroll":false, + "autoScrollLoopCount":2, + "autoScrollGap":50, + "autoScrollSpeed":80 + }, + + "TextLabelFontSize0": + { + "pointSize":10 + }, + "TextLabelFontSize1": + { + "pointSize":10 + }, + "TextLabelFontSize2": + { + "pointSize":10 + }, + "TextLabelFontSize3": + { + "pointSize":10 + }, + "TextLabelFontSize4": + { + "pointSize":10 + } + } +} \ No newline at end of file diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/res/Tizen.NUI.Tests.png b/tct-suite-vs/Tizen.NUI.Components.Tests/res/Tizen.NUI.Tests.png new file mode 100755 index 000000000..87abefddf Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.Components.Tests/res/Tizen.NUI.Tests.png differ diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/res/c_paganation_medium_dot_focus.png b/tct-suite-vs/Tizen.NUI.Components.Tests/res/c_paganation_medium_dot_focus.png new file mode 100755 index 000000000..bbcd0b8e6 Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.Components.Tests/res/c_paganation_medium_dot_focus.png differ diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/res/c_paganation_medium_dot_normal.png b/tct-suite-vs/Tizen.NUI.Components.Tests/res/c_paganation_medium_dot_normal.png new file mode 100755 index 000000000..597b43057 Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.Components.Tests/res/c_paganation_medium_dot_normal.png differ diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/res/dali-toolkit-default-theme.json b/tct-suite-vs/Tizen.NUI.Components.Tests/res/dali-toolkit-default-theme.json new file mode 100755 index 000000000..c4f2f2adc --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/res/dali-toolkit-default-theme.json @@ -0,0 +1,347 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * + * This file is part of Dali Toolkit + * + * 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. + */ + + +//****************************************************************************** +// +// Default Reference style theme for a 1920x1080 resolution, The values determined by UX design specification. +// This file can be copied to a new folder within the styles/ directory and amended with new default values. +// Can be overriden if StyleManager applies another style sheet. +// +//****************************************************************************** + +{ + "styles": + { + "Tooltip": + { + "tooltip": + { + "content": + { + "pointSize":84 + }, + "waitTime":0.5, + "background": + { + "visual":"{DALI_IMAGE_DIR}tooltip.9.png", + "border":[1,5,5,1] + }, + "tail": + { + "visibility":false, + "aboveVisual":"{DALI_IMAGE_DIR}tooltip-tail-above.png", + "belowVisual":"{DALI_IMAGE_DIR}tooltip-tail-below.png" + }, + "position":"BELOW", + "hoverPointOffset":[10,10], + "movementThreshold":5, + "disappearOnMovement":false + } + }, + "TextLabel": + { + "pointSize":108, + "enableAutoScroll":false, + "autoScrollLoopCount":2, + "autoScrollGap":50, + "autoScrollSpeed":80 + }, + + "TextLabelFontSize0": + { + "pointSize":84 + }, + "TextLabelFontSize1": + { + "pointSize":96 + }, + "TextLabelFontSize2": + { + "pointSize":108 + }, + "TextLabelFontSize3": + { + "pointSize":120 + }, + "TextLabelFontSize4": + { + "pointSize":132 + }, + + "TextField": + { + "pointSize":120, + "primaryCursorColor":[0.0,0.72,0.9,1.0], + "secondaryCursorColor":[0.0,0.72,0.9,1.0], + "cursorWidth":6, + "selectionHighlightColor":[0.75,0.96,1.0,1.0], + "grabHandleImage" : "{DALI_STYLE_IMAGE_DIR}cursor_handler_drop_center.png", + "selectionHandleImageLeft" : {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png" }, + "selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" } + }, + + "TextFieldFontSize0": + { + "pointSize":120 + }, + "TextFieldFontSize1": + { + "pointSize":120 + }, + "TextFieldFontSize2": + { + "pointSize":120 + }, + "TextFieldFontSize3": + { + "pointSize":120 + }, + "TextFieldFontSize4": + { + "pointSize":120 + }, + "TextSelectionPopup": + { + "popupMaxSize":[1700,100], + "optionDividerSize":[2,0], + "popupDividerColor":[0.23,0.72,0.8,0.11], + "popupIconColor":[1.0,1.0,1.0,1.0], + "popupPressedColor":[0.24,0.72,0.8,0.11], + "background": { + "rendererType": "image", + "url": "{DALI_IMAGE_DIR}selection-popup-bg.9.png" + }, + "popupFadeInDuration":0.25, + "popupFadeOutDuration":0.25 + }, + "TextSelectionPopupButton": + { + "label": + { + "visualType":"TEXT", + "pointSize":120 + }, + "unselectedBackgroundVisual": + { + "visualType": "IMAGE", + "url": "" + }, + "selectedBackgroundVisual": + { + "visualType": "IMAGE", + "url": "" + } + }, + "TextSelectionToolbar": + { + "enableOvershoot":true, + "enableScrollBar":true, + "scrollView": + { + "overshootAnimationSpeed":360.0, + "overshootSize":[1920.0,130.0] + } + }, + "ScrollView": + { + "overshootEffectColor":"B018", + "overshootAnimationSpeed":960.0, + "overshootSize":[1920.0,130.0] + }, + "ItemView": + { + "overshootEffectColor":"B018", + "overshootAnimationSpeed":960.0, + "overshootSize":[1920.0,130.0] + }, + "ScrollBar": + { + "indicatorShowDuration":0.25, + "indicatorHideDuration":0.25, + "color":[0.0,0.72,0.9,0.7] + }, + "TextEditor": + { + "pointSize":120, + "primaryCursorColor":[0.0,0.72,0.9,1.0], + "secondaryCursorColor":[0.0,0.72,0.9,1.0], + "cursorWidth":6, + "selectionHighlightColor":[0.75,0.96,1.0,1.0], + "grabHandleImage" : "{DALI_STYLE_IMAGE_DIR}cursor_handler_drop_center.png", + "selectionHandleImageLeft" : {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png" }, + "selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" } + }, + "ProgressBar": + { + "trackVisual":{ + "visualType":"IMAGE", + "url":"{DALI_IMAGE_DIR}progress-bar-skin-track.9.png" + }, + "progressVisual":{ + "visualType":"IMAGE", + "url":"{DALI_IMAGE_DIR}progress-bar-skin-progress.9.png" + }, + "secondaryProgressVisual":{ + "visualType":"IMAGE", + "url":"{DALI_IMAGE_DIR}progress-bar-skin-secondary-progress.9.png" + }, + "indeterminateVisual":{ + "visualType":"IMAGE", + "pixelArea":[0.0, 0.0, 10.0, 1.0], + "wrapModeU":"REPEAT", + "url":"{DALI_IMAGE_DIR}progress-bar-skin-indeterminate.png" + }, + "indeterminateVisualAnimation": + [ + { + "target":"indeterminateVisual", + "property":"pixelArea", + "initialValue":[0.0, 0.0, 10.0, 1.0], + "targetValue":[-1.0, 0.0, 10.0, 1.0], + "animator": + { + "alphaFunction":"DEFAULT", + "timePeriod": + { + "duration":0.8, + "delay":0 + } + } + } + ], + "labelVisual":{ + "visualType": "TEXT", + "textColor": [ 1.0, 1.0, 1.0, 1.0 ], + "pointSize" : 12.0, // Point size must always be provided to Text Visual + "horizontalAlignment": "CENTER", + "verticalAlignment": "CENTER" + }, + "progressValue": 0.0, + "secondaryProgressValue":0.0, + "indeterminate": false + }, + "Button": + { + "styles":["Tooltip"], + "initialAutoRepeatingDelay":2.0, + "nextAutoRepeatingDelay":0.9 + // Note: Visuals added to Button will be used in all derived buttons unless overridden. + }, + "PushButton": + { + "styles":["Button"], + "autoRepeating":false, + "togglable":false, + "labelPadding":[ 12.0, 12.0, 12.0, 12.0 ], + "label": + { + "visualType": "TEXT", + "horizontalAlignment": "CENTER", + "pointSize" : 15.0, // Point size must always be provided to Text Visual + "verticalAlignment": "CENTER" + }, + "unselectedBackgroundVisual": + { + "visualType": "IMAGE", + "url": "{DALI_IMAGE_DIR}button-up.9.png" + }, + "selectedBackgroundVisual": + { + "visualType": "IMAGE", + "url": "{DALI_IMAGE_DIR}button-down.9.png" + }, + "disabledSelectedBackgroundVisual": + { + "visualType": "IMAGE", + "url": "{DALI_IMAGE_DIR}button-down-disabled.9.png" + }, + "disabledUnselectedBackgroundVisual": + { + "visualType": "IMAGE", + "url": "{DALI_IMAGE_DIR}button-disabled.9.png" + } + }, + "ToggleButton": + { + "styles":["Button"] + }, + "CheckBoxButton": + { + "styles":["Button"], + "labelPadding":[ 12.0, 12.0, 0.0, 0.0 ], + "label": + { + "visualType": "TEXT", + "pointSize" : 15.0, // Point size must always be provided to Text Visual + "verticalAlignment": "CENTER" + }, + "unselectedVisual": + { + "visualType": "IMAGE", + "url": "{DALI_IMAGE_DIR}checkbox-unselected.png" + }, + "selectedVisual": + { + "visualType": "IMAGE", + "url": "{DALI_IMAGE_DIR}checkbox-selected.png" + }, + "disabledUnselectedVisual": + { + "visualType": "IMAGE", + "url": "{DALI_IMAGE_DIR}checkbox-unselected-disabled.png" + }, + "disabledSelectedVisual": + { + "visualType": "IMAGE", + "url": "{DALI_IMAGE_DIR}checkbox-selected-disabled.png" + } + }, + "RadioButton": + { + "styles":["Button"], + "labelPadding":[ 12.0, 12.0, 0.0, 0.0 ], + "label": + { + "visualType": "TEXT", + "pointSize" : 15.0, // Point size must always be provided to Text Visual + "verticalAlignment": "CENTER" + }, + "unselectedVisual": + { + "visualType": "IMAGE", + "url": "{DALI_IMAGE_DIR}radio-button-unselected.png" + }, + "selectedVisual": + { + "visualType": "IMAGE", + "url": "{DALI_IMAGE_DIR}radio-button-selected.png" + }, + "disabledUnselectedVisual": + { + "visualType": "IMAGE", + "url": "{DALI_IMAGE_DIR}radio-button-unselected-disabled.png" + }, + "disabledSelectedVisual": + { + "visualType": "IMAGE", + "url": "{DALI_IMAGE_DIR}radio-button-selected-disabled.png" + } + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/res/demoVideo.mp4 b/tct-suite-vs/Tizen.NUI.Components.Tests/res/demoVideo.mp4 new file mode 100755 index 000000000..923221935 Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.Components.Tests/res/demoVideo.mp4 differ diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/res/pagination_ic_nor.png b/tct-suite-vs/Tizen.NUI.Components.Tests/res/pagination_ic_nor.png new file mode 100755 index 000000000..f7eda28a8 Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.Components.Tests/res/pagination_ic_nor.png differ diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/res/pagination_ic_sel.png b/tct-suite-vs/Tizen.NUI.Components.Tests/res/pagination_ic_sel.png new file mode 100755 index 000000000..d5dc8acfc Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.Components.Tests/res/pagination_ic_sel.png differ diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/res/picture.png b/tct-suite-vs/Tizen.NUI.Components.Tests/res/picture.png new file mode 100755 index 000000000..87abefddf Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.Components.Tests/res/picture.png differ diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/res/popup_background.png b/tct-suite-vs/Tizen.NUI.Components.Tests/res/popup_background.png new file mode 100755 index 000000000..950dbba9b Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.Components.Tests/res/popup_background.png differ diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/res/popup_background_shadow.png b/tct-suite-vs/Tizen.NUI.Components.Tests/res/popup_background_shadow.png new file mode 100755 index 000000000..c302f687b Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.Components.Tests/res/popup_background_shadow.png differ diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/res/rectangle_btn_normal.png b/tct-suite-vs/Tizen.NUI.Components.Tests/res/rectangle_btn_normal.png new file mode 100755 index 000000000..5f0e30441 Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.Components.Tests/res/rectangle_btn_normal.png differ diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/shared/res/Tizen.NUI.Tests.png b/tct-suite-vs/Tizen.NUI.Components.Tests/shared/res/Tizen.NUI.Tests.png new file mode 100755 index 000000000..9765b1bda Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.Components.Tests/shared/res/Tizen.NUI.Tests.png differ diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSAttributes.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSAttributes.cs new file mode 100755 index 000000000..bdfb23757 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSAttributes.cs @@ -0,0 +1,73 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Attributes Tests")] + public class AttributesTests + { + private const string TAG = "NUI.Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("AttributesTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a Attributes object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.Attributes.Attributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Attributes_INIT() + { + /* TEST CODE */ + var attributes = new ViewAttributes(); + Assert.IsNotNull(attributes, "Can't create success object Attributes"); + Assert.IsInstanceOf(attributes, "Should be an instance of Attributes type."); + } + + [Test] + [Category("P1")] + [Description("Test Clone. Check Whether Clone works or not")] + [Property("SPEC", "Tizen.NUI.Components.Attributes.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Clone_TEST() + { + /* TEST CODE */ + try + { + var viewAttributes = new ViewAttributes(); + viewAttributes.PaddingLeft = 10; + var attributes = viewAttributes.Clone() as ViewAttributes; + Assert.IsNotNull(attributes, "Can't create success object Attributes"); + Assert.IsInstanceOf(attributes, "Should be an instance of Attributes type."); + Assert.AreEqual(10, attributes.PaddingLeft, "Should be equal!"); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSButton.ClickEventArgs.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSButton.ClickEventArgs.cs new file mode 100755 index 000000000..e480464b0 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSButton.ClickEventArgs.cs @@ -0,0 +1,50 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Components; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Button.ClickEventArgs Tests")] + public class ButtonClickEventArgsTests + { + private const string TAG = "Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("ButtonClickEventArgsTests"); + App.MainTitleChangeBackgroundColor(null); + + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test ClickEventArgs empty constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Button.ClickEventArgs.ClickEventArgs C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ClickEventArgs_CHECK_VALUE() + { + /* TEST CODE */ + var clickEventArgs = new Components.Button.ClickEventArgs(); + Assert.IsNotNull(clickEventArgs, "Should be not null!"); + Assert.IsInstanceOf(clickEventArgs, "Should be equal!"); + + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSButton.StateChangeEventArgs.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSButton.StateChangeEventArgs.cs new file mode 100755 index 000000000..31c8cb269 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSButton.StateChangeEventArgs.cs @@ -0,0 +1,80 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Components; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Button.StateChangeEventArgs Tests")] + public class ButtonStateChangeEventArgsTests + { + private const string TAG = "Components"; + + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("ButtonStateChangeEventArgsTests"); + App.MainTitleChangeBackgroundColor(null); + + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test StateChangeEventArgs empty constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Button.StateChangeEventArgs.StateChangeEventArgs C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void StateChangeEventArgs_CHECK_VALUE() + { + /* TEST CODE */ + var stateChangeEventArgs = new Components.Button.StateChangeEventArgs(); + Assert.IsNotNull(stateChangeEventArgs, "Should be not null!"); + Assert.IsInstanceOf(stateChangeEventArgs, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test PreviousState. Check whether PreviousState is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.StateChangeEventArgs.PreviousState A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void PreviousState_SET_GET_VALUE() + { + /* TEST CODE */ + var stateChangeEventArgs = new Components.Button.StateChangeEventArgs(); + stateChangeEventArgs.PreviousState = ControlStates.Normal; + Assert.AreEqual(ControlStates.Normal, stateChangeEventArgs.PreviousState, "Should be equal"); + } + + [Test] + [Category("P1")] + [Description("Test CurrentState. Check whether CurrentState is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.StateChangeEventArgs.CurrentState A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CurrentState_SET_GET_VALUE() + { + /* TEST CODE */ + var stateChangeEventArgs = new Components.Button.StateChangeEventArgs(); + stateChangeEventArgs.CurrentState = ControlStates.Normal; + Assert.AreEqual(ControlStates.Normal, stateChangeEventArgs.CurrentState, "Should be equal"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSButton.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSButton.cs new file mode 100755 index 000000000..172be2dab --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSButton.cs @@ -0,0 +1,1126 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Components; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Button Tests")] + public class ButtonTests + { + private const string TAG = "Components"; + private bool _stateChangedEvent = false; + private string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png"; + private static bool _focusGainedFlag = false; + private static bool _focusLostFlag = false; + private static bool _updateFlag = false; + private static bool _themeFlag = false; + private static bool _measureTextFlag = false; + private static bool _layoutChildFlag = false; + + [SetUp] + public void Init() + { + _stateChangedEvent = false; + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("CommonButtonTests"); + App.MainTitleChangeBackgroundColor(null); + + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test Button empty constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Button.Button C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void Button_CHECK_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + Assert.IsNotNull(button, "Should be not null"); + Assert.IsInstanceOf(button, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test Button style constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Button.Button C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "string")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void Button_Style_CHECK_VALUE() + { + /* TEST CODE */ + StyleManager.Instance.RegisterStyle("BasicButton", null, typeof(ButtonStyle)); + var button = new Components.Button("BasicButton"); + Assert.IsNotNull(button, "Should be not null"); + Assert.IsInstanceOf(button, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test Button ButtonAttributes constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Button.Button C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "ButtonAttributes")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void Button_ButtonAttributes_CHECK_VALUE() + { + /* TEST CODE */ + var buttonAttributes = new ButtonAttributes + { + IsSelectable = true, + BackgroundImageAttributes = new ImageAttributes + { + ResourceURL = new StringSelector { All = _image_path }, + Border = new RectangleSelector { All = new Rectangle(5, 5, 5, 5) } + }, + + TextAttributes = new TextAttributes + { + PointSize = new FloatSelector { All = 20 }, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent, + + TextColor = new ColorSelector + { + Normal = new Color(0, 0, 0, 1), + Pressed = new Color(0, 0, 0, 0.7f), + Selected = new Color(0.141f, 0.769f, 0.278f, 1), + Disabled = new Color(0, 0, 0, 0.4f), + }, + } + }; + var button = new Components.Button(buttonAttributes); + Assert.IsNotNull(button, "Should be not null"); + Assert.IsInstanceOf(button, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test IsSelectable. Check whether IsSelectable is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.IsSelectable A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void IsSelectable_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + button.IsSelectable = true; + Assert.AreEqual(true, button.IsSelectable, "Should be equals to the set value"); + button.IsSelectable = false; + Assert.AreEqual(false, button.IsSelectable, "Should be equals to the set value"); + } + + [Test] + [Category("P1")] + [Description("Test BackgroundImageURL. Check whether BackgroundImageURL is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.BackgroundImageURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void BackgroundImageURL_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + button.BackgroundImageURL = _image_path; + Assert.AreEqual(_image_path, button.BackgroundImageURL, "Should be equals to the set value of BackgroundImageURL"); + } + + [Test] + [Category("P1")] + [Description("Test BackgroundImageBorder. Check whether BackgroundImageBorder is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.BackgroundImageBorder A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void BackgroundImageBorder_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + button.BackgroundImageBorder = new Rectangle(0, 0, 10, 10); + Assert.AreEqual(0, button.BackgroundImageBorder.X, "Retrieved BackgroundImageBorder should be equal to set value"); + Assert.AreEqual(0, button.BackgroundImageBorder.Y, "Retrieved BackgroundImageBorder should be equal to set value"); + Assert.AreEqual(10, button.BackgroundImageBorder.Width, "Retrieved BackgroundImageBorder should be equal to set value"); + Assert.AreEqual(10, button.BackgroundImageBorder.Height, "Retrieved BackgroundImageBorder should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test ShadowImageURL. Check whether ShadowImageURL is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.ShadowImageURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ShadowImageURL_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + button.ShadowImageURL = _image_path; + Assert.AreEqual(_image_path, button.ShadowImageURL, "Should be equals to the set value of ShadowImageURL"); + } + + [Test] + [Category("P1")] + [Description("Test ShadowImageBorder. Check whether ShadowImageBorder is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.ShadowImageBorder A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ShadowImageBorder_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + button.ShadowImageBorder = new Rectangle(0, 0, 10, 10); + Assert.AreEqual(0, button.ShadowImageBorder.X, "Retrieved ShadowImageBorder should be equal to set value"); + Assert.AreEqual(0, button.ShadowImageBorder.Y, "Retrieved ShadowImageBorder should be equal to set value"); + Assert.AreEqual(10, button.ShadowImageBorder.Width, "Retrieved ShadowImageBorder should be equal to set value"); + Assert.AreEqual(10, button.ShadowImageBorder.Height, "Retrieved ShadowImageBorder should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test OverlayImageURL. Check whether OverlayImageURL is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.OverlayImageURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void OverlayImageURL_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + button.OverlayImageURL = _image_path; + Assert.AreEqual(_image_path, button.OverlayImageURL, "Should be equals to the set value of OverlayImageURL"); + } + + [Test] + [Category("P1")] + [Description("Test OverlayImageBorder. Check whether OverlayImageBorder is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.OverlayImageBorder A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void OverlayImageBorder_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + button.OverlayImageBorder = new Rectangle(0, 0, 10, 10); + Assert.AreEqual(0, button.OverlayImageBorder.X, "Retrieved OverlayImageBorder should be equal to set value"); + Assert.AreEqual(0, button.OverlayImageBorder.Y, "Retrieved OverlayImageBorder should be equal to set value"); + Assert.AreEqual(10, button.OverlayImageBorder.Width, "Retrieved OverlayImageBorder should be equal to set value"); + Assert.AreEqual(10, button.OverlayImageBorder.Height, "Retrieved OverlayImageBorder should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test Text. Check whether Text is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.Text A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void Text_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + button.Text = "Test Text"; + Assert.AreEqual("Test Text", button.Text, "Should be equals to the set value of Text"); + } + + [Test] + [Category("P1")] + [Description("Test TranslatableText. Check whether TranslatableText is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.TranslatableText A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void TranslatableText_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + button.TranslatableText = "Test TranslatableText"; + Assert.AreEqual("Test TranslatableText", button.TranslatableText, "Should be equals to the set value of TranslatableText"); + } + + [Test] + [Category("P1")] + [Description("Test PointSize. Check whether PointSize is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.PointSize A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void PointSize_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + button.PointSize = 10.0f; + Assert.AreEqual(10.0f, button.PointSize, "Should be equals to the set value of PointSize"); + } + + [Test] + [Category("P1")] + [Description("Test FontFamily. Check whether FontFamily is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.FontFamily A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void FontFamily_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + button.FontFamily = "SamsungOne 500"; + Assert.AreEqual("SamsungOne 500", button.FontFamily, "Should be equals to the set value of FontFamily"); + } + + [Test] + [Category("P1")] + [Description("Test TextColor. Check whether TextColor is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.TextColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void TextColor_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + var color = new Color(1.0f, 0.0f, 0.0f, 1.0f); + button.TextColor = color; + + Assert.AreEqual(color.R, button.TextColor.R, "Should be equals to the color.R set"); + Assert.AreEqual(color.G, button.TextColor.G, "Should be equals to the color.G set"); + Assert.AreEqual(color.B, button.TextColor.B, "Should be equals to the color.B set"); + Assert.AreEqual(color.A, button.TextColor.A, "Should be equals to the color.A set"); + + } + + [Test] + [Category("P1")] + [Description("Test TextAlignment. Check whether TextAlignment is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.TextAlignment A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void TextAlignment_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + button.TextAlignment = HorizontalAlignment.Begin; + Assert.AreEqual(HorizontalAlignment.Begin, button.TextAlignment, "Should be equals to the set value of TextAlignment"); + button.TextAlignment = HorizontalAlignment.Center; + Assert.AreEqual(HorizontalAlignment.Center, button.TextAlignment, "Should be equals to the set value of TextAlignment"); + button.TextAlignment = HorizontalAlignment.End; + Assert.AreEqual(HorizontalAlignment.End, button.TextAlignment, "Should be equals to the set value of TextAlignment"); + } + + [Test] + [Category("P1")] + [Description("Test IconURL. Check whether IconURL is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.IconURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void IconURL_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + button.IconURL = _image_path; + Assert.AreEqual(_image_path, button.IconURL, "Should be equals to the set value of IconURL"); + } + + [Test] + [Category("P1")] + [Description("Test TextSelector. Check whether TextSelector is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.TextSelector A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void TextSelector_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + var stringSelector = new StringSelector + { + Normal = "Normal", + Selected = "Selected", + }; + + button.TextSelector = stringSelector; + Assert.AreEqual(stringSelector.Normal, button.TextSelector.Normal, "Should be equals to the set value of TextSelector"); + Assert.AreEqual(stringSelector.Selected, button.TextSelector.Selected, "Should be equals to the set value of TextSelector"); + } + + [Test] + [Category("P1")] + [Description("Test TranslatableTextSelector. Check whether TranslatableTextSelector is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.TranslatableTextSelector A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void TranslatableTextSelector_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + var stringSelector = new StringSelector + { + Normal = "Normal", + Selected = "Selected", + }; + + button.TranslatableTextSelector = stringSelector; + Assert.AreEqual(stringSelector.Normal, button.TranslatableTextSelector.Normal, "Should be equals to the set value of TranslatableTextSelector"); + Assert.AreEqual(stringSelector.Selected, button.TranslatableTextSelector.Selected, "Should be equals to the set value of TranslatableTextSelector"); + } + + [Test] + [Category("P1")] + [Description("Test TextColorSelector. Check whether TextColorSelector is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.TextColorSelector A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void TextColorSelector_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + var colorSelector = new ColorSelector + { + Normal = new Color(0.0f, 0.0f, 1.0f, 1.0f), + Selected = new Color(0.0f, 1.0f, 0.0f, 1.0f), + }; + + button.TextColorSelector = colorSelector; + Assert.AreEqual(colorSelector.Normal.R, button.TextColorSelector.Normal.R, "Should be equals to the set value of TextColorSelector Normal R"); + Assert.AreEqual(colorSelector.Normal.G, button.TextColorSelector.Normal.G, "Should be equals to the set value of TextColorSelector Normal G"); + Assert.AreEqual(colorSelector.Normal.B, button.TextColorSelector.Normal.B, "Should be equals to the set value of TextColorSelector Normal B"); + Assert.AreEqual(colorSelector.Normal.A, button.TextColorSelector.Normal.A, "Should be equals to the set value of TextColorSelector Normal A"); + + Assert.AreEqual(colorSelector.Selected.R, button.TextColorSelector.Selected.R, "Should be equals to the set value of TextColorSelector Selected R"); + Assert.AreEqual(colorSelector.Selected.G, button.TextColorSelector.Selected.G, "Should be equals to the set value of TextColorSelector Selected G"); + Assert.AreEqual(colorSelector.Selected.B, button.TextColorSelector.Selected.B, "Should be equals to the set value of TextColorSelector Selected B"); + Assert.AreEqual(colorSelector.Selected.A, button.TextColorSelector.Selected.A, "Should be equals to the set value of TextColorSelector Selected A"); + } + + [Test] + [Category("P1")] + [Description("Test PointSizeSelector. Check whether PointSizeSelector is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.PointSizeSelector A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void PointSizeSelector_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + var floatSelector = new FloatSelector + { + Normal = 10.0f, + Selected = 12.0f, + }; + + button.PointSizeSelector = floatSelector; + Assert.AreEqual(floatSelector.Normal, button.PointSizeSelector.Normal, "Should be equals to the set value of PointSizeSelector Normal"); + Assert.AreEqual(floatSelector.Selected, button.PointSizeSelector.Selected, "Should be equals to the set value of PointSizeSelector Selected"); + } + + [Test] + [Category("P1")] + [Description("Test IconURLSelector. Check whether IconURLSelector is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.IconURLSelector A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void IconURLSelector_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + var stringSelector = new StringSelector + { + Normal = _image_path, + Selected = _image_path, + }; + button.IconURLSelector = stringSelector; + Assert.AreEqual(stringSelector.Normal, button.IconURLSelector.Normal, "Should be equals to the set value of IconURLSelector Normal"); + Assert.AreEqual(stringSelector.Selected, button.IconURLSelector.Selected, "Should be equals to the set value of IconURLSelector Selected"); + } + + [Test] + [Category("P1")] + [Description("Test BackgroundImageURLSelector. Check whether BackgroundImageURLSelector is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.BackgroundImageURLSelector A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void BackgroundImageURLSelector_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + var stringSelector = new StringSelector + { + Normal = _image_path, + Selected = _image_path, + }; + button.BackgroundImageURLSelector = stringSelector; + Assert.AreEqual(stringSelector.Normal, button.BackgroundImageURLSelector.Normal, "Should be equals to the set value of BackgroundImageURLSelector Normal"); + Assert.AreEqual(stringSelector.Selected, button.BackgroundImageURLSelector.Selected, "Should be equals to the set value of BackgroundImageURLSelector Selected"); + } + + [Test] + [Category("P1")] + [Description("Test BackgroundImageBorderSelector. Check whether BackgroundImageBorderSelector is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.BackgroundImageBorderSelector A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void BackgroundImageBorderSelector_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + var rectangleSelector = new RectangleSelector + { + Normal = new Rectangle(0, 0, 10, 10), + Selected = new Rectangle(0, 0, 11, 11), + }; + button.BackgroundImageBorderSelector = rectangleSelector; + + Assert.AreEqual(0, button.BackgroundImageBorderSelector.Normal.X, "Retrieved BackgroundImageBorderSelector Normal X should be equal to set value"); + Assert.AreEqual(0, button.BackgroundImageBorderSelector.Normal.Y, "Retrieved BackgroundImageBorderSelector Normal Y should be equal to set value"); + Assert.AreEqual(10, button.BackgroundImageBorderSelector.Normal.Width, "Retrieved BackgroundImageBorderSelector Normal Width should be equal to set value"); + Assert.AreEqual(10, button.BackgroundImageBorderSelector.Normal.Height, "Retrieved BackgroundImageBorderSelector Normal Height should be equal to set value"); + + Assert.AreEqual(0, button.BackgroundImageBorderSelector.Selected.X, "Retrieved BackgroundImageBorderSelector Selected X should be equal to set value"); + Assert.AreEqual(0, button.BackgroundImageBorderSelector.Selected.Y, "Retrieved BackgroundImageBorderSelector Selected Y should be equal to set value"); + Assert.AreEqual(11, button.BackgroundImageBorderSelector.Selected.Width, "Retrieved BackgroundImageBorderSelector Selected Width should be equal to set value"); + Assert.AreEqual(11, button.BackgroundImageBorderSelector.Selected.Height, "Retrieved BackgroundImageBorderSelector Selected Height should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test ShadowImageURLSelector. Check whether ShadowImageURLSelector is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.ShadowImageURLSelector A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ShadowImageURLSelector_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + var stringSelector = new StringSelector + { + Normal = _image_path, + Selected = _image_path, + }; + button.ShadowImageURLSelector = stringSelector; + Assert.AreEqual(stringSelector.Normal, button.ShadowImageURLSelector.Normal, "Should be equals to the set value of ShadowImageURLSelector Normal"); + Assert.AreEqual(stringSelector.Selected, button.ShadowImageURLSelector.Selected, "Should be equals to the set value of ShadowImageURLSelector Selected"); + } + + [Test] + [Category("P1")] + [Description("Test ShadowImageBorderSelector. Check whether ShadowImageBorderSelector is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.ShadowImageBorderSelector A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ShadowImageBorderSelector_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + var rectangleSelector = new RectangleSelector + { + Normal = new Rectangle(0, 0, 10, 10), + Selected = new Rectangle(0, 0, 11, 11), + }; + button.ShadowImageBorderSelector = rectangleSelector; + + Assert.AreEqual(0, button.ShadowImageBorderSelector.Normal.X, "Retrieved ShadowImageBorderSelector Normal X should be equal to set value"); + Assert.AreEqual(0, button.ShadowImageBorderSelector.Normal.Y, "Retrieved ShadowImageBorderSelector Normal Y should be equal to set value"); + Assert.AreEqual(10, button.ShadowImageBorderSelector.Normal.Width, "Retrieved ShadowImageBorderSelector Normal Width should be equal to set value"); + Assert.AreEqual(10, button.ShadowImageBorderSelector.Normal.Height, "Retrieved ShadowImageBorderSelector Normal Height should be equal to set value"); + + Assert.AreEqual(0, button.ShadowImageBorderSelector.Selected.X, "Retrieved ShadowImageBorderSelector Selected X should be equal to set value"); + Assert.AreEqual(0, button.ShadowImageBorderSelector.Selected.Y, "Retrieved ShadowImageBorderSelector Selected Y should be equal to set value"); + Assert.AreEqual(11, button.ShadowImageBorderSelector.Selected.Width, "Retrieved ShadowImageBorderSelector Selected Width should be equal to set value"); + Assert.AreEqual(11, button.ShadowImageBorderSelector.Selected.Height, "Retrieved ShadowImageBorderSelector Selected Height should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test OverlayImageURLSelector. Check whether OverlayImageURLSelector is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.OverlayImageURLSelector A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void OverlayImageURLSelector_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + var stringSelector = new StringSelector + { + Normal = _image_path, + Selected = _image_path, + }; + button.OverlayImageURLSelector = stringSelector; + Assert.AreEqual(stringSelector.Normal, button.OverlayImageURLSelector.Normal, "Should be equals to the set value of OverlayImageURLSelector Normal"); + Assert.AreEqual(stringSelector.Selected, button.OverlayImageURLSelector.Selected, "Should be equals to the set value of OverlayImageURLSelector Selected"); + } + + [Test] + [Category("P1")] + [Description("Test OverlayImageBorderSelector. Check whether OverlayImageBorderSelector is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.OverlayImageBorderSelector A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void OverlayImageBorderSelector_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + var rectangleSelector = new RectangleSelector + { + Normal = new Rectangle(0, 0, 10, 10), + Selected = new Rectangle(0, 0, 11, 11), + }; + button.OverlayImageBorderSelector = rectangleSelector; + + Assert.AreEqual(0, button.OverlayImageBorderSelector.Normal.X, "Retrieved OverlayImageBorderSelector Normal X should be equal to set value"); + Assert.AreEqual(0, button.OverlayImageBorderSelector.Normal.Y, "Retrieved OverlayImageBorderSelector Normal Y should be equal to set value"); + Assert.AreEqual(10, button.OverlayImageBorderSelector.Normal.Width, "Retrieved OverlayImageBorderSelector Normal Width should be equal to set value"); + Assert.AreEqual(10, button.OverlayImageBorderSelector.Normal.Height, "Retrieved OverlayImageBorderSelector Normal Height should be equal to set value"); + + Assert.AreEqual(0, button.OverlayImageBorderSelector.Selected.X, "Retrieved OverlayImageBorderSelector Selected X should be equal to set value"); + Assert.AreEqual(0, button.OverlayImageBorderSelector.Selected.Y, "Retrieved OverlayImageBorderSelector Selected Y should be equal to set value"); + Assert.AreEqual(11, button.OverlayImageBorderSelector.Selected.Width, "Retrieved OverlayImageBorderSelector Selected Width should be equal to set value"); + Assert.AreEqual(11, button.OverlayImageBorderSelector.Selected.Height, "Retrieved OverlayImageBorderSelector Selected Height should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test IsSelected. Check whether IsSelected is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.IsSelected A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void IsSelected_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + button.IsSelected = true; + Assert.AreEqual(true, button.IsSelected, "Retrieved IsSelected should be equal to set value"); + button.IsSelected = false; + Assert.AreEqual(false, button.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.Button.IsEnabled A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void IsEnabled_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + button.IsEnabled = true; + Assert.AreEqual(true, button.IsEnabled, "Retrieved IsEnabled should be equal to set value"); + button.IsEnabled = false; + Assert.AreEqual(false, button.IsEnabled, "Retrieved IsEnabled should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test IconRelativeOrientation. Check whether IconRelativeOrientation is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.IconRelativeOrientation A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void IconRelativeOrientation_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + button.IconRelativeOrientation = Components.Button.IconOrientation.Left; + Assert.AreEqual(Components.Button.IconOrientation.Left, button.IconRelativeOrientation, "Retrieved IconRelativeOrientation should be equal to set value"); + button.IconRelativeOrientation = Components.Button.IconOrientation.Right; + Assert.AreEqual(Components.Button.IconOrientation.Right, button.IconRelativeOrientation, "Retrieved IconRelativeOrientation should be equal to set value"); + button.IconRelativeOrientation = Components.Button.IconOrientation.Top; + Assert.AreEqual(Components.Button.IconOrientation.Top, button.IconRelativeOrientation, "Retrieved IconRelativeOrientation should be equal to set value"); + button.IconRelativeOrientation = Components.Button.IconOrientation.Bottom; + Assert.AreEqual(Components.Button.IconOrientation.Bottom, button.IconRelativeOrientation, "Retrieved IconRelativeOrientation should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test IconPaddingLeft. Check whether IconPaddingLeft is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.IconPaddingLeft A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void IconPaddingLeft_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + button.IconPaddingLeft = 10; + Assert.AreEqual(10, button.IconPaddingLeft, "Retrieved IconPaddingLeft should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test IconPaddingRight. Check whether IconPaddingRight is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.IconPaddingRight A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void IconPaddingRight_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + button.IconPaddingRight = 10; + Assert.AreEqual(10, button.IconPaddingRight, "Retrieved IconPaddingRight should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test IconPaddingTop. Check whether IconPaddingTop is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.IconPaddingTop A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void IconPaddingTop_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + button.IconPaddingTop = 10; + Assert.AreEqual(10, button.IconPaddingTop, "Retrieved IconPaddingTop should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test IconPaddingBottom. Check whether IconPaddingBottom is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.IconPaddingBottom A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void IconPaddingBottom_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + button.IconPaddingBottom = 10; + Assert.AreEqual(10, button.IconPaddingBottom, "Retrieved IconPaddingBottom should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test TextPaddingLeft. Check whether TextPaddingLeft is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.TextPaddingLeft A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void TextPaddingLeft_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + button.TextPaddingLeft = 10; + Assert.AreEqual(10, button.TextPaddingLeft, "Retrieved TextPaddingLeft should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test TextPaddingRight. Check whether TextPaddingRight is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.TextPaddingRight A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void TextPaddingRight_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + button.TextPaddingRight = 10; + Assert.AreEqual(10, button.TextPaddingRight, "Retrieved TextPaddingRight should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test TextPaddingTop. Check whether TextPaddingTop is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.TextPaddingTop A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void TextPaddingTop_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + button.TextPaddingTop = 10; + Assert.AreEqual(10, button.TextPaddingTop, "Retrieved TextPaddingTop should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test TextPaddingBottom. Check whether TextPaddingBottom is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Button.TextPaddingBottom A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void TextPaddingBottom_SET_GET_VALUE() + { + /* TEST CODE */ + var button = new Components.Button(); + button.TextPaddingBottom = 10; + Assert.AreEqual(10, button.TextPaddingBottom, "Retrieved TextPaddingBottom should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test OnKey. Check return the right value or not")] + [Property("SPEC", "Tizen.NUI.Components.Button.OnKey M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void OnKey_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + try + { + var button = new Components.Button(); + bool flag = true; + flag = button.OnKey(new Key()); + Assert.AreEqual(false, flag, "OnKey return check fail."); + } + 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 ButtonStyle : StyleBase + { + private string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png"; + public ButtonStyle() + { + + } + protected override Attributes GetAttributes() + { + ButtonAttributes attributes = new ButtonAttributes + { + IsSelectable = true, + BackgroundImageAttributes = new ImageAttributes + { + ResourceURL = new StringSelector + { + Normal = _image_path, + Selected = _image_path, + }, + Border = new RectangleSelector { All = new Rectangle(5, 5, 5, 5) } + }, + + ShadowImageAttributes = new ImageAttributes + { + ResourceURL = new StringSelector { All = _image_path }, + Border = new RectangleSelector { All = new Rectangle(5, 5, 5, 5) } + }, + + OverlayImageAttributes = new ImageAttributes + { + ResourceURL = new StringSelector { Pressed = _image_path, Other = "" }, + Border = new RectangleSelector { All = new Rectangle(5, 5, 5, 5) }, + }, + + IconAttributes = new ImageAttributes + { + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent, + } + }; + return attributes; + } + } + + public class MyButton : Components.Button + { + public override void OnFocusGained() + { + _focusGainedFlag = true; + base.OnFocusGained(); + } + + public override void OnFocusLost() + { + _focusLostFlag = true; + base.OnFocusLost(); + } + + protected override void OnUpdate() + { + _updateFlag = true; + base.OnUpdate(); + } + + protected override void MeasureText() + { + _measureTextFlag = true; + base.MeasureText(); + } + + protected override void LayoutChild() + { + _layoutChildFlag = true; + base.LayoutChild(); + } + + protected override void OnThemeChangedEvent(object sender, Components.StyleManager.ThemeChangeEventArgs e) + { + _themeFlag = true; + base.OnThemeChangedEvent(sender, e); + } + + protected override Attributes GetAttributes() + { + return base.GetAttributes(); + } + + public Attributes TestGetAttributes() + { + return GetAttributes(); + } + } + + [Test] + [Category("P1")] + [Description("Test OnFocusGained. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Button.OnFocusGained M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void OnFocusGained_CHECK_VALUE() + { + /* TEST CODE */ + _focusGainedFlag = false; + var myButton = new MyButton(); + myButton.Focusable = true; + Window.Instance.Add(myButton); + FocusManager.Instance.SetCurrentFocusView(myButton); + Assert.AreEqual(true, _focusGainedFlag, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test OnFocusLost. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Button.OnFocusLost M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void OnFocusLost_CHECK_VALUE() + { + /* TEST CODE */ + _focusLostFlag = false; + var myButton = new MyButton(); + var view = new BaseComponents.View(); + view.Focusable = true; + myButton.Focusable = true; + Window.Instance.Add(myButton); + Window.Instance.Add(view); + FocusManager.Instance.SetCurrentFocusView(myButton); + FocusManager.Instance.SetCurrentFocusView(view); + Assert.AreEqual(true, _focusLostFlag, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test OnThemeChangedEvent. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Button.OnThemeChangedEvent M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public async Task OnThemeChangedEvent_CHECK_VALUE() + { + _themeFlag = false; + Tizen.NUI.Components.StyleManager.Instance.Theme = "Utility"; + var myButton = new MyButton(); + Window window = Window.Instance; + window.Add(myButton); + Tizen.NUI.Components.StyleManager.Instance.Theme = "Food"; + await Task.Delay(500); + Assert.AreEqual(true, _themeFlag, "OnThemeChangedEvent trigger Check Fail."); + window.Remove(myButton); + } + + [Test] + [Category("P1")] + [Description("Test OnUpdate. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Button.OnUpdate M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public async Task OnUpdate_CHECK_VALUE() + { + /* TEST CODE */ + _updateFlag = false; + var myButton = new MyButton(); + myButton.Focusable = true; + myButton.Size2D = new Size2D(400, 80); + myButton.BackgroundColor = Color.Red; + Window.Instance.Add(myButton); + await Task.Delay(500); + Assert.AreEqual(true, _updateFlag, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test MeasureText. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Button.MeasureText M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public async Task MeasureText_CHECK_VALUE() + { + /* TEST CODE */ + _measureTextFlag = false; + var myButton = new MyButton(); + myButton.Focusable = true; + myButton.Size2D = new Size2D(400, 80); + myButton.BackgroundColor = Color.Red; + myButton.Text = "Button"; + Window.Instance.Add(myButton); + await Task.Delay(500); + Assert.AreEqual(true, _measureTextFlag, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test LayoutChild. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Button.LayoutChild M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public async Task LayoutChild_CHECK_VALUE() + { + /* TEST CODE */ + _layoutChildFlag = false; + var myButton = new MyButton(); + myButton.Focusable = true; + myButton.Size2D = new Size2D(400, 80); + myButton.BackgroundColor = Color.Red; + myButton.Text = "Button"; + Window.Instance.Add(myButton); + await Task.Delay(500); + Assert.AreEqual(true, _layoutChildFlag, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test GetAttributes. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Button.GetAttributes M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void GetAttributes_CHECK_VALUE() + { + /* TEST CODE */ + var myButton = new MyButton(); + var attr = myButton.TestGetAttributes(); + Assert.IsNotNull(attr, "Should be not null!"); + Assert.IsInstanceOf(attr, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test UpdateState. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Button.UpdateState M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void UpdateState_CHECK_VALUE() + { + /* TEST CODE */ + try + { + var myButton = new MyButton(); + myButton.Size2D = new Size2D(400, 80); + myButton.BackgroundColor = Color.Red; + Window.Instance.Add(myButton); + myButton.IsSelected = true; + Assert.IsTrue(_updateFlag, "Should be true!"); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + + } + + [Test] + [Category("P1")] + [Description("Test StateChangedEvent. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Button.StateChangedEvent E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void StateChangedEvent_CHECK_VALUE() + { + /* TEST CODE */ + var myButton = new MyButton(); + myButton.StateChangedEvent += OnStateChangedEvent; + myButton.IsSelected = true; + Assert.AreEqual(true, _stateChangedEvent, "Should be equal!"); + myButton.StateChangedEvent -= OnStateChangedEvent; + } + + [Test] + [Category("P1")] + [Description("Test Dispose, try to dispose the Button.")] + [Property("SPEC", "Tizen.NUI.Components.Button.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Dispose_TEST() + { + /* TEST CODE */ + try + { + Button button = new Button(); + button.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()); + } + } + + private void OnStateChangedEvent(object sender, Components.Button.StateChangeEventArgs args) + { + _stateChangedEvent = true; + } + + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSButtonAttributes.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSButtonAttributes.cs new file mode 100755 index 000000000..4ffea9707 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSButtonAttributes.cs @@ -0,0 +1,231 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Components; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.ButtonAttributes Tests")] + public class ButtonAttributesTests + { + private string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png"; + private const string TAG = "Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("ButtonAttributesTests"); + App.MainTitleChangeBackgroundColor(null); + + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test ButtonAttributes empty constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.ButtonAttributes.ButtonAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ButtonAttributes_CHECK_VALUE() + { + /* TEST CODE */ + var buttonAttributes = new ButtonAttributes(); + Assert.IsNotNull(buttonAttributes, "Should be not null!"); + Assert.IsInstanceOf(buttonAttributes, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test ButtonAttributes copy constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.ButtonAttributes.ButtonAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "ButtonAttributes")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ButtonAttributes_ButtonAttributes_CHECK_VALUE() + { + /* TEST CODE */ + var buttonAttributes = new ButtonAttributes + { + IsSelectable = true, + BackgroundImageAttributes = new ImageAttributes + { + ResourceURL = new StringSelector { All = _image_path }, + Border = new RectangleSelector { All = new Rectangle(5, 5, 5, 5) } + }, + + TextAttributes = new TextAttributes + { + PointSize = new FloatSelector { All = 20 }, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent, + + TextColor = new ColorSelector + { + Normal = new Color(0, 0, 0, 1), + Pressed = new Color(0, 0, 0, 0.7f), + Selected = new Color(0.141f, 0.769f, 0.278f, 1), + Disabled = new Color(0, 0, 0, 0.4f), + }, + } + }; + var _buttonAttributes = new ButtonAttributes(buttonAttributes); + Assert.IsNotNull(_buttonAttributes, "Should be not null!"); + Assert.IsInstanceOf(_buttonAttributes, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test ShadowImageAttributes. Check whether ShadowImageAttributes is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ButtonAttributes.ShadowImageAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ShadowImageAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var buttonAttributes = new ButtonAttributes(); + buttonAttributes.ShadowImageAttributes = new ImageAttributes(); + Assert.IsNotNull(buttonAttributes.ShadowImageAttributes, "Should be not null!"); + Assert.IsInstanceOf(buttonAttributes.ShadowImageAttributes, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test BackgroundImageAttributes. Check whether BackgroundImageAttributes is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ButtonAttributes.BackgroundImageAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void BackgroundImageAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var buttonAttributes = new ButtonAttributes(); + buttonAttributes.BackgroundImageAttributes = new ImageAttributes(); + Assert.IsNotNull(buttonAttributes.BackgroundImageAttributes, "Should be not null!"); + Assert.IsInstanceOf(buttonAttributes.BackgroundImageAttributes, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test OverlayImageAttributes. Check whether OverlayImageAttributes is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ButtonAttributes.OverlayImageAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void OverlayImageAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var buttonAttributes = new ButtonAttributes(); + buttonAttributes.OverlayImageAttributes = new ImageAttributes(); + Assert.IsNotNull(buttonAttributes.OverlayImageAttributes, "Should be not null!"); + Assert.IsInstanceOf(buttonAttributes.OverlayImageAttributes, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test TextAttributes. Check whether TextAttributes is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ButtonAttributes.TextAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void TextAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var buttonAttributes = new ButtonAttributes(); + buttonAttributes.TextAttributes = new TextAttributes(); + Assert.IsNotNull(buttonAttributes.TextAttributes, "Should be not null!"); + Assert.IsInstanceOf(buttonAttributes.TextAttributes, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test IconAttributes. Check whether IconAttributes is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ButtonAttributes.IconAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void IconAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var buttonAttributes = new ButtonAttributes(); + buttonAttributes.IconAttributes = new ImageAttributes(); + Assert.IsNotNull(buttonAttributes.IconAttributes, "Should be not null!"); + Assert.IsInstanceOf(buttonAttributes.IconAttributes, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test IsSelectable. Check whether IsSelectable is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ButtonAttributes.IsSelectable A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void IsSelectable_SET_GET_VALUE() + { + /* TEST CODE */ + var buttonAttributes = new ButtonAttributes(); + buttonAttributes.IsSelectable = true; + Assert.AreEqual(true, buttonAttributes.IsSelectable, "Should be equals!"); + buttonAttributes.IsSelectable = false; + Assert.AreEqual(false, buttonAttributes.IsSelectable, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test IconRelativeOrientation. Check whether IconRelativeOrientation is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ButtonAttributes.IconRelativeOrientation A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void IconRelativeOrientation_SET_GET_VALUE() + { + /* TEST CODE */ + var buttonAttributes = new ButtonAttributes(); + buttonAttributes.IconRelativeOrientation = Components.Button.IconOrientation.Top; + Assert.AreEqual(Components.Button.IconOrientation.Top, buttonAttributes.IconRelativeOrientation, "Should be equals!"); + buttonAttributes.IconRelativeOrientation = Components.Button.IconOrientation.Bottom; + Assert.AreEqual(Components.Button.IconOrientation.Bottom, buttonAttributes.IconRelativeOrientation, "Should be equals!"); + buttonAttributes.IconRelativeOrientation = Components.Button.IconOrientation.Left; + Assert.AreEqual(Components.Button.IconOrientation.Left, buttonAttributes.IconRelativeOrientation, "Should be equals!"); + buttonAttributes.IconRelativeOrientation = Components.Button.IconOrientation.Right; + Assert.AreEqual(Components.Button.IconOrientation.Right, buttonAttributes.IconRelativeOrientation, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test Clone. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.ButtonAttributes.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void Clone_CHECK_VALUE() + { + var buttonAttributes = new ButtonAttributes(); + buttonAttributes.IsSelectable = true; + var attr = buttonAttributes.Clone() as ButtonAttributes; + Assert.IsNotNull(attr, "Should be not null!"); + Assert.IsInstanceOf(attr, "Should be an instance of ButtonAttributes!"); + Assert.AreEqual(true, attr.IsSelectable, "Should be equal!"); + } + + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSChecBox.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSChecBox.cs new file mode 100755 index 000000000..bc7039874 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSChecBox.cs @@ -0,0 +1,152 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Components; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.CheckBox Tests")] + public class ChecBoxTests + { + 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!"); + App.MainTitleChangeText("CommonChecBoxTests"); + App.MainTitleChangeBackgroundColor(null); + + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test CheckBox empty constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.CheckBox.CheckBox C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckBox_CHECK_VALUE() + { + /* TEST CODE */ + var checkBox = new CheckBox(); + Assert.IsInstanceOf(checkBox, "Should be equal!"); + Assert.IsNotNull(checkBox, "Should be not null!"); + + } + + [Test] + [Category("P1")] + [Description("Test CheckBox style constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.CheckBox.CheckBox C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "string")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckBox_Style_CHECK_VALUE() + { + /* TEST CODE */ + StyleManager.Instance.RegisterStyle("BasicCheckBox", null, typeof(CheckBoxStyle)); + var checkBox = new CheckBox("BasicCheckBox"); + Assert.IsNotNull(checkBox, "Should be not null!"); + Assert.IsInstanceOf(checkBox, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test CheckBox SelectButtonAttributes constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.CheckBox.CheckBox C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "SelectButtonAttributes")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckBox_SelectButtonAttributes_CHECK_VALUE() + { + /* TEST CODE */ + var selectButtonAttributes = new SelectButtonAttributes + { + CheckImageAttributes = new ImageAttributes + { + Size2D = new Size2D(48, 48), + ResourceURL = new StringSelector + { + All = _image_path, + }, + Opacity = new FloatSelector + { + Normal = 1.0f, + Selected = 1.0f, + Disabled = 0.4f, + DisabledSelected = 0.4f + }, + }, + }; + var checkBox = new CheckBox(selectButtonAttributes); + Assert.IsNotNull(checkBox, "Should be not null!"); + Assert.IsInstanceOf(checkBox, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test ItemGroup. Check whether ItemGroup is readable.")] + [Property("SPEC", "Tizen.NUI.Components.CheckBox.ItemGroup A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ItemGroup_GET_VALUE() + { + /* TEST CODE */ + var checkBoxGroup = new CheckBoxGroup(); + var checkBox = new CheckBox(); + checkBoxGroup.Add(checkBox); + Assert.IsNotNull(checkBox.ItemGroup, "Should be equal!"); + } + } + + public class CheckBoxStyle : StyleBase + { + private string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png"; + protected override Attributes GetAttributes() + { + SelectButtonAttributes attributes = new SelectButtonAttributes + { + IsSelectable = true, + CheckImageAttributes = new ImageAttributes + { + Size2D = new Size2D(48, 48), + Position2D = new Position2D(0, 0), + ResourceURL = new StringSelector + { + Normal = _image_path, + Selected = _image_path, + Disabled = _image_path, + DisabledSelected = _image_path, + }, + Opacity = new FloatSelector + { + Normal = 1.0f, + Selected = 1.0f, + Disabled = 0.4f, + DisabledSelected = 0.4f + }, + }, + }; + + return attributes; + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSCheckBoxGroup.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSCheckBoxGroup.cs new file mode 100755 index 000000000..10e7c8745 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSCheckBoxGroup.cs @@ -0,0 +1,225 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Components; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.CheckBoxGroup Tests")] + public class CheckBoxGroupTests + { + 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!"); + App.MainTitleChangeText("CheckBoxGroupTests"); + App.MainTitleChangeBackgroundColor(null); + + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test CheckBoxGroup. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.CheckBoxGroup.CheckBoxGroup C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckBoxGroup_CHECK_VALUE() + { + var checkBoxGroup = new CheckBoxGroup(); + Assert.IsNotNull(checkBoxGroup, "Should be not null!"); + Assert.IsInstanceOf(checkBoxGroup, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test Add. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.CheckBoxGroup.Add M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void Add_CHECK_VALUE() + { + var checkBox1 = new CheckBox(); + checkBox1.Name = "checkbox1"; + + var checkBoxGroup = new CheckBoxGroup(); + checkBoxGroup.Add(checkBox1); + + string checkboxName1 = checkBoxGroup.GetItemByIndex(0).Name; + + Assert.AreEqual("checkbox1", checkboxName1, "Should be equals to the name of CheckBox"); + } + + [Test] + [Category("P1")] + [Description("Test Remove. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.CheckBoxGroup.Remove M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void Remove_CHECK_VALUE() + { + var checkBox1 = new CheckBox(); + checkBox1.Name = "checkbox1"; + var checkBox2 = new CheckBox(); + checkBox2.Name = "checkbox2"; + + var checkBoxGroup = new CheckBoxGroup(); + checkBoxGroup.Add(checkBox1); + checkBoxGroup.Add(checkBox2); + + checkBoxGroup.Remove(checkBox1); + + string checkboxName1 = checkBoxGroup.GetItemByIndex(0).Name; + + Assert.AreEqual("checkbox2", checkboxName1, "Should be equals to the name of CheckBox"); + } + + [Test] + [Category("P1")] + [Description("Test GetItemByIndex. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.CheckBoxGroup.GetItemByIndex M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void GetItemByIndex_CHECK_VALUE() + { + var checkBox1 = new CheckBox(); + checkBox1.Name = "checkbox1"; + var checkBox2 = new CheckBox(); + checkBox2.Name = "checkbox2"; + + var checkBoxGroup = new CheckBoxGroup(); + checkBoxGroup.Add(checkBox1); + checkBoxGroup.Add(checkBox2); + + string checkboxName1 = checkBoxGroup.GetItemByIndex(0).Name; + string checkboxName2 = checkBoxGroup.GetItemByIndex(1).Name; + + Assert.AreEqual("checkbox1", checkboxName1, "Should be equals to the name of CheckBox"); + Assert.AreEqual("checkbox2", checkboxName2, "Should be equals to the name of CheckBox"); + } + + [Test] + [Category("P1")] + [Description("Test GetCheckedIndexArray. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.CheckBoxGroup.GetCheckedIndexArray M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void GetCheckedIndexArray_CHECK_VALUE() + { + var checkBox1 = new CheckBox(); + checkBox1.Name = "checkbox1"; + var checkBox2 = new CheckBox(); + checkBox2.Name = "checkbox2"; + + var checkBoxGroup = new CheckBoxGroup(); + checkBoxGroup.Add(checkBox1); + checkBoxGroup.Add(checkBox2); + + checkBoxGroup.CheckingAll(true); + + int[] indexArray = new int[2]; + indexArray = checkBoxGroup.GetCheckedIndexArray(); + + Assert.AreEqual(0, indexArray[0], "Should be equal to GetCheckedIndexArray return value"); + Assert.AreEqual(1, indexArray[1], "Should be equal to GetCheckedIndexArray return value"); + } + + [Test] + [Category("P1")] + [Description("Test GetCheckedItemArray. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.CheckBoxGroup.GetCheckedItemArray M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void GetCheckedItemArray_CHECK_VALUE() + { + var checkBox1 = new CheckBox(); + checkBox1.Name = "checkbox1"; + var checkBox2 = new CheckBox(); + checkBox2.Name = "checkbox2"; + + var checkBoxGroup = new CheckBoxGroup(); + checkBoxGroup.Add(checkBox1); + checkBoxGroup.Add(checkBox2); + + checkBoxGroup.CheckingAll(true); + + CheckBox[] checkboxArray = new CheckBox[2]; + checkboxArray = checkBoxGroup.GetCheckedItemArray(); + + Assert.AreEqual("checkbox1", checkboxArray[0].Name, "Should be equal to GetCheckedItemArray return value"); + Assert.AreEqual("checkbox2", checkboxArray[1].Name, "Should be equal to GetCheckedItemArray return value"); + } + + [Test] + [Category("P1")] + [Description("Test IsCheckedAll. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.CheckBoxGroup.IsCheckedAll M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void IsCheckedAll_CHECK_VALUE() + { + var checkBox1 = new CheckBox(); + checkBox1.Name = "checkbox1"; + var checkBox2 = new CheckBox(); + checkBox2.Name = "checkbox2"; + + var checkBoxGroup = new CheckBoxGroup(); + checkBoxGroup.Add(checkBox1); + checkBoxGroup.Add(checkBox2); + + checkBoxGroup.CheckingAll(false); + bool flag = checkBoxGroup.IsCheckedAll(); + Assert.AreEqual(false, flag, "Should be equal!"); + checkBoxGroup.CheckingAll(true); + Assert.AreEqual(true, checkBoxGroup.IsCheckedAll(), "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test CheckingAll. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.CheckBoxGroup.CheckingAll M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckingAll_CHECK_VALUE() + { + var checkBox1 = new CheckBox(); + checkBox1.Name = "checkbox1"; + var checkBox2 = new CheckBox(); + checkBox2.Name = "checkbox2"; + + var checkBoxGroup = new CheckBoxGroup(); + checkBoxGroup.Add(checkBox1); + checkBoxGroup.Add(checkBox2); + + checkBoxGroup.CheckingAll(true); + + bool flag = checkBoxGroup.IsCheckedAll(); + Assert.AreEqual(true, flag, "Should be equal!"); + checkBoxGroup.CheckingAll(false); + Assert.AreEqual(false, checkBoxGroup.IsCheckedAll(), "Should be equal!"); + } + + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSColorSelector.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSColorSelector.cs new file mode 100755 index 000000000..4fe3e4b02 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSColorSelector.cs @@ -0,0 +1,67 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.ColorSelector Tests")] + public class ColorSelectorTests + { + private const string TAG = "NUI.Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("ColorSelectorTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a ColorSelector object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.ColorSelector.ColorSelector C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ColorSelector_INIT() + { + /* TEST CODE */ + var colorSelector = new ColorSelector(); + Assert.IsNotNull(colorSelector, "Can't create success object ColorSelector"); + Assert.IsInstanceOf(colorSelector, "Should be an instance of ColorSelector type."); + } + + [Test] + [Category("P1")] + [Description("Test Clone. Check Whether Clone works or not")] + [Property("SPEC", "Tizen.NUI.Components.ColorSelector.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Clone_TEST() + { + /* TEST CODE */ + var colorSelector1 = new ColorSelector(); + colorSelector1.All = Color.Red; + var colorSelector = colorSelector1.Clone(); + Assert.IsNotNull(colorSelector, "should be not null!"); + Assert.AreEqual(1.0f, colorSelector.All.R, "Should be equal!"); + Assert.AreEqual(0.0f, colorSelector.All.G, "Should be equal!"); + Assert.AreEqual(0.0f, colorSelector.All.B, "Should be equal!"); + Assert.AreEqual(1.0f, colorSelector.All.A, "Should be equal!"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSControl.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSControl.cs new file mode 100755 index 000000000..c3d610c71 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSControl.cs @@ -0,0 +1,526 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Control Tests")] + public class ControlTests + { + private const string TAG = "NUI.Components"; + private static bool _styleRegiesterFlag = false; + private static bool _focusGainedFlag = false; + private static bool _focusLostFlag = false; + private static bool _relayoutFlag = false; + private static bool _updateFlag = false; + private static bool _themeChanged = false; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("ControlTests"); + App.MainTitleChangeBackgroundColor(null); + + if (!_styleRegiesterFlag) + { + StyleManager.Instance.RegisterStyle("DAMyControl", null, typeof(Tizen.NUI.Components.Tests.DAMyControlStyle)); + _styleRegiesterFlag = true; + } + + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a Control object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.Control.Control C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Control_INIT() + { + /* TEST CODE */ + var myControl = new MyControl(); + Assert.IsNotNull(myControl, "Can't create success object MyControl"); + Assert.IsInstanceOf(myControl, "Should be an instance of MyControl type."); + } + + [Test] + [Category("P1")] + [Description("Create a Control object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.Control.Control C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "Attributes")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Control_INIT_WITH_ATTRIBUTES() + { + /* TEST CODE */ + var attr = new MyControlAttributes + { + BGImageAttributes = new ImageAttributes + { + BackgroundColor = new ColorSelector + { + All = new Color(0.43f, 0.43f, 0.43f, 0.1f), + } + }, + }; + var myControl = new MyControl(attr); + Assert.IsNotNull(myControl, "Can't create success object MyControl"); + Assert.IsInstanceOf(myControl, "Should be an instance of MyControl type."); + } + + [Test] + [Category("P1")] + [Description("Create a Control object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.Control.Control C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "string")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Control_INIT_WITH_STYLE() + { + /* TEST CODE */ + var myControl = new MyControl("DAMyControl"); + Assert.IsNotNull(myControl, "Can't create success object MyControl"); + Assert.IsInstanceOf(myControl, "Should be an instance of MyControl type."); + } + + [Test] + [Category("P1")] + [Description("Test State.Check whether State is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.Control.State A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void State_SET_GET_VALUE() + { + /* TEST CODE */ + var myControl = new MyControl(); + myControl.State = ControlStates.Normal; + Assert.AreEqual(ControlStates.Normal, myControl.State, "Should be equal"); + myControl.State = ControlStates.Focused; + Assert.AreEqual(ControlStates.Focused, myControl.State, "Should be equal"); + myControl.State = ControlStates.Disabled; + Assert.AreEqual(ControlStates.Disabled, myControl.State, "Should be equal"); + myControl.State = ControlStates.Selected; + Assert.AreEqual(ControlStates.Selected, myControl.State, "Should be equal"); + myControl.State = ControlStates.Pressed; + Assert.AreEqual(ControlStates.Pressed, myControl.State, "Should be equal"); + myControl.State = ControlStates.DisabledFocused; + Assert.AreEqual(ControlStates.DisabledFocused, myControl.State, "Should be equal"); + myControl.State = ControlStates.SelectedFocused; + Assert.AreEqual(ControlStates.SelectedFocused, myControl.State, "Should be equal"); + myControl.State = ControlStates.DisabledSelected; + Assert.AreEqual(ControlStates.DisabledSelected, myControl.State, "Should be equal"); + myControl.State = ControlStates.Max; + Assert.AreEqual(ControlStates.Max, myControl.State, "Should be equal"); + } + + [Test] + [Category("P1")] + [Description("Test ApplyAttributes. Check Whether ApplyAttributes works or not")] + [Property("SPEC", "Tizen.NUI.Components.Control.ApplyAttributes M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ApplyAttributes_TEST() + { + /* TEST CODE */ + try + { + var attr = new MyControlAttributes + { + BGImageAttributes = new ImageAttributes + { + BackgroundColor = new ColorSelector + { + All = new Color(0.43f, 0.43f, 0.43f, 0.1f), + } + }, + }; + + var myControl = new MyControl(); + myControl.ApplyAttributes(attr); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test GetAttributes. Check Whether GetAttributes works or not")] + [Property("SPEC", "Tizen.NUI.Components.Control.GetAttributes M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetAttributes_TEST() + { + /* TEST CODE */ + try + { + var myControl = new MyControl(); + var attr = myControl.TestGetAttributes() as MyControlAttributes; + Assert.IsNotNull(attr, "Should be not null"); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test OnTouch. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Control.OnTouch M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void OnTouch_CHECK_VALUE() + { + /* TEST CODE */ + try + { + var view = new MyControl(); + var touch = new Touch(); + bool flag = true; + flag = view.OnTouch(touch); + Assert.AreEqual(false, flag, "OnTouch trigger Check Fail."); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test OnKey. Check return the right value or not")] + [Property("SPEC", "Tizen.NUI.Components.Control.OnKey M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void OnKey_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + try + { + var view = new MyControl(); + bool flag = true; + flag = view.OnKey(new Key()); + Assert.AreEqual(false, flag, "OnKey return check fail."); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test OnRelayout. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Control.OnRelayout M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public async Task OnRelayout_CHECK_VALUE() + { + /* TEST CODE */ + try + { + _relayoutFlag = false; + var view = new MyControl(); + Window window = Window.Instance; + window.Add(view); + await Task.Delay(500); + Assert.AreEqual(true, _relayoutFlag, "OnRelayout trigger Check Fail."); + window.Remove(view); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test OnFocusGained. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Control.OnFocusGained M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com.com")] + public void OnFocusGained_CHECK_VALUE() + { + /* TEST CODE */ + _focusGainedFlag = false; + Window window = Window.Instance; + var view = new MyControl(); + view.Focusable = true; + window.Add(view); + FocusManager.Instance.SetCurrentFocusView(view); + Assert.AreEqual(true, _focusGainedFlag, "OnFocusGained Check Fail."); + window.Remove(view); + } + + [Test] + [Category("P1")] + [Description("Test OnFocusLost. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Control.OnFocusLost M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void OnFocusLost_CHECK_VALUE() + { + /* TEST CODE */ + _focusLostFlag = false; + Window window = Window.Instance; + var view = new MyControl(); + var view2 = new MyControl(); + view.Focusable = true; + view2.Focusable = true; + window.Add(view); + window.Add(view2); + FocusManager.Instance.SetCurrentFocusView(view); + FocusManager.Instance.SetCurrentFocusView(view2); + Assert.AreEqual(true, _focusLostFlag, "OnFocusLost Check Fail."); + window.Remove(view); + window.Remove(view2); + } + + [Test] + [Category("P1")] + [Description("Test OnUpdate. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Control.OnUpdate M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public async Task OnUpdate_CHECK_VALUE() + { + /* TEST CODE */ + _updateFlag = false; + var view = new MyControl(); + view.Size2D = new Size2D(200, 200); + view.BackgroundColor = Color.Red; + Window.Instance.Add(view); + view.BackgroundColor = Color.Cyan; + await Task.Delay(500); + Assert.AreEqual(true, _updateFlag, "OnUpdate trigger Check Fail."); + Window.Instance.Remove(view); + } + + [Test] + [Category("P1")] + [Description("Test OnThemeChangedEvent. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Control.OnThemeChangedEvent M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public async Task OnThemeChangedEvent_CHECK_VALUE() + { + /* TEST CODE */ + try + { + _themeChanged = false; + Tizen.NUI.Components.StyleManager.Instance.Theme = "Utility"; + var view = new MyControl(); + Window window = Window.Instance; + window.Add(view); + Tizen.NUI.Components.StyleManager.Instance.Theme = "Food"; + await Task.Delay(500); + Assert.AreEqual(true, _themeChanged, "OnThemeChangedEvent trigger Check Fail."); + window.Remove(view); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test Dispose, try to dispose the Control.")] + [Property("SPEC", "Tizen.NUI.Components.Control.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Dispose_TEST() + { + /* TEST CODE */ + try + { + MyControl control = new MyControl(); + control.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 MyControlAttributes : ViewAttributes + { + public MyControlAttributes() : base() + { + + } + + public MyControlAttributes(MyControlAttributes attributes) : base(attributes) + { + if (attributes == null) + { + return; + } + + if (attributes.BGImageAttributes != null) + { + BGImageAttributes = attributes.BGImageAttributes.Clone() as ImageAttributes; + } + } + public ImageAttributes BGImageAttributes + { + get; + set; + } + + public override Attributes Clone() + { + return new MyControlAttributes(this); + } + } + + public class MyControl : Control + { + private MyControlAttributes _myControlAttrs; + private ImageView _bgImage; + public MyControl() : base() + { + Initialize(); + } + + public MyControl(string style) : base(style) + { + Initialize(); + } + + public MyControl(MyControlAttributes attributes) : base(attributes) + { + Initialize(); + } + + private void Initialize() + { + _myControlAttrs = this.attributes as MyControlAttributes; + if (_myControlAttrs == null) + { + throw new Exception("ScrollBar attribute parse error."); + } + + _bgImage = new ImageView + { + Focusable = false, + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent, + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, + PivotPoint = Tizen.NUI.PivotPoint.TopLeft + + }; + } + + public void ApplyAttributes(ViewAttributes attrs) + { + ApplyAttributes(this, _myControlAttrs); + } + + public Attributes TestGetAttributes() + { + return GetAttributes(); + } + protected override Attributes GetAttributes() + { + return new MyControlAttributes() + { + BGImageAttributes = new ImageAttributes + { + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent, + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, + PivotPoint = Tizen.NUI.PivotPoint.TopLeft + } + + }; + } + + public override void OnRelayout(Vector2 size, RelayoutContainer container) + { + _relayoutFlag = true; + ApplyAttributes(this, _myControlAttrs); + ApplyAttributes(_bgImage, _myControlAttrs.BGImageAttributes); + base.OnRelayout(size, container); + } + + public override void OnFocusGained() + { + _focusGainedFlag = true; + base.OnFocusGained(); + } + + public override void OnFocusLost() + { + _focusLostFlag = true; + base.OnFocusLost(); + } + + protected override void OnUpdate() + { + _updateFlag = true; + base.OnUpdate(); + } + + protected override void OnThemeChangedEvent(object sender, Tizen.NUI.Components.StyleManager.ThemeChangeEventArgs e) + { + _themeChanged = true; + base.OnThemeChangedEvent(sender, e); + } + } + } + + public class DAMyControlStyle : StyleBase + { + protected override Attributes GetAttributes() + { + ControlTests.MyControlAttributes attributes = new ControlTests.MyControlAttributes + { + BGImageAttributes = new ImageAttributes + { + BackgroundColor = new ColorSelector + { + All = new Color(0.0f, 0.0f, 0.0f, 0.2f) + } + }, + }; + return attributes; + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSDropDown.DropDownItemData.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSDropDown.DropDownItemData.cs new file mode 100755 index 000000000..363bc14c1 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSDropDown.DropDownItemData.cs @@ -0,0 +1,353 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Components; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.DropDown.DropDownItemData Tests")] + public class DropDownItemDataTests + { + 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!"); + App.MainTitleChangeText("DropDownItemDataTests"); + App.MainTitleChangeBackgroundColor(null); + + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test DropDownItemData empty constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDownItemData.DropDownItemData C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void DropDownItemData_CHECK_VALUE() + { + /* TEST CODE */ + var dropDownItemData = new DropDown.DropDownItemData(); + Assert.IsNotNull(dropDownItemData, "Should be not null"); + Assert.IsInstanceOf(dropDownItemData, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test DropDown style constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDownItemData.DropDownItemData C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "string")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void DropDownItemData_Style_CHECK_VALUE() + { + /* TEST CODE */ + StyleManager.Instance.RegisterStyle("IconListItemStyle", null, typeof(IconListItemStyle)); + var dropDownItemData = new DropDown.DropDownItemData("IconListItemStyle"); + Assert.IsNotNull(dropDownItemData, "Should be not null"); + Assert.IsInstanceOf(dropDownItemData, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test DropDownItemData DropDownItemAttributes constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDownItemData.DropDownItemData C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "DropDownItemAttributes")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void DropDownItemData_DropDownItemAttributes_CHECK_VALUE() + { + /* TEST CODE */ + var itemAttrs = new DropDownItemAttributes + { + BackgroundColor = new ColorSelector + { + Pressed = new Color(0, 0, 0, 0.4f), + Other = new Color(1, 1, 1, 0), + }, + TextAttributes = new TextAttributes + { + PointSize = new FloatSelector { All = 18 }, + FontFamily = "SamsungOne 500", + Position2D = new Position2D(28, 0), + }, + CheckImageAttributes = new ImageAttributes + { + Size2D = new Size2D(40, 40), + ResourceURL = new StringSelector { All = _image_path }, + }, + CheckImageRightSpace = 16, + }; + var dropDownItemData = new DropDown.DropDownItemData(itemAttrs); + Assert.IsNotNull(dropDownItemData, "Should be not null"); + Assert.IsInstanceOf(dropDownItemData, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test Size2D. Check whether Size2D is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDownItemData.Size2D A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void Size2D_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownItemData = new DropDown.DropDownItemData(); + dropDownItemData.Size2D = new Size2D(10, 10); + Assert.AreEqual(10, dropDownItemData.Size2D.Width, "Should be equals to the set value of dropDownItemData.Size2D.Width"); + Assert.AreEqual(10, dropDownItemData.Size2D.Height, "Should be equals to the set value of dropDownItemData.Size2D.Height"); + } + + [Test] + [Category("P1")] + [Description("Test BackgroundColorSelector. Check whether BackgroundColorSelector is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDownItemData.BackgroundColorSelector A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void BackgroundColorSelector_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownItemData = new DropDown.DropDownItemData(); + var colorSelector = new ColorSelector + { + Normal = new Color(0.0f, 0.0f, 1.0f, 1.0f), + Selected = new Color(0.0f, 1.0f, 0.0f, 1.0f), + }; + + dropDownItemData.BackgroundColorSelector = colorSelector; + Assert.AreEqual(colorSelector.Normal.R, dropDownItemData.BackgroundColorSelector.Normal.R, "Should be equals to the set value of BackgroundColorSelector Normal R"); + Assert.AreEqual(colorSelector.Normal.G, dropDownItemData.BackgroundColorSelector.Normal.G, "Should be equals to the set value of BackgroundColorSelector Normal G"); + Assert.AreEqual(colorSelector.Normal.B, dropDownItemData.BackgroundColorSelector.Normal.B, "Should be equals to the set value of BackgroundColorSelector Normal B"); + Assert.AreEqual(colorSelector.Normal.A, dropDownItemData.BackgroundColorSelector.Normal.A, "Should be equals to the set value of BackgroundColorSelector Normal A"); + + Assert.AreEqual(colorSelector.Selected.R, dropDownItemData.BackgroundColorSelector.Selected.R, "Should be equals to the set value of BackgroundColorSelector Selected R"); + Assert.AreEqual(colorSelector.Selected.G, dropDownItemData.BackgroundColorSelector.Selected.G, "Should be equals to the set value of BackgroundColorSelector Selected G"); + Assert.AreEqual(colorSelector.Selected.B, dropDownItemData.BackgroundColorSelector.Selected.B, "Should be equals to the set value of BackgroundColorSelector Selected B"); + Assert.AreEqual(colorSelector.Selected.A, dropDownItemData.BackgroundColorSelector.Selected.A, "Should be equals to the set value of BackgroundColorSelector Selected A"); + } + + [Test] + [Category("P1")] + [Description("Test Text. Check whether Text is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDownItemData.Text A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void Text_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownItemData = new DropDown.DropDownItemData(); + dropDownItemData.Text = "Test Text"; + Assert.AreEqual("Test Text", dropDownItemData.Text, "Should be equals to the set value of Text"); + } + + [Test] + [Category("P1")] + [Description("Test PointSize. Check whether PointSize is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDownItemData.PointSize A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void PointSize_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownItemData = new DropDown.DropDownItemData(); + dropDownItemData.PointSize = 10.0f; + Assert.AreEqual(10.0f, dropDownItemData.PointSize, "Should be equals to the set value of PointSize"); + } + + [Test] + [Category("P1")] + [Description("Test FontFamily. Check whether FontFamily is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDownItemData.FontFamily A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void FontFamily_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownItemData = new DropDown.DropDownItemData(); + dropDownItemData.FontFamily = "SamsungOne 500"; + Assert.AreEqual("SamsungOne 500", dropDownItemData.FontFamily, "Should be equals to the set value of FontFamily"); + } + + [Test] + [Category("P1")] + [Description("Test TextPosition2D. Check whether TextPosition2D is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDownItemData.TextPosition2D A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void TextPosition2D_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownItemData = new DropDown.DropDownItemData(); + dropDownItemData.TextPosition2D = new Position2D(10, 10); + Assert.AreEqual(10, dropDownItemData.TextPosition2D.X, "Should be equals to the set value of TextPosition2D.X"); + Assert.AreEqual(10, dropDownItemData.TextPosition2D.Y, "Should be equals to the set value of TextPosition2D.Y"); + } + + [Test] + [Category("P1")] + [Description("Test IconResourceUrl. Check whether IconResourceUrl is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDownItemData.IconResourceUrl A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void IconResourceUrl_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownItemData = new DropDown.DropDownItemData(); + dropDownItemData.IconResourceUrl = _image_path; + Assert.AreEqual(_image_path, dropDownItemData.IconResourceUrl, "Should be equals to the set value of IconResourceUrl"); + } + + [Test] + [Category("P1")] + [Description("Test IconSize2D. Check whether IconSize2D is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDownItemData.IconSize2D A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void IconSize2D_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownItemData = new DropDown.DropDownItemData(); + dropDownItemData.IconSize2D = new Size2D(10, 10); + Assert.AreEqual(10, dropDownItemData.IconSize2D.Width, "Should be equals to the set value of IconSize2D.Width"); + Assert.AreEqual(10, dropDownItemData.IconSize2D.Height, "Should be equals to the set value of IconSize2D.Height"); + } + + [Test] + [Category("P1")] + [Description("Test IconPosition2D. Check whether IconPosition2D is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDownItemData.IconPosition2D A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void IconPosition2D_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownItemData = new DropDown.DropDownItemData(); + dropDownItemData.IconPosition2D = new Position2D(10, 10); + Assert.AreEqual(10, dropDownItemData.IconPosition2D.X, "Should be equals to the set value of IconPosition2D.X"); + Assert.AreEqual(10, dropDownItemData.IconPosition2D.Y, "Should be equals to the set value of IconPosition2D.Y"); + } + + [Test] + [Category("P1")] + [Description("Test CheckImageResourceUrl. Check whether CheckImageResourceUrl is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDownItemData.CheckImageResourceUrl A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckImageResourceUrl_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownItemData = new DropDown.DropDownItemData(); + dropDownItemData.CheckImageResourceUrl = _image_path; + Assert.AreEqual(_image_path, dropDownItemData.CheckImageResourceUrl, "Should be equals to the set value of CheckImageResourceUrl"); + } + + [Test] + [Category("P1")] + [Description("Test CheckImageSize2D. Check whether CheckImageSize2D is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDownItemData.CheckImageSize2D A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckImageSize2D_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownItemData = new DropDown.DropDownItemData(); + dropDownItemData.CheckImageSize2D = new Size2D(10, 10); + Assert.AreEqual(10, dropDownItemData.CheckImageSize2D.Width, "Should be equals to the set value of CheckImageSize2D.Width"); + Assert.AreEqual(10, dropDownItemData.CheckImageSize2D.Height, "Should be equals to the set value of CheckImageSize2D.Height"); + } + + [Test] + [Category("P1")] + [Description("Test CheckImageRightSpace. Check whether CheckImageRightSpace is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDownItemData.CheckImageRightSpace A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckImageRightSpace_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownItemData = new DropDown.DropDownItemData(); + dropDownItemData.CheckImageRightSpace = 10; + Assert.AreEqual(10, dropDownItemData.CheckImageRightSpace, "Should be equals to the set value of CheckImageRightSpace"); + } + + [Test] + [Category("P1")] + [Description("Test IsSelected. Check whether IsSelected is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDownItemData.IsSelected A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void IsSelected_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownItemData = new DropDown.DropDownItemData(); + dropDownItemData.IsSelected = true; + Assert.AreEqual(true, dropDownItemData.IsSelected, "Should be equals to the set value of IsSelected"); + dropDownItemData.IsSelected = false; + Assert.AreEqual(false, dropDownItemData.IsSelected, "Should be equals to the set value of IsSelected"); + } + + public class IconListItemStyle : StyleBase + { + private string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png"; + protected override Attributes GetAttributes() + { + DropDownItemAttributes attributes = new DropDownItemAttributes + { + BackgroundColor = new ColorSelector + { + Pressed = new Color(0, 0, 0, 0.4f), + Other = new Color(1, 1, 1, 0), + }, + IconAttributes = new ImageAttributes + { + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, + PivotPoint = Tizen.NUI.PivotPoint.TopLeft, + Size2D = new Size2D(28, 28), + Position2D = new Position2D(28, 0), + }, + CheckImageAttributes = new ImageAttributes + { + Size2D = new Size2D(40, 40), + ResourceURL = new StringSelector { All = _image_path }, + }, + CheckImageRightSpace = 16, + }; + + return attributes; + } + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSDropDown.DropDownListBridge.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSDropDown.DropDownListBridge.cs new file mode 100755 index 000000000..716519bc4 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSDropDown.DropDownListBridge.cs @@ -0,0 +1,219 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Components; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.DropDown.DropDownListBridge Tests")] + public class DropDownListBridgeTests + { + private const string TAG = "Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("DropDownListBridgeTests"); + App.MainTitleChangeBackgroundColor(null); + + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test DropDownListBridge empty constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDownListBridge.DropDownListBridge C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void DropDownListBridge_CHECK_VALUE() + { + /* TEST CODE */ + var dropDownListBridge = new DropDown.DropDownListBridge(); + Assert.IsNotNull(dropDownListBridge, "Should be not null!"); + Assert.IsInstanceOf(dropDownListBridge, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test InsertData. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDownListBridge.InsertData M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void InsertData_CHECK_VALUE() + { + /* TEST CODE */ + var dropDownListBridge = new DropDown.DropDownListBridge(); + var dropDownItemData = new DropDown.DropDownItemData(); + dropDownListBridge.InsertData(0, dropDownItemData); + + int num = dropDownListBridge.GetItemCount(); + Assert.AreEqual(1, num, "Should be equal"); + } + + [Test] + [Category("P1")] + [Description("Test RemoveData. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDownListBridge.RemoveData M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void RemoveData_CHECK_VALUE() + { + /* TEST CODE */ + var dropDownListBridge = new DropDown.DropDownListBridge(); + var dropDownItemData = new DropDown.DropDownItemData(); + dropDownListBridge.InsertData(0, dropDownItemData); + dropDownListBridge.RemoveData(0); + + int num = dropDownListBridge.GetItemCount(); + Assert.AreEqual(0, num, "Should be equal"); + } + + [Test] + [Category("P1")] + [Description("Test GetData. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDownListBridge.GetData M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void GetData_CHECK_VALUE() + { + /* TEST CODE */ + var dropDownListBridge = new DropDown.DropDownListBridge(); + var dropDownItemData = new DropDown.DropDownItemData(); + dropDownItemData.Text = "Item0"; + dropDownListBridge.InsertData(0, dropDownItemData); + var dropDownRet = dropDownListBridge.GetData(0); + Assert.IsNotNull(dropDownRet, "Should not be null"); + Assert.AreEqual("Item0", dropDownRet.Text, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test GetItemCount. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDownListBridge.GetItemCount M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void GetItemCount_CHECK_VALUE() + { + /* TEST CODE */ + var dropDownListBridge = new DropDown.DropDownListBridge(); + var dropDownItemData = new DropDown.DropDownItemData(); + var dropDownItemData1 = new DropDown.DropDownItemData(); + dropDownListBridge.InsertData(0, dropDownItemData); + dropDownListBridge.InsertData(1, dropDownItemData); + + int num = dropDownListBridge.GetItemCount(); + Assert.AreEqual(2, num, "Should be equal"); + } + + [Test] + [Category("P1")] + [Description("Test OnCreateViewHolder. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDownListBridge.OnCreateViewHolder M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void OnCreateViewHolder_CHECK_VALUE() + { + /* TEST CODE */ + var myDropDownListBridge = new MyDropDownListBridge(); + myDropDownListBridge.TestOnCreateViewHolder(); + Assert.AreEqual(true, myDropDownListBridge.createViewHolderFlag, "Should be equal"); + } + + [Test] + [Category("P1")] + [Description("Test OnBindViewHolder. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDownListBridge.OnBindViewHolder M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void OnBindViewHolder_CHECK_VALUE() + { + /* TEST CODE */ + + var myDropDownListBridge = new MyDropDownListBridge(); + var dropDownItemData = new DropDown.DropDownItemData(); + myDropDownListBridge.InsertData(0, dropDownItemData); + myDropDownListBridge.TestOnBindViewHolder(); + Assert.AreEqual(true, myDropDownListBridge.bindViewHolderFlag, "Should be equal"); + } + + [Test] + [Category("P1")] + [Description("Test OnDestroyViewHolder. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDownListBridge.OnDestroyViewHolder M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void OnDestroyViewHolder_CHECK_VALUE() + { + /* TEST CODE */ + var myDropDownListBridge = new MyDropDownListBridge(); + myDropDownListBridge.TestDestroyViewHolderFlag(); + Assert.AreEqual(true, myDropDownListBridge.destroyViewHolderFlag, "Should be equal"); + } + + } + + public class MyDropDownListBridge : DropDown.DropDownListBridge + { + public bool createViewHolderFlag = false; + public bool bindViewHolderFlag = false; + public bool destroyViewHolderFlag = false; + + public override FlexibleView.ViewHolder OnCreateViewHolder(int viewType) + { + createViewHolderFlag = true; + return base.OnCreateViewHolder(viewType); + } + + public override void OnBindViewHolder(FlexibleView.ViewHolder holder, int position) + { + bindViewHolderFlag = true; + } + + public override void OnDestroyViewHolder(FlexibleView.ViewHolder holder) + { + destroyViewHolderFlag = true; + base.OnDestroyViewHolder(holder); + } + + public void TestOnCreateViewHolder() + { + OnCreateViewHolder(0); + + } + + public void TestOnBindViewHolder() + { + FlexibleView.ViewHolder holder = new FlexibleView.ViewHolder(new BaseComponents.View()); + OnBindViewHolder(holder, 0); + Assert.AreEqual(true, bindViewHolderFlag, "Should be equal"); + } + + public void TestDestroyViewHolderFlag() + { + FlexibleView.ViewHolder holder = new FlexibleView.ViewHolder(new BaseComponents.View()); + OnDestroyViewHolder(holder); + Assert.AreEqual(true, destroyViewHolderFlag, "Should be equal"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSDropDown.ItemClickEventArgs.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSDropDown.ItemClickEventArgs.cs new file mode 100755 index 000000000..c4c170ddd --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSDropDown.ItemClickEventArgs.cs @@ -0,0 +1,81 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Components; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.DropDown.ItemClickEventArgs Tests")] + public class DropDownItemClickEventArgsTests + { + private const string TAG = "Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("DropDownItemClickEventArgsTests"); + App.MainTitleChangeBackgroundColor(null); + + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test ItemClickEventArgs empty constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.ItemClickEventArgs.ItemClickEventArgs C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ItemClickEventArgs_CHECK_VALUE() + { + /* TEST CODE */ + var itemClickEventArgs = new DropDown.ItemClickEventArgs(); + Assert.IsNotNull(itemClickEventArgs, "Should be not null!"); + Assert.IsInstanceOf(itemClickEventArgs, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test Index. Check whether Index is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.ItemClickEventArgs.Index A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void Index_SET_GET_VALUE() + { + /* TEST CODE */ + var itemClickEventArgs = new DropDown.ItemClickEventArgs(); + itemClickEventArgs.Index = 0; + Assert.AreEqual(0, itemClickEventArgs.Index, "Should be equal"); + } + + [Test] + [Category("P1")] + [Description("Test ItemClickEventArgs.Text. Check whether Text is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.ItemClickEventArgs.Text A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ItemClickEventArgs_Text_SET_GET_VALUE() + { + /* TEST CODE */ + var itemClickEventArgs = new DropDown.ItemClickEventArgs(); + itemClickEventArgs.Text = "text"; + Assert.AreEqual("text", itemClickEventArgs.Text, "Should be equal"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSDropDown.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSDropDown.cs new file mode 100755 index 000000000..3c4bc7a0a --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSDropDown.cs @@ -0,0 +1,832 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Components; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.DropDown Tests")] + public class DropDownTests + { + private const string TAG = "Components"; + private string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png"; + private static bool _updateFlag = false; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("CommonSwitchTests"); + App.MainTitleChangeBackgroundColor(null); + + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test DropDown empty constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDown C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void DropDown_CHECK_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + Assert.IsNotNull(dropDown, "Should be not null!"); + Assert.IsInstanceOf(dropDown, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test DropDown style constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDown C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "string")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void DropDown_Style_CHECK_VALUE() + { + /* TEST CODE */ + StyleManager.Instance.RegisterStyle("ListSpinnerDropDownStyle", null, typeof(ListSpinnerDropDownStyle)); + var dropDown = new DropDown("ListSpinnerDropDownStyle"); + Assert.IsNotNull(dropDown, "Should be not null!"); + Assert.IsInstanceOf(dropDown, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test var dropDownAttributes constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DropDown C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "DropDownAttributes")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void DropDown_DropDownAttributes_CHECK_VALUE() + { + /* TEST CODE */ + var attrs = new DropDownAttributes + { + HeaderTextAttributes = new TextAttributes + { + Text = new StringSelector { All = "TitleArea" }, + PointSize = new FloatSelector { All = 28 }, + TextColor = new ColorSelector { All = new Color(0, 0, 0, 1) }, + FontFamily = "SamsungOneUI 500C", + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, + PivotPoint = Tizen.NUI.PivotPoint.TopLeft, + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + }, + + ButtonAttributes = new ButtonAttributes + { + TextAttributes = new TextAttributes + { + Text = new StringSelector { All = "DropDown Text" }, + PointSize = new FloatSelector { All = 20 }, + TextColor = new ColorSelector { All = new Color(0, 0, 0, 1) }, + FontFamily = "SamsungOneUI 500", + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, + PivotPoint = Tizen.NUI.PivotPoint.TopLeft, + WidthResizePolicy = ResizePolicyType.UseNaturalSize, + HeightResizePolicy = ResizePolicyType.FillToParent, + Position2D = new Position2D(0, 0), + HorizontalAlignment = HorizontalAlignment.Begin, + VerticalAlignment = VerticalAlignment.Center, + }, + IconAttributes = new ImageAttributes + { + Size2D = new Size2D(48, 48), + ResourceURL = new StringSelector { All = _image_path }, + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.CenterRight, + PivotPoint = Tizen.NUI.PivotPoint.CenterRight, + }, + }, + ListBackgroundImageAttributes = new ImageAttributes + { + ResourceURL = new StringSelector { All = _image_path }, + Border = new RectangleSelector { All = new Rectangle(51, 51, 51, 51) }, + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, + PivotPoint = Tizen.NUI.PivotPoint.TopLeft, + WidthResizePolicy = ResizePolicyType.FitToChildren, + HeightResizePolicy = ResizePolicyType.FitToChildren, + }, + Space = new Vector4(56, 0, 0, 0), + SpaceBetweenButtonTextAndIcon = 8, + ListMargin = new Vector4(20, 0, 20, 0), + BackgroundColor = new ColorSelector { All = new Color(1, 1, 1, 1) }, + ListSize2D = new Size2D(360, 500), + ListPadding = new Extents(4, 4, 4, 4), + }; + var dropDown = new DropDown(attrs); + Assert.IsNotNull(dropDown, "Should be not null!"); + Assert.IsInstanceOf(dropDown, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test HeaderText. Check whether HeaderText is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.HeaderText A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void HeaderText_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + dropDown.HeaderText = "Test HeaderText"; + Assert.AreEqual("Test HeaderText", dropDown.HeaderText, "Should be equals to the set value of HeaderText"); + } + + [Test] + [Category("P1")] + [Description("Test HeaderTextPointSize. Check whether HeaderTextPointSize is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.HeaderTextPointSize A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void HeaderTextPointSize_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + dropDown.HeaderTextPointSize = 10.0f; + Assert.AreEqual(10.0f, dropDown.HeaderTextPointSize, "Should be equals to the set value of HeaderTextPointSize"); + } + + [Test] + [Category("P1")] + [Description("Test HeaderTextFontFamily. Check whether HeaderTextFontFamily is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.HeaderTextFontFamily A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void HeaderTextFontFamily_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + dropDown.HeaderTextFontFamily = "SamsungOne 500"; + Assert.AreEqual("SamsungOne 500", dropDown.HeaderTextFontFamily, "Should be equals to the set value of HeaderTextFontFamily"); + } + + [Test] + [Category("P1")] + [Description("Test HeaderTextColor. Check whether HeaderTextColor is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.HeaderTextColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void HeaderTextColor_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + var color = new Color(1.0f, 0.0f, 0.0f, 1.0f); + dropDown.HeaderTextColor = color; + + Assert.AreEqual(color.R, dropDown.HeaderTextColor.R, "Should be equals to the color.R set"); + Assert.AreEqual(color.G, dropDown.HeaderTextColor.G, "Should be equals to the color.G set"); + Assert.AreEqual(color.B, dropDown.HeaderTextColor.B, "Should be equals to the color.B set"); + Assert.AreEqual(color.A, dropDown.HeaderTextColor.A, "Should be equals to the color.A set"); + + } + + [Test] + [Category("P1")] + [Description("Test HeaderTextColorSelector. Check whether HeaderTextColorSelector is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.HeaderTextColorSelector A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void HeaderTextColorSelector_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + var colorSelector = new ColorSelector + { + Normal = new Color(0.0f, 0.0f, 1.0f, 1.0f), + Selected = new Color(0.0f, 1.0f, 0.0f, 1.0f), + }; + + dropDown.HeaderTextColorSelector = colorSelector; + Assert.AreEqual(colorSelector.Normal.R, dropDown.HeaderTextColorSelector.Normal.R, "Should be equals to the set value of HeaderTextColorSelector Normal R"); + Assert.AreEqual(colorSelector.Normal.G, dropDown.HeaderTextColorSelector.Normal.G, "Should be equals to the set value of HeaderTextColorSelector Normal G"); + Assert.AreEqual(colorSelector.Normal.B, dropDown.HeaderTextColorSelector.Normal.B, "Should be equals to the set value of HeaderTextColorSelector Normal B"); + Assert.AreEqual(colorSelector.Normal.A, dropDown.HeaderTextColorSelector.Normal.A, "Should be equals to the set value of HeaderTextColorSelector Normal A"); + + Assert.AreEqual(colorSelector.Selected.R, dropDown.HeaderTextColorSelector.Selected.R, "Should be equals to the set value of HeaderTextColorSelector Selected R"); + Assert.AreEqual(colorSelector.Selected.G, dropDown.HeaderTextColorSelector.Selected.G, "Should be equals to the set value of HeaderTextColorSelector Selected G"); + Assert.AreEqual(colorSelector.Selected.B, dropDown.HeaderTextColorSelector.Selected.B, "Should be equals to the set value of HeaderTextColorSelector Selected B"); + Assert.AreEqual(colorSelector.Selected.A, dropDown.HeaderTextColorSelector.Selected.A, "Should be equals to the set value of HeaderTextColorSelector Selected A"); + } + + [Test] + [Category("P1")] + [Description("Test ButtonText. Check whether ButtonText is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.ButtonText A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ButtonText_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + dropDown.ButtonText = "Test ButtonText"; + Assert.AreEqual("Test ButtonText", dropDown.ButtonText, "Should be equals to the set value of ButtonText"); + } + + [Test] + [Category("P1")] + [Description("Test ButtonTextPointSize. Check whether ButtonTextPointSize is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.ButtonTextPointSize A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ButtonTextPointSize_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + dropDown.ButtonTextPointSize = 10.0f; + Assert.AreEqual(10.0f, dropDown.ButtonTextPointSize, "Should be equals to the set value of ButtonTextPointSize"); + } + + [Test] + [Category("P1")] + [Description("Test ButtonTextFontFamily. Check whether ButtonTextFontFamily is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.ButtonTextFontFamily A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ButtonTextFontFamily_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + dropDown.ButtonTextFontFamily = "SamsungOne 500"; + Assert.AreEqual("SamsungOne 500", dropDown.ButtonTextFontFamily, "Should be equals to the set value of HeaderTextFontFamily"); + } + + [Test] + [Category("P1")] + [Description("Test ButtonTextColor. Check whether ButtonTextColor is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.ButtonTextColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ButtonTextColor_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + var color = new Color(1.0f, 0.0f, 0.0f, 1.0f); + dropDown.ButtonTextColor = color; + + Assert.AreEqual(color.R, dropDown.ButtonTextColor.R, "Should be equals to the color.R set"); + Assert.AreEqual(color.G, dropDown.ButtonTextColor.G, "Should be equals to the color.G set"); + Assert.AreEqual(color.B, dropDown.ButtonTextColor.B, "Should be equals to the color.B set"); + Assert.AreEqual(color.A, dropDown.ButtonTextColor.A, "Should be equals to the color.A set"); + } + + [Test] + [Category("P1")] + [Description("Test ButtonTextColorSelector. Check whether ButtonTextColorSelector is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.ButtonTextColorSelector A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ButtonTextColorSelector_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + var colorSelector = new ColorSelector + { + Normal = new Color(0.0f, 0.0f, 1.0f, 1.0f), + Selected = new Color(0.0f, 1.0f, 0.0f, 1.0f), + }; + + dropDown.ButtonTextColorSelector = colorSelector; + Assert.AreEqual(colorSelector.Normal.R, dropDown.ButtonTextColorSelector.Normal.R, "Should be equals to the set value of ButtonTextColorSelector Normal R"); + Assert.AreEqual(colorSelector.Normal.G, dropDown.ButtonTextColorSelector.Normal.G, "Should be equals to the set value of ButtonTextColorSelector Normal G"); + Assert.AreEqual(colorSelector.Normal.B, dropDown.ButtonTextColorSelector.Normal.B, "Should be equals to the set value of ButtonTextColorSelector Normal B"); + Assert.AreEqual(colorSelector.Normal.A, dropDown.ButtonTextColorSelector.Normal.A, "Should be equals to the set value of ButtonTextColorSelector Normal A"); + + Assert.AreEqual(colorSelector.Selected.R, dropDown.ButtonTextColorSelector.Selected.R, "Should be equals to the set value of ButtonTextColorSelector SelectedFocused R"); + Assert.AreEqual(colorSelector.Selected.G, dropDown.ButtonTextColorSelector.Selected.G, "Should be equals to the set value of ButtonTextColorSelector SelectedFocused G"); + Assert.AreEqual(colorSelector.Selected.B, dropDown.ButtonTextColorSelector.Selected.B, "Should be equals to the set value of ButtonTextColorSelector SelectedFocused B"); + Assert.AreEqual(colorSelector.Selected.A, dropDown.ButtonTextColorSelector.Selected.A, "Should be equals to the set value of ButtonTextColorSelector SelectedFocused A"); + } + + [Test] + [Category("P1")] + [Description("Test ButtonIconImageURL. Check whether ButtonIconImageURL is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.ButtonIconImageURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ButtonIconImageURL_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + dropDown.ButtonIconImageURL = _image_path; + Assert.AreEqual(_image_path, dropDown.ButtonIconImageURL, "Should be equals to the set value of ButtonIconImageURL"); + } + + [Test] + [Category("P1")] + [Description("Test ButtonIconSize2D. Check whether ButtonIconSize2D is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.ButtonIconSize2D A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ButtonIconSize2D_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + dropDown.ButtonIconSize2D = new Size2D(10, 10); + Assert.AreEqual(10, dropDown.ButtonIconSize2D.Width, "Should be equals to the set value of ButtonIconSize2D.Width"); + Assert.AreEqual(10, dropDown.ButtonIconSize2D.Height, "Should be equals to the set value of ButtonIconSize2D.Height"); + } + + [Test] + [Category("P1")] + [Description("Test SpaceBetweenButtonTextAndIcon. Check whether SpaceBetweenButtonTextAndIcon is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.SpaceBetweenButtonTextAndIcon A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void SpaceBetweenButtonTextAndIcon_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + dropDown.SpaceBetweenButtonTextAndIcon = 10; + Assert.AreEqual(10, dropDown.SpaceBetweenButtonTextAndIcon, "Should be equals to the set value of SpaceBetweenButtonTextAndIcon"); + } + + [Test] + [Category("P1")] + [Description("Test LeftSpace. Check whether LeftSpace is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.LeftSpace A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void LeftSpace_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + dropDown.LeftSpace = 10; + Assert.AreEqual(10, dropDown.LeftSpace, "Should be equals to the set value of LeftSpace"); + } + + [Test] + [Category("P1")] + [Description("Test RightSpace. Check whether RightSpace is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.RightSpace A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void RightSpace_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + dropDown.RightSpace = 10; + Assert.AreEqual(10, dropDown.RightSpace, "Should be equals to the set value of RightSpace"); + } + + [Test] + [Category("P1")] + [Description("Test ListBackgroundImageURL. Check whether ListBackgroundImageURL is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.ListBackgroundImageURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ListBackgroundImageURL_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + dropDown.ListBackgroundImageURL = _image_path; + Assert.AreEqual(_image_path, dropDown.ListBackgroundImageURL, "Should be equals to the set value of ListBackgroundImageURL"); + } + + [Test] + [Category("P1")] + [Description("Test ListBackgroundImageBorder. Check whether ListBackgroundImageBorder is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.ListBackgroundImageBorder A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ListBackgroundImageBorder_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + dropDown.ListBackgroundImageBorder = new Rectangle(0, 0, 10, 10); + Assert.AreEqual(0, dropDown.ListBackgroundImageBorder.X, "Retrieved ListBackgroundImageBorder should be equal to set value"); + Assert.AreEqual(0, dropDown.ListBackgroundImageBorder.Y, "Retrieved ListBackgroundImageBorder should be equal to set value"); + Assert.AreEqual(10, dropDown.ListBackgroundImageBorder.Width, "Retrieved ListBackgroundImageBorder should be equal to set value"); + Assert.AreEqual(10, dropDown.ListBackgroundImageBorder.Height, "Retrieved ListBackgroundImageBorder should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test ListRelativeOrientation. Check whether ListRelativeOrientation is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.ListRelativeOrientation A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ListRelativeOrientation_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + dropDown.ListRelativeOrientation = DropDown.ListOrientation.Left; + Assert.AreEqual(DropDown.ListOrientation.Left, dropDown.ListRelativeOrientation, "Should be equals to the set value of ListRelativeOrientation"); + dropDown.ListRelativeOrientation = DropDown.ListOrientation.Right; + Assert.AreEqual(DropDown.ListOrientation.Right, dropDown.ListRelativeOrientation, "Should be equals to the set value of ListRelativeOrientation"); + } + + [Test] + [Category("P1")] + [Description("Test ListLeftMargin. Check whether ListLeftMargin is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.ListLeftMargin A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ListLeftMargin_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + dropDown.ListLeftMargin = 10; + Assert.AreEqual(10, dropDown.ListLeftMargin, "Should be equals to the set value of ListLeftMargin"); + } + + [Test] + [Category("P1")] + [Description("Test ListRigthMargin. Check whether ListRigthMargin is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.ListRigthMargin A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ListRigthMargin_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + dropDown.ListRigthMargin = 10; + Assert.AreEqual(10, dropDown.ListRigthMargin, "Should be equals to the set value of ListRigthMargin"); + } + + [Test] + [Category("P1")] + [Description("Test ListTopMargin. Check whether ListTopMargin is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.ListTopMargin A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ListTopMargin_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + dropDown.ListTopMargin = 10; + Assert.AreEqual(10, dropDown.ListTopMargin, "Should be equals to the set value of ListTopMargin"); + } + + [Test] + [Category("P1")] + [Description("Test FocusedItemIndex. Check whether FocusedItemIndex is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.FocusedItemIndex A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void FocusedItemIndex_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + dropDown.FocusedItemIndex = 2; + Assert.AreEqual(2, dropDown.FocusedItemIndex, "Should be equals to the set value of FocusedItemIndex"); + } + + [Test] + [Category("P1")] + [Description("Test SelectedItemIndex. Check whether SelectedItemIndex is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.SelectedItemIndex A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void SelectedItemIndex_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + var dropDownItemData = new DropDown.DropDownItemData(); + dropDown.AddItem(dropDownItemData); + var dropDownItemData1 = new DropDown.DropDownItemData(); + dropDown.AddItem(dropDownItemData1); + dropDown.SelectedItemIndex = 1; + Assert.AreEqual(1, dropDown.SelectedItemIndex, "Should be equals to the set value of SelectedItemIndex"); + } + + [Test] + [Category("P1")] + [Description("Test ListSize2D. Check whether ListSize2D is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.ListSize2D A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ListSize2D_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + dropDown.ListSize2D = new Size2D(10, 10); + Assert.AreEqual(10, dropDown.ListSize2D.Width, "Should be equals to the set value of ListSize2D.Width"); + Assert.AreEqual(10, dropDown.ListSize2D.Height, "Should be equals to the set value of ListSize2D.Height"); + } + + [Test] + [Category("P1")] + [Description("Test ListPadding. Check whether ListPadding is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.ListPadding A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ListPadding_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + dropDown.ListPadding = new Extents(10, 10, 10, 10); + Assert.AreEqual(10, dropDown.ListPadding.Start, "Should be equals to the set value of ListPadding.Start"); + Assert.AreEqual(10, dropDown.ListPadding.End, "Should be equals to the set value of ListPadding.End"); + Assert.AreEqual(10, dropDown.ListPadding.Top, "Should be equals to the set value of ListPadding.Top"); + Assert.AreEqual(10, dropDown.ListPadding.Bottom, "Should be equals to the set value of ListPadding.Bottom"); + } + + [Test] + [Category("P1")] + [Description("Test AddItem. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.AddItem M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void AddItem_CHECK_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + var dropDownItemData = new DropDown.DropDownItemData(); + dropDown.AddItem(dropDownItemData); + dropDown.SelectedItemIndex = 0; + + Assert.AreEqual(true, dropDownItemData.IsSelected, "Should be equal"); + } + + [Test] + [Category("P1")] + [Description("Test DeleteItem. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DeleteItem M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void DeleteItem_CHECK_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + var dropDownItemData = new DropDown.DropDownItemData(); + dropDown.AddItem(dropDownItemData); + dropDown.DeleteItem(0); + dropDown.SelectedItemIndex = 0; + + Assert.AreEqual(false, dropDownItemData.IsSelected, "Should be equal"); + } + + [Test] + [Category("P1")] + [Description("Test InsertItem. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.InsertItem M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void InsertItem_CHECK_VALUE() + { + /* TEST CODE */ + var dropDown = new DropDown(); + var dropDownItemData = new DropDown.DropDownItemData(); + dropDown.AddItem(dropDownItemData); + + var dropDownItemData1 = new DropDown.DropDownItemData(); + dropDown.AddItem(dropDownItemData1); + dropDown.SelectedItemIndex = 1; + + var dropDownItemData2 = new DropDown.DropDownItemData(); + dropDown.InsertItem(dropDownItemData2, 0); + + Assert.AreEqual(2, dropDown.SelectedItemIndex, "Should be equal"); + } + + [Test] + [Category("P1")] + [Description("Test AttachScrollBar. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.AttachScrollBar M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void AttachScrollBar_CHECK_VALUE() + { + /* TEST CODE */ + try + { + var dropDown = new DropDown(); + var scrollBar = new ScrollBar(); + dropDown.AttachScrollBar(scrollBar); + } + 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 DetachScrollBar. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.DetachScrollBar M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void DetachScrollBar_CHECK_VALUE() + { + /* TEST CODE */ + try + { + var dropDown = new DropDown(); + var scrollBar = new ScrollBar(); + dropDown.AttachScrollBar(scrollBar); + dropDown.DetachScrollBar(); + } + 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 MyDropDown : DropDown + { + protected override void OnUpdate() + { + _updateFlag = true; + base.OnUpdate(); + } + + protected override Attributes GetAttributes() + { + return base.GetAttributes(); + } + + public Attributes TestGetAttributes() + { + return GetAttributes(); + } + } + + [Test] + [Category("P1")] + [Description("Test OnUpdate. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.OnUpdate M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public async Task OnUpdate_CHECK_VALUE() + { + /* TEST CODE */ + _updateFlag = false; + var myDropDown = new MyDropDown(); + myDropDown.Size2D = new Size2D(200, 200); + myDropDown.BackgroundColor = Color.Red; + Window.Instance.Add(myDropDown); + myDropDown.BackgroundColor = Color.Cyan; + await Task.Delay(500); + Assert.AreEqual(true, _updateFlag, "OnUpdate trigger Check Fail."); + Window.Instance.Remove(myDropDown); + } + + [Test] + [Category("P1")] + [Description("Test GetAttributes. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.GetAttributes M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void GetAttributes_CHECK_VALUE() + { + /* TEST CODE */ + var myDropDown = new MyDropDown(); + var attr = myDropDown.TestGetAttributes(); + Assert.IsNotNull(attr, "Should be not null!"); + Assert.IsInstanceOf(attr, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test Dispose, try to dispose the DropDown.")] + [Property("SPEC", "Tizen.NUI.Components.DropDown.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Dispose_TEST() + { + /* TEST CODE */ + try + { + DropDown dropDown = new DropDown(); + dropDown.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 ListSpinnerDropDownStyle : StyleBase + { + private string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png"; + protected override Attributes GetAttributes() + { + DropDownAttributes attributes = new DropDownAttributes + { + HeaderTextAttributes = new TextAttributes + { + PointSize = new FloatSelector { All = 28 }, + TextColor = new ColorSelector { All = new Color(0, 0, 0, 1) }, + FontFamily = "SamsungOneUI 500C", + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, + PivotPoint = Tizen.NUI.PivotPoint.TopLeft, + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent, + HorizontalAlignment = HorizontalAlignment.Begin, + VerticalAlignment = VerticalAlignment.Center, + Position2D = new Position2D(56, 0), + }, + + ButtonAttributes = new ButtonAttributes + { + TextAttributes = new TextAttributes + { + PointSize = new FloatSelector { All = 20 }, + TextColor = new ColorSelector { All = new Color(0, 0, 0, 1) }, + FontFamily = "SamsungOneUI 500", + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, + PivotPoint = Tizen.NUI.PivotPoint.TopLeft, + WidthResizePolicy = ResizePolicyType.UseNaturalSize, + HeightResizePolicy = ResizePolicyType.FillToParent, + Position2D = new Position2D(0, 0), + HorizontalAlignment = HorizontalAlignment.Begin, + VerticalAlignment = VerticalAlignment.Center, + }, + IconAttributes = new ImageAttributes + { + Size2D = new Size2D(48, 48), + ResourceURL = new StringSelector { All = _image_path }, + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.CenterRight, + PivotPoint = Tizen.NUI.PivotPoint.CenterRight, + }, + }, + ListBackgroundImageAttributes = new ImageAttributes + { + ResourceURL = new StringSelector { All = _image_path }, + Border = new RectangleSelector { All = new Rectangle(51, 51, 51, 51) }, + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, + PivotPoint = Tizen.NUI.PivotPoint.TopLeft, + WidthResizePolicy = ResizePolicyType.FitToChildren, + HeightResizePolicy = ResizePolicyType.FitToChildren, + }, + Space = new Vector4(900, 0, 0, 0), + SpaceBetweenButtonTextAndIcon = 8, + ListMargin = new Vector4(0, 20, 20, 0), + BackgroundColor = new ColorSelector { All = new Color(1, 1, 1, 1) }, + ListPadding = new Extents(4, 4, 4, 4), + ListRelativeOrientation = DropDown.ListOrientation.Right, + }; + return attributes; + } + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSDropDownAttributes.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSDropDownAttributes.cs new file mode 100755 index 000000000..0d404ed3e --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSDropDownAttributes.cs @@ -0,0 +1,471 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Components; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.DropDownAttributes Tests")] + public class DropDownAttributesTests + { + 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!"); + App.MainTitleChangeText("ButtonAttributesTests"); + App.MainTitleChangeBackgroundColor(null); + + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test DropDownAttributes empty constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDownAttributes.DropDownAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void DropDownAttributes_CHECK_VALUE() + { + /* TEST CODE */ + var dropDownAttributes = new DropDownAttributes(); + Assert.IsNotNull(dropDownAttributes, "Should be not null!"); + Assert.IsInstanceOf(dropDownAttributes, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test DropDownAttributes copy constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDownAttributes.DropDownAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "DropDownAttributes")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void DropDownAttributes_DropDownAttributes_CHECK_VALUE() + { + /* TEST CODE */ + var attrs = new DropDownAttributes + { + HeaderTextAttributes = new TextAttributes + { + Text = new StringSelector { All = "TitleArea" }, + PointSize = new FloatSelector { All = 28 }, + TextColor = new ColorSelector { All = new Color(0, 0, 0, 1) }, + FontFamily = "SamsungOneUI 500C", + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, + PivotPoint = Tizen.NUI.PivotPoint.TopLeft, + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + }, + + ButtonAttributes = new ButtonAttributes + { + TextAttributes = new TextAttributes + { + Text = new StringSelector { All = "DropDown Text" }, + PointSize = new FloatSelector { All = 20 }, + TextColor = new ColorSelector { All = new Color(0, 0, 0, 1) }, + FontFamily = "SamsungOneUI 500", + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, + PivotPoint = Tizen.NUI.PivotPoint.TopLeft, + WidthResizePolicy = ResizePolicyType.UseNaturalSize, + HeightResizePolicy = ResizePolicyType.FillToParent, + Position2D = new Position2D(0, 0), + HorizontalAlignment = HorizontalAlignment.Begin, + VerticalAlignment = VerticalAlignment.Center, + }, + IconAttributes = new ImageAttributes + { + Size2D = new Size2D(48, 48), + ResourceURL = new StringSelector { All = _image_path }, + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.CenterRight, + PivotPoint = Tizen.NUI.PivotPoint.CenterRight, + }, + }, + ListBackgroundImageAttributes = new ImageAttributes + { + ResourceURL = new StringSelector { All = _image_path }, + Border = new RectangleSelector { All = new Rectangle(51, 51, 51, 51) }, + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, + PivotPoint = Tizen.NUI.PivotPoint.TopLeft, + WidthResizePolicy = ResizePolicyType.FitToChildren, + HeightResizePolicy = ResizePolicyType.FitToChildren, + }, + Space = new Vector4(56, 0, 0, 0), + SpaceBetweenButtonTextAndIcon = 8, + ListMargin = new Vector4(20, 0, 20, 0), + BackgroundColor = new ColorSelector { All = new Color(1, 1, 1, 1) }, + ListSize2D = new Size2D(360, 500), + ListPadding = new Extents(4, 4, 4, 4), + }; + var dropDownAttributes = new DropDownAttributes(attrs); + Assert.IsNotNull(dropDownAttributes, "Should be not null!"); + Assert.IsInstanceOf(dropDownAttributes, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test ButtonAttributes. Check whether ButtonAttributes is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDownAttributes.ButtonAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ButtonAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownAttributes = new DropDownAttributes(); + dropDownAttributes.ButtonAttributes = new ButtonAttributes(); + Assert.IsNotNull(dropDownAttributes.ButtonAttributes, "Should be not null!"); + Assert.IsInstanceOf(dropDownAttributes.ButtonAttributes, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test HeaderTextAttributes. Check whether HeaderTextAttributes is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDownAttributes.HeaderTextAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void HeaderTextAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownAttributes = new DropDownAttributes(); + dropDownAttributes.HeaderTextAttributes = new TextAttributes(); + Assert.IsNotNull(dropDownAttributes.HeaderTextAttributes, "Should be not null!"); + Assert.IsInstanceOf(dropDownAttributes.HeaderTextAttributes, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test SpaceBetweenButtonTextAndIcon. Check whether SpaceBetweenButtonTextAndIcon is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDownAttributes.SpaceBetweenButtonTextAndIcon A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void SpaceBetweenButtonTextAndIcon_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownAttributes = new DropDownAttributes(); + dropDownAttributes.SpaceBetweenButtonTextAndIcon = 10; + + Assert.AreEqual(10, dropDownAttributes.SpaceBetweenButtonTextAndIcon, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test ListBackgroundImageAttributes. Check whether ListBackgroundImageAttributes is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDownAttributes.ListBackgroundImageAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ListBackgroundImageAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownAttributes = new DropDownAttributes(); + dropDownAttributes.ListBackgroundImageAttributes = new ImageAttributes(); + Assert.IsNotNull(dropDownAttributes.ListBackgroundImageAttributes, "Should be not null!"); + Assert.IsInstanceOf(dropDownAttributes.ListBackgroundImageAttributes, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test Space. Check whether Space is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDownAttributes.Space A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void Space_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownAttributes = new DropDownAttributes(); + dropDownAttributes.Space = new Vector4(10, 10, 10, 10); + + Assert.AreEqual(10, dropDownAttributes.Space.X, "Should be equals!"); + Assert.AreEqual(10, dropDownAttributes.Space.Y, "Should be equals!"); + Assert.AreEqual(10, dropDownAttributes.Space.Z, "Should be equals!"); + Assert.AreEqual(10, dropDownAttributes.Space.W, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test ListRelativeOrientation. Check whether ListRelativeOrientation is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDownAttributes.ListRelativeOrientation A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ListRelativeOrientation_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownAttributes = new DropDownAttributes(); + dropDownAttributes.ListRelativeOrientation = DropDown.ListOrientation.Left; + Assert.AreEqual(DropDown.ListOrientation.Left, dropDownAttributes.ListRelativeOrientation, "Should be equals!"); + + dropDownAttributes.ListRelativeOrientation = DropDown.ListOrientation.Right; + Assert.AreEqual(DropDown.ListOrientation.Right, dropDownAttributes.ListRelativeOrientation, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test ListMargin. Check whether ListMargin is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDownAttributes.ListMargin A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ListMargin_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownAttributes = new DropDownAttributes(); + dropDownAttributes.ListMargin = new Vector4(10, 10, 10, 10); + + Assert.AreEqual(10, dropDownAttributes.ListMargin.X, "Should be equals!"); + Assert.AreEqual(10, dropDownAttributes.ListMargin.Y, "Should be equals!"); + Assert.AreEqual(10, dropDownAttributes.ListMargin.Z, "Should be equals!"); + Assert.AreEqual(10, dropDownAttributes.ListMargin.W, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test FocusedItemIndex. Check whether FocusedItemIndex is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDownAttributes.FocusedItemIndex A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void FocusedItemIndex_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownAttributes = new DropDownAttributes(); + dropDownAttributes.FocusedItemIndex = 1; + + Assert.AreEqual(1, dropDownAttributes.FocusedItemIndex, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test ListSize2D. Check whether ListSize2D is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDownAttributes.ListSize2D A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ListSize2D_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownAttributes = new DropDownAttributes(); + dropDownAttributes.ListSize2D = new Size2D(10, 10); + + Assert.AreEqual(10, dropDownAttributes.ListSize2D.Width, "Should be equals!"); + Assert.AreEqual(10, dropDownAttributes.ListSize2D.Height, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test ListPadding. Check whether ListPadding is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDownAttributes.ListPadding A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ListPadding_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownAttributes = new DropDownAttributes(); + dropDownAttributes.ListPadding = new Extents(10, 10, 10, 10); + + Assert.AreEqual(10, dropDownAttributes.ListPadding.Start, "Should be equals!"); + Assert.AreEqual(10, dropDownAttributes.ListPadding.End, "Should be equals!"); + Assert.AreEqual(10, dropDownAttributes.ListPadding.Top, "Should be equals!"); + Assert.AreEqual(10, dropDownAttributes.ListPadding.Bottom, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test Clone. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDownAttributes.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void Clone_CHECK_VALUE() + { + var dropDownAttributes = new DropDownAttributes(); + dropDownAttributes.SpaceBetweenButtonTextAndIcon = 10; + var attr = dropDownAttributes.Clone() as DropDownAttributes; + Assert.IsNotNull(attr, "Should be not null!"); + Assert.IsInstanceOf(attr, "Should be equals!"); + Assert.AreEqual(10, attr.SpaceBetweenButtonTextAndIcon, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test DropDownItemAttributes empty constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDownItemAttributes.DropDownItemAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void DropDownItemAttributes_CHECK_VALUE() + { + /* TEST CODE */ + var dropDownItemAttributes = new DropDownItemAttributes(); + Assert.IsNotNull(dropDownItemAttributes, "Should be not null!"); + Assert.IsInstanceOf(dropDownItemAttributes, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test DropDownItemAttributes copy constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDownItemAttributes.DropDownItemAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "DropDownItemAttributes")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void DropDownItemAttributes_DropDownItemAttributes_CHECK_VALUE() + { + /* TEST CODE */ + var itemAttrs = new DropDownItemAttributes + { + BackgroundColor = new ColorSelector + { + Pressed = new Color(0, 0, 0, 0.4f), + Other = new Color(1, 1, 1, 0), + }, + TextAttributes = new TextAttributes + { + PointSize = new FloatSelector { All = 18 }, + FontFamily = "SamsungOne 500", + Position2D = new Position2D(28, 0), + }, + CheckImageAttributes = new ImageAttributes + { + Size2D = new Size2D(40, 40), + ResourceURL = new StringSelector { All = _image_path }, + }, + CheckImageRightSpace = 16, + }; + var dropDownItemAttributes = new DropDownItemAttributes(itemAttrs); + Assert.IsNotNull(dropDownItemAttributes, "Should be not null!"); + Assert.IsInstanceOf(dropDownItemAttributes, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test TextAttributes. Check whether TextAttributes is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDownItemAttributes.TextAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void TextAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownItemAttributes = new DropDownItemAttributes(); + dropDownItemAttributes.TextAttributes = new TextAttributes(); + Assert.IsNotNull(dropDownItemAttributes.TextAttributes, "Should be not null!"); + Assert.IsInstanceOf(dropDownItemAttributes.TextAttributes, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test IconAttributes. Check whether IconAttributes is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDownItemAttributes.IconAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void IconAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownItemAttributes = new DropDownItemAttributes(); + dropDownItemAttributes.IconAttributes = new ImageAttributes(); + Assert.IsNotNull(dropDownItemAttributes.IconAttributes, "Should be not null!"); + Assert.IsInstanceOf(dropDownItemAttributes.IconAttributes, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test CheckImageAttributes. Check whether CheckImageAttributes is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDownItemAttributes.CheckImageAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckImageAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownItemAttributes = new DropDownItemAttributes(); + dropDownItemAttributes.CheckImageAttributes = new ImageAttributes(); + Assert.IsNotNull(dropDownItemAttributes.CheckImageAttributes, "Should be not null!"); + Assert.IsInstanceOf(dropDownItemAttributes.CheckImageAttributes, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test CheckImageRightSpace. Check whether CheckImageRightSpace is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDownItemAttributes.CheckImageRightSpace A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckImageRightSpace_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownItemAttributes = new DropDownItemAttributes(); + dropDownItemAttributes.CheckImageRightSpace = 10; + + Assert.AreEqual(10, dropDownItemAttributes.CheckImageRightSpace, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test IsSelected. Check whether IsSelected is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.DropDownItemAttributes.IsSelected A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void IsSelected_SET_GET_VALUE() + { + /* TEST CODE */ + var dropDownItemAttributes = new DropDownItemAttributes(); + dropDownItemAttributes.IsSelected = true; + Assert.AreEqual(true, dropDownItemAttributes.IsSelected, "Should be equals!"); + dropDownItemAttributes.IsSelected = false; + Assert.AreEqual(false, dropDownItemAttributes.IsSelected, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test Clone. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.DropDownItemAttributes.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void DropDownItemAttributes_Clone_CHECK_VALUE() + { + + var dropDownItemAttributes = new DropDownItemAttributes(); + var attr = dropDownItemAttributes.Clone(); + Assert.IsNotNull(attr, "Should be not null!"); + Assert.IsInstanceOf(attr, "Should be equals!"); + + } + + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSFlexiableView.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSFlexiableView.cs new file mode 100755 index 000000000..b93c1dd96 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSFlexiableView.cs @@ -0,0 +1,721 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; +using System.Threading.Tasks; +using System.Collections.Generic; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.FlexibleView Tests")] + public class FlexibleViewTests + { + private string TAG = "NUI.Components.FlexibleView"; + private FlexibleView _flexibleView = null; + private ListBridge _adapter = null; + private FlexibleView.LayoutManager _layoutManager = null; + private string _trackImageUrl = ""; + private bool _styleChanged = false; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("FlexibleViewTests"); + App.MainTitleChangeBackgroundColor(null); + + CreateFlexiableView(); + + } + + public void CreateFlexiableView() + { + _flexibleView = new FlexibleView(); + _flexibleView.Name = "RecyclerView"; + _flexibleView.Position2D = new Position2D(500, 200); + _flexibleView.Size2D = new Size2D(400, 450); + _flexibleView.Padding = new Extents(10, 10, 10, 10); + _flexibleView.BackgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.4f); + _flexibleView.Focusable = true; + + List dataList = new List(); + for (int i = 0; i < 132; ++i) + { + dataList.Add(new ListItemData(i)); + } + _adapter = new ListBridge(dataList); + _flexibleView.SetAdapter(_adapter); + _layoutManager = new LinearLayoutManager(LinearLayoutManager.VERTICAL); + _flexibleView.SetLayoutManager(_layoutManager); + + Window.Instance.Add(_flexibleView); + FocusManager.Instance.SetCurrentFocusView(_flexibleView); + _flexibleView.FocusedItemIndex = 0; + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + Window.Instance.Remove(_flexibleView); + _flexibleView.Dispose(); + _flexibleView = null; + } + + [Test] + [Category("P1")] + [Description("Create a FlexiableView object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.FlexibleView C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void FlexibleView_INIT() + { + /* TEST CODE */ + var flexibleView1 = new FlexibleView(); + Assert.IsNotNull(flexibleView1, "Can't create success object FlexibleView"); + Assert.IsInstanceOf(flexibleView1, "Should be an instance of FlexibleView type."); + } + + [Test] + [Category("P1")] + [Description("Test NO_POSITION.Check whether NO_POSITION is readable.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.NO_POSITION A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void NO_POSITION_GET_VALUE() + { + /* TEST CODE */ + Assert.AreEqual(-1, FlexibleView.NO_POSITION, "Should be equals to the set value of NO_POSITION."); + } + + [Test] + [Category("P1")] + [Description("Test INVALID_TYPE.Check whether INVALID_TYPE is readable.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.INVALID_TYPE A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void INVALID_TYPE_GET_VALUE() + { + /* TEST CODE */ + Assert.AreEqual(-1, FlexibleView.INVALID_TYPE, "Should be equals to the set value of INVALID_TYPE."); + } + + [Test] + [Category("P1")] + [Description("Test FocusedItemIndex.Check whether FocusedItemIndex is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.FocusedItemIndex A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void FocusedItemIndex_SET_GET_VALUE() + { + /* TEST CODE */ + _flexibleView.FocusedItemIndex = 1; + _flexibleView.Relayout += FocusedItemIndexRelayout; + _flexibleView.Relayout -= FocusedItemIndexRelayout; + } + + private void FocusedItemIndexRelayout(object sender, EventArgs args) + { + Assert.AreEqual(1, _flexibleView.FocusedItemIndex, "Should be equals to the set value of FocusedItemIndex."); + } + + [Test] + [Category("P1")] + [Description("Test Padding.Check whether Padding is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Padding A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Padding_SET_GET_VALUE() + { + /* TEST CODE */ + _flexibleView.Padding = new Extents(10, 10, 10, 10); + Assert.AreEqual(10, _flexibleView.Padding.Start, "Should be equals to the set value."); + Assert.AreEqual(10, _flexibleView.Padding.End, "Should be equals to the set value."); + Assert.AreEqual(10, _flexibleView.Padding.Top, "Should be equals to the set value."); + Assert.AreEqual(10, _flexibleView.Padding.Bottom, "Should be equals to the set value."); + } + + [Test] + [Category("P1")] + [Description("Test AttachScrollBar.Check whether AttachScrollBar works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.AttachScrollBar M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void AttachScrollBar_TEST() + { + /* TEST CODE */ + var scrollBar1 = new ScrollBar(); + scrollBar1.Direction = ScrollBar.DirectionType.Vertical; + scrollBar1.Position2D = new Position2D(394, 2); + scrollBar1.Size2D = new Size2D(4, 446); + scrollBar1.TrackColor = Color.Green; + scrollBar1.ThumbSize = new Size2D(4, 30); + scrollBar1.ThumbColor = Color.Yellow; + scrollBar1.TrackImageURL = _trackImageUrl; + try + { + _flexibleView.AttachScrollBar(scrollBar1); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test DetachScrollBar.Check whether DetachScrollBar works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.DetachScrollBar M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void DetachScrollBar_TEST() + { + /* TEST CODE */ + try + { + _flexibleView.DetachScrollBar(); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test FindViewHolderForAdapterPosition.Check whether FindViewHolderForAdapterPosition works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.FindViewHolderForAdapterPosition M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void FindViewHolderForAdapterPosition_TEST() + { + /* TEST CODE */ + try + { + for (int i = 0; i < 20; i++) + { + _flexibleView.MoveFocus(FlexibleView.LayoutManager.Direction.Down); + } + _flexibleView.Relayout += FindViewHolderForAdapterPositionRelayout; + _flexibleView.Relayout -= FindViewHolderForAdapterPositionRelayout; + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + private void FindViewHolderForAdapterPositionRelayout(object sender, EventArgs args) + { + var viewHolder = _flexibleView.FindViewHolderForAdapterPosition(0); + Assert.IsNotNull(viewHolder, "Can't get the viewHolder!"); + Assert.IsInstanceOf(viewHolder, "Should be instance of FlexibleView.ViewHolder"); + } + + [Test] + [Category("P1")] + [Description("Test FindViewHolderForLayoutPosition.Check whether FindViewHolderForLayoutPosition works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.FindViewHolderForLayoutPosition M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void FindViewHolderForLayoutPosition_TEST() + { + /* TEST CODE */ + try + { + for (int i = 0; i < 20; i++) + { + _flexibleView.MoveFocus(FlexibleView.LayoutManager.Direction.Down); + } + _flexibleView.Relayout += FindViewHolderForLayoutPositionRelayout; + _flexibleView.Relayout -= FindViewHolderForLayoutPositionRelayout; + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + private void FindViewHolderForLayoutPositionRelayout(object sender, EventArgs args) + { + var viewHolder = _flexibleView.FindViewHolderForLayoutPosition(0); + Assert.IsNotNull(viewHolder, "Can't get the viewHolder!"); + Assert.IsInstanceOf(viewHolder, "Should be instance of FlexibleView.ViewHolder"); + } + + [Test] + [Category("P1")] + [Description("Test GetAdapter.Check whether GetAdapter works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.GetAdapter M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetAdapter_TEST() + { + /* TEST CODE */ + try + { + var adapter = _flexibleView.GetAdapter(); + Assert.IsNotNull(adapter, "Can't get the adapter!"); + Assert.IsInstanceOf(adapter, "Should be instance of FlexibleView.Adapter"); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test GetRecycler.Check whether GetRecycler works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.GetRecycler M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetRecycler_TEST() + { + /* TEST CODE */ + try + { + var recycler = _flexibleView.GetRecycler(); + Assert.IsNotNull(recycler, "Can't get the recycler!"); + Assert.IsInstanceOf(recycler, "Should be instance of FlexibleView.Recycler"); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test GetLayoutManager.Check whether GetLayoutManager works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.GetLayoutManager M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetLayoutManager_TEST() + { + /* TEST CODE */ + try + { + var layoutManager = _flexibleView.GetLayoutManager(); + Assert.IsNotNull(layoutManager, "Can't get the layoutManager!"); + Assert.IsInstanceOf(layoutManager, "Should be instance of LayoutManager.Adapter"); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test MoveFocus.Check whether MoveFocus works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.MoveFocus M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void MoveFocus_TEST() + { + /* TEST CODE */ + try + { + _flexibleView.MoveFocus(FlexibleView.LayoutManager.Direction.Down); + _flexibleView.MoveFocus(FlexibleView.LayoutManager.Direction.Up); + _flexibleView.MoveFocus(FlexibleView.LayoutManager.Direction.Left); + _flexibleView.MoveFocus(FlexibleView.LayoutManager.Direction.Right); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test ScrollToPositionWithOffset.Check whether ScrollToPositionWithOffset works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.ScrollToPositionWithOffset M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ScrollToPositionWithOffset_TEST() + { + /* TEST CODE */ + try + { + _flexibleView.ScrollToPositionWithOffset(2, 0); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test SetAdapter.Check whether SetAdapter works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.SetAdapter M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void SetAdapter_TEST() + { + /* TEST CODE */ + try + { + _flexibleView.SetAdapter(_adapter); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test SetLayoutManager.Check whether SetLayoutManager works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.SetLayoutManager M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void SetLayoutManager_TEST() + { + /* TEST CODE */ + try + { + var hLayoutManager = new LinearLayoutManager(LinearLayoutManager.HORIZONTAL); + _flexibleView.SetLayoutManager(hLayoutManager); + var vLayoutManager = new LinearLayoutManager(LinearLayoutManager.VERTICAL); + _flexibleView.SetLayoutManager(vLayoutManager); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test GetAttributes.Check whether GetAttributes works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.GetAttributes M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetAttributes_TEST() + { + /* TEST CODE */ + try + { + var myFlexibleView = new MyFlexibleView(); + var attr = myFlexibleView.TestGetAttributes(); + Assert.IsNull(attr, "Should be null, because there is no attributes for FlexibleView!"); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test OnRelayout. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.OnRelayout M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public async Task OnRelayout_CHECK_VALUE() + { + /* TEST CODE */ + try + { + var view = new MyFlexibleView(); + Window window = Window.Instance; + window.Add(view); + await Task.Delay(500); + Assert.AreEqual(true, view._relayoutFlag, "OnRelayout trigger Check Fail."); + window.Remove(view); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test OnStyleChange. Check whether OnStyleChange works or not!")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.OnStyleChange M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void OnStyleChange_CHECK_VALUE() + { + /* TEST CODE */ + try + { + _flexibleView.OnStyleChange(NUI.StyleManager.Instance, StyleChangeType.ThemeChange); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test StyleChanged. Check whether StyleChanged works or not!")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.StyleChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public async Task StyleChanged_CHECK_VALUE() + { + /* TEST CODE */ + try + { + _flexibleView.StyleChanged += StyleChange; + _flexibleView.OnStyleChange(NUI.StyleManager.Instance, StyleChangeType.DefaultFontSizeChange); + await Task.Delay(500); + Assert.IsTrue(_styleChanged, "Should be true!"); + _flexibleView.StyleChanged -= StyleChange; + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test Dispose, try to dispose the FlexibleView.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Dispose_TEST() + { + /* TEST CODE */ + try + { + FlexibleView flexibleView = new FlexibleView(); + var hLayoutManager = new LinearLayoutManager(LinearLayoutManager.HORIZONTAL); + flexibleView.SetLayoutManager(hLayoutManager); + flexibleView.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()); + } + } + + private void StyleChange(object sender, NUI.StyleManager.StyleChangedEventArgs args) + { + _styleChanged = true; + } + } + + public class ListItemData + { + private string _str; + + public ListItemData(int i) + { + _str = "Text" + i.ToString(); + } + + public string TextString + { + get + { + return _str; + } + } + } + + public class ListItemView : View + { + private TextLabel _mText; + + public ListItemView() + { + _mText = new TextLabel(); + _mText.WidthResizePolicy = ResizePolicyType.FillToParent; + _mText.HeightResizePolicy = ResizePolicyType.FillToParent; + _mText.PointSize = 22; + _mText.HorizontalAlignment = HorizontalAlignment.Center; + _mText.VerticalAlignment = VerticalAlignment.Center; + Add(_mText); + } + + public string MainText + { + get + { + return _mText.Text; + } + set + { + _mText.Text = value; + } + } + } + + public class MyFlexibleView : FlexibleView + { + public bool _relayoutFlag = false; + + protected override Attributes GetAttributes() + { + return base.GetAttributes(); + } + + public Attributes TestGetAttributes() + { + return GetAttributes(); + } + + public override void OnRelayout(Vector2 size, RelayoutContainer container) + { + _relayoutFlag = true; + base.OnRelayout(size, container); + } + } + + public class ListBridge : FlexibleView.Adapter + { + private List _mDatas; + + public ListBridge(List datas) + { + _mDatas = datas; + } + + public void InsertData(int position) + { + _mDatas.Insert(position, new ListItemData(1000 + position)); + NotifyItemInserted(position); + } + + public void RemoveData(int position) + { + _mDatas.RemoveAt(position); + NotifyItemRemoved(position); + } + + public override int GetItemViewType(int position) + { + return 1; + } + + public override FlexibleView.ViewHolder OnCreateViewHolder(int viewType) + { + FlexibleView.ViewHolder viewHolder = new FlexibleView.ViewHolder(new ListItemView()); + //Console.WriteLine($"OnCreateViewHolder... viewType: {viewType} viewID: {viewHolder.ItemView.ID}"); + + return viewHolder; + } + + public override void OnAttachedToRecyclerView(FlexibleView flexibleView) + { + + } + public override void OnBindViewHolder(FlexibleView.ViewHolder holder, int position) + { + //Console.WriteLine($"OnBindItemView... position: {position}"); + ListItemData listItemData = _mDatas[position]; + + ListItemView listItemView = holder.ItemView as ListItemView; + listItemView.Name = "Item" + position; + //Random rd = new Random(); + listItemView.SizeWidth = 150; + listItemView.SizeHeight = 60; + if (listItemView != null) + { + listItemView.MainText = String.Format("{0:D2}", position) + " : " + listItemData.TextString; + } + listItemView.Margin = new Extents(2, 2, 2, 2); + if (position % 2 == 0) + listItemView.BackgroundColor = Color.Cyan; + else + listItemView.BackgroundColor = Color.Yellow; + } + + public override void OnDestroyViewHolder(FlexibleView.ViewHolder holder) + { + //Console.WriteLine($"OnDestroyViewHolder... viewID: {holder.ItemView?.ID}"); + if (holder.ItemView != null) + { + holder.ItemView.Dispose(); + } + } + + public override void OnDetachedFromRecyclerView(FlexibleView flexibleView) + { + + } + + public override int GetItemCount() + { + return _mDatas.Count; + } + + public override void OnFocusChange(FlexibleView flexibleView, int previousFocus, int currentFocus) + { + FlexibleView.ViewHolder previousFocusView = flexibleView.FindViewHolderForAdapterPosition(previousFocus); + if (previousFocusView != null) + { + //Console.WriteLine($"previousFocus {previousFocus.AdapterPosition}"); + if (previousFocusView.AdapterPosition % 2 == 0) + previousFocusView.ItemView.BackgroundColor = Color.Cyan; + else + previousFocusView.ItemView.BackgroundColor = Color.Yellow; + //previousFocus.SizeWidth = 150; + //previousFocus.SizeHeight = 60; + //NotifyItemChanged(previousFocus.AdapterPosition); + } + FlexibleView.ViewHolder currentFocusView = flexibleView.FindViewHolderForAdapterPosition(currentFocus); + if (currentFocusView != null) + { + //Console.WriteLine($"currentFocus {currentFocus.AdapterPosition}"); + currentFocusView.ItemView.BackgroundColor = Color.Magenta; + //currentFocus.SizeWidth = 200; + //currentFocus.SizeHeight = 100; + //NotifyItemChanged(currentFocus.AdapterPosition); + } + } + + public override void OnViewAttachedToWindow(FlexibleView.ViewHolder holder) + { + //Console.WriteLine($"+Attached: {holder.AdapterPosition}"); + } + + public override void OnViewDetachedFromWindow(FlexibleView.ViewHolder holder) + { + //Console.WriteLine($" --Detached: {holder.AdapterPosition}"); + } + + public override void OnViewRecycled(FlexibleView.ViewHolder holder) + { + + } + + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSFlexibleView.Adapter.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSFlexibleView.Adapter.cs new file mode 100755 index 000000000..c3f263503 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSFlexibleView.Adapter.cs @@ -0,0 +1,451 @@ +using NUnit.Framework; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; +using System.Collections.Generic; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.FlexibleView.Adapter Tests")] + public class FlexibleViewAdapterTests + { + private const string TAG = "NUI.Components"; + private FlexibleView _flexibleView = null; + private ListBridge _adapter = null; + private const int COUNT = 132; + private FlexibleView.LayoutManager _layoutManager = null; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("ScrollBarTests"); + App.MainTitleChangeBackgroundColor(null); + CreateFlexiableView(); + } + + public void CreateFlexiableView() + { + _flexibleView = new FlexibleView(); + _flexibleView.Name = "RecyclerView"; + _flexibleView.Position2D = new Position2D(500, 200); + _flexibleView.Size2D = new Size2D(400, 450); + _flexibleView.Padding = new Extents(10, 10, 10, 10); + _flexibleView.BackgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.4f); + _flexibleView.Focusable = true; + + List dataList = new List(); + for (int i = 0; i < COUNT; ++i) + { + dataList.Add(new ListItemData(i)); + } + _adapter = new ListBridge(dataList); + _flexibleView.SetAdapter(_adapter); + _layoutManager = new LinearLayoutManager(LinearLayoutManager.VERTICAL); + _flexibleView.SetLayoutManager(_layoutManager); + + Window.Instance.Add(_flexibleView); + FocusManager.Instance.SetCurrentFocusView(_flexibleView); + _flexibleView.FocusedItemIndex = 0; + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + Window.Instance.Remove(_flexibleView); + _flexibleView.Dispose(); + _flexibleView = null; + } + + [Test] + [Category("P1")] + [Description("Create a Adapter object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Adapter.Adapter C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Adapter_INIT() + { + /* TEST CODE */ + List dataList = new List(); + for (int i = 0; i < 131; ++i) + { + dataList.Add(new ListItemData(i)); + } + var adapter = new ListBridge(dataList); + Assert.IsNotNull(adapter, "Can't create success object Adapter"); + Assert.IsInstanceOf(adapter, "Should be an instance of Adapter"); + } + + [Test] + [Category("P1")] + [Description("Test GetItemCount. Check whether GetItemCount works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Adapter.GetItemCount M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetItemCount_TEST() + { + /* TEST CODE */ + Assert.AreEqual(COUNT, _adapter.GetItemCount(), "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test GetItemViewType. Check whether GetItemViewType works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Adapter.GetItemViewType M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetItemViewType_TEST() + { + /* TEST CODE */ + Assert.AreEqual(1, _adapter.GetItemViewType(0), "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test OnFocusChange. Check whether OnFocusChange works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Adapter.OnFocusChange M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void OnFocusChange_TEST() + { + /* TEST CODE */ + try + { + _adapter.OnFocusChange(_flexibleView, 0, 1); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test NotifyDataSetChanged. Check whether NotifyDataSetChanged works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Adapter.NotifyDataSetChanged M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void NotifyDataSetChanged_TEST() + { + /* TEST CODE */ + try + { + _adapter.NotifyDataSetChanged(); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test NotifyItemChanged. Check whether NotifyItemChanged works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Adapter.NotifyItemChanged M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void NotifyItemChanged_TEST() + { + /* TEST CODE */ + try + { + _adapter.NotifyItemChanged(0); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test NotifyItemInserted. Check whether NotifyItemInserted works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Adapter.NotifyItemInserted M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void NotifyItemInserted_TEST() + { + /* TEST CODE */ + try + { + _adapter.NotifyItemInserted(0); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test NotifyItemMoved. Check whether NotifyItemMoved works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Adapter.NotifyItemMoved M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void NotifyItemMoved_TEST() + { + /* TEST CODE */ + try + { + _adapter.NotifyItemMoved(0, 1); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test NotifyItemRangeChanged. Check whether NotifyItemRangeChanged works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Adapter.NotifyItemRangeChanged M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void NotifyItemRangeChanged_TEST() + { + /* TEST CODE */ + try + { + _adapter.NotifyItemRangeChanged(0, 1); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test NotifyItemRangeInserted. Check whether NotifyItemRangeInserted works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Adapter.NotifyItemRangeInserted M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void NotifyItemRangeInserted_TEST() + { + /* TEST CODE */ + try + { + _adapter.NotifyItemRangeInserted(0, 1); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test NotifyItemRangeRemoved. Check whether NotifyItemRangeRemoved works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Adapter.NotifyItemRangeRemoved M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void NotifyItemRangeRemoved_TEST() + { + /* TEST CODE */ + try + { + _adapter.NotifyItemRangeRemoved(0, 1); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test NotifyItemRemoved. Check whether NotifyItemRemoved works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Adapter.NotifyItemRemoved M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void NotifyItemRemoved_TEST() + { + /* TEST CODE */ + try + { + _adapter.NotifyItemRemoved(0); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test OnAttachedToRecyclerView. Check whether OnAttachedToRecyclerView works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Adapter.OnAttachedToRecyclerView M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void OnAttachedToRecyclerView_TEST() + { + /* TEST CODE */ + try + { + _adapter.OnAttachedToRecyclerView(_flexibleView); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test OnBindViewHolder. Check whether OnBindViewHolder works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Adapter.OnBindViewHolder M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void OnBindViewHolder_TEST() + { + /* TEST CODE */ + try + { + var viewHolder = new FlexibleView.ViewHolder(new ListItemView()); + _adapter.OnBindViewHolder(viewHolder, 0); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test OnCreateViewHolder. Check whether OnCreateViewHolder works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Adapter.OnCreateViewHolder M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void OnCreateViewHolder_TEST() + { + /* TEST CODE */ + var viewHolder = _adapter.OnCreateViewHolder(0); + Assert.IsNotNull(viewHolder, "should be not null!"); + Assert.IsInstanceOf(viewHolder, "Should be an instance of ViewHolder!"); + } + + [Test] + [Category("P1")] + [Description("Test OnDestroyViewHolder. Check whether OnDestroyViewHolder works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Adapter.OnDestroyViewHolder M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void OnDestroyViewHolder_TEST() + { + /* TEST CODE */ + try + { + var viewHolder = _adapter.OnCreateViewHolder(20); + _adapter.OnDestroyViewHolder(viewHolder); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test OnDetachedFromRecyclerView. Check whether OnDetachedFromRecyclerView works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Adapter.OnDetachedFromRecyclerView M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void OnDetachedFromRecyclerView_TEST() + { + /* TEST CODE */ + try + { + _adapter.OnDetachedFromRecyclerView(_flexibleView); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test OnViewAttachedToWindow. Check whether OnViewAttachedToWindow works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Adapter.OnViewAttachedToWindow M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void OnViewAttachedToWindow_TEST() + { + /* TEST CODE */ + try + { + var viewHolder = new FlexibleView.ViewHolder(new ListItemView()); + _adapter.OnViewAttachedToWindow(viewHolder); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test OnViewDetachedFromWindow. Check whether OnViewDetachedFromWindow works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Adapter.OnViewDetachedFromWindow M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void OnViewDetachedFromWindow_TEST() + { + /* TEST CODE */ + try + { + var viewHolder = new FlexibleView.ViewHolder(new ListItemView()); + _adapter.OnViewDetachedFromWindow(viewHolder); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test OnViewRecycled. Check whether OnViewRecycled works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Adapter.OnViewRecycled M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void OnViewRecycled_TEST() + { + /* TEST CODE */ + try + { + var viewHolder = new FlexibleView.ViewHolder(new ListItemView()); + _adapter.OnViewRecycled(viewHolder); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSFlexibleView.ItemClickEventArgs.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSFlexibleView.ItemClickEventArgs.cs new file mode 100755 index 000000000..60163195c --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSFlexibleView.ItemClickEventArgs.cs @@ -0,0 +1,63 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.FlexibleView.ItemClickEventArgs Tests")] + public class FlexibleViewItemClickEventArgsTests + { + private const string TAG = "Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("FlexibleView.ItemClickEventArgsTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a ItemClickEventArgs object. Check whether ItemClickEventArgs is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.ItemClickEventArgs.ItemClickEventArgs C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ItemClickEventArgs_INIT() + { + /* TEST CODE */ + var itemClickEventArgs = new Components.FlexibleView.ItemClickEventArgs(); + Assert.IsNotNull(itemClickEventArgs, "Can't create success object ItemClickEventArgs"); + Assert.IsInstanceOf(itemClickEventArgs, "Should be an instance of ItemClickEventArgs type."); + } + + + [Test] + [Category("P1")] + [Description("Test ClickedView. Check whether ClickedView is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.ItemClickEventArgs.ClickedView A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ClickedView_SET_GET_VALUE() + { + /* TEST CODE */ + var itemClickEventArgs = new Components.FlexibleView.ItemClickEventArgs(); + var viewHolder = new FlexibleView.ViewHolder(new ListItemView()); + itemClickEventArgs.ClickedView = viewHolder; + Assert.IsNotNull(itemClickEventArgs.ClickedView, "Should be not null"); + Assert.IsInstanceOf(itemClickEventArgs.ClickedView, "Should be an instance of itemClickEventArgs.ClickedView"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSFlexibleView.ItemTouchEventArgs.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSFlexibleView.ItemTouchEventArgs.cs new file mode 100755 index 000000000..e1be03efd --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSFlexibleView.ItemTouchEventArgs.cs @@ -0,0 +1,63 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.FlexibleView.ItemTouchEventArgs Tests")] + public class FlexibleViewItemTouchEventArgsTests + { + private const string TAG = "Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("FlexibleView.ItemTouchEventArgsTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a ItemTouchEventArgs object. Check whether ItemTouchEventArgs is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.ItemTouchEventArgs.ItemTouchEventArgs C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ItemTouchEventArgs_INIT() + { + /* TEST CODE */ + var itemTouchEventArgs = new Components.FlexibleView.ItemTouchEventArgs(); + Assert.IsNotNull(itemTouchEventArgs, "Can't create success object ItemTouchEventArgs"); + Assert.IsInstanceOf(itemTouchEventArgs, "Should be an instance of ItemTouchEventArgs type."); + } + + + [Test] + [Category("P1")] + [Description("Test TouchedView. Check whether TouchedView is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.ItemTouchEventArgs.TouchedView A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void TouchedView_SET_GET_VALUE() + { + /* TEST CODE */ + var itemTouchEventArgs = new Components.FlexibleView.ItemTouchEventArgs(); + var viewHolder = new FlexibleView.ViewHolder(new ListItemView()); + itemTouchEventArgs.TouchedView = viewHolder; + Assert.IsNotNull(itemTouchEventArgs.TouchedView, "Should be not null"); + Assert.IsInstanceOf(itemTouchEventArgs.TouchedView, "Should be an instance of ItemTouchEventArgs.ClickedView"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSFlexibleView.LayoutManager.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSFlexibleView.LayoutManager.cs new file mode 100755 index 000000000..813bf7903 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSFlexibleView.LayoutManager.cs @@ -0,0 +1,755 @@ +using NUnit.Framework; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; +using System.Collections.Generic; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.FlexibleView.LayoutManager Tests")] + public class FlexibleViewLayoutManagerTests + { + private const string TAG = "NUI.Components"; + private FlexibleView _flexibleView = null; + private ListBridge _adapter = null; + private FlexibleView.LayoutManager _layoutManager = null; + private string _trackImageUrl = ""; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("ScrollBarTests"); + App.MainTitleChangeBackgroundColor(null); + CreateFlexiableView(); + } + + public void CreateFlexiableView() + { + _flexibleView = new FlexibleView(); + _flexibleView.Name = "RecyclerView"; + _flexibleView.Position2D = new Position2D(500, 200); + _flexibleView.Size2D = new Size2D(400, 450); + _flexibleView.Padding = new Extents(10, 10, 10, 10); + _flexibleView.BackgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.4f); + _flexibleView.Focusable = true; + + List dataList = new List(); + for (int i = 0; i < 132; ++i) + { + dataList.Add(new ListItemData(i)); + } + _adapter = new ListBridge(dataList); + _flexibleView.SetAdapter(_adapter); + _layoutManager = new LinearLayoutManager(LinearLayoutManager.VERTICAL); + _flexibleView.SetLayoutManager(_layoutManager); + + ScrollBar scrollBar = new ScrollBar(); + scrollBar.Direction = ScrollBar.DirectionType.Vertical; + scrollBar.Position2D = new Position2D(394, 2); + scrollBar.Size2D = new Size2D(4, 446); + scrollBar.TrackColor = Color.Green; + scrollBar.ThumbSize = new Size2D(4, 30); + scrollBar.ThumbColor = Color.Yellow; + scrollBar.TrackImageURL = _trackImageUrl; + _flexibleView.AttachScrollBar(scrollBar); + + Window.Instance.Add(_flexibleView); + FocusManager.Instance.SetCurrentFocusView(_flexibleView); + _flexibleView.FocusedItemIndex = 0; + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + Window.Instance.Remove(_flexibleView); + _flexibleView.Dispose(); + _flexibleView = null; + } + + [Test] + [Category("P1")] + [Description("Create a LayoutManager object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.LayoutManager C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void LayoutManager_INIT() + { + /* TEST CODE */ + var layoutManager = new LinearLayoutManager(LinearLayoutManager.VERTICAL); + Assert.IsNotNull(layoutManager, "Can't create success object FlexibleView.ViewHolder"); + Assert.IsInstanceOf(layoutManager, "Should be an instance of LinearLayoutManager"); + } + + [Test] + [Category("P1")] + [Description("Test FocusPosition.Check whether FocusPosition is readable.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.FocusPosition A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void FocusPosition_GET_VALUE() + { + /* TEST CODE */ + _layoutManager.ChangeFocus(0); + Assert.AreEqual(0, _layoutManager.FocusPosition, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test ItemCount.Check whether ItemCount is readable.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.ItemCount A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ItemCount_GET_VALUE() + { + /* TEST CODE */ + Assert.AreEqual(132, _layoutManager.ItemCount, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test CanScrollHorizontally. Check whether CanScrollHorizontally works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.CanScrollHorizontally M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void CanScrollHorizontally_TEST() + { + /* TEST CODE */ + Assert.IsFalse(_layoutManager.CanScrollHorizontally(), "Should be false!"); + var layoutManager = new LinearLayoutManager(LinearLayoutManager.HORIZONTAL); + Assert.IsTrue(layoutManager.CanScrollHorizontally(), "Should be true"); + } + + [Test] + [Category("P1")] + [Description("Test AddView. Check whether AddView works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.AddView M")] + [Property("SPEC_URL", "-")] + [Property("COVPARAM", "FlexibleView.ViewHolder")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void AddView_TEST() + { + /* TEST CODE */ + try + { + var viewHolder = new FlexibleView.ViewHolder(new ListItemView()); + _layoutManager.AddView(viewHolder); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test AddView. Check whether AddView works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.AddView M")] + [Property("SPEC_URL", "-")] + [Property("COVPARAM", "FlexibleView.ViewHolder, int")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void AddView_TEST_WITH_INT() + { + /* TEST CODE */ + try + { + var viewHolder = new FlexibleView.ViewHolder(new ListItemView()); + _layoutManager.AddView(viewHolder, -1); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test CanScrollVertically. Check whether CanScrollVertically works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.CanScrollVertically M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void CanScrollVertically_TEST() + { + /* TEST CODE */ + Assert.IsTrue(_layoutManager.CanScrollVertically(), "Should be true!"); + var layoutManager = new LinearLayoutManager(LinearLayoutManager.HORIZONTAL); + Assert.IsFalse(layoutManager.CanScrollVertically(), "Should be false!"); + } + + [Test] + [Category("P1")] + [Description("Test ComputeScrollExtent. Check whether ComputeScrollExtent works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.ComputeScrollExtent M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ComputeScrollExtent_TEST() + { + /* TEST CODE */ + for (int i = 0; i < 50; i++) + { + _flexibleView.MoveFocus(FlexibleView.LayoutManager.Direction.Down); + } + _flexibleView.Relayout += ComputeScrollExtentRelayout; + _flexibleView.Relayout -= ComputeScrollExtentRelayout; + } + + private void ComputeScrollExtentRelayout(object sender, EventArgs args) + { + Assert.Greater(0, _layoutManager.ComputeScrollExtent(), "Should be greater than 0!"); + } + + [Test] + [Category("P1")] + [Description("Test ComputeScrollOffset. Check whether ComputeScrollOffset works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.ComputeScrollOffset M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ComputeScrollOffset_TEST() + { + /* TEST CODE */ + for (int i = 0; i < 50; i++) + { + _flexibleView.MoveFocus(FlexibleView.LayoutManager.Direction.Down); + } + _flexibleView.Relayout += ComputeScrollOffsetRelayout; + _flexibleView.Relayout -= ComputeScrollOffsetRelayout; + } + + private void ComputeScrollOffsetRelayout(object sender, EventArgs args) + { + Assert.AreEqual(0, _layoutManager.ComputeScrollOffset(), "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test ComputeScrollRange. Check whether ComputeScrollRange works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.ComputeScrollRange M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ComputeScrollRange_TEST() + { + /* TEST CODE */ + for (int i = 0; i < 50; i++) + { + _flexibleView.MoveFocus(FlexibleView.LayoutManager.Direction.Down); + } + _flexibleView.Relayout += ComputeScrollRangeRelayout; + _flexibleView.Relayout -= ComputeScrollRangeRelayout; + + } + + private void ComputeScrollRangeRelayout(object sender, EventArgs args) + { + Assert.Greater(0, _layoutManager.ComputeScrollRange(), "Should be greater than 0!"); + } + + [Test] + [Category("P1")] + [Description("Test FindItemViewByPosition. Check whether FindItemViewByPosition works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.FindItemViewByPosition M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void FindItemViewByPosition_TEST() + { + /* TEST CODE */ + for (int i = 0; i < 20; i++) + { + _flexibleView.MoveFocus(FlexibleView.LayoutManager.Direction.Down); + } + _flexibleView.Relayout += FindItemViewByPositionRelayout; + _flexibleView.Relayout -= FindItemViewByPositionRelayout; + } + + private void FindItemViewByPositionRelayout(object sender, EventArgs args) + { + var viewHolder = _layoutManager.FindItemViewByPosition(0); + Assert.IsNotNull(viewHolder, "Should be not null!"); + Assert.IsInstanceOf(viewHolder, "Should be an instance of ViewHolder!"); + } + + [Test] + [Category("P1")] + [Description("Test GetChildAt. Check whether GetChildAt works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.GetChildAt M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetChildAt_TEST() + { + /* TEST CODE */ + for (int i = 0; i < 20; i++) + { + _flexibleView.MoveFocus(FlexibleView.LayoutManager.Direction.Down); + } + _flexibleView.Relayout += GetChildAtRelayout; + _flexibleView.Relayout -= GetChildAtRelayout; + + } + + private void GetChildAtRelayout(object sender, EventArgs args) + { + var viewHolder = _layoutManager.GetChildAt(0); + Assert.IsNotNull(viewHolder, "Should be not null!"); + Assert.IsInstanceOf(viewHolder, "Should be an instance of ViewHolder!"); + } + + [Test] + [Category("P1")] + [Description("Test GetChildCount. Check whether GetChildCount works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.GetChildCount M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetChildCount_TEST() + { + /* TEST CODE */ + for (int i = 0; i < 20; i++) + { + _flexibleView.MoveFocus(FlexibleView.LayoutManager.Direction.Down); + } + _flexibleView.Relayout += GetChildCountRelayout; + _flexibleView.Relayout -= GetChildCountRelayout; + } + + private void GetChildCountRelayout(object sender, EventArgs args) + { + Assert.Greater(0, _layoutManager.GetChildCount(), "Should be greater than 0!"); + } + + [Test] + [Category("P1")] + [Description("Test GetHeight. Check whether GetHeight works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.GetHeight M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetHeight_TEST() + { + /* TEST CODE */ + Assert.AreEqual(450, _layoutManager.GetHeight(), "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test GetWidth. Check whether GetWidth works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.GetWidth M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetWidth_TEST() + { + /* TEST CODE */ + Assert.AreEqual(400, _layoutManager.GetWidth(), "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test GetPaddingBottom. Check whether GetPaddingBottom works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.GetPaddingBottom M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetPaddingBottom_TEST() + { + /* TEST CODE */ + Assert.AreEqual(10, _layoutManager.GetPaddingBottom(), "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test GetPaddingLeft. Check whether GetPaddingLeft works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.GetPaddingLeft M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetPaddingLeft_TEST() + { + /* TEST CODE */ + Assert.AreEqual(10, _layoutManager.GetPaddingLeft(), "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test GetPaddingRight. Check whether GetPaddingRight works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.GetPaddingRight M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetPaddingRight_TEST() + { + /* TEST CODE */ + Assert.AreEqual(10, _layoutManager.GetPaddingRight(), "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test GetPaddingTop. Check whether GetPaddingTop works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.GetPaddingTop M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetPaddingTop_TEST() + { + /* TEST CODE */ + Assert.AreEqual(10, _layoutManager.GetPaddingTop(), "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test ChangeFocus. Check whether ChangeFocus works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.ChangeFocus M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ChangeFocus_TEST() + { + /* TEST CODE */ + _layoutManager.ChangeFocus(2); + Assert.AreEqual(2, _layoutManager.FocusPosition, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test GetNextPosition. Check whether GetNextPosition works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.GetNextPosition M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetNextPosition_TEST() + { + /* TEST CODE */ + var myLayoutManager = new MyLayoutManager(); + Assert.AreEqual(1, myLayoutManager.TestGetNextPosition(0, FlexibleView.LayoutManager.Direction.Down), "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test LayoutChild. Check whether LayoutChild works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.LayoutChild M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void LayoutChild_TEST() + { + /* TEST CODE */ + try + { + var viewHolder = new FlexibleView.ViewHolder(new ListItemView()); + _layoutManager.LayoutChild(viewHolder, 10, 10, 200, 200); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test OffsetChildrenHorizontal. Check whether OffsetChildrenHorizontal works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.OffsetChildrenHorizontal M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void OffsetChildrenHorizontal_TEST() + { + /* TEST CODE */ + try + { + _layoutManager.OffsetChildrenHorizontal(0, true); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test OffsetChildrenVertical. Check whether OffsetChildrenVertical works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.OffsetChildrenVertical M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void OffsetChildrenVertical_TEST() + { + /* TEST CODE */ + try + { + _layoutManager.OffsetChildrenVertical(0, true); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test OnLayoutChildren. Check whether OnLayoutChildren works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.OnLayoutChildren M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void OnLayoutChildren_TEST() + { + /* TEST CODE */ + try + { + _flexibleView.MoveFocus(FlexibleView.LayoutManager.Direction.Down); + _flexibleView.Relayout += OnLayoutChildrenRelayout; + _flexibleView.Relayout -= OnLayoutChildrenRelayout; + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + private void OnLayoutChildrenRelayout(object sender, EventArgs args) + { + var recycler = _flexibleView.GetRecycler(); + _layoutManager.OnLayoutChildren(recycler); + } + + [Test] + [Category("P1")] + [Description("Test OnLayoutCompleted. Check whether OnLayoutCompleted works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.OnLayoutCompleted M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void OnLayoutCompleted_TEST() + { + /* TEST CODE */ + try + { + _layoutManager.OnLayoutCompleted(); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test ScrollToPosition. Check whether ScrollToPosition works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.ScrollToPosition M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ScrollToPosition_TEST() + { + /* TEST CODE */ + try + { + _layoutManager.ScrollToPosition(0); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test ScrollToPositionWithOffset. Check whether ScrollToPositionWithOffset works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.ScrollToPositionWithOffset M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ScrollToPositionWithOffset_TEST() + { + /* TEST CODE */ + try + { + _layoutManager.ScrollToPositionWithOffset(0, 0); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test RecycleChildren. Check whether RecycleChildren works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.RecycleChildren M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void RecycleChildren_TEST() + { + /* TEST CODE */ + try + { + var recycler = new FlexibleView.Recycler(_flexibleView); + _layoutManager.RecycleChildren(recycler, 0, 0, true); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test ScrapAttachedViews. Check whether ScrapAttachedViews works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.ScrapAttachedViews M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ScrapAttachedViews_TEST() + { + /* TEST CODE */ + try + { + var recycler = new FlexibleView.Recycler(_flexibleView); + _layoutManager.ScrapAttachedViews(recycler); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test RelayoutRequest. Check whether RelayoutRequest works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.RelayoutRequest M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void RelayoutRequest_TEST() + { + /* TEST CODE */ + try + { + _layoutManager.RelayoutRequest(); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test RemoveAndRecycleViewAt. Check whether RemoveAndRecycleViewAt works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.RemoveAndRecycleViewAt M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void RemoveAndRecycleViewAt_TEST() + { + /* TEST CODE */ + try + { + _flexibleView.MoveFocus(FlexibleView.LayoutManager.Direction.Down); + _flexibleView.Relayout += RemoveAndRecycleViewAtRelayout; + _flexibleView.Relayout -= RemoveAndRecycleViewAtRelayout; + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + private void RemoveAndRecycleViewAtRelayout(object sender, EventArgs args) + { + var recycler = _flexibleView.GetRecycler(); + _layoutManager.RemoveAndRecycleViewAt(0, recycler); + } + + [Test] + [Category("P1")] + [Description("Test ScrollVerticallyBy. Check whether ScrollVerticallyBy works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.ScrollVerticallyBy M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ScrollVerticallyBy_TEST() + { + /* TEST CODE */ + try + { + var recycler = new FlexibleView.Recycler(_flexibleView); + _layoutManager.ScrollVerticallyBy(0, recycler, true); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test ScrollHorizontallyBy. Check whether ScrollHorizontallyBy works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.LayoutManager.ScrollHorizontallyBy M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ScrollHorizontallyBy_TEST() + { + /* TEST CODE */ + try + { + var recycler = new FlexibleView.Recycler(_flexibleView); + _layoutManager.ScrollHorizontallyBy(0, recycler, true); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + } + + public class MyLayoutManager : FlexibleView.LayoutManager + { + public override void OnLayoutChildren(FlexibleView.Recycler recycler) + { + } + + public int TestGetNextPosition(int position, Direction direction) + { + return GetNextPosition(position, direction); + } + + protected override int GetNextPosition(int position, Direction direction) + { + switch (direction) + { + case FlexibleView.LayoutManager.Direction.Up: + if (position > 0) + { + return position - 1; + } + break; + case FlexibleView.LayoutManager.Direction.Down: + return position + 1; + } + + return FlexibleView.NO_POSITION; + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSFlexibleView.Recycler.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSFlexibleView.Recycler.cs new file mode 100755 index 000000000..9626ed68a --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSFlexibleView.Recycler.cs @@ -0,0 +1,223 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.FlexibleView.Recycler Tests")] + public class FlexibleViewRecyclerTests + { + private const string TAG = "NUI.Components"; + private FlexibleView _flexibleView = null; + private ListBridge _adapter = null; + private FlexibleView.LayoutManager _layoutManager = null; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("ScrollBarTests"); + App.MainTitleChangeBackgroundColor(null); + CreateFlexiableView(); + } + + public void CreateFlexiableView() + { + _flexibleView = new FlexibleView(); + _flexibleView.Name = "RecyclerView"; + _flexibleView.Position2D = new Position2D(500, 200); + _flexibleView.Size2D = new Size2D(400, 450); + _flexibleView.Padding = new Extents(10, 10, 10, 10); + _flexibleView.BackgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.4f); + _flexibleView.Focusable = true; + + List dataList = new List(); + for (int i = 0; i < 131; ++i) + { + dataList.Add(new ListItemData(i)); + } + _adapter = new ListBridge(dataList); + _flexibleView.SetAdapter(_adapter); + _layoutManager = new LinearLayoutManager(LinearLayoutManager.VERTICAL); + _flexibleView.SetLayoutManager(_layoutManager); + + Window.Instance.Add(_flexibleView); + FocusManager.Instance.SetCurrentFocusView(_flexibleView); + _flexibleView.FocusedItemIndex = 0; + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + Window.Instance.Remove(_flexibleView); + _flexibleView.Dispose(); + _flexibleView = null; + } + + [Test] + [Category("P1")] + [Description("Create a Recycler object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Recycler.Recycler C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Recycler_INIT() + { + /* TEST CODE */ + var recycler = new FlexibleView.Recycler(_flexibleView); + Assert.IsNotNull(recycler, "Can't create success object FlexibleView.Recycler"); + Assert.IsInstanceOf(recycler, "Should be an instance of FlexibleView.Recycler type."); + } + + [Test] + [Category("P1")] + [Description("Test SetViewCacheSize. Check SetViewCacheSize whether works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Recycler.SetViewCacheSize M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void SetViewCacheSize_TEST() + { + /* TEST CODE */ + var recycler = new FlexibleView.Recycler(_flexibleView); + try + { + recycler.SetViewCacheSize(2); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test GetViewForPosition. Check whether GetViewForPosition works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Recycler.GetViewForPosition M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetViewForPosition_TEST() + { + /* TEST CODE */ + try + { + _flexibleView.MoveFocus(FlexibleView.LayoutManager.Direction.Down); + _flexibleView.Relayout += GetViewForPositionRelayout; + _flexibleView.Relayout -= GetViewForPositionRelayout; + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + private void GetViewForPositionRelayout(object sender, EventArgs args) + { + var recycler = _flexibleView.GetRecycler(); + var viewHolder = recycler.GetViewForPosition(0); + Assert.IsNotNull(viewHolder, "should be not null"); + Assert.IsInstanceOf(viewHolder, "Should be an instance of ViewHolder!"); + } + + [Test] + [Category("P1")] + [Description("Test GetScrapCount. Check whether GetScrapCount works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Recycler.GetScrapCount M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetScrapCount_TEST() + { + /* TEST CODE */ + var recycler = new FlexibleView.Recycler(_flexibleView); + try + { + Assert.AreEqual(0, recycler.GetScrapCount(), "Should be equal"); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test RecycleView. Check whether GetViewForPosition works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Recycler.RecycleView M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void RecycleView_TEST() + { + /* TEST CODE */ + try + { + _flexibleView.MoveFocus(FlexibleView.LayoutManager.Direction.Down); + _flexibleView.Relayout += RecycleViewRelayout; + _flexibleView.Relayout -= RecycleViewRelayout; + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + private void RecycleViewRelayout(object sender, EventArgs args) + { + FlexibleView.Recycler recycler = _flexibleView.GetRecycler(); + FlexibleView.ViewHolder viewHolder = recycler.GetViewForPosition(0); + recycler.RecycleView(viewHolder); + } + + [Test] + [Category("P1")] + [Description("Test GetScrapViewAt. Check whether GetScrapViewAt works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Recycler.GetScrapViewAt M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetScrapViewAt_TEST() + { + /* TEST CODE */ + var recycler = new FlexibleView.Recycler(_flexibleView); + try + { + if (recycler.GetScrapCount() != 0) + { + var viewHolder = recycler.GetScrapViewAt(0); + Assert.IsNotNull(viewHolder, "should be not null"); + Assert.IsInstanceOf(viewHolder, "should be an instance of FlexibleView.ViewHolder"); + } + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test Clear. Check whether Clear works or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.Recycler.Clear M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Clear_TEST() + { + /* TEST CODE */ + var recycler = new FlexibleView.Recycler(_flexibleView); + try + { + recycler.Clear(); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSFlexibleView.ViewHolder.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSFlexibleView.ViewHolder.cs new file mode 100755 index 000000000..38ccd7f2e --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSFlexibleView.ViewHolder.cs @@ -0,0 +1,254 @@ +using NUnit.Framework; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; +using System.Collections.Generic; +using System; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.FlexibleView.ViewHolder Tests")] + public class FlexibleViewViewHolderTests + { + private const string TAG = "NUI.Components"; + private FlexibleView _flexibleView = null; + private ListBridge _adapter = null; + private FlexibleView.LayoutManager _layoutManager = null; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("ScrollBarTests"); + App.MainTitleChangeBackgroundColor(null); + CreateFlexiableView(); + } + + public void CreateFlexiableView() + { + _flexibleView = new FlexibleView(); + _flexibleView.Name = "RecyclerView"; + _flexibleView.Position2D = new Position2D(500, 200); + _flexibleView.Size2D = new Size2D(400, 450); + _flexibleView.Padding = new Extents(10, 10, 10, 10); + _flexibleView.BackgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.4f); + _flexibleView.Focusable = true; + + List dataList = new List(); + for (int i = 0; i < 131; ++i) + { + dataList.Add(new ListItemData(i)); + } + _adapter = new ListBridge(dataList); + _flexibleView.SetAdapter(_adapter); + _layoutManager = new LinearLayoutManager(LinearLayoutManager.VERTICAL); + _flexibleView.SetLayoutManager(_layoutManager); + + Window.Instance.Add(_flexibleView); + FocusManager.Instance.SetCurrentFocusView(_flexibleView); + _flexibleView.FocusedItemIndex = 0; + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + Window.Instance.Remove(_flexibleView); + _flexibleView.Dispose(); + _flexibleView = null; + } + + [Test] + [Category("P1")] + [Description("Create a ViewHolder object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.ViewHolder.ViewHolder C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ViewHolder_INIT() + { + /* TEST CODE */ + var view = new View(); + view.Size2D = new Size2D(200, 200); + view.BackgroundColor = Color.Green; + var viewHolder = new FlexibleView.ViewHolder(view); + Assert.IsNotNull(viewHolder, "Can't create success object FlexibleView.ViewHolder"); + Assert.IsInstanceOf(viewHolder, "Should be an instance of FlexibleView.ViewHolder type."); + } + + [Test] + [Category("P1")] + [Description("Test ItemView.Check whether ItemView is readable.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.ViewHolder.ItemView A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ItemView_GET_VALUE() + { + /* TEST CODE */ + var viewHolder = new FlexibleView.ViewHolder(new ListItemView()); + Assert.IsNotNull(viewHolder, "should be not null!"); + Assert.IsInstanceOf(viewHolder, "Should be an instance of ViewHolder"); + } + + [Test] + [Category("P1")] + [Description("Test Left.Check whether Left is readable.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.ViewHolder.Left A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Left_GET_VALUE() + { + /* TEST CODE */ + var view = new View(); + view.Size2D = new Size2D(200, 200); + view.BackgroundColor = Color.Green; + view.Position2D = new Position2D(200, 200); + view.Margin = new Extents(20, 20, 20, 20); + var viewHolder = new FlexibleView.ViewHolder(view); + + Assert.AreEqual(180, viewHolder.Left, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test Right.Check whether Right is readable.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.ViewHolder.Right A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Right_GET_VALUE() + { + /* TEST CODE */ + var view = new View(); + view.Size2D = new Size2D(200, 200); + view.BackgroundColor = Color.Green; + view.Position2D = new Position2D(200, 200); + view.Margin = new Extents(20, 20, 20, 20); + var viewHolder = new FlexibleView.ViewHolder(view); + + Assert.AreEqual(420, viewHolder.Right, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test Top.Check whether Top is readable.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.ViewHolder.Top A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Top_GET_VALUE() + { + /* TEST CODE */ + var view = new View(); + view.Size2D = new Size2D(200, 200); + view.BackgroundColor = Color.Green; + view.Position2D = new Position2D(200, 200); + view.Margin = new Extents(20, 20, 20, 20); + var viewHolder = new FlexibleView.ViewHolder(view); + + Assert.AreEqual(180, viewHolder.Top, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test Bottom.Check whether Bottom is readable.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.ViewHolder.Bottom A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Bottom_GET_VALUE() + { + /* TEST CODE */ + var view = new View(); + view.Size2D = new Size2D(200, 200); + view.BackgroundColor = Color.Green; + view.Position2D = new Position2D(200, 200); + view.Margin = new Extents(20, 20, 20, 20); + var viewHolder = new FlexibleView.ViewHolder(view); + + Assert.AreEqual(420, viewHolder.Bottom, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test LayoutPosition.Check whether LayoutPosition is readable.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.ViewHolder.LayoutPosition A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void LayoutPosition_GET_VALUE() + { + /* TEST CODE */ + _flexibleView.Relayout += LayoutPositionRelayout; + _flexibleView.Relayout -= LayoutPositionRelayout; + } + + private void LayoutPositionRelayout(object sender, EventArgs args) + { + var viewHolder = _flexibleView.FindViewHolderForLayoutPosition(0); + Assert.AreEqual(0, viewHolder.LayoutPosition, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test AdapterPosition.Check whether AdapterPosition is readable.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.ViewHolder.AdapterPosition A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void AdapterPosition_GET_VALUE() + { + /* TEST CODE */ + _flexibleView.Relayout += AdapterPositionRelayout; + _flexibleView.Relayout -= AdapterPositionRelayout; + } + + private void AdapterPositionRelayout(object sender, EventArgs args) + { + var viewHolder = _flexibleView.FindViewHolderForAdapterPosition(0); + Assert.AreEqual(0, viewHolder.AdapterPosition, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test OldPosition.Check whether OldPosition is readable.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.ViewHolder.OldPosition A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void OldPosition_GET_VALUE() + { + /* TEST CODE */ + _flexibleView.Relayout += OldPositionRelayout; + _flexibleView.Relayout -= OldPositionRelayout; + } + + private void OldPositionRelayout(object sender, EventArgs args) + { + var viewHolder = _flexibleView.FindViewHolderForAdapterPosition(0); + Assert.AreEqual(0, viewHolder.OldPosition, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test ItemViewType.Check whether ItemViewType is readable.")] + [Property("SPEC", "Tizen.NUI.Components.FlexibleView.ViewHolder.ItemViewType A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ItemViewType_SET_GET_VALUE() + { + /* TEST CODE */ + var view = new View(); + view.Size2D = new Size2D(200, 200); + view.BackgroundColor = Color.Green; + var viewHolder = new FlexibleView.ViewHolder(view); + viewHolder.ItemViewType = 1; + Assert.AreEqual(1, viewHolder.ItemViewType, "Should be equals to the set value of ItemViewType."); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSFloatSelector.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSFloatSelector.cs new file mode 100755 index 000000000..85f0468b9 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSFloatSelector.cs @@ -0,0 +1,64 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.FloatSelector Tests")] + public class FloatSelectorTests + { + private const string TAG = "NUI.Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("FloatSelectorTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a FloatSelector object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.FloatSelector.FloatSelector C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void FloatSelector_INIT() + { + /* TEST CODE */ + var floatSelector = new FloatSelector(); + Assert.IsNotNull(floatSelector, "Can't create success object FloatSelector"); + Assert.IsInstanceOf(floatSelector, "Should be an instance of FloatSelector type."); + } + + [Test] + [Category("P1")] + [Description("Test Clone. Check Whether Clone works or not")] + [Property("SPEC", "Tizen.NUI.Components.FloatSelector.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Clone_TEST() + { + /* TEST CODE */ + var floatSelector1 = new FloatSelector(); + floatSelector1.All = 1.0f; + var floatSelector = floatSelector1.Clone(); + Assert.IsNotNull(floatSelector, "should be not null!"); + Assert.AreEqual(1.0f, floatSelector.All); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSGridLayoutManager.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSGridLayoutManager.cs new file mode 100755 index 000000000..db2d20462 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSGridLayoutManager.cs @@ -0,0 +1,106 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; +using System.Threading.Tasks; +using System.Collections.Generic; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.GridLayoutManager Tests")] + public class GridLayoutManagerTests + { + private const string TAG = "NUI.Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("GridLayoutManagerTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a GridLayoutManager object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.GridLayoutManager.GridLayoutManager C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GridLayoutManager_INIT() + { + /* TEST CODE */ + var layoutManager = new GridLayoutManager(10, LinearLayoutManager.VERTICAL); + Assert.IsNotNull(layoutManager, "Can't create success object GridLayoutManager"); + Assert.IsInstanceOf(layoutManager, "Should be an instance of GridLayoutManager type."); + } + + [Test] + [Category("P1")] + [Description("Test GetNextPosition. Check whether GetNextPosition works or not.")] + [Property("SPEC", "Tizen.NUI.Components.GridLayoutManager.GetNextPosition M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetNextPosition_TEST() + { + /* TEST CODE */ + try + { + var myGrideLayoutManager = new MyGridLayoutManager(3, LinearLayoutManager.HORIZONTAL); + Assert.AreEqual(3, myGrideLayoutManager.TestGetNextPosition(0, FlexibleView.LayoutManager.Direction.Right), "Should be equal!"); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + } + + public class MyGridLayoutManager : GridLayoutManager + { + private int _mSpanCount; + public MyGridLayoutManager(int spanCount, int orientation) : base(spanCount, orientation) + { + _mSpanCount = spanCount; + } + public int TestGetNextPosition(int position, Direction direction) + { + return GetNextPosition(position, direction); + } + + protected override int GetNextPosition(int position, Direction direction) + { + switch (direction) + { + case FlexibleView.LayoutManager.Direction.Left: + if (position >= _mSpanCount) + { + return position - _mSpanCount; + } + break; + case FlexibleView.LayoutManager.Direction.Right: + return position + _mSpanCount; + case FlexibleView.LayoutManager.Direction.Up: + if (position % _mSpanCount > 0) + { + return position - 1; + } + break; + case FlexibleView.LayoutManager.Direction.Down: + return position + 1; + } + + return FlexibleView.NO_POSITION; + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSImageAttributes.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSImageAttributes.cs new file mode 100755 index 000000000..e3077acec --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSImageAttributes.cs @@ -0,0 +1,124 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.ImageAttributes Tests")] + public class ImageAttributesTests + { + private const string TAG = "NUI.Components"; + private string _imagePath = ""; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("ImageAttributesTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a ImageAttributes object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.ImageAttributes.ImageAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ImageAttributes_INIT() + { + /* TEST CODE */ + var imageAttributes = new ImageAttributes(); + Assert.IsNotNull(imageAttributes, "Can't create success object ImageAttributes"); + Assert.IsInstanceOf(imageAttributes, "Should be an instance of ImageAttributes type."); + } + + [Test] + [Category("P1")] + [Description("Create a ImageAttributes object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.ImageAttributes.ImageAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "ImageAttributes")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ImageAttributes_INIT_WITH_IMAGEATTRIBUTES() + { + /* TEST CODE */ + var imageAttributes1 = new ImageAttributes(); + var imageAttributes = new ImageAttributes(imageAttributes1); + Assert.IsNotNull(imageAttributes, "Can't create success object ImageAttributes"); + Assert.IsInstanceOf(imageAttributes, "Should be an instance of ImageAttributes type."); + } + + [Test] + [Category("P1")] + [Description("Test ResourceURL.Check whether ResourceURL is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ImageAttributes.ResourceURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ResourceURL_SET_GET_VALUE() + { + /* TEST CODE */ + var imageAttributes = new ImageAttributes(); + imageAttributes.ResourceURL = new StringSelector { All = _imagePath }; + Assert.AreEqual(_imagePath, imageAttributes.ResourceURL.All, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test Border.Check whether Border is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ImageAttributes.Border A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Border_SET_GET_VALUE() + { + /* TEST CODE */ + var imageAttributes = new ImageAttributes(); + imageAttributes.Border = new RectangleSelector { All = new Rectangle(1, 2, 3, 4) }; + Assert.AreEqual(1, imageAttributes.Border.All.X, "Should be equal!"); + Assert.AreEqual(2, imageAttributes.Border.All.Y, "Should be equal!"); + Assert.AreEqual(3, imageAttributes.Border.All.Width, "Should be equal!"); + Assert.AreEqual(4, imageAttributes.Border.All.Height, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test Clone. Check Whether Clone works or not")] + [Property("SPEC", "Tizen.NUI.Components.ImageAttributes.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Clone_TEST() + { + /* TEST CODE */ + try + { + var imageAttributes = new ImageAttributes(); + imageAttributes.ResourceURL = new StringSelector() { All = _imagePath }; + var attributes = imageAttributes.Clone() as ImageAttributes; + Assert.IsNotNull(attributes, "Should be not null"); + Assert.IsInstanceOf(attributes, "Should be an instance of ImageAttributes type."); + Assert.AreEqual(_imagePath, attributes.ResourceURL.All, "Should be equal!"); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSInputField.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSInputField.cs new file mode 100755 index 000000000..e89ca2845 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSInputField.cs @@ -0,0 +1,682 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.InputField Tests")] + public class InputFieldTests + { + private const string TAG = "Components"; + private string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "Tizen.NUI.Components.Tests.png"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("InputFieldTests"); + App.MainTitleChangeBackgroundColor(null); + + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a InputField object. Check whether InputField is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.InputField C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void InputField_INIT() + { + /* TEST CODE */ + var inputField = new InputField(); + Assert.IsNotNull(inputField, "Can't create success object InputField"); + Assert.IsInstanceOf(inputField, "Should be an instance of InputField type."); + } + + [Test] + [Category("P1")] + [Description("Create a InputField object with attributes. Check whether object whose text is initialized is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.InputField C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "InputFieldAttributes")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void InputField_INIT_WITH_InputFieldAttributes() + { + /* TEST CODE */ + var inputField = new InputField(new InputFieldAttributes()); + Assert.IsNotNull(inputField, "Can't create success object InputField"); + Assert.IsInstanceOf(inputField, "Should be an instance of textLabel type."); + } + + [Test] + [Category("P1")] + [Description("Create a InputField object with string. Check whether object whose text is initialized is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.InputField C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "string")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void InputField_INIT_WITH_STRING() + { + /* TEST CODE */ + StyleManager.Instance.RegisterStyle("DefaultInputField", "Utility", typeof(UtilityDefaultInputFieldStyle), true); + + var inputField = new InputField("DefaultInputField"); + Assert.IsNotNull(inputField, "Can't create success object InputField"); + Assert.IsInstanceOf(inputField, "Should be an instance of InputField type."); + } + + [Test] + [Category("P1")] + [Description("Test StateEnabled. Check whether StateEnabled works or not.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.StateEnabled A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void StateEnabled_SET_GET_VALUE() + { + /* TEST CODE */ + var inputField = new InputField(); + Assert.IsInstanceOf(inputField, "Should be an instance of InputField type"); + inputField.StateEnabled = true; + Assert.AreEqual(true, inputField.StateEnabled, "Retrieved StateEnabled should be equal to set value"); + inputField.StateEnabled = false; + Assert.AreEqual(false, inputField.StateEnabled, "Retrieved StateEnabled should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test Text. Check whether Text works or not.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.Text A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void Text_SET_GET_VALUE() + { + /* TEST CODE */ + var inputField = new InputField(); + Assert.IsInstanceOf(inputField, "Should be an instance of InputField type"); + inputField.Text = "inputfield"; + Assert.AreEqual("inputfield", inputField.Text, "Retrieved Text width should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test HintText. Check whether HintText works or not.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.HintText A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void HintText_SET_GET_VALUE() + { + /* TEST CODE */ + var inputField = new InputField(); + Assert.IsInstanceOf(inputField, "Should be an instance of InputField type"); + inputField.HintText = "hinttext"; + Assert.AreEqual("hinttext", inputField.HintText, "Retrieved HintText should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test TextColor. Check whether TextColor works or not.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.TextColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void TextColor_SET_GET_VALUE() + { + /* TEST CODE */ + var inputField = new InputField(); + Color color = Color.Red; + inputField.TextColor = color; + Assert.AreEqual(color.R, inputField.TextColor.R, "Retrieved TextColor should be equal to set value"); + Assert.AreEqual(color.G, inputField.TextColor.G, "Retrieved TextColor should be equal to set value"); + Assert.AreEqual(color.B, inputField.TextColor.B, "Retrieved TextColor should be equal to set value"); + Assert.AreEqual(color.A, inputField.TextColor.A, "Retrieved TextColor should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test HintTextColor. Check whether HintTextColor works or not.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.HintTextColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void HintTextColor_SET_GET_VALUE() + { + /* TEST CODE */ + var inputField = new InputField(); + Color color = Color.Red; + inputField.HintTextColor = color; + Assert.AreEqual(color.R, inputField.HintTextColor.R, "Retrieved HintTextColor should be equal to set value"); + Assert.AreEqual(color.G, inputField.HintTextColor.G, "Retrieved HintTextColor should be equal to set value"); + Assert.AreEqual(color.B, inputField.HintTextColor.B, "Retrieved HintTextColor should be equal to set value"); + Assert.AreEqual(color.A, inputField.HintTextColor.A, "Retrieved HintTextColor should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test PrimaryCursorColor. Check whether PrimaryCursorColor works or not.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.PrimaryCursorColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void PrimaryCursorColor_SET_GET_VALUE() + { + /* TEST CODE */ + var inputField = new InputField(); + Color color = Color.Red; + inputField.PrimaryCursorColor = color; + Assert.AreEqual(color.R, inputField.PrimaryCursorColor.R, "Retrieved PrimaryCursorColor should be equal to set value"); + Assert.AreEqual(color.G, inputField.PrimaryCursorColor.G, "Retrieved PrimaryCursorColor should be equal to set value"); + Assert.AreEqual(color.B, inputField.PrimaryCursorColor.B, "Retrieved PrimaryCursorColor should be equal to set value"); + Assert.AreEqual(color.A, inputField.PrimaryCursorColor.A, "Retrieved PrimaryCursorColor should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test SecondaryCursorColor. Check whether SecondaryCursorColor works or not.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.SecondaryCursorColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void SecondaryCursorColor_SET_GET_VALUE() + { + /* TEST CODE */ + var inputField = new InputField(); + Color color = Color.Red; + inputField.SecondaryCursorColor = color; + Assert.AreEqual(color.R, inputField.SecondaryCursorColor.R, "Retrieved SecondaryCursorColor should be equal to set value"); + Assert.AreEqual(color.G, inputField.SecondaryCursorColor.G, "Retrieved SecondaryCursorColor should be equal to set value"); + Assert.AreEqual(color.B, inputField.SecondaryCursorColor.B, "Retrieved SecondaryCursorColor should be equal to set value"); + Assert.AreEqual(color.A, inputField.SecondaryCursorColor.A, "Retrieved SecondaryCursorColor should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test PointSize. Check whether PointSize works or not.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.PointSize A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void PointSize_SET_GET_VALUE() + { + /* TEST CODE */ + var inputField = new InputField(); + inputField.PointSize = 38; + Assert.AreEqual(38, inputField.PointSize, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test FontFamily. Check whether FontFamily works or not.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.FontFamily A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void FontFamily_SET_GET_VALUE() + { + /* TEST CODE */ + var inputField = new InputField(); + inputField.FontFamily = "FontFamily"; + Assert.AreEqual("FontFamily", inputField.FontFamily, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test EnableCursorBlink. Check whether EnableCursorBlink is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.EnableCursorBlink A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void EnableCursorBlink_SET_GET_VALUE() + { + /* TEST CODE */ + var inputField = new InputField(); + inputField.EnableCursorBlink = true; + Assert.AreEqual(true, inputField.EnableCursorBlink, "Retrieved EnableCursorBlink should be equal to set value"); + inputField.EnableCursorBlink = false; + Assert.AreEqual(false, inputField.EnableCursorBlink, "Retrieved EnableCursorBlink should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test EnableSelection. Check whether EnableSelection is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.EnableSelection A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void EnableSelection_SET_GET_VALUE() + { + /* TEST CODE */ + var inputField = new InputField(); + inputField.EnableSelection = false; + Assert.IsFalse(inputField.EnableSelection, "Retrieved EnableSelection count should be equal to the set value"); + inputField.EnableSelection = true; + Assert.IsTrue(inputField.EnableSelection, "Retrieved EnableSelection count should be equal to the set value"); + } + + [Test] + [Category("P1")] + [Description("Test CursorWidth. Check whether CursorWidth is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.CursorWidth A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void CursorWidth_SET_GET_VALUE() + { + /* TEST CODE */ + var inputField = new InputField(); + inputField.CursorWidth = 5; + Assert.AreEqual(5, inputField.CursorWidth, "Retrieved CursorWidth should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test EnableEllipsis. Check whether EnableEllipsis is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.EnableEllipsis A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void EnableEllipsis_SET_GET_VALUE() + { + /* TEST CODE */ + var inputField = new InputField(); + inputField.EnableEllipsis = false; + Assert.IsFalse(inputField.EnableEllipsis, "Retrieved Ellipsis value should be equal to the set value"); + inputField.EnableEllipsis = true; + Assert.IsTrue(inputField.EnableEllipsis, "Retrieved Ellipsis value should be equal to the set value"); + } + + [Test] + [Category("P1")] + [Description("Test BackgroundImageURL. Check whether BackgroundImageURL works or not.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.BackgroundImageURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void BackgroundImageURL_SET_GET_VALUE() + { + /* TEST CODE */ + var inputField = new InputField(); + inputField.BackgroundImageURL = "inputFieldurl"; + Assert.AreEqual("inputFieldurl", inputField.BackgroundImageURL, "Retrieved BackgroundImageURL should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test BackgroundImageBorder. Check whether BackgroundImageBorder works or not.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.BackgroundImageBorder A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void BackgroundImageBorder_SET_GET_VALUE() + { + /* TEST CODE */ + var inputField = new InputField(); + + inputField.BackgroundImageBorder = new Rectangle(0, 0, 10, 10); + Assert.AreEqual(0, inputField.BackgroundImageBorder.X, "Retrieved BackgroundImageBorder should be equal to set value"); + Assert.AreEqual(0, inputField.BackgroundImageBorder.Y, "Retrieved BackgroundImageBorder should be equal to set value"); + Assert.AreEqual(10, inputField.BackgroundImageBorder.Width, "Retrieved BackgroundImageBorder should be equal to set value"); + Assert.AreEqual(10, inputField.BackgroundImageBorder.Height, "Retrieved BackgroundImageBorder should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test Space. Check whether Space works or not.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.Space A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Space_SET_GET_VALUE() + { + /* TEST CODE */ + var inputField = new InputField(); + inputField.Space = 20; + Assert.AreEqual(20, inputField.Space, "Retrieved Space should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test GetAttributes. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.InputField.GetAttributes M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void GetAttributes_CHECK_VALUE() + { + /* TEST CODE */ + try + { + var myInputField = new MyInputField(); + Assert.IsTrue(myInputField.flagGetAttributes, "GetAttributes trigger Check Fail."); + } + 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 OnUpdate. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.InputField.OnUpdate M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public async Task OnUpdate_CHECK_VALUE() + { + /* TEST CODE */ + var myInputField = new MyInputField(); + Window.Instance.Add(myInputField); + try + { + await Task.Delay(200); + Assert.IsTrue(myInputField.flagOnUpdate, "OnUpdate trigger Check Fail."); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + finally + { + Window.Instance.Remove(myInputField); + } + } + + [Test] + [Category("P1")] + [Description("Test OnThemeChangedEvent. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.InputField.OnThemeChangedEvent M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public async Task OnThemeChangedEvent_CHECK_VALUE() + { + /* TEST CODE */ + StyleManager.Instance.Theme = "Utility"; + var myInputField = new MyInputField(); + Window.Instance.Add(myInputField); + try + { + StyleManager.Instance.Theme = "Food"; + await Task.Delay(200); + Assert.IsTrue(myInputField.flagOnThemeChangedEvent, "OnThemeChangedEvent trigger Check Fail."); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + finally + { + Window.Instance.Remove(myInputField); + } + } + + [Test] + [Category("P1")] + [Description("Test SetTextFieldSize2D, Check whether SetTextFieldSize2D works or not.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.SetTextFieldSize2D M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void SetTextFieldSize2D_CHECK() + { + /* TEST CODE */ + try + { + var myInputField = new MyInputField(); + myInputField.SetTextFieldSize2D(160, 60); + } + 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 SetTextFieldPosX, Check whether SetTextFieldPosX works or not.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.SetTextFieldPosX M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void SetTextFieldPosX_CHECK() + { + /* TEST CODE */ + try + { + var myInputField = new MyInputField(); + myInputField.SetTextFieldPosX(60); + } + 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 SetTextFieldTextColor, Check whether SetTextFieldTextColor works or not.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.SetTextFieldTextColor M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void SetTextFieldTextColor_CHECK() + { + /* TEST CODE */ + try + { + var myInputField = new MyInputField(); + myInputField.SetTextFieldTextColor(Color.Red); + } + 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 RelayoutTextField, Check whether RelayoutTextField works or not.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.RelayoutTextField M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void RelayoutTextField_CHECK() + { + /* TEST CODE */ + try + { + var myInputField = new MyInputField(); + myInputField.RelayoutTextField(false); + } + 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 Dispose, try to dispose the InputField.")] + [Property("SPEC", "Tizen.NUI.Components.InputField.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Dispose_CHECK() + { + /* TEST CODE */ + try + { + var inputField = new InputField(); + inputField.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 MyInputField : InputField + { + public bool flagGetAttributes = false; + public bool flagOnUpdate = false; + public bool flagOnThemeChangedEvent = false; + public bool flagOnTextFieldFocusGained = false; + public bool flagOnTextFieldFocusLost = false; + public bool flagOnTextFieldTextChanged = false; + public bool flagOnTextFieldKeyEvent = false; + + public MyInputField() : base() + { } + + public MyInputField(string style) : base(style) + { } + + protected override Attributes GetAttributes() + { + flagGetAttributes = true; + return new InputFieldAttributes(); + } + + protected override void OnUpdate() + { + base.OnUpdate(); + flagOnUpdate = true; + } + + protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e) + { + flagOnThemeChangedEvent = true; + } + + protected override void OnTextFieldFocusGained(object source, EventArgs e) + { + flagOnTextFieldFocusGained = true; + } + + protected override void OnTextFieldFocusLost(object source, EventArgs e) + { + flagOnTextFieldFocusLost = true; + } + + protected override void OnTextFieldTextChanged(object sender, Tizen.NUI.BaseComponents.TextField.TextChangedEventArgs e) + { + flagOnTextFieldTextChanged = true; + } + + protected override bool OnTextFieldKeyEvent(object source, KeyEventArgs e) + { + flagOnTextFieldKeyEvent = true; + return false; + } + + public new void SetTextFieldSize2D(int w, int h) + { + base.SetTextFieldSize2D(w, h); + } + + public new void SetTextFieldPosX(int x) + { + base.SetTextFieldPosX(x); + } + + public new void SetTextFieldTextColor(Color color) + { + base.SetTextFieldTextColor(color); + } + + public new void RelayoutTextField(bool value) + { + base.RelayoutTextField(value); + } + } + + internal class UtilityDefaultInputFieldStyle : StyleBase + { + protected override Attributes GetAttributes() + { + if (Content != null) + { + return (Content as Attributes).Clone(); + } + var attributes = new InputFieldAttributes + { + Space = 24, + BackgroundImageAttributes = new ImageAttributes + { + ResourceURL = new StringSelector + { + All = "1. Action bar/search_bg.png", + }, + Border = new RectangleSelector + { + All = new Rectangle(45, 45, 0, 0), + }, + }, + InputBoxAttributes = new TextFieldAttributes + { + TextColor = new ColorSelector + { + Normal = new Color(0, 0, 0, 1), + Pressed = new Color(0, 0, 0, 1), + Disabled = new Color(0, 0, 0, 0.4f) + }, + PlaceholderTextColor = new ColorSelector + { + All = new Color(0, 0, 0, 0.4f), + }, + PrimaryCursorColor = new ColorSelector + { + All = Color.Red, + }, + SecondaryCursorColor = new ColorSelector + { + All = Color.Green, + }, + HorizontalAlignment = HorizontalAlignment.Begin, + VerticalAlignment = VerticalAlignment.Center, + PointSize = new FloatSelector + { + All = 38, + }, + FontFamily = "SamsungOne 500", + CursorWidth = 2, + }, + }; + + return attributes; + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSInputFieldAttributes.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSInputFieldAttributes.cs new file mode 100755 index 000000000..799dc8c68 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSInputFieldAttributes.cs @@ -0,0 +1,124 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.InputFieldAttributes Tests")] + public class InputFieldAttributesTests + { + private const string TAG = "Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("InputFieldAttributesTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a InputFieldAttributes object. Check whether InputFieldAttributes is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.InputFieldAttributes.InputFieldAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void InputFieldAttributes_INIT() + { + /* TEST CODE */ + var inputFieldAttributes = new InputFieldAttributes(); + Assert.IsNotNull(inputFieldAttributes, "Can't create success object PreFocusChangedArgs"); + Assert.IsInstanceOf(inputFieldAttributes, "Should be an instance of InputFieldAttributes type."); + } + + [Test] + [Category("P1")] + [Description("Create a InputFieldAttributes object. Check whether InputFieldAttributes is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.InputFieldAttributes.InputFieldAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "InputFieldAttributes")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void InputFieldAttributes_INIT_WITH_InputFieldAttributes() + { + /* TEST CODE */ + var inputFieldAttributes = new InputFieldAttributes(); + var inputFieldAttributes2 = new InputFieldAttributes(inputFieldAttributes); + Assert.IsNotNull(inputFieldAttributes2, "Can't create success object InputFieldAttributes"); + Assert.IsInstanceOf(inputFieldAttributes2, "Should be an instance of InputFieldAttributes type."); + } + + [Test] + [Category("P1")] + [Description("Test BackgroundImageAttributes. Check whether BackgroundImageAttributes is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.InputFieldAttributes.BackgroundImageAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void BackgroundImageAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var inputFieldAttributes = new InputFieldAttributes(); + var imageAttributes = new ImageAttributes() { ResourceURL = new StringSelector() { All = "test.png" } }; + inputFieldAttributes.BackgroundImageAttributes = imageAttributes; + Assert.AreEqual(imageAttributes.ResourceURL.All, inputFieldAttributes.BackgroundImageAttributes.ResourceURL.All, "Retrieved BackgroundImageAttributes should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test InputBoxAttributes. Check whether InputBoxAttributes is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.InputFieldAttributes.InputBoxAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void InputBoxAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var inputFieldAttributes = new InputFieldAttributes(); + var textFieldAttributes = new TextFieldAttributes() { Text = new StringSelector() { All = "test" } }; + inputFieldAttributes.InputBoxAttributes = textFieldAttributes; + Assert.AreEqual(textFieldAttributes.Text.All, inputFieldAttributes.InputBoxAttributes.Text.All, "Retrieved InputBoxAttributes should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test Space. Check whether Space is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.InputFieldAttributes.Space A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Space_SET_GET_VALUE() + { + /* TEST CODE */ + var inputFieldAttributes = new InputFieldAttributes(); + inputFieldAttributes.Space = 30; + Assert.AreEqual(30, inputFieldAttributes.Space, "Retrieved Space should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test Clone. Check whether Clone works or not")] + [Property("SPEC", "Tizen.NUI.Components.InputFieldAttributes.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Clone_CHECK_RETURN_VALUE() + { + var inputFieldAttributes = new InputFieldAttributes(); + inputFieldAttributes.InputBoxAttributes = new TextFieldAttributes() { Text = new StringSelector() { All = "test" } }; + var inputFieldAttributes2 = inputFieldAttributes.Clone() as InputFieldAttributes; + Assert.AreEqual(inputFieldAttributes.InputBoxAttributes.Text.All, inputFieldAttributes2.InputBoxAttributes.Text.All, "Retrieved InputBoxAttributes should be equal to clone value"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSIntSelector.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSIntSelector.cs new file mode 100755 index 000000000..56df5a11e --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSIntSelector.cs @@ -0,0 +1,64 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.IntSelector Tests")] + public class IntSelectorTests + { + private const string TAG = "NUI.Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("IntSelectorTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a IntSelector object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.IntSelector.IntSelector C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void IntSelector_INIT() + { + /* TEST CODE */ + var intSelector = new IntSelector(); + Assert.IsNotNull(intSelector, "Can't create success object IntSelector"); + Assert.IsInstanceOf(intSelector, "Should be an instance of IntSelector type."); + } + + [Test] + [Category("P1")] + [Description("Test Clone. Check Whether Clone works or not")] + [Property("SPEC", "Tizen.NUI.Components.IntSelector.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Clone_TEST() + { + /* TEST CODE */ + var intSelector1 = new IntSelector(); + intSelector1.All = 0; + var intSelector = intSelector1.Clone(); + Assert.IsNotNull(intSelector, "should be not null!"); + Assert.AreEqual(0, intSelector.All); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSLinearLayoutManager.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSLinearLayoutManager.cs new file mode 100755 index 000000000..4aa21f28c --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSLinearLayoutManager.cs @@ -0,0 +1,455 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; +using System.Threading.Tasks; +using System.Collections.Generic; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.LinearLayoutManager Tests")] + public class LinearLayoutManagerTests + { + private const string TAG = "NUI.Components"; + private FlexibleView _flexibleView = null; + private ListBridge _adapter = null; + private LinearLayoutManager _layoutManager = null; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("LinearLayoutManagerTests"); + App.MainTitleChangeBackgroundColor(null); + CreateFlexiableView(); + } + + public void CreateFlexiableView() + { + _flexibleView = new FlexibleView(); + _flexibleView.Name = "RecyclerView"; + _flexibleView.Position2D = new Position2D(500, 200); + _flexibleView.Size2D = new Size2D(400, 450); + _flexibleView.Padding = new Extents(10, 10, 10, 10); + _flexibleView.BackgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.4f); + _flexibleView.Focusable = true; + + List dataList = new List(); + for (int i = 0; i < 131; ++i) + { + dataList.Add(new ListItemData(i)); + } + _adapter = new ListBridge(dataList); + _flexibleView.SetAdapter(_adapter); + _layoutManager = new LinearLayoutManager(LinearLayoutManager.VERTICAL); + _flexibleView.SetLayoutManager(_layoutManager); + + Window.Instance.Add(_flexibleView); + FocusManager.Instance.SetCurrentFocusView(_flexibleView); + _flexibleView.FocusedItemIndex = 0; + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a LinearLayoutManager object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.LinearLayoutManager.LinearLayoutManager C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void LinearLayoutManager_INIT() + { + /* TEST CODE */ + var layoutManager = new LinearLayoutManager(LinearLayoutManager.VERTICAL); + Assert.IsNotNull(layoutManager, "Can't create success object LinearLayoutManager"); + Assert.IsInstanceOf(layoutManager, "Should be an instance of LinearLayoutManager type."); + } + + [Test] + [Category("P1")] + [Description("Test HORIZONTAL.Check whether HORIZONTAL is readable.")] + [Property("SPEC", "Tizen.NUI.Components.LinearLayoutManager.HORIZONTAL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void HORIZONTAL_GET_VALUE() + { + /* TEST CODE */ + Assert.AreEqual(0, LinearLayoutManager.HORIZONTAL, "Should be equals to the set value of INVALID_TYPE."); + } + + [Test] + [Category("P1")] + [Description("Test VERTICAL.Check whether VERTICAL is readable.")] + [Property("SPEC", "Tizen.NUI.Components.LinearLayoutManager.VERTICAL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void VERTICAL_GET_VALUE() + { + /* TEST CODE */ + Assert.AreEqual(1, LinearLayoutManager.VERTICAL, "Should be equals to the set value of INVALID_TYPE."); + } + + [Test] + [Category("P1")] + [Description("Test NO_POSITION.Check whether NO_POSITION is readable.")] + [Property("SPEC", "Tizen.NUI.Components.LinearLayoutManager.NO_POSITION A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void NO_POSITION_GET_VALUE() + { + /* TEST CODE */ + Assert.AreEqual(FlexibleView.NO_POSITION, LinearLayoutManager.NO_POSITION, "Should be equals to the set value of INVALID_TYPE."); + } + + [Test] + [Category("P1")] + [Description("Test INVALID_OFFSET.Check whether INVALID_OFFSET is readable.")] + [Property("SPEC", "Tizen.NUI.Components.LinearLayoutManager.INVALID_OFFSET A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void INVALID_OFFSET_GET_VALUE() + { + /* TEST CODE */ + Assert.AreEqual(-2147483648, LinearLayoutManager.INVALID_OFFSET, "Should be equals to the set value of INVALID_TYPE."); + } + + [Test] + [Category("P1")] + [Description("Test FirstCompleteVisibleItemPosition. Check FirstCompleteVisibleItemPosition works or not.")] + [Property("SPEC", "Tizen.NUI.Components.LinearLayoutManager.FirstCompleteVisibleItemPosition A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void FirstCompleteVisibleItemPosition_GET_VALUE() + { + /* TEST CODE */ + _flexibleView.Relayout += FirstCompleteVisibleItemPositionRelayout; + _flexibleView.Relayout -= FirstCompleteVisibleItemPositionRelayout; + } + + private void FirstCompleteVisibleItemPositionRelayout(object sender, EventArgs args) + { + Assert.AreEqual(0, _layoutManager.FirstCompleteVisibleItemPosition, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test FirstVisibleItemPosition. Check FirstVisibleItemPosition works or not.")] + [Property("SPEC", "Tizen.NUI.Components.LinearLayoutManager.FirstVisibleItemPosition A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void FirstVisibleItemPosition_GET_VALUE() + { + /* TEST CODE */ + _flexibleView.Relayout += FirstVisibleItemPositionRelayout; + _flexibleView.Relayout -= FirstVisibleItemPositionRelayout; + } + + private void FirstVisibleItemPositionRelayout(object sender, EventArgs args) + { + Assert.AreEqual(0, _layoutManager.FirstVisibleItemPosition, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test LastVisibleItemPosition. Check LastVisibleItemPosition works or not.")] + [Property("SPEC", "Tizen.NUI.Components.LinearLayoutManager.LastVisibleItemPosition A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void LastVisibleItemPosition_GET_VALUE() + { + /* TEST CODE */ + _flexibleView.Relayout += LastVisibleItemPositionRelayout; + _flexibleView.Relayout -= LastVisibleItemPositionRelayout; + } + + private void LastVisibleItemPositionRelayout(object sender, EventArgs args) + { + Assert.AreEqual(6, _layoutManager.LastVisibleItemPosition, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test LastCompleteVisibleItemPosition. Check LastCompleteVisibleItemPosition works or not.")] + [Property("SPEC", "Tizen.NUI.Components.LinearLayoutManager.LastCompleteVisibleItemPosition A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void LastCompleteVisibleItemPosition_GET_VALUE() + { + /* TEST CODE */ + _flexibleView.Relayout += LastCompleteVisibleItemPositionRelayout; + _flexibleView.Relayout -= LastCompleteVisibleItemPositionRelayout; + } + + private void LastCompleteVisibleItemPositionRelayout(object sender, EventArgs args) + { + Assert.AreEqual(5, _layoutManager.LastCompleteVisibleItemPosition, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test CanScrollHorizontally. Check whether CanScrollHorizontally works or not.")] + [Property("SPEC", "Tizen.NUI.Components.LinearLayoutManager.CanScrollHorizontally M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void CanScrollHorizontally_TEST() + { + /* TEST CODE */ + Assert.IsFalse(_layoutManager.CanScrollHorizontally(), "Should be false"); + var layoutManager = new LinearLayoutManager(LinearLayoutManager.HORIZONTAL); + Assert.IsTrue(layoutManager.CanScrollHorizontally(), "Should be true"); + } + + [Test] + [Category("P1")] + [Description("Test CanScrollVertically. Check whether CanScrollVertically works or not.")] + [Property("SPEC", "Tizen.NUI.Components.LinearLayoutManager.CanScrollVertically M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void CanScrollVertically_TEST() + { + /* TEST CODE */ + Assert.IsTrue(_layoutManager.CanScrollVertically(), "Should be true"); + var layoutManager = new LinearLayoutManager(LinearLayoutManager.HORIZONTAL); + Assert.IsFalse(layoutManager.CanScrollVertically(), "Should be false"); + } + + [Test] + [Category("P1")] + [Description("Test ComputeScrollExtent. Check whether ComputeScrollExtent works or not.")] + [Property("SPEC", "Tizen.NUI.Components.LinearLayoutManager.ComputeScrollExtent M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ComputeScrollExtent_TEST() + { + /* TEST CODE */ + Assert.AreEqual(0, _layoutManager.ComputeScrollExtent(), "Should be equal"); + } + + [Test] + [Category("P1")] + [Description("Test ComputeScrollOffset. Check whether ComputeScrollOffset works or not.")] + [Property("SPEC", "Tizen.NUI.Components.LinearLayoutManager.ComputeScrollOffset M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ComputeScrollOffset_TEST() + { + /* TEST CODE */ + Assert.AreEqual(0, _layoutManager.ComputeScrollOffset(), "Should be equal"); + } + + [Test] + [Category("P1")] + [Description("Test ComputeScrollRange. Check whether ComputeScrollRange works or not.")] + [Property("SPEC", "Tizen.NUI.Components.LinearLayoutManager.ComputeScrollRange M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ComputeScrollRange_TEST() + { + /* TEST CODE */ + Assert.AreEqual(0, _layoutManager.ComputeScrollRange(), "Should be false"); + } + + [Test] + [Category("P1")] + [Description("Test OnLayoutCompleted. Check whether OnLayoutCompleted works or not.")] + [Property("SPEC", "Tizen.NUI.Components.LinearLayoutManager.OnLayoutCompleted M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void OnLayoutCompleted_TEST() + { + /* TEST CODE */ + try + { + _layoutManager.OnLayoutCompleted(); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test GetNextPosition. Check whether GetNextPosition works or not.")] + [Property("SPEC", "Tizen.NUI.Components.LinearLayoutManager.GetNextPosition M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetNextPosition_TEST() + { + /* TEST CODE */ + try + { + var myLinearLayoutManager = new MyLinearLayoutManager(LinearLayoutManager.VERTICAL); + Assert.AreEqual(1, myLinearLayoutManager.TestGetNextPosition(0, FlexibleView.LayoutManager.Direction.Down), "Should be equal!"); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test ScrollToPosition. Check whether ScrollToPosition works or not.")] + [Property("SPEC", "Tizen.NUI.Components.LinearLayoutManager.ScrollToPosition M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ScrollToPosition_TEST() + { + /* TEST CODE */ + try + { + _layoutManager.ScrollToPosition(0); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test ScrollToPositionWithOffset. Check whether ScrollToPositionWithOffset works or not.")] + [Property("SPEC", "Tizen.NUI.Components.LinearLayoutManager.ScrollToPositionWithOffset M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ScrollToPositionWithOffset_TEST() + { + /* TEST CODE */ + try + { + _layoutManager.ScrollToPositionWithOffset(0, 0); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test OnLayoutChildren. Check whether OnLayoutChildren works or not.")] + [Property("SPEC", "Tizen.NUI.Components.LinearLayoutManager.OnLayoutChildren M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void OnLayoutChildren_TEST() + { + /* TEST CODE */ + try + { + _flexibleView.MoveFocus(FlexibleView.LayoutManager.Direction.Down); + _flexibleView.Relayout += OnLayoutChildrenRelayout; + _flexibleView.Relayout -= OnLayoutChildrenRelayout; + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + private void OnLayoutChildrenRelayout(object sender, EventArgs args) + { + var recycler = _flexibleView.GetRecycler(); + _layoutManager.OnLayoutChildren(recycler); + } + + [Test] + [Category("P1")] + [Description("Test ScrollVerticallyBy. Check whether ScrollVerticallyBy works or not.")] + [Property("SPEC", "Tizen.NUI.Components.LinearLayoutManager.ScrollVerticallyBy M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ScrollVerticallyBy_TEST() + { + /* TEST CODE */ + try + { + var recycler = new FlexibleView.Recycler(_flexibleView); + _layoutManager.ScrollVerticallyBy(0, recycler, true); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test ScrollHorizontallyBy. Check whether ScrollHorizontallyBy works or not.")] + [Property("SPEC", "Tizen.NUI.Components.LinearLayoutManager.ScrollHorizontallyBy M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ScrollHorizontallyBy_TEST() + { + /* TEST CODE */ + try + { + var recycler = new FlexibleView.Recycler(_flexibleView); + _layoutManager.ScrollHorizontallyBy(0, recycler, true); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + } + + public class MyLinearLayoutManager : LinearLayoutManager + { + public MyLinearLayoutManager(int orientation) : base(orientation) + { + + } + public int TestGetNextPosition(int position, Direction direction) + { + return GetNextPosition(position, direction); + } + + protected override int GetNextPosition(int position, Direction direction) + { + switch (direction) + { + case FlexibleView.LayoutManager.Direction.Up: + if (position > 0) + { + return position - 1; + } + break; + case FlexibleView.LayoutManager.Direction.Down: + return position + 1; + break; + } + + return FlexibleView.NO_POSITION; + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSLoading.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSLoading.cs new file mode 100755 index 000000000..21bd8f5ca --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSLoading.cs @@ -0,0 +1,265 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using System.Threading.Tasks; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Loading Tests")] + public class LoadingTests + { + private const string TAG = "Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("LoadingTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a Loading object. Check whether Loading is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.Loading.Loading C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void Loading_INIT() + { + /* TEST CODE */ + var loading = new Loading(); + Assert.IsNotNull(loading, "Can't create success object Loading"); + Assert.IsInstanceOf(loading, "Should be an instance of Loading type."); + } + + [Test] + [Category("P1")] + [Description("Create a Loading object with attributes. Check whether object whose text is initialized is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.Loading.Loading C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "LoadingAttributes")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Loading_INIT_WITH_LoadingAttributes() + { + /* TEST CODE */ + var loading = new Loading(new LoadingAttributes()); + Assert.IsNotNull(loading, "Can't create success object Loading"); + Assert.IsInstanceOf(loading, "Should be an instance of textLabel type."); + } + + [Test] + [Category("P1")] + [Description("Create a Loading object with string. Check whether object whose text is initialized is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.Loading.Loading C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "string")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Loading_INIT_WITH_STRING() + { + /* TEST CODE */ + StyleManager.Instance.RegisterStyle("DefaultLoading", null, typeof(DefaultLoadingStyle)); + var loading = new Loading("DefaultLoading"); + Assert.IsNotNull(loading, "Can't create success object Loading"); + Assert.IsInstanceOf(loading, "Should be an instance of Loading type."); + } + + [Test] + [Category("P1")] + [Description("Test ImageArray. Check whether ImageArray works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Loading.ImageArray A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void ImageArray_SET_GET_VALUE() + { + /* TEST CODE */ + try + { + var loading = new Loading(); + Assert.IsInstanceOf(loading, "Should be an instance of Loading type"); + loading.ImageArray = new string[] {"aaa", "bbb"}; + string[] imageArray = loading.ImageArray; + Assert.AreEqual("aaa", imageArray[0], "Retrieved ImageArray should be equal to set value"); + Assert.AreEqual("bbb", imageArray[1], "Retrieved ImageArray should be equal to set value"); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test LoadingSize. Check whether LoadingSize works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Loading.LoadingSize A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void LoadingSize_SET_GET_VALUE() + { + /* TEST CODE */ + var loading = new Loading(); + Assert.IsInstanceOf(loading, "Should be an instance of Loading type"); + loading.LoadingSize = new Size2D(100, 100); + Assert.AreEqual(100, loading.LoadingSize.Width, "Retrieved LoadingSize width should be equal to set value"); + Assert.AreEqual(100, loading.LoadingSize.Height, "Retrieved LoadingSize height should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test FPS. Check whether FPS works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Loading.FPS A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void FPS_SET_GET_VALUE() + { + /* TEST CODE */ + var loading = new Loading(); + Assert.IsInstanceOf(loading, "Should be an instance of Loading type"); + loading.FPS = 33; + Assert.AreEqual(33, loading.FPS, "Retrieved FPS should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test GetAttributes. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Loading.GetAttributes M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void GetAttributes_CHECK_VALUE() + { + /* TEST CODE */ + try + { + var myLoading = new MyLoading(); + Assert.IsTrue(myLoading.flagGetAttributes, "GetAttributes trigger Check Fail."); + } + 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 OnUpdate. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Loading.OnUpdate M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public async Task OnUpdate_CHECK_VALUE() + { + /* TEST CODE */ + var myLoading = new MyLoading(); + Window.Instance.Add(myLoading); + try + { + await Task.Delay(200); + Assert.IsTrue(myLoading.flagOnUpdate, "OnUpdate trigger Check Fail."); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + finally + { + Window.Instance.Remove(myLoading); + } + } + + [Test] + [Category("P1")] + [Description("Test Dispose, try to dispose the Loading.")] + [Property("SPEC", "Tizen.NUI.Components.Loading.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Dispose_CHECK() + { + /* TEST CODE */ + try + { + Loading loading = new Loading(); + loading.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 MyLoading : Loading + { + public bool flagGetAttributes = false; + public bool flagOnUpdate = false; + + public MyLoading() : base() + { } + + public MyLoading(string style) : base(style) + { } + + protected override Attributes GetAttributes() + { + flagGetAttributes = true; + return new LoadingAttributes(); + } + + protected override void OnUpdate() + { + base.OnUpdate(); + flagOnUpdate = true; + } + } + + internal class DefaultLoadingStyle : StyleBase + { + protected override Attributes GetAttributes() + { + if (Content != null) + { + return (Content as Attributes).Clone(); + } + string[] imageArray = new string[36]; + for (int i = 0; i < 36; i++) + { + if (i < 10) + { + imageArray[i] = "9. Controller/Loading Sequence_Native/loading_0" + i + ".png"; + } + else + { + imageArray[i] = "9. Controller/Loading Sequence_Native/loading_" + i + ".png"; + } + } + + LoadingAttributes attributes = new LoadingAttributes { ImageArray = imageArray }; + return attributes; + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSLoadingAttributes.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSLoadingAttributes.cs new file mode 100755 index 000000000..7e98ff684 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSLoadingAttributes.cs @@ -0,0 +1,124 @@ +using NUnit.Framework; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.LoadingAttributes Tests")] + public class LoadingAttributesTests + { + private const string TAG = "Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("LoadingAttributesTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a LoadingAttributes object. Check whether LoadingAttributes is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.LoadingAttributes.LoadingAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void LoadingAttributes_INIT() + { + /* TEST CODE */ + var loadingAttributes = new LoadingAttributes(); + Assert.IsNotNull(loadingAttributes, "Can't create success object LoadingAttributes"); + Assert.IsInstanceOf(loadingAttributes, "Should be an instance of LoadingAttributes type."); + } + + [Test] + [Category("P1")] + [Description("Create a LoadingAttributes object. Check whether LoadingAttributes is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.LoadingAttributes.LoadingAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "LoadingAttributes")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void LoadingAttributes_INIT_WITH_LoadingAttributes() + { + /* TEST CODE */ + var loadingAttributes = new LoadingAttributes(); + var loadingAttributes2 = new LoadingAttributes(loadingAttributes); + Assert.IsNotNull(loadingAttributes2, "Can't create success object LoadingAttributes"); + Assert.IsInstanceOf(loadingAttributes2, "Should be an instance of LoadingAttributes type."); + } + + [Test] + [Category("P1")] + [Description("Test ImageArray. Check whether ImageArray is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.LoadingAttributes.ImageArray A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void ImageArray_SET_GET_VALUE() + { + /* TEST CODE */ + var loadingAttributes = new LoadingAttributes(); + string[] imageArray = new string[3]{"aaa", "bbb", "ccc"}; + loadingAttributes.ImageArray = imageArray; + Assert.AreEqual(imageArray[0], loadingAttributes.ImageArray[0], "Retrieved ImageArray should be equal to set value"); + Assert.AreEqual(imageArray[1], loadingAttributes.ImageArray[1], "Retrieved ImageArray should be equal to set value"); + Assert.AreEqual(imageArray[2], loadingAttributes.ImageArray[2], "Retrieved ImageArray should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test LoadingSize. Check whether LoadingSize is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.LoadingAttributes.LoadingSize A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void LoadingSize_SET_GET_VALUE() + { + /* TEST CODE */ + var loadingAttributes = new LoadingAttributes(); + loadingAttributes.LoadingSize = new Size2D(30, 40); + Assert.AreEqual(30, loadingAttributes.LoadingSize.Width, "Retrieved LoadingSize should be equal to set value"); + Assert.AreEqual(40, loadingAttributes.LoadingSize.Height, "Retrieved LoadingSize should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test FPS. Check whether FPS is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.LoadingAttributes.FPS A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void FPS_SET_GET_VALUE() + { + /* TEST CODE */ + var loadingAttributes = new LoadingAttributes(); + IntSelector intSelector = new IntSelector() { All = 60 }; + loadingAttributes.FPS = intSelector; + Assert.AreEqual(intSelector.All, loadingAttributes.FPS.All, "Retrieved FPS should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test Clone. Check whether Clone works or not")] + [Property("SPEC", "Tizen.NUI.Components.LoadingAttributes.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Clone_CHECK_RETURN_VALUE() + { + var loadingAttributes = new LoadingAttributes(); + loadingAttributes.FPS = new IntSelector() { All = 60 }; + var loadingAttributes2 = loadingAttributes.Clone() as LoadingAttributes; + Assert.AreEqual(loadingAttributes.FPS.All, loadingAttributes2.FPS.All, "Retrieved FPS should be equal to clone value"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSPagination.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSPagination.cs new file mode 100755 index 000000000..16dd4c5ff --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSPagination.cs @@ -0,0 +1,440 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Pagination Tests")] + public class PaginationTests + { + private string TAG = "NUI.Components.Pagination"; + private string _style = ""; + private string _indicatorBackgroundURL = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "pagination_ic_nor.png"; + private string _indicatorSelectURL = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "pagination_ic_sel.png"; + private bool _styleRegiesterFlag = false; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("PaginationTests"); + App.MainTitleChangeBackgroundColor(null); + if (!_styleRegiesterFlag) + { + StyleManager.Instance.RegisterStyle("DefaultPagination", null, typeof(Tizen.NUI.Components.Tests.DefaultPaginationStyle)); + _styleRegiesterFlag = true; + } + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a Pagination object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.Pagination.Pagination C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Pagination_INIT() + { + /* TEST CODE */ + var pagination = new Pagination(); + Assert.IsNotNull(pagination, "Can't create success object Pagination"); + Assert.IsInstanceOf(pagination, "Should be an instance of Pagination type."); + } + + [Test] + [Category("P1")] + [Description("Create a Pagination object. Check whether Pagination object which set style is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.Pagination.Pagination C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "string")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Pagination_INIT_WITH_STYLE() + { + /* TEST CODE */ + var pagination = new Pagination("DefaultPagination"); + Assert.IsNotNull(pagination, "Can't create success object Pagination"); + Assert.IsInstanceOf(pagination, "Should be an instance of Pagination type."); + } + + [Test] + [Category("P1")] + [Description("Create a Pagination object. Check whether Pagination object which set attributes is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.Pagination.Pagination C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "PaginationAttributes")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Pagination_INIT_WITH_ATTRIBUTES() + { + /* TEST CODE */ + var attrs = new PaginationAttributes(); + attrs.IndicatorSize = new Size2D(15, 15); + attrs.IndicatorBackgroundURL = _indicatorBackgroundURL; + attrs.IndicatorSelectURL = _indicatorSelectURL; + attrs.IndicatorSpacing = 14; + var pagination = new Pagination(attrs); + Assert.IsNotNull(pagination, "Can't create success object Pagination"); + Assert.IsInstanceOf(pagination, "Should be an instance of Pagination type."); + } + + [Test] + [Category("P1")] + [Description("Test IndicatorSpacing.Check whether IndicatorSpacing is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.Pagination.IndicatorSpacing A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void IndicatorSpacing_SET_GET_VALUE() + { + /* TEST CODE */ + var pagination = new Pagination(); + pagination.IndicatorSpacing = 10; + Assert.AreEqual(10, pagination.IndicatorSpacing, "Should be equals to the set value of IndicatorSpacing."); + } + + [Test] + [Category("P1")] + [Description("Test IndicatorSize.Check whether IndicatorSize is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.Pagination.IndicatorSize A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public async Task IndicatorSize_SET_GET_VALUE() + { + /* TEST CODE */ + var pagination = new Pagination(); + pagination.Position2D = new Position2D(500, 450); + pagination.Size2D = new Size2D(400, 30); + pagination.BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.6f); + pagination.IndicatorSize = new Size2D(26, 26); + pagination.IndicatorBackgroundURL = _indicatorBackgroundURL; + pagination.IndicatorSelectURL = _indicatorSelectURL; + pagination.IndicatorSpacing = 8; + pagination.IndicatorCount = 5; + pagination.SelectedIndex = 0; + Window.Instance.Add(pagination); + await Task.Delay(500); + Assert.AreEqual(26, pagination.IndicatorSize.Width, "Should be equals to the set value."); + Assert.AreEqual(26, pagination.IndicatorSize.Height, "Should be equals to the set value."); + } + + [Test] + [Category("P1")] + [Description("Test IndicatorCount.Check whether IndicatorCount is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.Pagination.IndicatorCount A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void IndicatorCount_SET_GET_VALUE() + { + /* TEST CODE */ + var pagination = new Pagination(); + pagination.Position2D = new Position2D(500, 450); + pagination.Size2D = new Size2D(400, 30); + pagination.BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.6f); + pagination.IndicatorSize = new Size2D(26, 26); + pagination.IndicatorBackgroundURL = _indicatorBackgroundURL; + pagination.IndicatorSelectURL = _indicatorSelectURL; + pagination.IndicatorSpacing = 8; + pagination.IndicatorCount = 5; + pagination.SelectedIndex = 0; + Window.Instance.Add(pagination); + Assert.AreEqual(5, pagination.IndicatorCount, "Should be equals to the set value of IndicatorCount."); + } + + [Test] + [Category("P1")] + [Description("Test SelectedIndex.Check whether SelectedIndex is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.Pagination.SelectedIndex A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void SelectedIndex_SET_GET_VALUE() + { + /* TEST CODE */ + var pagination = new Pagination(); + pagination.SelectedIndex = 5; + Assert.AreEqual(5, pagination.SelectedIndex, "Should be equals to the set value of SelectedIndex."); + } + + [Test] + [Category("P1")] + [Description("Test IndicatorBackgroundURL.Check whether IndicatorBackgroundURL is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.Pagination.IndicatorBackgroundURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void IndicatorBackgroundURL_SET_GET_VALUE() + { + /* TEST CODE */ + var pagination = new Pagination(); + pagination.IndicatorBackgroundURL = _indicatorBackgroundURL; + Assert.AreEqual(_indicatorBackgroundURL, pagination.IndicatorBackgroundURL, "Should be equals to the set value of IndicatorBackgroundURL."); + } + + [Test] + [Category("P1")] + [Description("Test IndicatorSelectURL.Check whether IndicatorSelectURL is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.Pagination.IndicatorSelectURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void IndicatorSelectURL_SET_GET_VALUE() + { + /* TEST CODE */ + var pagination = new Pagination(); + pagination.IndicatorSelectURL = _indicatorSelectURL; + Assert.AreEqual(_indicatorSelectURL, pagination.IndicatorSelectURL, "Should be equals to the set value of IndicatorSelectURL."); + } + + [Test] + [Category("P1")] + [Description("Test GetIndicatorPosition.Check whether GetIndicatorPosition works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Pagination.GetIndicatorPosition M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetIndicatorPosition_TEST() + { + /* TEST CODE */ + var pagination = new Pagination(); + pagination.Position2D = new Position2D(500, 450); + pagination.Size2D = new Size2D(400, 30); + pagination.BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.6f); + pagination.IndicatorSize = new Size2D(26, 26); + pagination.IndicatorBackgroundURL = _indicatorBackgroundURL; + pagination.IndicatorSelectURL = _indicatorSelectURL; + pagination.IndicatorSpacing = 8; + pagination.IndicatorCount = 5; + pagination.SelectedIndex = 0; + Window.Instance.Add(pagination); + Position2D position = pagination.GetIndicatorPosition(0); + Assert.AreEqual(119, position.X, "Should be equals to the set value."); + Assert.AreEqual(0, position.Y, "Should be equals to the set value."); + } + + [Test] + [Category("P1")] + [Description("Test OnUpdate. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Pagination.OnUpdate M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public async Task OnUpdate_CHECK_VALUE() + { + /* TEST CODE */ + try + { + var view = CreatePagination(); + Window window = Window.Instance; + window.Add(view); + await Task.Delay(500); + Assert.AreEqual(true, view.updateFlag, "OnUpdate trigger Check Fail."); + window.Remove(view); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test GetAttributes. Check Whether GetAttributes works or not")] + [Property("SPEC", "Tizen.NUI.Components.Pagination.GetAttributes M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetAttributes_TEST() + { + /* TEST CODE */ + var myPagination = new MyPagination(); + Assert.IsNotNull(myPagination.TestGetAttributes(), "Should be not null"); + Assert.IsInstanceOf(myPagination.TestGetAttributes(), "Should be an instance of PaginationAttributes"); + } + + [Test] + [Category("P1")] + [Description("Test SelectIn. Check Whether SelectIn works or not")] + [Property("SPEC", "Tizen.NUI.Components.Pagination.SelectIn M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void SelectIn_TEST() + { + /* TEST CODE */ + try + { + var myPagination = new MyPagination(); + ImageVisual indicator = new ImageVisual + { + URL = _indicatorBackgroundURL, + Size = new Size2D(36, 36) + }; + indicator.Position = new Position2D(0, 0); + myPagination.TestSelectIn(indicator); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test SelectOut. Check Whether SelectOut works or not")] + [Property("SPEC", "Tizen.NUI.Components.Pagination.SelectOut M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void SelectOut_TEST() + { + /* TEST CODE */ + try + { + var myPagination = new MyPagination(); + ImageVisual indicator = new ImageVisual + { + URL = _indicatorBackgroundURL, + Size = new Size2D(36, 36) + }; + indicator.Position = new Position2D(0, 0); + myPagination.TestSelectOut(indicator); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test Dispose, try to dispose the Pagination.")] + [Property("SPEC", "Tizen.NUI.Components.Pagination.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Dispose_TEST() + { + /* TEST CODE */ + try + { + Pagination pagination = new Pagination(); + pagination.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()); + } + } + + private MyPagination CreatePagination() + { + PaginationAttributes attrs = new PaginationAttributes(); + attrs.IndicatorSize = new Size2D(15, 15); + attrs.IndicatorBackgroundURL = _indicatorBackgroundURL; + attrs.IndicatorSelectURL = _indicatorSelectURL; + attrs.IndicatorSpacing = 14; + + MyPagination pagination = new MyPagination(attrs); + pagination.Name = "Pagination2"; + pagination.Position2D = new Position2D(500, 500); + pagination.Size2D = new Size2D(400, 30); + pagination.BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.6f); + pagination.IndicatorCount = 6; + pagination.SelectedIndex = 0; + Window.Instance.Add(pagination); + return pagination; + } + } + + public class MyPagination:Pagination + { + public bool updateFlag = false; + + public MyPagination():base() + { + + } + public MyPagination(PaginationAttributes attributes):base(attributes) + { + + } + + public Attributes TestGetAttributes() + { + return GetAttributes(); + } + protected override Attributes GetAttributes() + { + return base.GetAttributes(); + } + + protected override void OnUpdate() + { + updateFlag = true; + base.OnUpdate(); + } + + protected override void SelectIn(VisualMap selectInIndicator) + { + base.SelectIn(selectInIndicator); + } + + protected override void SelectOut(VisualMap selectOutIndicator) + { + base.SelectIn(selectOutIndicator); + } + + public void TestSelectIn(VisualMap selectInIndicator) + { + SelectIn(selectInIndicator); + } + + public void TestSelectOut(VisualMap selectOutIndicator) + { + SelectOut(selectOutIndicator); + } + } + + public class DefaultPaginationStyle : StyleBase + { + private string _indicatorBackgroundURL = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "pagination_ic_nor.png"; + private string _indicatorSelectURL = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "pagination_ic_sel.png"; + protected override Attributes GetAttributes() + { + if (Content != null) + { + return (Content as Attributes).Clone(); + } + + PaginationAttributes attributes = new PaginationAttributes + { + IndicatorSize = new Size2D(26, 26), + IndicatorBackgroundURL = _indicatorBackgroundURL, + IndicatorSelectURL = _indicatorSelectURL, + IndicatorSpacing = 8, + }; + return attributes; + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSPaginationAttributes.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSPaginationAttributes.cs new file mode 100755 index 000000000..ecef8c6e9 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSPaginationAttributes.cs @@ -0,0 +1,152 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.PaginationAttributes Tests")] + public class PaginationAttributesTests + { + private const string TAG = "NUI.Components"; + private string _imagePath = ""; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("PaginationAttributesTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a PaginationAttributes object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.PaginationAttributes.PaginationAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void PaginationAttributes_INIT() + { + /* TEST CODE */ + var paginationAttributes = new PaginationAttributes(); + Assert.IsNotNull(paginationAttributes, "Can't create success object PaginationAttributes"); + Assert.IsInstanceOf(paginationAttributes, "Should be an instance of PaginationAttributes type."); + } + + [Test] + [Category("P1")] + [Description("Create a PaginationAttributes object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.PaginationAttributes.PaginationAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "PaginationAttributes")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void PaginationAttributes_INIT_WITH_PAGINATIONATTRIBUTES() + { + /* TEST CODE */ + var paginationAttributes1 = new PaginationAttributes(); + var paginationAttributes = new PaginationAttributes(paginationAttributes1); + Assert.IsNotNull(paginationAttributes, "Can't create success object PaginationAttributes"); + Assert.IsInstanceOf(paginationAttributes, "Should be an instance of PaginationAttributes type."); + } + + [Test] + [Category("P1")] + [Description("Test IndicatorBackgroundURL.Check whether IndicatorBackgroundURL is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.PaginationAttributes.IndicatorBackgroundURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void IndicatorBackgroundURL_SET_GET_VALUE() + { + /* TEST CODE */ + var paginationAttributes = new PaginationAttributes(); + paginationAttributes.IndicatorBackgroundURL = _imagePath; + Assert.AreEqual(_imagePath, paginationAttributes.IndicatorBackgroundURL, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test IndicatorSelectURL.Check whether IndicatorSelectURL is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.PaginationAttributes.IndicatorSelectURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void IndicatorSelectURL_SET_GET_VALUE() + { + /* TEST CODE */ + var paginationAttributes = new PaginationAttributes(); + paginationAttributes.IndicatorSelectURL = _imagePath; + Assert.AreEqual(_imagePath, paginationAttributes.IndicatorSelectURL, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test IndicatorSpacing.Check whether IndicatorSpacing is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.PaginationAttributes.IndicatorSpacing A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void IndicatorSpacing_SET_GET_VALUE() + { + /* TEST CODE */ + var paginationAttributes = new PaginationAttributes(); + paginationAttributes.IndicatorSpacing = 10; + Assert.AreEqual(10, paginationAttributes.IndicatorSpacing, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test IndicatorSize.Check whether IndicatorSize is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.PaginationAttributes.IndicatorSize A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void IndicatorSize_SET_GET_VALUE() + { + /* TEST CODE */ + var paginationAttributes = new PaginationAttributes(); + paginationAttributes.IndicatorSize = new Size2D(32, 32); + Assert.AreEqual(32, paginationAttributes.IndicatorSize.Width, "Should be equal!"); + Assert.AreEqual(32, paginationAttributes.IndicatorSize.Height, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test Clone. Check Whether Clone works or not")] + [Property("SPEC", "Tizen.NUI.Components.PaginationAttributes.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Clone_TEST() + { + /* TEST CODE */ + try + { + var paginationAttributes = new PaginationAttributes(); + paginationAttributes.IndicatorSpacing = 10; + var attributes = paginationAttributes.Clone() as PaginationAttributes; + Assert.IsNotNull(attributes, "Should be not null"); + Assert.IsInstanceOf(attributes, "Should be an instance of PaginationAttributes type."); + Assert.AreEqual(10, attributes.IndicatorSpacing, "Should be equal!"); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSPopup.ButtonClickEventArgs.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSPopup.ButtonClickEventArgs.cs new file mode 100755 index 000000000..bd03c4b5a --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSPopup.ButtonClickEventArgs.cs @@ -0,0 +1,66 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Components; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Popup.ButtonClickEventArgs Tests")] + public class PopupButtonClickEventArgsTests + { + private const string TAG = "Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("PopupButtonClickEventArgsTests"); + App.MainTitleChangeBackgroundColor(null); + + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test ButtonClickEventArgs empty constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Popup.ButtonClickEventArgs.ButtonClickEventArgs C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ButtonClickEventArgs_CHECK_VALUE() + { + /* TEST CODE */ + var buttonClickEventArgs = new Components.Popup.ButtonClickEventArgs(); + Assert.IsNotNull(buttonClickEventArgs, "Should be not null!"); + Assert.IsInstanceOf(buttonClickEventArgs, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test ButtonIndex. Check whether ButtonIndex is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.Popup.ButtonClickEventArgs.ButtonIndex A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ButtonIndex_SET_GET_VALUE() + { + /* TEST CODE */ + var buttonClickEventArgs = new Components.Popup.ButtonClickEventArgs(); + buttonClickEventArgs.ButtonIndex = 0; + Assert.AreEqual(0, buttonClickEventArgs.ButtonIndex, "Should be equal"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSPopup.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSPopup.cs new file mode 100755 index 000000000..72d033315 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSPopup.cs @@ -0,0 +1,847 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Components; +using Tizen.NUI.BaseComponents; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Popup Tests")] + public class PopupTests + { + private const string TAG = "Components"; + private string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png"; + private string _path = Tizen.Applications.Application.Current.DirectoryInfo.Resource; + private static bool _focusGainedFlag = false; + private static bool _focusLostFlag = false; + private static bool _updateFlag = false; + private static bool _layoutChildFlag = false; + private static bool _themeFlag = false; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("CommonPopupTests"); + App.MainTitleChangeBackgroundColor(null); + + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test Popup empty constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Popup.Popup C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void Popup_CHECK_VALUE() + { + /* TEST CODE */ + var popup = new Components.Popup(); + Assert.IsNotNull(popup, "Should be not Null!"); + Assert.IsInstanceOf(popup, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test Popup style constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Popup.Popup C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "string")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void Popup_Style_CHECK_VALUE() + { + /* TEST CODE */ + StyleManager.Instance.RegisterStyle("PopupStyle", null, typeof(PopupStyle)); + var popup = new Components.Popup("PopupStyle"); + Assert.IsNotNull(popup, "Should be not Null!"); + Assert.IsInstanceOf(popup, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test Popup PopupAttributes constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Popup.Popup C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "PopupAttributes")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void Popup_PopupAttributes_CHECK_VALUE() + { + /* TEST CODE */ + var attrs = new PopupAttributes + { + MinimumSize = new Size2D(1032, 184), + ShadowOffset = new Vector4(24, 24, 24, 24), + TitleTextAttributes = new TextAttributes + { + PointSize = new FloatSelector { All = 25 }, + TextColor = new ColorSelector { All = Color.Black }, + Size2D = new Size2D(0, 68), + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, + PivotPoint = Tizen.NUI.PivotPoint.TopLeft, + HorizontalAlignment = HorizontalAlignment.Begin, + VerticalAlignment = VerticalAlignment.Bottom, + Position2D = new Position2D(64, 52), + Text = new StringSelector { All = "Popup Title" }, + }, + BackgroundImageAttributes = new ImageAttributes + { + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.Center, + PivotPoint = Tizen.NUI.PivotPoint.Center, + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent, + ResourceURL = new StringSelector { All = _image_path }, + Border = new RectangleSelector { All = new Rectangle(0, 0, 81, 81) }, + }, + ButtonAttributes = new ButtonAttributes + { + Size2D = new Size2D(0, 132), + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft, + PivotPoint = Tizen.NUI.PivotPoint.BottomLeft, + BackgroundImageAttributes = new ImageAttributes + { + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.Center, + PivotPoint = Tizen.NUI.PivotPoint.Center, + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent, + ResourceURL = new StringSelector { All = _image_path }, + Border = new RectangleSelector { All = new Rectangle(5, 5, 5, 5) }, + }, + OverlayImageAttributes = new ImageAttributes + { + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.Center, + PivotPoint = Tizen.NUI.PivotPoint.Center, + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent, + BackgroundColor = new ColorSelector + { + Normal = new Color(1.0f, 1.0f, 1.0f, 1.0f), + Pressed = new Color(0.0f, 0.0f, 0.0f, 0.1f), + Selected = new Color(1.0f, 1.0f, 1.0f, 1.0f), + }, + }, + TextAttributes = new TextAttributes + { + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.Center, + PivotPoint = Tizen.NUI.PivotPoint.Center, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + TextColor = new ColorSelector { All = Color.Cyan }, + }, + }, + }; + var popup = new Components.Popup(attrs); + Assert.IsNotNull(popup, "Should be not Null!"); + Assert.IsInstanceOf(popup, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test TitleText. Check whether TitleText is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Popup.TitleText A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void TitleText_SET_GET_VALUE() + { + /* TEST CODE */ + var popup = new Components.Popup(); + popup.TitleText = "Test TitleText"; + Assert.AreEqual("Test TitleText", popup.TitleText, "Should be equals to the set value of TitleText"); + } + + [Test] + [Category("P1")] + [Description("Test ButtonCount. Check whether ButtonCount is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Popup.ButtonCount A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ButtonCount_SET_GET_VALUE() + { + /* TEST CODE */ + var popup = new Components.Popup(); + popup.ButtonCount = 2; + Assert.AreEqual(2, popup.ButtonCount, "Should be equals to the set value of ButtonCount"); + } + + [Test] + [Category("P1")] + [Description("Test ContentView. Check whether ContentView is readable.")] + [Property("SPEC", "Tizen.NUI.Components.Popup.ContentView A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ContentView_GET_VALUE() + { + /* TEST CODE */ + var popup = new Components.Popup(); + Assert.IsNotNull(popup.ContentView, "Should be equals!"); + Assert.IsInstanceOf(popup.ContentView, "Should be an instance of view!"); + } + + [Test] + [Category("P1")] + [Description("Test ShadowImageURL. Check whether ShadowImageURL is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Popup.ShadowImageURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ShadowImageURL_SET_GET_VALUE() + { + /* TEST CODE */ + var popup = new Components.Popup(); + popup.ShadowImageURL = _image_path; + Assert.AreEqual(_image_path, popup.ShadowImageURL, "Should be equals to the set value of ShadowImageURL"); + } + + [Test] + [Category("P1")] + [Description("Test ShadowImageBorder. Check whether ShadowImageBorder is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Popup.ShadowImageBorder A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ShadowImageBorder_SET_GET_VALUE() + { + /* TEST CODE */ + var popup = new Components.Popup(); + popup.ShadowImageBorder = new Rectangle(0, 0, 10, 10); + Assert.AreEqual(0, popup.ShadowImageBorder.X, "Retrieved ShadowImageBorder should be equal to set value"); + Assert.AreEqual(0, popup.ShadowImageBorder.Y, "Retrieved ShadowImageBorder should be equal to set value"); + Assert.AreEqual(10, popup.ShadowImageBorder.Width, "Retrieved ShadowImageBorder should be equal to set value"); + Assert.AreEqual(10, popup.ShadowImageBorder.Height, "Retrieved ShadowImageBorder should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test BackgroundImageURL. Check whether BackgroundImageURL is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Popup.BackgroundImageURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void BackgroundImageURL_SET_GET_VALUE() + { + /* TEST CODE */ + var popup = new Components.Popup(); + popup.BackgroundImageURL = _image_path; + Assert.AreEqual(_image_path, popup.BackgroundImageURL, "Should be equals to the set value of BackgroundImageURL"); + } + + [Test] + [Category("P1")] + [Description("Test BackgroundImageBorder. Check whether BackgroundImageBorder is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Popup.BackgroundImageBorder A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void BackgroundImageBorder_SET_GET_VALUE() + { + /* TEST CODE */ + var popup = new Components.Popup(); + popup.BackgroundImageBorder = new Rectangle(0, 0, 10, 10); + Assert.AreEqual(0, popup.BackgroundImageBorder.X, "Retrieved BackgroundImageBorder should be equal to set value"); + Assert.AreEqual(0, popup.BackgroundImageBorder.Y, "Retrieved BackgroundImageBorder should be equal to set value"); + Assert.AreEqual(10, popup.BackgroundImageBorder.Width, "Retrieved BackgroundImageBorder should be equal to set value"); + Assert.AreEqual(10, popup.BackgroundImageBorder.Height, "Retrieved BackgroundImageBorder should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test TitlePointSize. Check whether TitlePointSize is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Popup.TitlePointSize A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void TitlePointSize_SET_GET_VALUE() + { + /* TEST CODE */ + var popup = new Components.Popup(); + popup.TitlePointSize = 10.0f; + Assert.AreEqual(10.0f, popup.TitlePointSize, "Should be equals to the set value of TitlePointSize"); + } + + [Test] + [Category("P1")] + [Description("Test TitleFontFamily. Check whether TitleFontFamily is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Popup.TitleFontFamily A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void TitleFontFamily_SET_GET_VALUE() + { + /* TEST CODE */ + var popup = new Components.Popup(); + popup.TitleFontFamily = "SamsungOne 500"; + Assert.AreEqual("SamsungOne 500", popup.TitleFontFamily, "Should be equals to the set value of TitleFontFamily"); + } + + [Test] + [Category("P1")] + [Description("Test TitleTextColor. Check whether TitleTextColor is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Popup.TitleTextColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void TitleTextColor_SET_GET_VALUE() + { + /* TEST CODE */ + var popup = new Components.Popup(); + var color = new Color(1.0f, 0.0f, 0.0f, 1.0f); + popup.TitleTextColor = color; + + Assert.AreEqual(color.R, popup.TitleTextColor.R, "Should be equals to the color.R set"); + Assert.AreEqual(color.G, popup.TitleTextColor.G, "Should be equals to the color.G set"); + Assert.AreEqual(color.B, popup.TitleTextColor.B, "Should be equals to the color.B set"); + Assert.AreEqual(color.A, popup.TitleTextColor.A, "Should be equals to the color.A set"); + + } + + [Test] + [Category("P1")] + [Description("Test TitleTextHorizontalAlignment. Check whether TitleTextHorizontalAlignment is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Popup.TitleTextHorizontalAlignment A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void TitleTextHorizontalAlignment_SET_GET_VALUE() + { + /* TEST CODE */ + var popup = new Components.Popup(); + popup.TitleTextHorizontalAlignment = HorizontalAlignment.Begin; + Assert.AreEqual(HorizontalAlignment.Begin, popup.TitleTextHorizontalAlignment, "Should be equals to the set value of TitleTextHorizontalAlignment"); + } + + [Test] + [Category("P1")] + [Description("Test TitleTextPosition2D. Check whether TitleTextPosition2D is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Popup.TitleTextPosition2D A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void TitleTextPosition2D_SET_GET_VALUE() + { + /* TEST CODE */ + var popup = new Components.Popup(); + popup.TitleTextPosition2D = new Position2D(10, 10); + + Assert.AreEqual(10, popup.TitleTextPosition2D.X, "Should be equal"); + Assert.AreEqual(10, popup.TitleTextPosition2D.Y, "Should be equal"); + } + + [Test] + [Category("P1")] + [Description("Test TitleHeight. Check whether TitleHeight is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Popup.TitleHeight A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void TitleHeight_SET_GET_VALUE() + { + /* TEST CODE */ + var popup = new Components.Popup(); + popup.TitleHeight = 10; + Assert.AreEqual(10, popup.TitleHeight, "Should be equals to the set value of TitleHeight"); + } + + [Test] + [Category("P1")] + [Description("Test ShadowOffset. Check whether ShadowOffset is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.Popup.ShadowOffset A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ShadowOffset_SET_GET_VALUE() + { + /* TEST CODE */ + var popup = new Components.Popup(); + popup.ShadowOffset = new Vector4(10, 10, 10, 10); + + Assert.AreEqual(10, popup.ShadowOffset.X, "Should be equals!"); + Assert.AreEqual(10, popup.ShadowOffset.Y, "Should be equals!"); + Assert.AreEqual(10, popup.ShadowOffset.Z, "Should be equals!"); + Assert.AreEqual(10, popup.ShadowOffset.W, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test ButtonHeight. Check whether ButtonHeight is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Popup.ButtonHeight A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ButtonHeight_SET_GET_VALUE() + { + /* TEST CODE */ + var popup = new Components.Popup(); + popup.ButtonHeight = 10; + Assert.AreEqual(10, popup.ButtonHeight, "Should be equals to the set value of ButtonHeight"); + } + + [Test] + [Category("P1")] + [Description("Test ButtonPointSize. Check whether ButtonPointSize is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Popup.ButtonPointSize A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ButtonPointSize_SET_GET_VALUE() + { + /* TEST CODE */ + var popup = new Components.Popup(); + popup.ButtonPointSize = 10.0f; + Assert.AreEqual(10.0f, popup.ButtonPointSize, "Should be equals to the set value of ButtonPointSize"); + } + + [Test] + [Category("P1")] + [Description("Test ButtonFontFamily. Check whether ButtonFontFamily is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Popup.ButtonFontFamily A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ButtonFontFamily_SET_GET_VALUE() + { + /* TEST CODE */ + var popup = new Components.Popup(); + popup.ButtonFontFamily = "SamsungOne 500"; + Assert.AreEqual("SamsungOne 500", popup.ButtonFontFamily, "Should be equals to the set value of ButtonFontFamily"); + } + + [Test] + [Category("P1")] + [Description("Test ButtonOverLayBackgroundColorSelector. Check whether ButtonOverLayBackgroundColorSelector is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Popup.ButtonOverLayBackgroundColorSelector A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ButtonOverLayBackgroundColorSelector_SET_GET_VALUE() + { + /* TEST CODE */ + var popup = new Components.Popup(); + var colorSelector = new ColorSelector + { + Normal = new Color(0.0f, 0.0f, 1.0f, 1.0f), + Selected = new Color(0.0f, 1.0f, 0.0f, 1.0f), + }; + + popup.ButtonOverLayBackgroundColorSelector = colorSelector; + Assert.AreEqual(colorSelector.Normal.R, popup.ButtonOverLayBackgroundColorSelector.Normal.R, "Should be equals to the set value of ButtonOverLayBackgroundColorSelector Normal R"); + Assert.AreEqual(colorSelector.Normal.G, popup.ButtonOverLayBackgroundColorSelector.Normal.G, "Should be equals to the set value of ButtonOverLayBackgroundColorSelector Normal G"); + Assert.AreEqual(colorSelector.Normal.B, popup.ButtonOverLayBackgroundColorSelector.Normal.B, "Should be equals to the set value of ButtonOverLayBackgroundColorSelector Normal B"); + Assert.AreEqual(colorSelector.Normal.A, popup.ButtonOverLayBackgroundColorSelector.Normal.A, "Should be equals to the set value of ButtonOverLayBackgroundColorSelector Normal A"); + + Assert.AreEqual(colorSelector.Selected.R, popup.ButtonOverLayBackgroundColorSelector.Selected.R, "Should be equals to the set value of ButtonOverLayBackgroundColorSelector Selected R"); + Assert.AreEqual(colorSelector.Selected.G, popup.ButtonOverLayBackgroundColorSelector.Selected.G, "Should be equals to the set value of ButtonOverLayBackgroundColorSelector Selected G"); + Assert.AreEqual(colorSelector.Selected.B, popup.ButtonOverLayBackgroundColorSelector.Selected.B, "Should be equals to the set value of ButtonOverLayBackgroundColorSelector Selected B"); + Assert.AreEqual(colorSelector.Selected.A, popup.ButtonOverLayBackgroundColorSelector.Selected.A, "Should be equals to the set value of ButtonOverLayBackgroundColorSelector Selected A"); + } + + [Test] + [Category("P1")] + [Description("Test ButtonTextAlignment. Check whether ButtonTextAlignment is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Popup.ButtonTextAlignment A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ButtonTextAlignment_SET_GET_VALUE() + { + /* TEST CODE */ + var popup = new Components.Popup(); + popup.ButtonTextAlignment = HorizontalAlignment.Begin; + Assert.AreEqual(HorizontalAlignment.Begin, popup.ButtonTextAlignment, "Should be equal"); + } + + [Test] + [Category("P1")] + [Description("Test ButtonTextColor. Check whether ButtonTextColor is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Popup.ButtonTextColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ButtonTextColor_SET_GET_VALUE() + { + /* TEST CODE */ + var popup = new Components.Popup(); + var textColor = new Color(0.0f, 0.0f, 1.0f, 0.0f); + popup.ButtonTextColor = textColor; + + Assert.AreEqual(textColor.R, popup.ButtonTextColor.R, "Should be equal"); + Assert.AreEqual(textColor.G, popup.ButtonTextColor.G, "Should be equal"); + Assert.AreEqual(textColor.B, popup.ButtonTextColor.B, "Should be equal"); + Assert.AreEqual(textColor.A, popup.ButtonTextColor.A, "Should be equal"); + } + + [Test] + [Category("P1")] + [Description("Test ButtonBackgroundImageURL. Check whether ButtonBackgroundImageURL is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Popup.ButtonBackgroundImageURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ButtonBackgroundImageURL_SET_GET_VALUE() + { + /* TEST CODE */ + var popup = new Components.Popup(); + popup.ButtonBackgroundImageURL = _image_path; + Assert.AreEqual(_image_path, popup.ButtonBackgroundImageURL, "Should be equals to the set value of ButtonBackgroundImageURL"); + } + + [Test] + [Category("P1")] + [Description("Test ButtonBackgroundImageBorder. Check whether ButtonBackgroundImageBorder is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Popup.ButtonBackgroundImageBorder A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ButtonBackgroundImageBorder_SET_GET_VALUE() + { + /* TEST CODE */ + var popup = new Components.Popup(); + popup.ButtonBackgroundImageBorder = new Rectangle(0, 0, 10, 10); + Assert.AreEqual(0, popup.ButtonBackgroundImageBorder.X, "Retrieved ButtonBackgroundImageBorder should be equal to set value"); + Assert.AreEqual(0, popup.ButtonBackgroundImageBorder.Y, "Retrieved ButtonBackgroundImageBorder should be equal to set value"); + Assert.AreEqual(10, popup.ButtonBackgroundImageBorder.Width, "Retrieved ButtonBackgroundImageBorder should be equal to set value"); + Assert.AreEqual(10, popup.ButtonBackgroundImageBorder.Height, "Retrieved ButtonBackgroundImageBorder should be equal to set value"); + } + + public class MyPopup : Components.Popup + { + public override void OnFocusGained() + { + _focusGainedFlag = true; + base.OnFocusGained(); + } + + public override void OnFocusLost() + { + _focusLostFlag = true; + base.OnFocusLost(); + } + + protected override Attributes GetAttributes() + { + return base.GetAttributes(); + } + + public Attributes TestGetAttributes() + { + return GetAttributes(); + } + + protected override void OnUpdate() + { + _updateFlag = true; + base.OnUpdate(); + } + + protected override void LayoutChild() + { + _layoutChildFlag = true; + base.LayoutChild(); + } + + protected override void OnThemeChangedEvent(object sender, Components.StyleManager.ThemeChangeEventArgs e) + { + _themeFlag = true; + base.OnThemeChangedEvent(sender, e); + } + } + + [Test] + [Category("P1")] + [Description("Test OnFocusGained. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Popup.OnFocusGained M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void OnFocusGained_CHECK_VALUE() + { + /* TEST CODE */ + _focusGainedFlag = false; + var myPopup = new MyPopup(); + myPopup.Focusable = true; + Window.Instance.Add(myPopup); + FocusManager.Instance.SetCurrentFocusView(myPopup); + Assert.AreEqual(true, _focusGainedFlag, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test OnFocusLost. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Popup.OnFocusLost M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void OnFocusLost_CHECK_VALUE() + { + /* TEST CODE */ + _focusLostFlag = false; + var myPopup = new MyPopup(); + var view = new BaseComponents.View(); + view.Focusable = true; + myPopup.Focusable = true; + Window.Instance.Add(myPopup); + Window.Instance.Add(view); + FocusManager.Instance.SetCurrentFocusView(myPopup); + FocusManager.Instance.SetCurrentFocusView(view); + Assert.AreEqual(true, _focusLostFlag, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test GetAttributes. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Popup.GetAttributes M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void GetAttributes_CHECK_VALUE() + { + /* TEST CODE */ + var myPopup = new MyPopup(); + var attr = myPopup.TestGetAttributes(); + Assert.IsNotNull(attr, "Should be not null!"); + Assert.IsInstanceOf(attr, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test OnUpdate. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Popup.OnUpdate M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public async Task OnUpdate_CHECK_VALUE() + { + /* TEST CODE */ + _updateFlag = false; + var myPopup = CreatePopup(); + await Task.Delay(500); + Assert.AreEqual(true, _updateFlag, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test SetButtonText. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Popup.SetButtonText M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void SetButtonText_CHECK_VALUE() + { + /* TEST CODE */ + try + { + Popup popup = new Popup(); + popup.SetButtonText(0, "YES"); + } + 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 LayoutChild. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Popup.LayoutChild M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public async Task LayoutChild_CHECK_VALUE() + { + /* TEST CODE */ + _layoutChildFlag = false; + var myPopup = CreatePopup(); + await Task.Delay(500); + Assert.AreEqual(true, _layoutChildFlag, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test OnThemeChangedEvent. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Popup.OnThemeChangedEvent M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public async Task OnThemeChangedEvent_CHECK_VALUE() + { + _themeFlag = false; + Tizen.NUI.Components.StyleManager.Instance.Theme = "Utility"; + var myPopup = new MyPopup(); + Window window = Window.Instance; + window.Add(myPopup); + Tizen.NUI.Components.StyleManager.Instance.Theme = "Food"; + await Task.Delay(500); + Assert.AreEqual(true, _themeFlag, "OnThemeChangedEvent trigger Check Fail."); + window.Remove(myPopup); + } + + [Test] + [Category("P1")] + [Description("Test Dispose, try to dispose the Popup.")] + [Property("SPEC", "Tizen.NUI.Components.Popup.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Dispose_TEST() + { + /* TEST CODE */ + try + { + Popup popup = new Popup(); + popup.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()); + } + } + + private MyPopup CreatePopup() + { + MyPopup popup = new MyPopup(); + popup.MinimumSize = new Size2D(1032, 184); + popup.Size2D = new Size2D(1032, 400); + popup.Position2D = new Position2D(200, 100); + + popup.TitlePointSize = 25; + popup.TitleTextColor = Color.Black; + popup.TitleHeight = 68; + popup.TitleTextHorizontalAlignment = HorizontalAlignment.Begin; + popup.TitleTextPosition2D = new Position2D(64, 52); + popup.TitleText = "Popup Title"; + + popup.ShadowImageURL = _path + "11. Popup/popup_background_shadow.png"; + popup.ShadowImageBorder = new Rectangle(0, 0, 105, 105); + popup.ShadowOffset = new Vector4(24, 24, 24, 24); + popup.BackgroundImageURL = _path + "11. Popup/popup_background.png"; + popup.BackgroundImageBorder = new Rectangle(0, 0, 81, 81); + + popup.ButtonBackgroundImageURL = _path + "3. Button/rectangle_btn_normal.png"; + popup.ButtonBackgroundImageBorder = new Rectangle(5, 5, 5, 5); + popup.ButtonOverLayBackgroundColorSelector = new ColorSelector + { + Normal = new Color(1.0f, 1.0f, 1.0f, 1.0f), + Pressed = new Color(0.0f, 0.0f, 0.0f, 0.1f), + Selected = new Color(1.0f, 1.0f, 1.0f, 1.0f), + }; + popup.ButtonTextColor = Color.Red; + popup.ButtonHeight = 132; + popup.ButtonCount = 2; + popup.SetButtonText(0, "Yes"); + popup.SetButtonText(1, "Exit"); + + Window.Instance.Add(popup); + + TextLabel contentText = new TextLabel(); + contentText.Size2D = new Size2D(904, 100); + contentText.PointSize = 20; + contentText.HorizontalAlignment = HorizontalAlignment.Begin; + contentText.VerticalAlignment = VerticalAlignment.Center; + contentText.Text = "Popup ButtonStyle is "; + popup.ContentView.Add(contentText); + + return popup; + } + + } + + public class PopupStyle : StyleBase + { + private string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png"; + protected override Attributes GetAttributes() + { + PopupAttributes attributes = new PopupAttributes + { + MinimumSize = new Size2D(1032, 184), + ShadowOffset = new Vector4(24, 24, 24, 24), + TitleTextAttributes = new TextAttributes + { + PointSize = new FloatSelector { All = 25 }, + TextColor = new ColorSelector { All = Color.Black }, + Size2D = new Size2D(0, 68), + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, + PivotPoint = Tizen.NUI.PivotPoint.TopLeft, + HorizontalAlignment = HorizontalAlignment.Begin, + VerticalAlignment = VerticalAlignment.Bottom, + Position2D = new Position2D(64, 52), + }, + BackgroundImageAttributes = new ImageAttributes + { + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.Center, + PivotPoint = Tizen.NUI.PivotPoint.Center, + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent, + ResourceURL = new StringSelector { All = _image_path}, + Border = new RectangleSelector { All = new Rectangle(0, 0, 81, 81) }, + }, + ButtonAttributes = new ButtonAttributes + { + Size2D = new Size2D(0, 132), + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft, + PivotPoint = Tizen.NUI.PivotPoint.BottomLeft, + BackgroundImageAttributes = new ImageAttributes + { + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.Center, + PivotPoint = Tizen.NUI.PivotPoint.Center, + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent, + ResourceURL = new StringSelector { All = _image_path }, + Border = new RectangleSelector { All = new Rectangle(5, 5, 5, 5) }, + }, + OverlayImageAttributes = new ImageAttributes + { + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.Center, + PivotPoint = Tizen.NUI.PivotPoint.Center, + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent, + BackgroundColor = new ColorSelector + { + Normal = new Color(1.0f, 1.0f, 1.0f, 1.0f), + Pressed = new Color(0.0f, 0.0f, 0.0f, 0.1f), + Selected = new Color(1.0f, 1.0f, 1.0f, 1.0f), + }, + } + }, + }; + return attributes; + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSPopupAttributes.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSPopupAttributes.cs new file mode 100755 index 000000000..319d7322d --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSPopupAttributes.cs @@ -0,0 +1,239 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Components; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.PopupAttributes Tests")] + public class PopupAttributesTests + { + 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!"); + App.MainTitleChangeText("PopupAttributesTests"); + App.MainTitleChangeBackgroundColor(null); + + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test PopupAttributes empty constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.PopupAttributes.PopupAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void PopupAttributes_CHECK_VALUE() + { + /* TEST CODE */ + var popupAttributes = new PopupAttributes(); + Assert.IsNotNull(popupAttributes, "Should be not null!"); + Assert.IsInstanceOf(popupAttributes, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test PopupAttributes copy constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.PopupAttributes.PopupAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "PopupAttributes")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void PopupAttributes_PopupAttributes_CHECK_VALUE() + { + /* TEST CODE */ + var attrs = new PopupAttributes + { + MinimumSize = new Size2D(1032, 184), + ShadowOffset = new Vector4(24, 24, 24, 24), + TitleTextAttributes = new TextAttributes + { + PointSize = new FloatSelector { All = 25 }, + TextColor = new ColorSelector { All = Color.Black }, + Size2D = new Size2D(0, 68), + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, + PivotPoint = Tizen.NUI.PivotPoint.TopLeft, + HorizontalAlignment = HorizontalAlignment.Begin, + VerticalAlignment = VerticalAlignment.Bottom, + Position2D = new Position2D(64, 52), + Text = new StringSelector { All = "Popup Title" }, + }, + BackgroundImageAttributes = new ImageAttributes + { + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.Center, + PivotPoint = Tizen.NUI.PivotPoint.Center, + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent, + ResourceURL = new StringSelector { All = _image_path }, + Border = new RectangleSelector { All = new Rectangle(0, 0, 81, 81) }, + }, + ButtonAttributes = new ButtonAttributes + { + Size2D = new Size2D(0, 132), + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft, + PivotPoint = Tizen.NUI.PivotPoint.BottomLeft, + BackgroundImageAttributes = new ImageAttributes + { + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.Center, + PivotPoint = Tizen.NUI.PivotPoint.Center, + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent, + ResourceURL = new StringSelector { All = _image_path }, + Border = new RectangleSelector { All = new Rectangle(5, 5, 5, 5) }, + }, + OverlayImageAttributes = new ImageAttributes + { + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.Center, + PivotPoint = Tizen.NUI.PivotPoint.Center, + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent, + BackgroundColor = new ColorSelector + { + Normal = new Color(1.0f, 1.0f, 1.0f, 1.0f), + Pressed = new Color(0.0f, 0.0f, 0.0f, 0.1f), + Selected = new Color(1.0f, 1.0f, 1.0f, 1.0f), + }, + }, + TextAttributes = new TextAttributes + { + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.Center, + PivotPoint = Tizen.NUI.PivotPoint.Center, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + TextColor = new ColorSelector { All = Color.Cyan }, + }, + }, + }; + var popupAttributes = new PopupAttributes(attrs); + Assert.IsNotNull(popupAttributes, "Should be not null!"); + Assert.IsInstanceOf(popupAttributes, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test ShadowImageAttributes. Check whether ShadowImageAttributes is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.PopupAttributes.ShadowImageAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ShadowImageAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var popupAttributes = new PopupAttributes(); + popupAttributes.ShadowImageAttributes = new ImageAttributes(); + Assert.IsNotNull(popupAttributes.ShadowImageAttributes, "Should be not null!"); + Assert.IsInstanceOf(popupAttributes.ShadowImageAttributes, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test BackgroundImageAttributes. Check whether BackgroundImageAttributes is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.PopupAttributes.BackgroundImageAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void BackgroundImageAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var popupAttributes = new PopupAttributes(); + popupAttributes.BackgroundImageAttributes = new ImageAttributes(); + Assert.IsNotNull(popupAttributes.BackgroundImageAttributes, "Should be not null!"); + Assert.IsInstanceOf(popupAttributes.BackgroundImageAttributes, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test TitleTextAttributes. Check whether TitleTextAttributes is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.PopupAttributes.TitleTextAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void TitleTextAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var popupAttributes = new PopupAttributes(); + popupAttributes.TitleTextAttributes = new TextAttributes(); + Assert.IsNotNull(popupAttributes.TitleTextAttributes, "Should be not null!"); + Assert.IsInstanceOf(popupAttributes.TitleTextAttributes, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test ShadowOffset. Check whether ShadowOffset is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.PopupAttributes.ShadowOffset A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ShadowOffset_SET_GET_VALUE() + { + /* TEST CODE */ + var popupAttributes = new PopupAttributes(); + popupAttributes.ShadowOffset = new Vector4(10, 10, 10, 10); + + Assert.AreEqual(10, popupAttributes.ShadowOffset.X, "Should be equals!"); + Assert.AreEqual(10, popupAttributes.ShadowOffset.Y, "Should be equals!"); + Assert.AreEqual(10, popupAttributes.ShadowOffset.Z, "Should be equals!"); + Assert.AreEqual(10, popupAttributes.ShadowOffset.W, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test ButtonAttributes. Check whether ButtonAttributes is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.PopupAttributes.ButtonAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ButtonAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var popupAttributes = new PopupAttributes(); + popupAttributes.ButtonAttributes = new ButtonAttributes(); + Assert.IsNotNull(popupAttributes.ButtonAttributes, "Should be not null!"); + Assert.IsInstanceOf(popupAttributes.ButtonAttributes, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test Clone. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.PopupAttributes.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void Clone_CHECK_VALUE() + { + var popupAttributes = new PopupAttributes(); + popupAttributes.ShadowOffset = new Vector4(1, 1, 1, 1); + popupAttributes.ButtonAttributes = new ButtonAttributes(); + var attr = popupAttributes.Clone() as PopupAttributes; + Assert.IsNotNull(attr, "Should be not null!"); + Assert.IsInstanceOf(attr, "Should be an instance of PopupAttributes!"); + Assert.AreEqual(1, attr.ShadowOffset.X, "Should be equal!"); + } + + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSProgress.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSProgress.cs new file mode 100755 index 000000000..aa73d325c --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSProgress.cs @@ -0,0 +1,507 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.Components; +using System.Threading; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Progress Tests")] + public class ProgressTests + { + private const string TAG = "Components"; + private string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "Tizen.NUI.Components.Tests.png"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("ProgressTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test Construct. Check whether Progress construct.")] + [Property("SPEC", "Tizen.NUI.Components.Progress.Progress C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Progress_INIT() + { + var progress = new Progress(); + Assert.IsNotNull(progress, "Should be not null!"); + Assert.IsInstanceOf(progress, "Progress Contruct Fail"); + } + + [Test] + [Category("P1")] + [Description("Create a Progress object with attributes. Check whether object whose text is initialized is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.Progress.Progress C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "ProgressAttributes")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Progress_INIT_WITH_ProgressAttributes() + { + /* TEST CODE */ + var tab = new Progress(new ProgressAttributes()); + Assert.IsNotNull(tab, "Can't create success object Progress"); + Assert.IsInstanceOf(tab, "Should be an instance of textLabel type."); + } + + [Test] + [Category("P1")] + [Description("Create a Progress object with string. Check whether object whose text is initialized is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.Progress.Progress C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "string")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Progress_INIT_WITH_STRING() + { + /* TEST CODE */ + StyleManager.Instance.RegisterStyle("DefaultProgress", "Utility", typeof(UtilityProgressStyle), true); + var tab = new Progress("DefaultProgress"); + Assert.IsNotNull(tab, "Can't create success object Progress"); + Assert.IsInstanceOf(tab, "Should be an instance of Progress type."); + } + + [Test] + [Category("P1")] + [Description("Test TrackImageURL. Check whether TrackImageURL works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Progress.TrackImageURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void TrackImageURL_SET_GET_VALUE() + { + /* TEST CODE */ + var progress = new Progress(); + progress.TrackImageURL = "progressurl"; + Assert.AreEqual("progressurl", progress.TrackImageURL, "Retrieved TrackImageURL should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test ProgressImageURL. Check whether ProgressImageURL works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Progress.ProgressImageURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void ProgressImageURL_SET_GET_VALUE() + { + /* TEST CODE */ + var progress = new Progress(); + progress.ProgressImageURL = "progressurl"; + Assert.AreEqual("progressurl", progress.ProgressImageURL, "Retrieved ProgressImageURL should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test BufferImageURL. Check whether BufferImageURL works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Progress.BufferImageURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void BufferImageURL_SET_GET_VALUE() + { + /* TEST CODE */ + var progress = new Progress(); + progress.BufferImageURL = "progressurl"; + Assert.AreEqual("progressurl", progress.BufferImageURL, "Retrieved BufferImageURL should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test TrackColor. Check whether TrackColor works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Progress.TrackColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void TrackColor_SET_GET_VALUE() + { + /* TEST CODE */ + var progress = new Progress(); + Color color = Color.Red; + progress.TrackColor = color; + Assert.AreEqual(color.R, progress.TrackColor.R, "Retrieved TrackColor should be equal to set value"); + Assert.AreEqual(color.G, progress.TrackColor.G, "Retrieved TrackColor should be equal to set value"); + Assert.AreEqual(color.B, progress.TrackColor.B, "Retrieved TrackColor should be equal to set value"); + Assert.AreEqual(color.A, progress.TrackColor.A, "Retrieved TrackColor should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test ProgressColor. Check whether ProgressColor works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Progress.ProgressColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void ProgressColor_SET_GET_VALUE() + { + /* TEST CODE */ + var progress = new Progress(); + Color color = Color.Red; + progress.ProgressColor = color; + Assert.AreEqual(color.R, progress.ProgressColor.R, "Retrieved ProgressColor should be equal to set value"); + Assert.AreEqual(color.G, progress.ProgressColor.G, "Retrieved ProgressColor should be equal to set value"); + Assert.AreEqual(color.B, progress.ProgressColor.B, "Retrieved ProgressColor should be equal to set value"); + Assert.AreEqual(color.A, progress.ProgressColor.A, "Retrieved ProgressColor should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test BufferColor. Check whether BufferColor works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Progress.BufferColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void BufferColor_SET_GET_VALUE() + { + /* TEST CODE */ + var progress = new Progress(); + Color color = Color.Red; + progress.BufferColor = color; + Assert.AreEqual(color.R, progress.BufferColor.R, "Retrieved BufferColor should be equal to set value"); + Assert.AreEqual(color.G, progress.BufferColor.G, "Retrieved BufferColor should be equal to set value"); + Assert.AreEqual(color.B, progress.BufferColor.B, "Retrieved BufferColor should be equal to set value"); + Assert.AreEqual(color.A, progress.BufferColor.A, "Retrieved BufferColor should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test MaxValue. Check MaxValue Read and Write.")] + [Property("SPEC", "Tizen.NUI.Components.Progress.MaxValue A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void MaxValue_SET_GET_VALUE() + { + var progress = new Progress(); + progress.MaxValue = 30; + Assert.AreEqual(30f, progress.MaxValue, "Retrieved MaxValue should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test MinValue. Check MinValue Read and Write.")] + [Property("SPEC", "Tizen.NUI.Components.Progress.MinValue A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void MinValue_SET_GET_VALUE() + { + var progress = new Progress(); + progress.MinValue = 5; + Assert.AreEqual(5, progress.MinValue, "Retrieved MinValue should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test CurrentValue. Check whether CurrentValue works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Progress.CurrentValue A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void CurrentValue_SET_GET_VALUE() + { + /* TEST CODE */ + var progress = new Progress(); + progress.CurrentValue = 20; + Assert.AreEqual(20, progress.CurrentValue, "Retrieved CurrentValue should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test BufferValue. Check whether BufferValue works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Progress.BufferValue A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void BufferValue_SET_GET_VALUE() + { + /* TEST CODE */ + var progress = new Progress(); + progress.BufferValue = 20; + Assert.AreEqual(20, progress.BufferValue, "Retrieved BufferValue should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test ProgressState. Check ProgressState Read and Write.")] + [Property("SPEC", "Tizen.NUI.Components.Progress.ProgressState A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void ProgressState_SET_GET_VALUE() + { + var progress = new Progress(); + progress.ProgressState = Progress.ProgressStatusType.Determinate; + Assert.AreEqual(Progress.ProgressStatusType.Determinate, progress.ProgressState, "Retrieved ProgressState should be equal to set value"); + progress.ProgressState = Progress.ProgressStatusType.Buffering; + Assert.AreEqual(Progress.ProgressStatusType.Buffering, progress.ProgressState, "Retrieved ProgressState should be equal to set value"); + progress.ProgressState = Progress.ProgressStatusType.Indeterminate; + Assert.AreEqual(Progress.ProgressStatusType.Indeterminate, progress.ProgressState, "Retrieved ProgressState should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test GetAttributes. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Progress.GetAttributes M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void GetAttributes_CHECK_VALUE() + { + /* TEST CODE */ + try + { + var myProgress = new MyProgress(); + Assert.IsTrue(myProgress.flagGetAttributes, "GetAttributes trigger Check Fail."); + } + 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 OnUpdate. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Progress.OnUpdate M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public async Task OnUpdate_CHECK_VALUE() + { + /* TEST CODE */ + var myProgress = new MyProgress(); + Window.Instance.Add(myProgress); + try + { + await Task.Delay(200); + Assert.IsTrue(myProgress.flagOnUpdate, "OnUpdate trigger Check Fail."); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + finally + { + Window.Instance.Remove(myProgress); + } + } + + [Test] + [Category("P1")] + [Description("Test OnThemeChangedEvent. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Progress.OnThemeChangedEvent M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public async Task OnThemeChangedEvent_CHECK_VALUE() + { + /* TEST CODE */ + StyleManager.Instance.Theme = "Utility"; + var myProgress = new MyProgress(); + Window.Instance.Add(myProgress); + try + { + StyleManager.Instance.Theme = "Food"; + await Task.Delay(200); + Assert.IsTrue(myProgress.flagOnThemeChangedEvent, "OnThemeChangedEvent trigger Check Fail."); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + finally + { + Window.Instance.Remove(myProgress); + } + } + + [Test] + [Category("P1")] + [Description("Test UpdateStates. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Progress.UpdateStates M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void UpdateStates_CHECK_VALUE() + { + /* TEST CODE */ + try + { + var myProgress = new MyProgress(); + myProgress.ProgressState = Progress.ProgressStatusType.Determinate; + Assert.IsTrue(myProgress.flagUpdateStates, "UpdateStates trigger Check Fail."); + } + 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 UpdateValue. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Progress.UpdateValue M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void UpdateValue_CHECK_VALUE() + { + /* TEST CODE */ + try + { + var myProgress = new MyProgress(); + myProgress.MinValue = 1; + Assert.IsTrue(myProgress.flagUpdateValue, "UpdateValue trigger Check Fail."); + } + 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 ChangeImageState, Check whether ChangeImageState works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Progress.ChangeImageState M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void ChangeImageState_CHECK() + { + /* TEST CODE */ + try + { + var myProgress = new MyProgress(); + myProgress._ChangeImageState(Progress.ProgressStatusType.Buffering); + } + 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 Dispose, try to dispose the Progress.")] + [Property("SPEC", "Tizen.NUI.Components.Progress.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Dispose_TEST() + { + /* TEST CODE */ + try + { + Progress progressBar = new Progress(); + progressBar.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 MyProgress : Progress + { + public bool flagGetAttributes = false; + public bool flagOnUpdate = false; + public bool flagOnThemeChangedEvent = false; + public bool flagUpdateStates = false; + public bool flagUpdateValue = false; + + public MyProgress() : base() + { } + + public MyProgress(string style) : base(style) + { } + + protected override Attributes GetAttributes() + { + flagGetAttributes = true; + return new ProgressAttributes(); + } + + protected override void OnUpdate() + { + base.OnUpdate(); + flagOnUpdate = true; + } + + protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e) + { + flagOnThemeChangedEvent = true; + } + + protected override void UpdateStates() + { + flagUpdateStates = true; + } + + protected override void UpdateValue() + { + flagUpdateValue = true; + } + + public void _ChangeImageState(ProgressStatusType statusType) + { + base.ChangeImageState(statusType); + } + } + + internal class UtilityProgressStyle : StyleBase + { + protected override Attributes GetAttributes() + { + ProgressAttributes attributes = new ProgressAttributes + { + TrackImageAttributes = new ImageAttributes + { + BackgroundColor = new ColorSelector + { + All = new Color(0.0f, 0.0f, 0.0f, 0.1f), + } + }, + ProgressImageAttributes = new ImageAttributes + { + BackgroundColor = new ColorSelector + { + All = Color.Green + } + }, + }; + return attributes; + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSProgressAttributes.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSProgressAttributes.cs new file mode 100755 index 000000000..12ffec14a --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSProgressAttributes.cs @@ -0,0 +1,138 @@ +using NUnit.Framework; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.ProgressAttributes Tests")] + public class ProgressAttributesTests + { + private const string TAG = "Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("ProgressAttributesTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a ProgressAttributes object. Check whether ProgressAttributes is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.ProgressAttributes.ProgressAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void ProgressAttributes_INIT() + { + /* TEST CODE */ + var progressAttributes = new ProgressAttributes(); + Assert.IsNotNull(progressAttributes, "Can't create success object ProgressAttributes"); + Assert.IsInstanceOf(progressAttributes, "Should be an instance of ProgressAttributes type."); + } + + [Test] + [Category("P1")] + [Description("Create a ProgressAttributes object. Check whether ProgressAttributes is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.ProgressAttributes.ProgressAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "ProgressAttributes")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void ProgressAttributes_INIT_WITH_ProgressAttributes() + { + /* TEST CODE */ + var progressAttributes = new ProgressAttributes(); + var progressAttributes2 = new ProgressAttributes(progressAttributes); + Assert.IsNotNull(progressAttributes2, "Can't create success object ProgressAttributes"); + Assert.IsInstanceOf(progressAttributes2, "Should be an instance of ProgressAttributes type."); + } + + [Test] + [Category("P1")] + [Description("Test TrackImageAttributes. Check whether TrackImageAttributes is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.ProgressAttributes.TrackImageAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void TrackImageAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var progressAttributes = new ProgressAttributes(); + var imageAttributes = new ImageAttributes() { ResourceURL = new StringSelector() { All = "test.png" } }; + progressAttributes.TrackImageAttributes = imageAttributes; + Assert.AreEqual(imageAttributes.ResourceURL.All, progressAttributes.TrackImageAttributes.ResourceURL.All, "Retrieved TrackImageAttributes should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test ProgressImageAttributes. Check whether ProgressImageAttributes is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.ProgressAttributes.ProgressImageAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void ProgressImageAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var progressAttributes = new ProgressAttributes(); + var imageAttributes = new ImageAttributes() { ResourceURL = new StringSelector() { All = "test.png" } }; + progressAttributes.ProgressImageAttributes = imageAttributes; + Assert.AreEqual(imageAttributes.ResourceURL.All, progressAttributes.ProgressImageAttributes.ResourceURL.All, "Retrieved ProgressImageAttributes should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test BufferImageAttributes. Check whether BufferImageAttributes is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.ProgressAttributes.BufferImageAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void BufferImageAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var progressAttributes = new ProgressAttributes(); + var imageAttributes = new ImageAttributes() { ResourceURL = new StringSelector() { All = "test.png" } }; + progressAttributes.BufferImageAttributes = imageAttributes; + Assert.AreEqual(imageAttributes.ResourceURL.All, progressAttributes.BufferImageAttributes.ResourceURL.All, "Retrieved BufferImageAttributes should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test LoadingImageAttributes. Check whether LoadingImageAttributes is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.ProgressAttributes.LoadingImageAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void LoadingImageAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var progressAttributes = new ProgressAttributes(); + var imageAttributes = new ImageAttributes() { ResourceURL = new StringSelector() { All = "test.png" } }; + progressAttributes.LoadingImageAttributes = imageAttributes; + Assert.AreEqual(imageAttributes, progressAttributes.LoadingImageAttributes, "Retrieved LoadingImageAttributes should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test Clone. Check whether Clone works or not")] + [Property("SPEC", "Tizen.NUI.Components.ProgressAttributes.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Clone_CHECK_RETURN_VALUE() + { + var progressAttributes = new ProgressAttributes(); + progressAttributes.TrackImageAttributes = new ImageAttributes() { ResourceURL = new StringSelector() { All = "test.png" } }; + var progressAttributes2 = progressAttributes.Clone() as ProgressAttributes; + Assert.AreEqual(progressAttributes.TrackImageAttributes.ResourceURL.All, progressAttributes2.TrackImageAttributes.ResourceURL.All, "Retrieved InputBoxAttributes should be equal to clone value"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSRadioButton.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSRadioButton.cs new file mode 100755 index 000000000..61975111d --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSRadioButton.cs @@ -0,0 +1,154 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Components; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.RadioButton Tests")] + public class RadioButtonTests + { + 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!"); + App.MainTitleChangeText("CommonRadioButtonTests"); + App.MainTitleChangeBackgroundColor(null); + + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test RadioButton empty constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.RadioButton.RadioButton C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void RadioButton_CHECK_VALUE() + { + /* TEST CODE */ + var radioButton = new Components.RadioButton(); + Assert.IsNotNull(radioButton, "Should be not null!"); + Assert.IsInstanceOf(radioButton, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test RadioButton style constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.RadioButton.RadioButton C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "string")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void RadioButton_Style_CHECK_VALUE() + { + /* TEST CODE */ + StyleManager.Instance.RegisterStyle("RadioButtonStyle", null, typeof(RadioButtonStyle)); + var radioButton = new Components.RadioButton("RadioButtonStyle"); + Assert.IsNotNull(radioButton, "Should be not null!"); + Assert.IsInstanceOf(radioButton, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test RadioButton SelectButtonAttributes constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.RadioButton.RadioButton C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "SelectButtonAttributes")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void RadioButton_SelectButtonAttributes_CHECK_VALUE() + { + /* TEST CODE */ + var selectButtonAttributes = new SelectButtonAttributes + { + CheckImageAttributes = new ImageAttributes + { + Size2D = new Size2D(48, 48), + ResourceURL = new StringSelector + { + All = _image_path, + }, + Opacity = new FloatSelector + { + Normal = 1.0f, + Selected = 1.0f, + Disabled = 0.4f, + DisabledSelected = 0.4f + }, + }, + }; + var radioButton = new Components.RadioButton(selectButtonAttributes); + Assert.IsNotNull(radioButton, "Should be not null!"); + Assert.IsInstanceOf(radioButton, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test ItemGroup. Check whether ItemGroup is readable.")] + [Property("SPEC", "Tizen.NUI.Components.RadioButton.ItemGroup A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void ItemGroup_SET_GET_VALUE() + { + /* TEST CODE */ + var radioButtonGroup = new RadioButtonGroup(); + var radioButton = new Components.RadioButton(); + var radioButton2 = new Components.RadioButton(); + radioButtonGroup.Add(radioButton); + radioButtonGroup.Add(radioButton2); + Assert.IsNotNull(radioButton.ItemGroup, "Should be equal!"); + Assert.AreEqual(2, radioButton.ItemGroup.Count, "Should be equal!"); + } + } + + public class RadioButtonStyle : StyleBase + { + private string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png"; + protected override Attributes GetAttributes() + { + SelectButtonAttributes attributes = new SelectButtonAttributes + { + CheckImageAttributes = new ImageAttributes + { + Size2D = new Size2D(48, 48), + Position2D = new Position2D(0, 0), + ResourceURL = new StringSelector + { + Normal = _image_path, + Selected = _image_path, + Disabled = _image_path, + DisabledSelected = _image_path, + }, + Opacity = new FloatSelector + { + Normal = 1.0f, + Selected = 1.0f, + Disabled = 0.4f, + DisabledSelected = 0.4f + }, + }, + }; + + return attributes; + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSRadioButtonGroup.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSRadioButtonGroup.cs new file mode 100755 index 000000000..a63292dc1 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSRadioButtonGroup.cs @@ -0,0 +1,119 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Components; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.RadioButtonGroup Tests")] + public class RadioButtonGroupTests + { + 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!"); + App.MainTitleChangeText("RadioButtonGroupTests"); + App.MainTitleChangeBackgroundColor(null); + + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test RadioButtonGroup. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.RadioButtonGroup.RadioButtonGroup C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void RadioButtonGroup_CHECK_VALUE() + { + var radioButtonGroup = new RadioButtonGroup(); + Assert.IsNotNull(radioButtonGroup, "Should be not null!"); + Assert.IsInstanceOf(radioButtonGroup, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test Add. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.RadioButtonGroup.Add M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void Add_CHECK_VALUE() + { + var radioButton1 = new Components.RadioButton(); + radioButton1.Name = "radioButton1"; + + var radioButtonGroup = new RadioButtonGroup(); + radioButtonGroup.Add(radioButton1); + + string radiobuttonName1 = radioButtonGroup.GetItemByIndex(0).Name; + + Assert.AreEqual("radioButton1", radiobuttonName1, "Should be equals to the name of RadioButton"); + } + + [Test] + [Category("P1")] + [Description("Test Remove. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.RadioButtonGroup.Remove M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void Remove_CHECK_VALUE() + { + var radioButton1 = new Components.RadioButton(); + radioButton1.Name = "radioButton1"; + var radioButton2 = new Components.RadioButton(); + radioButton2.Name = "radioButton2"; + + var radioButtonGroup = new RadioButtonGroup(); + radioButtonGroup.Add(radioButton1); + radioButtonGroup.Add(radioButton2); + + radioButtonGroup.Remove(radioButton1); + + string radiobuttonName1 = radioButtonGroup.GetItemByIndex(0).Name; + + Assert.AreEqual("radioButton2", radiobuttonName1, "Should be equals to the name of RadioButton"); + } + + [Test] + [Category("P1")] + [Description("Test GetItemByIndex. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.RadioButtonGroup.GetItemByIndex M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void GetItemByIndex_CHECK_VALUE() + { + var radioButton1 = new Components.RadioButton(); + radioButton1.Name = "radioButton1"; + var radioButton2 = new Components.RadioButton(); + radioButton2.Name = "radioButton2"; + + var radioButtonGroup = new RadioButtonGroup(); + radioButtonGroup.Add(radioButton1); + radioButtonGroup.Add(radioButton2); + + string radiobuttonName1 = radioButtonGroup.GetItemByIndex(0).Name; + string radiobuttonName2 = radioButtonGroup.GetItemByIndex(1).Name; + + Assert.AreEqual("radioButton1", radiobuttonName1, "Should be equals to the name of RadioButton"); + Assert.AreEqual("radioButton2", radiobuttonName2, "Should be equals to the name of RadioButton"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSRectangleSelector.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSRectangleSelector.cs new file mode 100755 index 000000000..5e5a8e3bc --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSRectangleSelector.cs @@ -0,0 +1,67 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.RectangleSelector Tests")] + public class RectangleSelectorTests + { + private const string TAG = "NUI.Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("RectangleSelectorTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a RectangleSelector object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.RectangleSelector.RectangleSelector C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void RectangleSelector_INIT() + { + /* TEST CODE */ + var rectangleSelector = new RectangleSelector(); + Assert.IsNotNull(rectangleSelector, "Can't create success object RectangleSelector"); + Assert.IsInstanceOf(rectangleSelector, "Should be an instance of RectangleSelector type."); + } + + [Test] + [Category("P1")] + [Description("Test Clone. Check Whether Clone works or not")] + [Property("SPEC", "Tizen.NUI.Components.RectangleSelector.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Clone_TEST() + { + /* TEST CODE */ + var rectangleSelector1 = new RectangleSelector(); + rectangleSelector1.All = new Rectangle(10, 10, 20, 20); + var rectangleSelector = rectangleSelector1.Clone(); + Assert.IsNotNull(rectangleSelector, "should be not null!"); + Assert.AreEqual(10, rectangleSelector.All.X, "Should be equal!"); + Assert.AreEqual(10, rectangleSelector.All.Y, "Should be equal!"); + Assert.AreEqual(20, rectangleSelector.All.Width, "Should be equal!"); + Assert.AreEqual(20, rectangleSelector.All.Height, "Should be equal!"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSScrollBar.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSScrollBar.cs new file mode 100755 index 000000000..9363845ba --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSScrollBar.cs @@ -0,0 +1,412 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.ScrollBar Tests")] + public class ScrollBarTests + { + private const string TAG = "NUI.Components"; + private string _style = ""; + private string _trackImageUrl = ""; + private bool _styleRegiesterFlag = false; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("ScrollBarTests"); + App.MainTitleChangeBackgroundColor(null); + if (!_styleRegiesterFlag) + { + StyleManager.Instance.RegisterStyle("DAScrollbar", null, typeof(Tizen.NUI.Components.Tests.DAScrollBarStyle)); + _styleRegiesterFlag = true; + } + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a ScrollBar object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.ScrollBar.ScrollBar C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ScrollBar_INIT() + { + /* TEST CODE */ + var scrollBar = new ScrollBar(); + Assert.IsNotNull(scrollBar, "Can't create success object ScrollBar"); + Assert.IsInstanceOf(scrollBar, "Should be an instance of ScrollBar type."); + } + + [Test] + [Category("P1")] + [Description("Create a ScrollBar object. Check whether ScrollBar object which set style is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.ScrollBar.ScrollBar C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "string")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ScrollBar_INIT_WITH_STYLE() + { + /* TEST CODE */ + var scrollBar = new ScrollBar("DAScrollbar"); + Assert.IsNotNull(scrollBar, "Can't create success object ScrollBar"); + Assert.IsInstanceOf(scrollBar, "Should be an instance of ScrollBar type."); + } + + [Test] + [Category("P1")] + [Description("Create a ScrollBar object. Check whether ScrollBar object which set attributes is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.ScrollBar.ScrollBar C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "ScrollBarAttributes")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ScrollBar_INIT_WITH_ATTRIBUTES() + { + /* TEST CODE */ + ScrollBarAttributes attr = new ScrollBarAttributes + { + TrackImageAttributes = new ImageAttributes + { + BackgroundColor = new ColorSelector + { + All = new Color(0.43f, 0.43f, 0.43f, 0.1f), + } + }, + ThumbImageAttributes = new ImageAttributes + { + BackgroundColor = new ColorSelector + { + All = new Color(0.0f, 0.0f, 0.0f, 0.2f), + } + }, + + }; + var scrollBar = new ScrollBar(attr); + Assert.IsNotNull(scrollBar, "Can't create success object ScrollBar"); + Assert.IsInstanceOf(scrollBar, "Should be an instance of ScrollBar type."); + } + + [Test] + [Category("P1")] + [Description("Test MinValue.Check whether MinValue is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ScrollBar.MinValue A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void MinValue_SET_GET_VALUE() + { + /* TEST CODE */ + var scrollBar = new ScrollBar(); + scrollBar.MinValue = 0; + Assert.AreEqual(0, scrollBar.MinValue, "Should be equals to the set value of MinValue."); + } + + [Test] + [Category("P1")] + [Description("Test MaxValue.Check whether MaxValue is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ScrollBar.MaxValue A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void MaxValue_SET_GET_VALUE() + { + /* TEST CODE */ + var scrollBar = new ScrollBar(); + scrollBar.MaxValue = 100; + Assert.AreEqual(100, scrollBar.MaxValue, "Should be equals to the set value of MaxValue."); + } + + [Test] + [Category("P1")] + [Description("Test CurrentValue.Check whether CurrentValue is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ScrollBar.CurrentValue A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void CurrentValue_SET_GET_VALUE() + { + /* TEST CODE */ + var scrollBar = new ScrollBar(); + scrollBar.CurrentValue = 50; + Assert.AreEqual(50, scrollBar.CurrentValue, "Should be equals to the set value of CurrentValue."); + } + + [Test] + [Category("P1")] + [Description("Test ThumbColor.Check whether ThumbColor is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ScrollBar.ThumbColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ThumbColor_SET_GET_VALUE() + { + /* TEST CODE */ + var scrollBar = new ScrollBar(); + scrollBar.ThumbColor = Color.Red; + Assert.AreEqual(Color.Red.R, scrollBar.ThumbColor.R, "Should be equals to the set value."); + Assert.AreEqual(Color.Red.G, scrollBar.ThumbColor.G, "Should be equals to the set value."); + Assert.AreEqual(Color.Red.B, scrollBar.ThumbColor.B, "Should be equals to the set value."); + Assert.AreEqual(Color.Red.A, scrollBar.ThumbColor.A, "Should be equals to the set value."); + } + + [Test] + [Category("P1")] + [Description("Test TrackColor.Check whether TrackColor is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ScrollBar.TrackColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void TrackColor_SET_GET_VALUE() + { + /* TEST CODE */ + var scrollBar = new ScrollBar(); + scrollBar.TrackColor = Color.Green; + Assert.AreEqual(Color.Green.R, scrollBar.TrackColor.R, "Should be equals to the set value."); + Assert.AreEqual(Color.Green.G, scrollBar.TrackColor.G, "Should be equals to the set value."); + Assert.AreEqual(Color.Green.B, scrollBar.TrackColor.B, "Should be equals to the set value."); + Assert.AreEqual(Color.Green.A, scrollBar.TrackColor.A, "Should be equals to the set value."); + } + + [Test] + [Category("P1")] + [Description("Test TrackImageURL.Check whether TrackImageURL is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ScrollBar.TrackImageURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void TrackImageURL_SET_GET_VALUE() + { + /* TEST CODE */ + var scrollBar = new ScrollBar(); + scrollBar.TrackImageURL = _trackImageUrl; + Assert.AreEqual(_trackImageUrl, scrollBar.TrackImageURL, "Should be equals to the set value of TrackImageURL."); + } + + [Test] + [Category("P1")] + [Description("Test Direction.Check whether Direction is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ScrollBar.Direction A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Direction_SET_GET_VALUE() + { + /* TEST CODE */ + var scrollBar = new ScrollBar(); + scrollBar.Direction = ScrollBar.DirectionType.Vertical; + Assert.AreEqual(ScrollBar.DirectionType.Vertical, scrollBar.Direction, "Should be equals to the set value of Direction."); + scrollBar.Direction = ScrollBar.DirectionType.Horizontal; + Assert.AreEqual(ScrollBar.DirectionType.Horizontal, scrollBar.Direction, "Should be equals to the set value of Direction."); + } + + [Test] + [Category("P1")] + [Description("Test Duration.Check whether Duration is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ScrollBar.Duration A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Duration_SET_GET_VALUE() + { + /* TEST CODE */ + var scrollBar = new ScrollBar(); + scrollBar.Duration = 100; + Assert.AreEqual(100, scrollBar.Duration, "Should be equals to the set value of Duration."); + } + + [Test] + [Category("P1")] + [Description("Test ThumbSize.Check whether ThumbSize is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ScrollBar.ThumbSize A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ThumbSize_SET_GET_VALUE() + { + /* TEST CODE */ + var scrollBar = new ScrollBar(); + scrollBar.ThumbSize = new Size2D(50, 50); + Assert.AreEqual(50, scrollBar.ThumbSize.Width, "Should be equals to the set value."); + Assert.AreEqual(50, scrollBar.ThumbSize.Height, "Should be equals to the set value."); + } + + [Test] + [Category("P1")] + [Description("Test SetCurrentValue.Check whether SetCurrentValue works or not.")] + [Property("SPEC", "Tizen.NUI.Components.ScrollBar.SetCurrentValue M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void SetCurrentValue_TEST() + { + /* TEST CODE */ + var scrollBar = new ScrollBar(); + scrollBar.MinValue = 0; + scrollBar.MaxValue = 100; + scrollBar.SetCurrentValue(50); + Assert.AreEqual(50, scrollBar.CurrentValue, "Should be equals to the set value of CurrentValue."); + } + + [Test] + [Category("P1")] + [Description("Test OnUpdate. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.ScrollBar.OnUpdate M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public async Task OnUpdate_CHECK_VALUE() + { + /* TEST CODE */ + try + { + var view = new MyScrollBar(); + Window window = Window.Instance; + window.Add(view); + await Task.Delay(500); + Assert.AreEqual(true, view.updateFlag, "OnUpdate trigger Check Fail."); + window.Remove(view); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test GetAttributes. Check Whether GetAttributes works or not")] + [Property("SPEC", "Tizen.NUI.Components.ScrollBar.GetAttributes M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetAttributes_TEST() + { + /* TEST CODE */ + var myScrollBar = new MyScrollBar(); + Assert.IsNotNull(myScrollBar.TestGetAttributes(), "Should be not null"); + Assert.IsInstanceOf(myScrollBar.TestGetAttributes(), "Should be an instance of PaginationAttributes"); + } + + + [Test] + [Category("P1")] + [Description("Test OnThemeChangedEvent. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.ScrollBar.OnThemeChangedEvent M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public async Task OnThemeChangedEvent_CHECK_VALUE() + { + /* TEST CODE */ + try + { + Tizen.NUI.Components.StyleManager.Instance.Theme = "Utility"; + var view = new MyScrollBar(); + Window window = Window.Instance; + window.Add(view); + Tizen.NUI.Components.StyleManager.Instance.Theme = "Food"; + await Task.Delay(500); + Assert.AreEqual(true, view.themeChanged, "OnThemeChangedEvent trigger Check Fail."); + window.Remove(view); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test Dispose, try to dispose the ScrollBar.")] + [Property("SPEC", "Tizen.NUI.Components.ScrollBar.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Dispose_TEST() + { + /* TEST CODE */ + try + { + ScrollBar scrollBar = new ScrollBar(); + scrollBar.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 MyScrollBar : ScrollBar + { + public bool updateFlag = false; + public bool themeChanged = false; + + public Attributes TestGetAttributes() + { + return GetAttributes(); + } + protected override Attributes GetAttributes() + { + return base.GetAttributes(); + } + + protected override void OnUpdate() + { + updateFlag = true; + base.OnUpdate(); + } + + protected override void OnThemeChangedEvent(object sender, Tizen.NUI.Components.StyleManager.ThemeChangeEventArgs e) + { + themeChanged = true; + base.OnThemeChangedEvent(sender, e); + } + } + + internal class DAScrollBarStyle : StyleBase + { + protected override Attributes GetAttributes() + { + ScrollBarAttributes attributes = new ScrollBarAttributes + { + TrackImageAttributes = new ImageAttributes + { + BackgroundColor = new ColorSelector + { + All = new Color(0.43f, 0.43f, 0.43f, 0.6f), + } + }, + ThumbImageAttributes = new ImageAttributes + { + BackgroundColor = new ColorSelector + { + All = new Color(0.0f, 0.0f, 0.0f, 0.2f) + } + }, + }; + return attributes; + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSScrollBarAttributes.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSScrollBarAttributes.cs new file mode 100755 index 000000000..ade0f4c3b --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSScrollBarAttributes.cs @@ -0,0 +1,170 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.ScrollBarAttributes Tests")] + public class ScrollBarAttributesTests + { + private const string TAG = "NUI.Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("ScrollBarAttributesTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a ScrollBarAttributes object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.ScrollBarAttributes.ScrollBarAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ScrollBarAttributes_INIT() + { + /* TEST CODE */ + var attributes = new ScrollBarAttributes(); + Assert.IsNotNull(attributes, "Can't create success object ScrollBarAttributes"); + Assert.IsInstanceOf(attributes, "Should be an instance of ScrollBarAttributes type."); + } + + [Test] + [Category("P1")] + [Description("Create a ScrollBarAttributes object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.ScrollBarAttributes.ScrollBarAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "ScrollBarAttributes")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ScrollBarAttributes_INIT_WITH_SCROLLBARATTRIBUTES() + { + /* TEST CODE */ + var scrollBarAttributes1 = new ScrollBarAttributes(); + var scrollBarAttributes = new ScrollBarAttributes(scrollBarAttributes1); + Assert.IsNotNull(scrollBarAttributes, "Can't create success object ScrollBarAttributes"); + Assert.IsInstanceOf(scrollBarAttributes, "Should be an instance of ScrollBarAttributes type."); + } + + [Test] + [Category("P1")] + [Description("Test Direction.Check whether Direction is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ScrollBarAttributes.Direction A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Direction_SET_GET_VALUE() + { + /* TEST CODE */ + var scrollBarAttributes = new ScrollBarAttributes(); + scrollBarAttributes.Direction = ScrollBar.DirectionType.Vertical; + Assert.AreEqual(ScrollBar.DirectionType.Vertical, scrollBarAttributes.Direction, "Should be equal!"); + scrollBarAttributes.Direction = ScrollBar.DirectionType.Horizontal; + Assert.AreEqual(ScrollBar.DirectionType.Horizontal, scrollBarAttributes.Direction, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test Duration.Check whether Duration is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ScrollBarAttributes.Duration A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Duration_SET_GET_VALUE() + { + /* TEST CODE */ + var scrollBarAttributes = new ScrollBarAttributes(); + scrollBarAttributes.Duration = 100; + Assert.AreEqual(100, scrollBarAttributes.Duration, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test TrackImageAttributes.Check whether TrackImageAttributes is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ScrollBarAttributes.TrackImageAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void TrackImageAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + ImageAttributes trackImageAttributes = new ImageAttributes + { + BackgroundColor = new ColorSelector + { + All = new Color(0.43f, 0.43f, 0.43f, 0.1f), + } + }; + + var scrollBarAttributes = new ScrollBarAttributes(); + scrollBarAttributes.TrackImageAttributes = trackImageAttributes; + Assert.IsNotNull(scrollBarAttributes.TrackImageAttributes, "Should be not null"); + Assert.IsInstanceOf(scrollBarAttributes.TrackImageAttributes, "Should be an instance of ImageAttributes type."); + } + + [Test] + [Category("P1")] + [Description("Test ThumbImageAttributes.Check whether ThumbImageAttributes is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ScrollBarAttributes.ThumbImageAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ThumbImageAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + ImageAttributes thumbImageAttributes = new ImageAttributes + { + BackgroundColor = new ColorSelector + { + All = new Color(0.43f, 0.43f, 0.43f, 0.1f), + } + }; + + var scrollBarAttributes = new ScrollBarAttributes(); + scrollBarAttributes.ThumbImageAttributes = thumbImageAttributes; + Assert.IsNotNull(scrollBarAttributes.ThumbImageAttributes, "Should be not null"); + Assert.IsInstanceOf(scrollBarAttributes.ThumbImageAttributes, "Should be an instance of ImageAttributes type."); + } + + [Test] + [Category("P1")] + [Description("Test Clone. Check Whether Clone works or not")] + [Property("SPEC", "Tizen.NUI.Components.ScrollBarAttributes.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Clone_TEST() + { + /* TEST CODE */ + try + { + var scrollBarAttributes = new ScrollBarAttributes(); + scrollBarAttributes.Duration = 10; + var attributes = scrollBarAttributes.Clone() as ScrollBarAttributes; + Assert.IsNotNull(attributes, "Should be not null"); + Assert.IsInstanceOf(attributes, "Should be an instance of ScrollBarAttributes type."); + Assert.AreEqual(10, attributes.Duration, "Should be equal!"); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSelectButton.SelectEventArgs.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSelectButton.SelectEventArgs.cs new file mode 100755 index 000000000..a1feff3f5 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSelectButton.SelectEventArgs.cs @@ -0,0 +1,68 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Components; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.SelectButton.SelectEventArgs Tests")] + public class SelectButtonSelectEventArgsTests + { + private const string TAG = "Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("SelectButtonSelectEventArgsTests"); + App.MainTitleChangeBackgroundColor(null); + + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test SelectEventArgs empty constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.SelectEventArgs.SelectEventArgs C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void SelectEventArgs_CHECK_VALUE() + { + /* TEST CODE */ + var selectEventArgs = new SelectButton.SelectEventArgs(); + Assert.IsNotNull(selectEventArgs, "Should be not null!"); + Assert.IsInstanceOf(selectEventArgs, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test IsSelected. Check whether IsSelected is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.SelectEventArgs.IsSelected A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void IsSelected_SET_GET_VALUE() + { + /* TEST CODE */ + var selectEventArgs = new SelectButton.SelectEventArgs(); + selectEventArgs.IsSelected = true; + Assert.AreEqual(true, selectEventArgs.IsSelected, "Should be equal"); + selectEventArgs.IsSelected = false; + Assert.AreEqual(false, selectEventArgs.IsSelected, "Should be equal"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSelectButton.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSelectButton.cs new file mode 100755 index 000000000..34b2ab3b7 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSelectButton.cs @@ -0,0 +1,571 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Components; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.SelectButton Tests")] + public class SelectButtonTests + { + 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!"); + App.MainTitleChangeText("CommonSelectButtonTests"); + App.MainTitleChangeBackgroundColor(null); + + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test SelectButton empty constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.SelectButton C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void SelectButton_CHECK_VALUE() + { + /* TEST CODE */ + var selectButton = new SelectButton(); + Assert.IsNotNull(selectButton, "Should be not null!"); + Assert.IsInstanceOf(selectButton, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test SelectButton style constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.SelectButton C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "string")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void SelectButton_Style_CHECK_VALUE() + { + /* TEST CODE */ + StyleManager.Instance.RegisterStyle("SelectButtonStyle", null, typeof(SelectButtonStyle)); + var selectButton = new SelectButton("SelectButtonStyle"); + Assert.IsNotNull(selectButton, "Should be not null!"); + Assert.IsInstanceOf(selectButton, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test SelectButton SelectButtonAttributes constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.SelectButton C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "SelectButtonAttributes")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void SelectButton_SelectButtonAttributes_CHECK_VALUE() + { + /* TEST CODE */ + var selectButtonAttributes = new SelectButtonAttributes + { + CheckImageAttributes = new ImageAttributes + { + Size2D = new Size2D(48, 48), + ResourceURL = new StringSelector + { + All = _image_path, + }, + Opacity = new FloatSelector + { + Normal = 1.0f, + Selected = 1.0f, + Disabled = 0.4f, + DisabledSelected = 0.4f + }, + }, + }; + var selectButton = new SelectButton(selectButtonAttributes); + Assert.IsNotNull(selectButton, "Should be not null!"); + Assert.IsInstanceOf(selectButton, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test Index. Check whether Index is readable.")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.Index A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void Index_CHECK_VALUE() + { + /* TEST CODE */ + var selectButton = new SelectButton(); + Assert.AreEqual(-1, selectButton.Index, "Should be equals to default value"); + } + + [Test] + [Category("P1")] + [Description("Test CheckImageURL. Check whether CheckImageURL is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.CheckImageURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckImageURL_SET_GET_VALUE() + { + /* TEST CODE */ + var selectButton = new SelectButton(); + selectButton.CheckImageURL = _image_path; + Assert.AreEqual(_image_path, selectButton.CheckImageURL, "Should be equals to the set value of CheckImageURL"); + } + + [Test] + [Category("P1")] + [Description("Test CheckImageURLSelector. Check whether CheckImageURLSelector is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.CheckImageURLSelector A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckImageURLSelector_SET_GET_VALUE() + { + /* TEST CODE */ + var selectButton = new SelectButton(); + var stringSelector = new StringSelector + { + Normal = _image_path, + Selected = _image_path, + }; + selectButton.CheckImageURLSelector = stringSelector; + Assert.AreEqual(stringSelector.Normal, selectButton.CheckImageURLSelector.Normal, "Should be equals to the set value of CheckImageURLSelector Normal"); + Assert.AreEqual(stringSelector.Selected, selectButton.CheckImageURLSelector.Selected, "Should be equals to the set value of CheckImageURLSelector Selected"); + } + + [Test] + [Category("P1")] + [Description("Test CheckImageOpacity. Check whether CheckImageOpacity is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.CheckImageOpacity A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckImageOpacity_SET_GET_VALUE() + { + /* TEST CODE */ + var selectButton = new SelectButton(); + selectButton.CheckImageOpacity = 1.0f; + Assert.AreEqual(1.0f, selectButton.CheckImageOpacity, "Should be equals to the set value of CheckImageOpacity"); + } + + [Test] + [Category("P1")] + [Description("Test CheckImageOpacitySelector. Check whether CheckImageOpacitySelector is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.CheckImageOpacitySelector A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckImageOpacitySelector_SET_GET_VALUE() + { + /* TEST CODE */ + var selectButton = new SelectButton(); + var floatSelector = new FloatSelector + { + Normal = 0.5f, + Selected = 1.0f, + }; + selectButton.CheckImageOpacitySelector = floatSelector; + Assert.AreEqual(floatSelector.Normal, selectButton.CheckImageOpacitySelector.Normal, "Should be equals to the set value of CheckImageOpacitySelector Normal"); + Assert.AreEqual(floatSelector.Selected, selectButton.CheckImageOpacitySelector.Selected, "Should be equals to the set value of CheckImageOpacitySelector Selected"); + } + + [Test] + [Category("P1")] + [Description("Test CheckImageSize2D. Check whether CheckImageSize2D is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.CheckImageSize2D A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckImageSize2D_SET_GET_VALUE() + { + /* TEST CODE */ + var selectButton = new SelectButton(); + selectButton.CheckImageSize2D = new Size2D(10, 10); + Assert.AreEqual(10, selectButton.CheckImageSize2D.Width, "Should be equals to the set value of CheckImageSize2D.Width"); + Assert.AreEqual(10, selectButton.CheckImageSize2D.Height, "Should be equals to the set value of CheckImageSize2D.Height"); + } + + [Test] + [Category("P1")] + [Description("Test CheckBackgroundImageURL. Check whether CheckBackgroundImageURL is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.CheckBackgroundImageURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckBackgroundImageURL_SET_GET_VALUE() + { + /* TEST CODE */ + var selectButton = new SelectButton(); + selectButton.CheckBackgroundImageURL = _image_path; + Assert.AreEqual(_image_path, selectButton.CheckBackgroundImageURL, "Should be equals to the set value of CheckBackgroundImageURL"); + } + + [Test] + [Category("P1")] + [Description("Test CheckBackgroundImageURLSelector. Check whether CheckBackgroundImageURLSelector is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.CheckBackgroundImageURLSelector A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckBackgroundImageURLSelector_SET_GET_VALUE() + { + /* TEST CODE */ + var selectButton = new SelectButton(); + var stringSelector = new StringSelector + { + Normal = _image_path, + Selected = _image_path, + }; + selectButton.CheckBackgroundImageURLSelector = stringSelector; + Assert.AreEqual(stringSelector.Normal, selectButton.CheckBackgroundImageURLSelector.Normal, "Should be equals to the set value of CheckBackgroundImageURLSelector Normal"); + Assert.AreEqual(stringSelector.Selected, selectButton.CheckBackgroundImageURLSelector.Selected, "Should be equals to the set value of CheckBackgroundImageURLSelector Selected"); + } + + [Test] + [Category("P1")] + [Description("Test CheckBackgroundImageOpacity. Check whether CheckBackgroundImageOpacity is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.CheckBackgroundImageOpacity A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckBackgroundImageOpacity_SET_GET_VALUE() + { + /* TEST CODE */ + var selectButton = new SelectButton(); + selectButton.CheckBackgroundImageOpacity = 1.0f; + Assert.AreEqual(1.0f, selectButton.CheckBackgroundImageOpacity, "Should be equals to the set value of CheckBackgroundImageOpacity"); + } + + [Test] + [Category("P1")] + [Description("Test CheckBackgroundImageOpacitySelector. Check whether CheckBackgroundImageOpacitySelector is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.CheckBackgroundImageOpacitySelector A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckBackgroundImageOpacitySelector_SET_GET_VALUE() + { + /* TEST CODE */ + var selectButton = new SelectButton(); + var floatSelector = new FloatSelector + { + Normal = 0.5f, + Selected = 1.0f, + }; + selectButton.CheckBackgroundImageOpacitySelector = floatSelector; + Assert.AreEqual(floatSelector.Normal, selectButton.CheckBackgroundImageOpacitySelector.Normal, "Should be equals to the set value of CheckBackgroundImageOpacitySelector Normal"); + Assert.AreEqual(floatSelector.Selected, selectButton.CheckBackgroundImageOpacitySelector.Selected, "Should be equals to the set value of CheckBackgroundImageOpacitySelector Selected"); + } + + [Test] + [Category("P1")] + [Description("Test CheckShadowImageURL. Check whether CheckShadowImageURL is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.CheckShadowImageURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckShadowImageURL_SET_GET_VALUE() + { + /* TEST CODE */ + var selectButton = new SelectButton(); + selectButton.CheckShadowImageURL = _image_path; + Assert.AreEqual(_image_path, selectButton.CheckShadowImageURL, "Should be equals to the set value of CheckShadowImageURL"); + } + + [Test] + [Category("P1")] + [Description("Test CheckShadowImageURLSelector. Check whether CheckShadowImageURLSelector is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.CheckShadowImageURLSelector A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckShadowImageURLSelector_SET_GET_VALUE() + { + /* TEST CODE */ + var selectButton = new SelectButton(); + var stringSelector = new StringSelector + { + Normal = _image_path, + Selected = _image_path, + }; + selectButton.CheckShadowImageURLSelector = stringSelector; + Assert.AreEqual(stringSelector.Normal, selectButton.CheckShadowImageURLSelector.Normal, "Should be equals to the set value of CheckShadowImageURLSelector Normal"); + Assert.AreEqual(stringSelector.Selected, selectButton.CheckShadowImageURLSelector.Selected, "Should be equals to the set value of CheckShadowImageURLSelector Selected"); + } + + [Test] + [Category("P1")] + [Description("Test CheckShadowImageOpacity. Check whether CheckShadowImageOpacity is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.CheckShadowImageOpacity A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckShadowImageOpacity_SET_GET_VALUE() + { + /* TEST CODE */ + var selectButton = new SelectButton(); + selectButton.CheckShadowImageOpacity = 1.0f; + Assert.AreEqual(1.0f, selectButton.CheckShadowImageOpacity, "Should be equals to the set value of CheckShadowImageOpacity"); + } + + [Test] + [Category("P1")] + [Description("Test CheckShadowImageOpacitySelector. Check whether CheckShadowImageOpacitySelector is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.CheckShadowImageOpacitySelector A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckShadowImageOpacitySelector_SET_GET_VALUE() + { + /* TEST CODE */ + var selectButton = new SelectButton(); + var floatSelector = new FloatSelector + { + Normal = 0.5f, + Selected = 1.0f, + }; + selectButton.CheckShadowImageOpacitySelector = floatSelector; + Assert.AreEqual(floatSelector.Normal, selectButton.CheckShadowImageOpacitySelector.Normal, "Should be equals to the set value of CheckShadowImageOpacitySelector Normal"); + Assert.AreEqual(floatSelector.Selected, selectButton.CheckShadowImageOpacitySelector.Selected, "Should be equals to the set value of CheckShadowImageOpacitySelector Selected"); + } + + [Test] + [Category("P1")] + [Description("Test CheckImagePaddingLeft. Check whether CheckImagePaddingLeft is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.CheckImagePaddingLeft A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckImagePaddingLeft_SET_GET_VALUE() + { + /* TEST CODE */ + var selectButton = new SelectButton(); + selectButton.CheckImagePaddingLeft = 10; + Assert.AreEqual(10, selectButton.CheckImagePaddingLeft, "Should be equals to the set value of CheckImagePaddingLeft"); + } + + [Test] + [Category("P1")] + [Description("Test CheckImagePaddingRight. Check whether CheckImagePaddingRight is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.CheckImagePaddingRight A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckImagePaddingRight_SET_GET_VALUE() + { + /* TEST CODE */ + var selectButton = new SelectButton(); + selectButton.CheckImagePaddingRight = 10; + Assert.AreEqual(10, selectButton.CheckImagePaddingRight, "Should be equals to the set value of CheckImagePaddingRight"); + } + + [Test] + [Category("P1")] + [Description("Test CheckImagePaddingTop. Check whether CheckImagePaddingTop is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.CheckImagePaddingTop A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckImagePaddingTop_SET_GET_VALUE() + { + /* TEST CODE */ + var selectButton = new SelectButton(); + selectButton.CheckImagePaddingTop = 10; + Assert.AreEqual(10, selectButton.CheckImagePaddingTop, "Should be equals to the set value of CheckImagePaddingTop"); + } + + [Test] + [Category("P1")] + [Description("Test CheckImagePaddingBottom. Check whether CheckImagePaddingBottom is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.CheckImagePaddingBottom A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckImagePaddingBottom_SET_GET_VALUE() + { + /* TEST CODE */ + var selectButton = new SelectButton(); + selectButton.CheckImagePaddingBottom = 10; + Assert.AreEqual(10, selectButton.CheckImagePaddingBottom, "Should be equals to the set value of CheckImagePaddingBottom"); + } + + [Test] + [Category("P1")] + [Description("Test OnKey. Check return the right value or not")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.OnKey M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void OnKey_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + try + { + var selectButton = new SelectButton(); + bool flag = true; + flag = selectButton.OnKey(new Key()); + Assert.AreEqual(false, flag, "OnKey return check fail."); + } + 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 MySelectButton : SelectButton + { + public bool updateFlag = false; + public bool themeFlag = false; + + protected override void OnUpdate() + { + updateFlag = true; + base.OnUpdate(); + } + + protected override Attributes GetAttributes() + { + return base.GetAttributes(); + } + + public Attributes TestGetAttributes() + { + return GetAttributes(); + } + + protected override void OnThemeChangedEvent(object sender, Components.StyleManager.ThemeChangeEventArgs e) + { + themeFlag = true; + base.OnThemeChangedEvent(sender, e); + } + + } + + [Test] + [Category("P1")] + [Description("Test OnUpdate. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.OnUpdate M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public async Task OnUpdate_CHECK_VALUE() + { + var mySelectButton = new MySelectButton(); + mySelectButton.BackgroundColor = Color.Red; + mySelectButton.Size2D = new Size2D(200, 200); + Window.Instance.Add(mySelectButton); + await Task.Delay(500); + Assert.AreEqual(true, mySelectButton.updateFlag, "Should be equal"); + } + + [Test] + [Category("P1")] + [Description("Test GetAttributes. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.GetAttributes M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void GetAttributes_CHECK_VALUE() + { + /* TEST CODE */ + var mySelectButton = new MySelectButton(); + var attr = mySelectButton.TestGetAttributes(); + Assert.IsNotNull(attr, "Should be not null!"); + Assert.IsInstanceOf(attr, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test OnThemeChangedEvent. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.OnThemeChangedEvent M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public async Task OnThemeChangedEvent_CHECK_VALUE() + { + Tizen.NUI.Components.StyleManager.Instance.Theme = "Utility"; + var mySelectButton = new MySelectButton(); + Window window = Window.Instance; + window.Add(mySelectButton); + Tizen.NUI.Components.StyleManager.Instance.Theme = "Food"; + await Task.Delay(500); + Assert.AreEqual(true, mySelectButton.themeFlag, "OnThemeChangedEvent trigger Check Fail."); + window.Remove(mySelectButton); + } + + [Test] + [Category("P1")] + [Description("Test Dispose, try to dispose the SelectButton.")] + [Property("SPEC", "Tizen.NUI.Components.SelectButton.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Dispose_TEST() + { + /* TEST CODE */ + try + { + SelectButton selectButton = new SelectButton(); + selectButton.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 SelectButtonStyle : StyleBase + { + private string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png"; + protected override Attributes GetAttributes() + { + SelectButtonAttributes attributes = new SelectButtonAttributes + { + CheckImageAttributes = new ImageAttributes + { + Size2D = new Size2D(48, 48), + Position2D = new Position2D(0, 0), + ResourceURL = new StringSelector + { + Normal = _image_path, + Selected = _image_path, + Disabled = _image_path, + DisabledSelected = _image_path, + }, + Opacity = new FloatSelector + { + Normal = 1.0f, + Selected = 1.0f, + Disabled = 0.4f, + DisabledSelected = 0.4f + }, + }, + }; + + return attributes; + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSelectButtonAttributes.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSelectButtonAttributes.cs new file mode 100755 index 000000000..8027ae502 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSelectButtonAttributes.cs @@ -0,0 +1,153 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Components; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.SelectButtonAttributes Tests")] + public class SelectButtonAttributesTests + { + 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!"); + App.MainTitleChangeText("SelectButtonAttributesTests"); + App.MainTitleChangeBackgroundColor(null); + + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test SelectButtonAttributes empty constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.SelectButtonAttributes.SelectButtonAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void SelectButtonAttributes_CHECK_VALUE() + { + /* TEST CODE */ + var selectButtonAttributes = new SelectButtonAttributes(); + Assert.IsNotNull(selectButtonAttributes, "Should be not null"); + Assert.IsInstanceOf(selectButtonAttributes, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test SelectButtonAttributes copy constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.SelectButtonAttributes.SelectButtonAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "SelectButtonAttributes")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void SelectButtonAttributes_SelectButtonAttributes_CHECK_VALUE() + { + /* TEST CODE */ + var attrs = new SelectButtonAttributes + { + CheckImageAttributes = new ImageAttributes + { + Size2D = new Size2D(48, 48), + ResourceURL = new StringSelector + { + All = _image_path, + }, + Opacity = new FloatSelector + { + Normal = 1.0f, + Selected = 1.0f, + Disabled = 0.4f, + DisabledSelected = 0.4f + }, + }, + }; + var selectButtonAttributes = new SelectButtonAttributes(attrs); + Assert.IsNotNull(selectButtonAttributes, "Should be not null!"); + Assert.IsInstanceOf(selectButtonAttributes, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test CheckImageAttributes. Check whether CheckImageAttributes is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.SelectButtonAttributes.CheckImageAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckImageAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var selectButtonAttributes = new SelectButtonAttributes(); + selectButtonAttributes.CheckImageAttributes = new ImageAttributes(); + Assert.IsNotNull(selectButtonAttributes.CheckImageAttributes, "Should be not null!"); + Assert.IsInstanceOf(selectButtonAttributes.CheckImageAttributes, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test CheckBackgroundImageAttributes. Check whether CheckBackgroundImageAttributes is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.SelectButtonAttributes.CheckBackgroundImageAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckBackgroundImageAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var selectButtonAttributes = new SelectButtonAttributes(); + selectButtonAttributes.CheckBackgroundImageAttributes = new ImageAttributes(); + Assert.IsNotNull(selectButtonAttributes.CheckBackgroundImageAttributes, "Should be not null!"); + Assert.IsInstanceOf(selectButtonAttributes.CheckBackgroundImageAttributes, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test CheckShadowImageAttributes. Check whether CheckShadowImageAttributes is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.SelectButtonAttributes.CheckShadowImageAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void CheckShadowImageAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var selectButtonAttributes = new SelectButtonAttributes(); + selectButtonAttributes.CheckShadowImageAttributes = new ImageAttributes(); + Assert.IsNotNull(selectButtonAttributes.CheckShadowImageAttributes, "Should be not null!"); + Assert.IsInstanceOf(selectButtonAttributes.CheckShadowImageAttributes, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test Clone. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.SelectButtonAttributes.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void Clone_CHECK_VALUE() + { + var selectButtonAttributes = new SelectButtonAttributes(); + selectButtonAttributes.IsSelectable = true; + var attr = selectButtonAttributes.Clone() as SelectButtonAttributes; + Assert.IsNotNull(attr, "Should be not null!"); + Assert.IsInstanceOf(attr, "Should be an instance of SelectButtonAttributes!"); + Assert.AreEqual(true, attr.IsSelectable, "Should be equal!"); + } + + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSelectGroup.SelectGroupEventArgs.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSelectGroup.SelectGroupEventArgs.cs new file mode 100755 index 000000000..7f4122158 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSelectGroup.SelectGroupEventArgs.cs @@ -0,0 +1,66 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Components; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.SelectGroup.SelectGroupEventArgs Tests")] + public class SelectGroupEventArgsTests + { + private const string TAG = "Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("SelectGroupEventArgsTests"); + App.MainTitleChangeBackgroundColor(null); + + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test SelectGroupEventArgs empty constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.SelectGroup.SelectGroupEventArgs.SelectGroupEventArgs C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void SelectGroupEventArgs_CHECK_VALUE() + { + /* TEST CODE */ + var selectGroupEventArgs = new SelectGroup.SelectGroupEventArgs(); + Assert.IsNotNull(selectGroupEventArgs, "Should be not null!"); + Assert.IsInstanceOf(selectGroupEventArgs, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test SelectedIndex. Check whether SelectedIndex is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.SelectGroup.SelectGroupEventArgs.SelectedIndex A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void SelectedIndex_SET_GET_VALUE() + { + /* TEST CODE */ + var selectGroupEventArgs = new Components.SelectGroup.SelectGroupEventArgs(); + selectGroupEventArgs.SelectedIndex = 1; + Assert.AreEqual(1, selectGroupEventArgs.SelectedIndex, "Should be equal"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSelectGroup.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSelectGroup.cs new file mode 100755 index 000000000..597a922f9 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSelectGroup.cs @@ -0,0 +1,186 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Components; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.SelectGroup Tests")] + public class SelectGroupTests + { + 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!"); + App.MainTitleChangeText("CommonSelectGroupTests"); + App.MainTitleChangeBackgroundColor(null); + + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + public class MySelectGroup : SelectGroup + { + public MySelectGroup() : base() { } + + public void TestAddSelection(SelectButton selectButton) + { + base.AddSelection(selectButton); + } + + public void TestRemoveSelection(SelectButton selectButton) + { + base.RemoveSelection(selectButton); + + } + } + + [Test] + [Category("P1")] + [Description("Test SelectGroup. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.SelectGroup.SelectGroup C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void SelectGroup_CHECK_VALUE() + { + var checkBoxGroup = new CheckBoxGroup(); + Assert.IsNotNull(checkBoxGroup, "Should be not null!"); + Assert.IsInstanceOf(checkBoxGroup, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test Count. Check whether Count is readable.")] + [Property("SPEC", "Tizen.NUI.Components.SelectGroup.Count A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void Count_GET_VALUE() + { + /* TEST CODE */ + var checkBox1 = new CheckBox(); + checkBox1.Name = "checkbox1"; + + var checkBoxGroup = new CheckBoxGroup(); + checkBoxGroup.Add(checkBox1); + + Assert.AreEqual(1, checkBoxGroup.Count, "Should be equals to checkBoxGroup.Count"); + } + + [Test] + [Category("P1")] + [Description("Test SelectedIndex. Check whether SelectedIndex is readable.")] + [Property("SPEC", "Tizen.NUI.Components.SelectGroup.SelectedIndex A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void SelectedIndex_GET_VALUE() + { + /* TEST CODE */ + var checkBox1 = new CheckBox(); + checkBox1.Name = "checkbox1"; + + var checkBoxGroup = new CheckBoxGroup(); + checkBoxGroup.Add(checkBox1); + + Assert.AreEqual(0, checkBoxGroup.SelectedIndex, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test Contains. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.SelectGroup.Contains M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void Contains_CHECK_VALUE() + { + var checkBox1 = new CheckBox(); + checkBox1.Name = "checkbox1"; + + var checkBoxGroup = new CheckBoxGroup(); + checkBoxGroup.Add(checkBox1); + + bool flag = checkBoxGroup.Contains(checkBox1); + + Assert.AreEqual(true, flag, "Should be true"); + + var checkBox2 = new CheckBox(); + checkBox2.Name = "checkbox2"; + flag = checkBoxGroup.Contains(checkBox2); + + Assert.AreEqual(false, flag, "Should be false!"); + } + + [Test] + [Category("P1")] + [Description("Test GetIndex. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.SelectGroup.GetIndex M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void GetIndex_CHECK_VALUE() + { + var checkBox1 = new CheckBox(); + checkBox1.Name = "checkbox1"; + + var checkBoxGroup = new CheckBoxGroup(); + checkBoxGroup.Add(checkBox1); + + int index = checkBoxGroup.GetIndex(checkBox1); + + Assert.AreEqual(0, index, "Should be same with index"); + } + + [Test] + [Category("P1")] + [Description("Test AddSelection. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.SelectGroup.AddSelection M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void AddSelection_CHECK_VALUE() + { + var mySelectGroup = new MySelectGroup(); + var selectButton = new SelectButton(); + mySelectGroup.TestAddSelection(selectButton); + + bool flag = mySelectGroup.Contains(selectButton); + + Assert.AreEqual(true, flag, "Should be equal"); + } + + [Test] + [Category("P1")] + [Description("Test RemoveSelection. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.SelectGroup.RemoveSelection M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void RemoveSelection_CHECK_VALUE() + { + var mySelectGroup = new MySelectGroup(); + var selectButton = new SelectButton(); + mySelectGroup.TestAddSelection(selectButton); + mySelectGroup.TestRemoveSelection(selectButton); + + bool flag = mySelectGroup.Contains(selectButton); + + Assert.AreEqual(false, flag, "Should be equal"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSelector.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSelector.cs new file mode 100755 index 000000000..c9069b4cf --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSelector.cs @@ -0,0 +1,231 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Selector Tests")] + public class SelectorTests + { + private const string TAG = "NUI.Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("SelectorTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a Selector object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.Selector.Selector C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Selector_INIT() + { + /* TEST CODE */ + var selector = new Selector(); + Assert.IsNotNull(selector, "Can't create success object Selector"); + Assert.IsInstanceOf>(selector, "Should be an instance of Selector type."); + } + + [Test] + [Category("P1")] + [Description("Test All. Check Whether All works or not")] + [Property("SPEC", "Tizen.NUI.Components.Selector.All A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void All_GET_SET_VALUE() + { + /* TEST CODE */ + var selector = new Selector(); + selector.All = 1; + Assert.AreEqual(1, selector.All, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test Normal. Check Whether Normal works or not")] + [Property("SPEC", "Tizen.NUI.Components.Selector.Normal A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Normal_GET_SET_VALUE() + { + /* TEST CODE */ + var selector = new Selector(); + selector.Normal = 1; + Assert.AreEqual(1, selector.Normal, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test Pressed. Check Whether Pressed works or not")] + [Property("SPEC", "Tizen.NUI.Components.Selector.Pressed A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Pressed_GET_SET_VALUE() + { + /* TEST CODE */ + var selector = new Selector(); + selector.Pressed = 1; + Assert.AreEqual(1, selector.Pressed, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test Focused. Check Whether Focused works or not")] + [Property("SPEC", "Tizen.NUI.Components.Selector.Focused A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Focused_GET_SET_VALUE() + { + /* TEST CODE */ + var selector = new Selector(); + selector.Focused = 1; + Assert.AreEqual(1, selector.Focused, "Should be equal!"); + } + + + [Test] + [Category("P1")] + [Description("Test Selected. Check Whether Selected works or not")] + [Property("SPEC", "Tizen.NUI.Components.Selector.Selected A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Selected_GET_SET_VALUE() + { + /* TEST CODE */ + var selector = new Selector(); + selector.Selected = 1; + Assert.AreEqual(1, selector.Selected, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test Disabled. Check Whether Disabled works or not")] + [Property("SPEC", "Tizen.NUI.Components.Selector.Disabled A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Disabled_GET_SET_VALUE() + { + /* TEST CODE */ + var selector = new Selector(); + selector.Disabled = 1; + Assert.AreEqual(1, selector.Disabled, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test DisabledFocused. Check Whether DisabledFocused works or not")] + [Property("SPEC", "Tizen.NUI.Components.Selector.DisabledFocused A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void DisabledFocused_GET_SET_VALUE() + { + /* TEST CODE */ + var selector = new Selector(); + selector.DisabledFocused = 1; + Assert.AreEqual(1, selector.DisabledFocused, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test SelectedFocused. Check Whether SelectedFocused works or not")] + [Property("SPEC", "Tizen.NUI.Components.Selector.SelectedFocused A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void SelectedFocused_GET_SET_VALUE() + { + /* TEST CODE */ + var selector = new Selector(); + selector.SelectedFocused = 1; + Assert.AreEqual(1, selector.SelectedFocused, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test DisabledSelected. Check Whether DisabledSelected works or not")] + [Property("SPEC", "Tizen.NUI.Components.Selector.DisabledSelected A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void DisabledSelected_GET_SET_VALUE() + { + /* TEST CODE */ + var selector = new Selector(); + selector.DisabledSelected = 1; + Assert.AreEqual(1, selector.DisabledSelected, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test Other. Check Whether Other works or not")] + [Property("SPEC", "Tizen.NUI.Components.Selector.Other A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Other_GET_SET_VALUE() + { + /* TEST CODE */ + var selector = new Selector(); + selector.Other = 1; + Assert.AreEqual(1, selector.Other, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test GetValue. Check Whether GetValue works or not")] + [Property("SPEC", "Tizen.NUI.Components.Selector.GetValue M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetValue_GET_SET_VALUE() + { + /* TEST CODE */ + var selector = new Selector(); + selector.Focused = 1; + Assert.AreEqual(1, selector.GetValue(ControlStates.Focused), "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test Clone. Check Whether Clone works or not")] + [Property("SPEC", "Tizen.NUI.Components.Selector.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Clone_GET_SET_VALUE() + { + /* TEST CODE */ + var selector = new Selector(); + selector.Focused = 1; + var selector2 = new Selector(); + selector2.Clone(selector); + Assert.AreEqual(1, selector2.Focused, "Should be equal!"); + } + + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSlider.SlidingFinishedArgs.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSlider.SlidingFinishedArgs.cs new file mode 100755 index 000000000..f1ea0a8b2 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSlider.SlidingFinishedArgs.cs @@ -0,0 +1,56 @@ +using NUnit.Framework; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Slider.SlidingFinishedArgs Tests")] + public class SlidingFinishedArgsTests + { + private const string TAG = "Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("SlidingFinishedArgsTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a SlidingFinishedArgs object. Check whether SlidingFinishedArgs is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.SlidingFinishedArgs.SlidingFinishedArgs C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void SlidingFinishedArgs_INIT() + { + var eventArgs = new Slider.SlidingFinishedArgs(); + Assert.IsNotNull(eventArgs, "Should be not null!"); + Assert.IsInstanceOf(eventArgs, "Should return SlidingFinishedArgs instance."); + } + + [Test] + [Category("P1")] + [Description("Test CurrentValue. Check whether CurrentValue is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.SlidingFinishedArgs.CurrentValue A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void CurrentValue_SET_GET_VALUE() + { + var eventArgs = new Slider.SlidingFinishedArgs(); + eventArgs.CurrentValue = 100.0f; + Assert.AreEqual(100.0f, eventArgs.CurrentValue, "Retrieved CurrentValue should be equal to set value."); + } + } +} + diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSlider.StateChangedArgs.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSlider.StateChangedArgs.cs new file mode 100755 index 000000000..870d7bca2 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSlider.StateChangedArgs.cs @@ -0,0 +1,72 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Slider.StateChangedArgs Tests")] + public class StateChangedArgsTests + { + private const string TAG = "Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("StateChangedArgsTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a StateChangedArgs object. Check whether StateChangedArgs is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.StateChangedArgs.StateChangedArgs C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void StateChangedArgs_INIT() + { + var eventArgs = new Slider.StateChangedArgs(); + Assert.IsNotNull(eventArgs, "Should be not null!"); + Assert.IsInstanceOf(eventArgs, "Should return StateChangedArgs instance."); + } + + [Test] + [Category("P1")] + [Description("Test CurrentState. Check whether CurrentState is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.StateChangedArgs.CurrentState A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void CurrentState_SET_GET_VALUE() + { + var eventArgs = new Slider.StateChangedArgs(); + eventArgs.CurrentState = ControlStates.Normal; + Assert.AreEqual(ControlStates.Normal, eventArgs.CurrentState, "Retrieved CurrentState should be equal to set value."); + eventArgs.CurrentState = ControlStates.Focused; + Assert.AreEqual(ControlStates.Focused, eventArgs.CurrentState, "Retrieved CurrentState should be equal to set value."); + eventArgs.CurrentState = ControlStates.Disabled; + Assert.AreEqual(ControlStates.Disabled, eventArgs.CurrentState, "Retrieved CurrentState should be equal to set value."); + eventArgs.CurrentState = ControlStates.Selected; + Assert.AreEqual(ControlStates.Selected, eventArgs.CurrentState, "Retrieved CurrentState should be equal to set value."); + eventArgs.CurrentState = ControlStates.Pressed; + Assert.AreEqual(ControlStates.Pressed, eventArgs.CurrentState, "Retrieved CurrentState should be equal to set value."); + eventArgs.CurrentState = ControlStates.DisabledFocused; + Assert.AreEqual(ControlStates.DisabledFocused, eventArgs.CurrentState, "Retrieved CurrentState should be equal to set value."); + eventArgs.CurrentState = ControlStates.SelectedFocused; + Assert.AreEqual(ControlStates.SelectedFocused, eventArgs.CurrentState, "Retrieved CurrentState should be equal to set value."); + eventArgs.CurrentState = ControlStates.DisabledSelected; + Assert.AreEqual(ControlStates.DisabledSelected, eventArgs.CurrentState, "Retrieved CurrentState should be equal to set value."); + eventArgs.CurrentState = ControlStates.Max; + Assert.AreEqual(ControlStates.Max, eventArgs.CurrentState, "Retrieved CurrentState should be equal to set value."); + } + } +} + diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSlider.ValueChangedArgs.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSlider.ValueChangedArgs.cs new file mode 100755 index 000000000..bfc46e4f7 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSlider.ValueChangedArgs.cs @@ -0,0 +1,55 @@ +using NUnit.Framework; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Slider.ValueChangedArgs Tests")] + public class ValueChangedArgsTests + { + private const string TAG = "Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("ValueChangedArgsTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a ValueChangedArgs object. Check whether ValueChangedArgs is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.ValueChangedArgs.ValueChangedArgs C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void ValueChangedArgs_INIT() + { + var eventArgs = new Slider.ValueChangedArgs(); + Assert.IsNotNull(eventArgs, "Should be not null!"); + Assert.IsInstanceOf(eventArgs, "Should return ValueChangedArgs instance."); + } + + [Test] + [Category("P1")] + [Description("Test CurrentValue. Check whether CurrentValue is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.ValueChangedArgs.CurrentValue A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void CurrentValue_SET_GET_VALUE() + { + var eventArgs = new Slider.ValueChangedArgs(); + eventArgs.CurrentValue = 100.0f; + Assert.AreEqual(100.0f, eventArgs.CurrentValue, "Retrieved CurrentValue should be equal to set value."); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSlider.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSlider.cs new file mode 100755 index 000000000..7c08044cd --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSlider.cs @@ -0,0 +1,641 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Slider Tests")] + public class SliderTests + { + private bool _checkValue; + private bool _checkFinish; + private bool _checkMark; + private const string TAG = "TCT"; + private string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png"; + public SliderTests() + { + _checkValue = false; + _checkFinish = false; + _checkMark = false; + } + + ~SliderTests() + { + } + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("SliderTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + public bool OnSlidingFinish(object obj, Slider.SlidingFinishedArgs args) + { + _checkFinish = true; + return true; + } + + public void OnSliderValueChange(object obj, Slider.ValueChangedArgs args) + { + _checkValue = true; + } + + [Test] + [Category("P1")] + [Description("Create a Slider object. Check whether Slider is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.Slider C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Slider_INIT() + { + var slider = new Slider(); + Assert.IsNotNull(slider, "Can't create success object Slider"); + Assert.IsInstanceOf(slider, "Costruct Test Fail"); + } + + [Test] + [Category("P1")] + [Description("Create a Slider object with attributes. Check whether object whose text is initialized is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.Slider C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "SliderAttributes")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Slider_INIT_WITH_SliderAttributes() + { + /* TEST CODE */ + var slider = new Slider(new SliderAttributes()); + Assert.IsNotNull(slider, "Can't create success object Slider"); + Assert.IsInstanceOf(slider, "Should be an instance of textLabel type."); + } + + [Test] + [Category("P1")] + [Description("Create a Slider object with string. Check whether object whose text is initialized is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.Slider C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "string")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Slider_INIT_WITH_STRING() + { + /* TEST CODE */ + StyleManager.Instance.RegisterStyle("DefaultSlider", "Utility", typeof(UtilityDefaultSliderStyle), true); + var slider = new Slider("DefaultSlider"); + Assert.IsNotNull(slider, "Can't create success object Slider"); + Assert.IsInstanceOf(slider, "Should be an instance of Slider type."); + } + + [Test] + [Category("P1")] + [Description("Test Direction. Check Direction works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.Direction A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Direction_SET_GET_VALUE() + { + var slider = new Slider(); + slider.Direction = Slider.DirectionType.Horizontal; + Assert.AreEqual(Slider.DirectionType.Horizontal, slider.Direction, "Retrieved Direction should be equal to set value."); + slider.Direction = Slider.DirectionType.Vertical; + Assert.AreEqual(Slider.DirectionType.Vertical, slider.Direction, "Retrieved Direction should be equal to set value."); + } + + [Test] + [Category("P1")] + [Description("Test Indicator. Check Indicator works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.Indicator A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Indicator_SET_GET_VALUE() + { + var slider = new Slider(); + slider.Indicator = Slider.IndicatorType.Image; + Assert.AreEqual(Slider.IndicatorType.Image, slider.Indicator, "Retrieved Indicator should be equal to set value."); + slider.Indicator = Slider.IndicatorType.Text; + Assert.AreEqual(Slider.IndicatorType.Text, slider.Indicator, "Retrieved Indicator should be equal to set value."); + slider.Indicator = Slider.IndicatorType.None; + Assert.AreEqual(Slider.IndicatorType.None, slider.Indicator, "Retrieved Indicator should be equal to set value."); + } + + [Test] + [Category("P1")] + [Description("Test MinValue. Check MinValue works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.MinValue A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void MinValue_SET_GET_VALUE() + { + var slider = new Slider(); + slider.MinValue = 1; + Assert.AreEqual(1, slider.MinValue, "Retrieved MinValue should be equal to set value."); + } + + [Test] + [Category("P1")] + [Description("Test MaxValue. Check MaxValue works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.MaxValue A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void MaxValue_SET_GET_VALUE() + { + var slider = new Slider(); + slider.MaxValue = 100; + Assert.AreEqual(100, slider.MaxValue, "Retrieved MaxValue should be equal to set value."); + } + + [Test] + [Category("P1")] + [Description("Test CurrentValue. Check CurrentValue works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.CurrentValue A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void CurrentValue_SET_GET_VALUE() + { + var slider = new Slider(); + slider.CurrentValue = 50; + Assert.AreEqual(50, slider.CurrentValue, "Retrieved CurrentValue should be equal to set value."); + } + + [Test] + [Category("P1")] + [Description("Test ThumbSize. Check ThumbSize works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.ThumbSize A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void ThumbSize_SET_GET_VALUE() + { + var slider = new Slider(); + slider.ThumbSize = new Size2D(100,100); + Assert.AreEqual(100, slider.ThumbSize.Width, "Retrieved ThumbSize width should be equal to set value."); + Assert.AreEqual(100, slider.ThumbSize.Height, "Retrieved ThumbSize height should be equal to set value."); + } + + [Test] + [Category("P1")] + [Description("Test ThumbImageBackgroundURLSelector. Check ThumbImageBackgroundURLSelector works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.ThumbImageBackgroundURLSelector A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void ThumbImageBackgroundURLSelector_SET_GET_VALUE() + { + var slider = new Slider(); + slider.ThumbImageBackgroundURLSelector = new StringSelector(){All="background"}; + Assert.AreEqual("background", slider.ThumbImageBackgroundURLSelector.All, "Retrieved ThumbImageBackgroundURLSelector should be equal to set value."); + } + + [Test] + [Category("P1")] + [Description("Test ThumbImageURL. Check whether ThumbImageURL works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.ThumbImageURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void ThumbImageURL_SET_GET_VALUE() + { + /* TEST CODE */ + var slider = new Slider(); + slider.ThumbImageURL = "sliderurl"; + Assert.AreEqual("sliderurl", slider.ThumbImageURL, "Retrieved ThumbImageURL should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test ThumbImageURLSelector. Check ThumbImageURLSelector works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.ThumbImageURLSelector A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void ThumbImageURLSelector_SET_GET_VALUE() + { + var slider = new Slider(); + slider.ThumbImageURLSelector = new StringSelector(){All="background"}; + Assert.AreEqual("background", slider.ThumbImageURLSelector.All, "Retrieved ThumbImageURLSelector should be equal to set value."); + } + + [Test] + [Category("P1")] + [Description("Test BgTrackColor. Check whether BgTrackColor works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.BgTrackColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void BgTrackColor_SET_GET_VALUE() + { + /* TEST CODE */ + var slider = new Slider(); + Color color = Color.Red; + slider.BgTrackColor = color; + Assert.AreEqual(color.R, slider.BgTrackColor.R, "Retrieved BgTrackColor should be equal to set value"); + Assert.AreEqual(color.G, slider.BgTrackColor.G, "Retrieved BgTrackColor should be equal to set value"); + Assert.AreEqual(color.B, slider.BgTrackColor.B, "Retrieved BgTrackColor should be equal to set value"); + Assert.AreEqual(color.A, slider.BgTrackColor.A, "Retrieved BgTrackColor should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test SlidedTrackColor. Check whether SlidedTrackColor works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.SlidedTrackColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void SlidedTrackColor_SET_GET_VALUE() + { + /* TEST CODE */ + var slider = new Slider(); + Color color = Color.Red; + slider.SlidedTrackColor = color; + Assert.AreEqual(color.R, slider.SlidedTrackColor.R, "Retrieved SlidedTrackColor should be equal to set value"); + Assert.AreEqual(color.G, slider.SlidedTrackColor.G, "Retrieved SlidedTrackColor should be equal to set value"); + Assert.AreEqual(color.B, slider.SlidedTrackColor.B, "Retrieved SlidedTrackColor should be equal to set value"); + Assert.AreEqual(color.A, slider.SlidedTrackColor.A, "Retrieved SlidedTrackColor should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test TrackThickness. Check whether TrackThickness works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.TrackThickness A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void TrackThickness_SET_GET_VALUE() + { + /* TEST CODE */ + var slider = new Slider(); + slider.TrackThickness = 20; + Assert.AreEqual(20, slider.TrackThickness, "Retrieved TrackThickness should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test LowIndicatorImageURL. Check whether LowIndicatorImageURL works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.LowIndicatorImageURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void LowIndicatorImageURL_SET_GET_VALUE() + { + /* TEST CODE */ + var slider = new Slider(); + slider.LowIndicatorImageURL = "sliderurl"; + Assert.AreEqual("sliderurl", slider.LowIndicatorImageURL, "Retrieved LowIndicatorImageURL should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test HighIndicatorImageURL. Check whether HighIndicatorImageURL works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.HighIndicatorImageURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void HighIndicatorImageURL_SET_GET_VALUE() + { + /* TEST CODE */ + var slider = new Slider(); + slider.HighIndicatorImageURL = "sliderurl"; + Assert.AreEqual("sliderurl", slider.HighIndicatorImageURL, "Retrieved HighIndicatorImageURL should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test LowIndicatorTextContent. Check whether LowIndicatorTextContent works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.LowIndicatorTextContent A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void LowIndicatorTextContent_SET_GET_VALUE() + { + /* TEST CODE */ + var slider = new Slider(); + Assert.IsInstanceOf(slider, "Should be an instance of Slider type"); + slider.LowIndicatorTextContent = "slider"; + Assert.AreEqual("slider", slider.LowIndicatorTextContent, "Retrieved LowIndicatorTextContent width should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test HighIndicatorTextContent. Check whether HighIndicatorTextContent works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.HighIndicatorTextContent A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void HighIndicatorTextContent_SET_GET_VALUE() + { + /* TEST CODE */ + var slider = new Slider(); + Assert.IsInstanceOf(slider, "Should be an instance of Slider type"); + slider.HighIndicatorTextContent = "hinttext"; + Assert.AreEqual("hinttext", slider.HighIndicatorTextContent, "Retrieved HighIndicatorTextContent should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test LowIndicatorSize. Check whether LowIndicatorSize works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.LowIndicatorSize A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void LowIndicatorSize_SET_GET_VALUE() + { + /* TEST CODE */ + var slider = new Slider(); + Assert.IsInstanceOf(slider, "Should be an instance of Slider type"); + slider.LowIndicatorSize = new Size2D(100, 100); + Assert.AreEqual(100, slider.LowIndicatorSize.Width, "Retrieved LowIndicatorSize width should be equal to set value"); + Assert.AreEqual(100, slider.LowIndicatorSize.Height, "Retrieved LowIndicatorSize height should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test HighIndicatorSize. Check whether HighIndicatorSize works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.HighIndicatorSize A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void HighIndicatorSize_SET_GET_VALUE() + { + /* TEST CODE */ + var slider = new Slider(); + Assert.IsInstanceOf(slider, "Should be an instance of Slider type"); + slider.HighIndicatorSize = new Size2D(100, 100); + Assert.AreEqual(100, slider.HighIndicatorSize.Width, "Retrieved HighIndicatorSize width should be equal to set value"); + Assert.AreEqual(100, slider.HighIndicatorSize.Height, "Retrieved HighIndicatorSize height should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test SpaceBetweenTrackAndIndicator. Check whether SpaceBetweenTrackAndIndicator works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.SpaceBetweenTrackAndIndicator A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void SpaceBetweenTrackAndIndicator_SET_GET_VALUE() + { + /* TEST CODE */ + var slider = new Slider(); + slider.SpaceBetweenTrackAndIndicator = 20; + Assert.AreEqual(20, slider.SpaceBetweenTrackAndIndicator, "Retrieved SpaceBetweenTrackAndIndicator should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test GetAttributes. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Slider.GetAttributes M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void GetAttributes_CHECK_VALUE() + { + /* TEST CODE */ + try + { + var mySlider = new MySlider(); + Assert.IsTrue(mySlider.flagGetAttributes, "GetAttributes trigger Check Fail."); + } + 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 OnUpdate. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Slider.OnUpdate M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public async Task OnUpdate_CHECK_VALUE() + { + /* TEST CODE */ + var mySlider = new MySlider(); + Window.Instance.Add(mySlider); + try + { + await Task.Delay(200); + Assert.IsTrue(mySlider.flagOnUpdate, "OnUpdate trigger Check Fail."); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + finally + { + Window.Instance.Remove(mySlider); + } + } + + [Test] + [Category("P1")] + [Description("Test OnThemeChangedEvent. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Slider.OnThemeChangedEvent M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public async Task OnThemeChangedEvent_CHECK_VALUE() + { + /* TEST CODE */ + StyleManager.Instance.Theme = "Utility"; + var mySlider = new MySlider(); + Window.Instance.Add(mySlider); + try + { + StyleManager.Instance.Theme = "Food"; + await Task.Delay(200); + Assert.IsTrue(mySlider.flagOnThemeChangedEvent, "OnThemeChangedEvent trigger Check Fail."); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + finally + { + Window.Instance.Remove(mySlider); + } + } + + [Test] + [Category("P1")] + [Description("Test OnFocusGained. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Slider.OnFocusGained M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void OnFocusGained_CHECK_VALUE() + { + /* TEST CODE */ + Window window = Window.Instance; + var mySlider = new MySlider(); + mySlider.Focusable = true; + window.Add(mySlider); + FocusManager.Instance.SetCurrentFocusView(mySlider); + Assert.AreEqual(true, mySlider.flagFocusGained, "OnFocusGained Check Fail."); + window.Remove(mySlider); + } + + [Test] + [Category("P1")] + [Description("Test OnFocusLost. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Slider.OnFocusLost M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void OnFocusLost_CHECK_VALUE() + { + /* TEST CODE */ + Window window = Window.Instance; + var mySlider = new MySlider(); + var mySlider2 = new MySlider(); + mySlider.Focusable = true; + mySlider2.Focusable = true; + window.Add(mySlider); + window.Add(mySlider2); + FocusManager.Instance.SetCurrentFocusView(mySlider); + FocusManager.Instance.SetCurrentFocusView(mySlider2); + Assert.AreEqual(true, mySlider.flagFocusLost, "OnFocusLost Check Fail."); + window.Remove(mySlider); + window.Remove(mySlider2); + } + + [Test] + [Category("P1")] + [Description("Test Dispose, try to dispose the Slider.")] + [Property("SPEC", "Tizen.NUI.Components.Slider.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Dispose_CHECK_RETURN_TYPE() + { + /* TEST CODE */ + try + { + Slider slider = new Slider(); + slider.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 MySlider : Slider + { + public bool flagGetAttributes = false; + public bool flagOnUpdate = false; + public bool flagOnThemeChangedEvent = false; + public bool flagFocusGained = false; + public bool flagFocusLost = false; + + public MySlider() : base() + { } + + public MySlider(string style) : base(style) + { } + + public override void OnFocusGained() + { + flagFocusGained = true; + } + + public override void OnFocusLost() + { + flagFocusLost = true; + } + + protected override Attributes GetAttributes() + { + flagGetAttributes = true; + return new SliderAttributes(); + } + + protected override void OnUpdate() + { + base.OnUpdate(); + flagOnUpdate = true; + } + + protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e) + { + flagOnThemeChangedEvent = true; + } + } + + internal class UtilityDefaultSliderStyle : StyleBase + { + protected override Attributes GetAttributes() + { + if (Content != null) + { + return (Content as Attributes).Clone(); + } + SliderAttributes attributes = new SliderAttributes + { + TrackThickness = 4, + BackgroundTrackAttributes = new ImageAttributes + { + BackgroundColor = new ColorSelector + { + All = new Color(0, 0, 0, 0.1f), + } + }, + + SlidedTrackAttributes = new ImageAttributes + { + BackgroundColor = new ColorSelector + { + All = Color.Green, + } + }, + + ThumbAttributes = new ImageAttributes + { + ResourceURL = new StringSelector + { + Normal = "9. Controller/controller_btn_slide_handler_normal.png", + Pressed = "9. Controller/controller_btn_slide_handler_press.png", + } + }, + + ThumbBackgroundAttributes = new ImageAttributes + { + Size2D = new Size2D(60, 60), + ResourceURL = new StringSelector + { + Normal = "", + Pressed = "9. Controller/controller_btn_slide_handler_effect.png", + } + } + }; + + return attributes; + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSliderAttributes.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSliderAttributes.cs new file mode 100755 index 000000000..7dc95fdf5 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSliderAttributes.cs @@ -0,0 +1,254 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.SliderAttributes Tests")] + public class SliderAttributesTests + { + private const string TAG = "Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("SliderAttributesTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a SliderAttributes object. Check whether SliderAttributes is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.SliderAttributes.SliderAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void SliderAttributes_INIT() + { + /* TEST CODE */ + var sliderAttributes = new SliderAttributes(); + Assert.IsNotNull(sliderAttributes, "Can't create success object SliderAttributes"); + Assert.IsInstanceOf(sliderAttributes, "Should be an instance of SliderAttributes type."); + } + + [Test] + [Category("P1")] + [Description("Create a SliderAttributes object. Check whether SliderAttributes is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.SliderAttributes.SliderAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "SliderAttributes")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void SliderAttributes_INIT_WITH_SliderAttributes() + { + /* TEST CODE */ + var sliderAttributes = new SliderAttributes(); + var sliderAttributes2 = new SliderAttributes(sliderAttributes); + Assert.IsNotNull(sliderAttributes2, "Can't create success object SliderAttributes"); + Assert.IsInstanceOf(sliderAttributes2, "Should be an instance of SliderAttributes type."); + } + + [Test] + [Category("P1")] + [Description("Test BackgroundTrackAttributes. Check whether BackgroundTrackAttributes is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SliderAttributes.BackgroundTrackAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void BackgroundTrackAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var sliderAttributes = new SliderAttributes(); + var imageAttributes = new ImageAttributes() { ResourceURL = new StringSelector() { All = "test.png" } }; + sliderAttributes.BackgroundTrackAttributes = imageAttributes; + Assert.AreEqual(imageAttributes.ResourceURL.All, sliderAttributes.BackgroundTrackAttributes.ResourceURL.All, "Retrieved BackgroundTrackAttributes should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test SlidedTrackAttributes. Check whether SlidedTrackAttributes is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SliderAttributes.SlidedTrackAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void SlidedTrackAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var sliderAttributes = new SliderAttributes(); + var imageAttributes = new ImageAttributes() { ResourceURL = new StringSelector() { All = "test.png" } }; + sliderAttributes.SlidedTrackAttributes = imageAttributes; + Assert.AreEqual(imageAttributes.ResourceURL.All, sliderAttributes.SlidedTrackAttributes.ResourceURL.All, "Retrieved SlidedTrackAttributes should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test ThumbAttributes. Check whether ThumbAttributes is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SliderAttributes.ThumbAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void ThumbAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var sliderAttributes = new SliderAttributes(); + var imageAttributes = new ImageAttributes() { ResourceURL = new StringSelector() { All = "test.png" } }; + sliderAttributes.ThumbAttributes = imageAttributes; + Assert.AreEqual(imageAttributes, sliderAttributes.ThumbAttributes, "Retrieved ThumbAttributes should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test ThumbBackgroundAttributes. Check whether ThumbBackgroundAttributes is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SliderAttributes.ThumbBackgroundAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void ThumbBackgroundAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var sliderAttributes = new SliderAttributes(); + var imageAttributes = new ImageAttributes() { ResourceURL = new StringSelector() { All = "test.png" } }; + sliderAttributes.ThumbBackgroundAttributes = imageAttributes; + Assert.AreEqual(imageAttributes.ResourceURL.All, sliderAttributes.ThumbBackgroundAttributes.ResourceURL.All, "Retrieved ThumbBackgroundAttributes should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test LowIndicatorImageAttributes. Check whether LowIndicatorImageAttributes is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SliderAttributes.LowIndicatorImageAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void LowIndicatorImageAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var sliderAttributes = new SliderAttributes(); + var imageAttributes = new ImageAttributes() { ResourceURL = new StringSelector() { All = "test.png" } }; + sliderAttributes.LowIndicatorImageAttributes = imageAttributes; + Assert.AreEqual(imageAttributes.ResourceURL.All, sliderAttributes.LowIndicatorImageAttributes.ResourceURL.All, "Retrieved LowIndicatorImageAttributes should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test HighIndicatorImageAttributes. Check whether HighIndicatorImageAttributes is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SliderAttributes.HighIndicatorImageAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void HighIndicatorImageAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var sliderAttributes = new SliderAttributes(); + var imageAttributes = new ImageAttributes() { ResourceURL = new StringSelector() { All = "test.png" } }; + sliderAttributes.HighIndicatorImageAttributes = imageAttributes; + Assert.AreEqual(imageAttributes.ResourceURL.All, sliderAttributes.HighIndicatorImageAttributes.ResourceURL.All, "Retrieved HighIndicatorImageAttributes should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test LowIndicatorTextAttributes. Check whether LowIndicatorTextAttributes is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SliderAttributes.LowIndicatorTextAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void LowIndicatorTextAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var sliderAttributes = new SliderAttributes(); + var textAttributes = new TextAttributes() { Text = new StringSelector() { All = "test" } }; + sliderAttributes.LowIndicatorTextAttributes = textAttributes; + Assert.AreEqual(textAttributes.Text.All, sliderAttributes.LowIndicatorTextAttributes.Text.All, "Retrieved LowIndicatorTextAttributes should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test HighIndicatorTextAttributes. Check whether HighIndicatorTextAttributes is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SliderAttributes.HighIndicatorTextAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void HighIndicatorTextAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var sliderAttributes = new SliderAttributes(); + var textAttributes = new TextAttributes() { Text = new StringSelector() { All = "test" } }; + sliderAttributes.HighIndicatorTextAttributes = textAttributes; + Assert.AreEqual(textAttributes.Text.All, sliderAttributes.HighIndicatorTextAttributes.Text.All, "Retrieved HighIndicatorTextAttributes should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test TrackThickness. Check whether TrackThickness is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SliderAttributes.TrackThickness A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void TrackThickness_SET_GET_VALUE() + { + /* TEST CODE */ + var sliderAttributes = new SliderAttributes(); + sliderAttributes.TrackThickness = 4; + Assert.AreEqual(4, sliderAttributes.TrackThickness, "Retrieved TrackThickness should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test SpaceBetweenTrackAndIndicator. Check whether SpaceBetweenTrackAndIndicator is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SliderAttributes.SpaceBetweenTrackAndIndicator A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void SpaceBetweenTrackAndIndicator_SET_GET_VALUE() + { + /* TEST CODE */ + var sliderAttributes = new SliderAttributes(); + sliderAttributes.SpaceBetweenTrackAndIndicator = 4; + Assert.AreEqual(4, sliderAttributes.SpaceBetweenTrackAndIndicator, "Retrieved SpaceBetweenTrackAndIndicator should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test IndicatorType. Check whether IndicatorType is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.SliderAttributes.IndicatorType A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void IndicatorType_SET_GET_VALUE() + { + /* TEST CODE */ + var sliderAttributes = new SliderAttributes(); + sliderAttributes.IndicatorType = Slider.IndicatorType.Image; + Assert.AreEqual(Slider.IndicatorType.Image, sliderAttributes.IndicatorType, "Retrieved IndicatorType should be equal to set value"); + sliderAttributes.IndicatorType = Slider.IndicatorType.None; + Assert.AreEqual(Slider.IndicatorType.None, sliderAttributes.IndicatorType, "Retrieved IndicatorType should be equal to set value"); + sliderAttributes.IndicatorType = Slider.IndicatorType.Text; + Assert.AreEqual(Slider.IndicatorType.Text, sliderAttributes.IndicatorType, "Retrieved IndicatorType should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test Clone. Check whether Clone works or not")] + [Property("SPEC", "Tizen.NUI.Components.SliderAttributes.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Clone_CHECK_RETURN_VALUE() + { + var sliderAttributes = new SliderAttributes(); + sliderAttributes.TrackThickness = 30; + var sliderAttributes2 = sliderAttributes.Clone() as SliderAttributes; + Assert.AreEqual(sliderAttributes.TrackThickness, sliderAttributes2.TrackThickness, "Retrieved TrackThickness should be equal to clone value"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSStringSelector.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSStringSelector.cs new file mode 100755 index 000000000..7fca416e0 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSStringSelector.cs @@ -0,0 +1,64 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.StringSelector Tests")] + public class StringSelectorTests + { + private const string TAG = "NUI.Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("StringSelectorTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a StringSelector object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.StringSelector.StringSelector C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void StringSelector_INIT() + { + /* TEST CODE */ + var stringSelector = new StringSelector(); + Assert.IsNotNull(stringSelector, "Can't create success object StringSelector"); + Assert.IsInstanceOf(stringSelector, "Should be an instance of StringSelector type."); + } + + [Test] + [Category("P1")] + [Description("Test Clone. Check Whether Clone works or not")] + [Property("SPEC", "Tizen.NUI.Components.StringSelector.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Clone_TEST() + { + /* TEST CODE */ + var stringSelector1 = new StringSelector(); + stringSelector1.All = "TEST"; + var stringSelector = stringSelector1.Clone(); + Assert.IsNotNull(stringSelector, "should be not null!"); + Assert.AreEqual("TEST", stringSelector.All); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSStyleBase.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSStyleBase.cs new file mode 100755 index 000000000..a35e25bae --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSStyleBase.cs @@ -0,0 +1,120 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.StyleBase Tests")] + public class StyleBaseTests + { + private const string TAG = "NUI.Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("StyleBaseTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a StyleBase object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.StyleBase.StyleBase C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void StyleBase_INIT() + { + /* TEST CODE */ + var styleBase = new StyleBase(); + Assert.IsNotNull(styleBase, "Can't create success object StyleBase"); + Assert.IsInstanceOf(styleBase, "Should be an instance of StyleBase type."); + } + + [Test] + [Category("P1")] + [Description("Test Content.Check whether Content is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.StyleBase.Content A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Content_SET_GET_VALUE() + { + /* TEST CODE */ + var style = new MyControlStyle(); + style.SetContent(); + object content = style.GetContent(); + Assert.IsNotNull(content, "Should be not null!"); + } + + [Test] + [Category("P1")] + [Description("Test GetAttributes. Check Whether GetAttributes works or not")] + [Property("SPEC", "Tizen.NUI.Components.StyleBase.GetAttributes M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetAttributes_TEST() + { + /* TEST CODE */ + try + { + var myControl = new MyControlStyle(); + var attr = myControl.TestGetAttributes() as ControlTests.MyControlAttributes; + Assert.IsNotNull(attr, "Should be not null"); + Assert.IsInstanceOf(attr, "Should be an instance of Attributes!"); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + } + + public class MyControlStyle : StyleBase + { + protected override Attributes GetAttributes() + { + ControlTests.MyControlAttributes attributes = new ControlTests.MyControlAttributes + { + BGImageAttributes = new ImageAttributes + { + BackgroundColor = new ColorSelector + { + All = new Color(0.43f, 0.43f, 0.43f, 0.6f), + } + }, + }; + return attributes; + } + + public void SetContent() + { + Content = GetAttributes(); + } + + public object GetContent() + { + return Content; + } + + public Attributes TestGetAttributes() + { + return GetAttributes(); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSStyleManager.ThemeChangeEventArgs.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSStyleManager.ThemeChangeEventArgs.cs new file mode 100755 index 000000000..5eb60d514 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSStyleManager.ThemeChangeEventArgs.cs @@ -0,0 +1,67 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.StyleManager.ThemeChangeEventArgs Tests")] + public class ThemeChangeEventArgsTests + { + private const string TAG = "Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("ThemeChangeEventArgsTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a ThemeChangeEventArgs object. Check whether ThemeChangeEventArgs is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.StyleManager.ThemeChangeEventArgs.ThemeChangeEventArgs C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ThemeChangeEventArgs_INIT() + { + /* TEST CODE */ + var themeChangedEventArgs = new Components.StyleManager.ThemeChangeEventArgs(); + Assert.IsNotNull(themeChangedEventArgs, "Can't create success object ThemeChangeEventArgs"); + Assert.IsInstanceOf(themeChangedEventArgs, "Should be an instance of ThemeChangeEventArgs type."); + } + + + [Test] + [Category("P1")] + [Description("Test CurrentTheme. Check whether CurrentTheme is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.StyleManager.ThemeChangeEventArgs.CurrentTheme A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void CurrentTheme_SET_GET_VALUE() + { + /* TEST CODE */ + Components.StyleManager.Instance.Theme = "Utility"; + Components.StyleManager.Instance.Theme = "Food"; + Components.StyleManager.Instance.ThemeChangedEvent += OnThemeChanged; + Components.StyleManager.Instance.ThemeChangedEvent -= OnThemeChanged; + } + + private void OnThemeChanged(object sender, Components.StyleManager.ThemeChangeEventArgs args) + { + Assert.AreEqual("Food", args.CurrentTheme, "Should be equal!"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSStyleManager.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSStyleManager.cs new file mode 100755 index 000000000..7734ad050 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSStyleManager.cs @@ -0,0 +1,159 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.StyleManager Tests")] + public class StyleManagerTests + { + private const string TAG = "NUI.Components"; + private bool _themeChangedFlag = false; + + [SetUp] + public void Init() + { + _themeChangedFlag = false; + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("StyleManagerTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test Instance.Check whether Instance is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.StyleManager.Instance A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Instance_GET_VALUE() + { + /* TEST CODE */ + var styleManager = Tizen.NUI.Components.StyleManager.Instance; + Assert.IsNotNull(styleManager, "Should be not null"); + Assert.IsInstanceOf(styleManager, "Should be an instance of StyleManager type."); + } + + [Test] + [Category("P1")] + [Description("Test RegisterStyle. Check whether RegisterStyle works or not.")] + [Property("SPEC", "Tizen.NUI.Components.StyleManager.RegisterStyle M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void RegisterStyle_TEST() + { + /* TEST CODE */ + try + { + Components.StyleManager.Instance.RegisterStyle("MyControl", "Utility", typeof(Tizen.NUI.Components.Tests.MyControlStyle)); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test GetAttributes. Check whether GetAttributes works or not.")] + [Property("SPEC", "Tizen.NUI.Components.StyleManager.GetAttributes M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void GetAttributes_TEST() + { + /* TEST CODE */ + try + { + Components.StyleManager.Instance.RegisterStyle("MyControl", "Food", typeof(Tizen.NUI.Components.Tests.MyControlFoodStyle), true); + var attributes = Components.StyleManager.Instance.GetAttributes("MyControl"); + Assert.IsNotNull(attributes, "Should be not null"); + Assert.IsInstanceOf(attributes, "Should be an instance of Attributes"); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test ThemeChangedEvent. Check Whether ThemeChangedEvent works or not")] + [Property("SPEC", "Tizen.NUI.Components.StyleManager.ThemeChangedEvent E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ThemeChangedEvent_TEST() + { + /* TEST CODE */ + try + { + Components.StyleManager.Instance.Theme = "Utility"; + Components.StyleManager.Instance.ThemeChangedEvent += OnThemeChangedEvent; + Components.StyleManager.Instance.Theme = "Food"; + Assert.IsTrue(_themeChangedFlag, "Should be true!"); + Components.StyleManager.Instance.ThemeChangedEvent -= OnThemeChangedEvent; + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + private void OnThemeChangedEvent(object sender, EventArgs args) + { + _themeChangedFlag = true; + } + + [Test] + [Category("P1")] + [Description("Test Theme. Check whether Theme works or not.")] + [Property("SPEC", "Tizen.NUI.Components.StyleManager.Theme A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Theme_SET_GET_VALUE() + { + /* TEST CODE */ + try + { + Components.StyleManager.Instance.Theme = "Utility"; + Assert.AreEqual("Utility", Components.StyleManager.Instance.Theme, "Should be equal!"); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + } + + public class MyControlFoodStyle : StyleBase + { + protected override Attributes GetAttributes() + { + ControlTests.MyControlAttributes attributes = new ControlTests.MyControlAttributes + { + BGImageAttributes = new ImageAttributes + { + BackgroundColor = new ColorSelector + { + All = new Color(0.43f, 0.43f, 0.43f, 0.6f), + } + }, + }; + return attributes; + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSwitch.SelectEventArgs.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSwitch.SelectEventArgs.cs new file mode 100755 index 000000000..fb763f38f --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSwitch.SelectEventArgs.cs @@ -0,0 +1,68 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Components; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Switch.SelectEventArgs Tests")] + public class SwitchSelectEventArgsTests + { + private const string TAG = "Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("SwitchSelectEventArgsTests"); + App.MainTitleChangeBackgroundColor(null); + + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test SelectEventArgs empty constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Switch.SelectEventArgs.SelectEventArgs C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void SelectEventArgs_CHECK_VALUE() + { + /* TEST CODE */ + var selectEventArgs = new Switch.SelectEventArgs(); + Assert.IsNotNull(selectEventArgs, "Should be not null!"); + Assert.IsInstanceOf(selectEventArgs, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test IsSelected. Check whether IsSelected is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.Switch.SelectEventArgs.IsSelected A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void IsSelected_SET_GET_VALUE() + { + /* TEST CODE */ + var selectEventArgs = new Switch.SelectEventArgs(); + selectEventArgs.IsSelected = true; + Assert.AreEqual(true, selectEventArgs.IsSelected, "Should be equal"); + selectEventArgs.IsSelected = false; + Assert.AreEqual(false, selectEventArgs.IsSelected, "Should be equal"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSwitch.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSwitch.cs new file mode 100755 index 000000000..9326d7d6f --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSwitch.cs @@ -0,0 +1,352 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Components; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Switch Tests")] + public class SwitchTests + { + 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!"); + App.MainTitleChangeText("CommonSwitchTests"); + App.MainTitleChangeBackgroundColor(null); + + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test Switch empty constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Switch.Switch C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void Switch_CHECK_VALUE() + { + /* TEST CODE */ + var _switch = new Switch(); + Assert.IsNotNull(_switch, "Should be not null!"); + Assert.IsInstanceOf(_switch, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test Switch style constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Switch.Switch C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "string")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void Switch_Style_CHECK_VALUE() + { + /* TEST CODE */ + StyleManager.Instance.RegisterStyle("SwitchStyle", null, typeof(SwitchStyle)); + var _switch = new Switch("SwitchStyle"); + Assert.IsNotNull(_switch, "Should be not null!"); + Assert.IsInstanceOf(_switch, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test Switch SwitchAttributes constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Switch.Switch C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "SwitchAttributes")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void Switch_SwitchAttributes_CHECK_VALUE() + { + /* TEST CODE */ + var attrs = new SwitchAttributes + { + IsSelectable = true, + SwitchBackgroundImageAttributes = new ImageAttributes + { + ResourceURL = new StringSelector + { + All = _image_path + }, + }, + SwitchHandlerImageAttributes = new ImageAttributes + { + Size2D = new Size2D(60, 60), + ResourceURL = new StringSelector + { + All = _image_path + }, + }, + }; + var _switch = new Switch(attrs); + Assert.IsNotNull(_switch, "Should be not null!"); + Assert.IsInstanceOf(_switch, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test SwitchBackgroundImageURL. Check whether SwitchBackgroundImageURL is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Switch.SwitchBackgroundImageURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void SwitchBackgroundImageURL_SET_GET_VALUE() + { + /* TEST CODE */ + var _switch = new Switch(); + _switch.SwitchBackgroundImageURL = _image_path; + Assert.AreEqual(_image_path, _switch.SwitchBackgroundImageURL, "Should be equals to the set value of SwitchBackgroundImageURL"); + } + + [Test] + [Category("P1")] + [Description("Test SwitchBackgroundImageURLSelector. Check whether SwitchBackgroundImageURLSelector is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Switch.SwitchBackgroundImageURLSelector A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void SwitchBackgroundImageURLSelector_SET_GET_VALUE() + { + /* TEST CODE */ + var _switch = new Switch(); + StringSelector stringSelector = new StringSelector + { + Normal = _image_path, + Selected = _image_path, + }; + _switch.SwitchBackgroundImageURLSelector = stringSelector; + Assert.AreEqual(stringSelector.Normal, _switch.SwitchBackgroundImageURLSelector.Normal, "Should be equals to the set value of SwitchBackgroundImageURLSelector Normal"); + Assert.AreEqual(stringSelector.Selected, _switch.SwitchBackgroundImageURLSelector.Selected, "Should be equals to the set value of SwitchBackgroundImageURLSelector Selected"); + } + + [Test] + [Category("P1")] + [Description("Test SwitchHandlerImageURL. Check whether SwitchHandlerImageURL is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Switch.SwitchHandlerImageURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void SwitchHandlerImageURL_SET_GET_VALUE() + { + /* TEST CODE */ + var _switch = new Switch(); + _switch.SwitchHandlerImageURL = _image_path; + Assert.AreEqual(_image_path, _switch.SwitchHandlerImageURL, "Should be equals to the set value of SwitchHandlerImageURL"); + } + + [Test] + [Category("P1")] + [Description("Test SwitchHandlerImageURLSelector. Check whether SwitchHandlerImageURLSelector is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Switch.SwitchHandlerImageURLSelector A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void SwitchHandlerImageURLSelector_SET_GET_VALUE() + { + /* TEST CODE */ + var _switch = new Switch(); + StringSelector stringSelector = new StringSelector + { + Normal = _image_path, + Selected = _image_path, + }; + _switch.SwitchHandlerImageURLSelector = stringSelector; + Assert.AreEqual(stringSelector.Normal, _switch.SwitchHandlerImageURLSelector.Normal, "Should be equals to the set value of SwitchHandlerImageURLSelector Normal"); + Assert.AreEqual(stringSelector.Selected, _switch.SwitchHandlerImageURLSelector.Selected, "Should be equals to the set value of SwitchHandlerImageURLSelector Selected"); + } + + [Test] + [Category("P1")] + [Description("Test SwitchHandlerImageSize2D. Check whether SwitchHandlerImageSize2D is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Switch.SwitchHandlerImageSize2D A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void SwitchHandlerImageSize2D_SET_GET_VALUE() + { + /* TEST CODE */ + var _switch = new Switch(); + _switch.SwitchHandlerImageSize2D = new Size2D(10, 10); + Assert.AreEqual(10, _switch.SwitchHandlerImageSize2D.Width, "Should be equals to the set value of SwitchHandlerImageSize2D.Width"); + Assert.AreEqual(10, _switch.SwitchHandlerImageSize2D.Height, "Should be equals to the set value of SwitchHandlerImageSize2D.Height"); + } + + [Test] + [Category("P1")] + [Description("Test OnKey. Check return the right value or not")] + [Property("SPEC", "Tizen.NUI.Components.Switch.OnKey M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void OnKey_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + try + { + var _switch = new Switch(); + bool flag = true; + flag = _switch.OnKey(new Key()); + Assert.AreEqual(false, flag, "OnKey return check fail."); + } + 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 OnThemeChangedEvent. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Switch.OnThemeChangedEvent M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public async Task OnThemeChangedEvent_CHECK_VALUE() + { + Tizen.NUI.Components.StyleManager.Instance.Theme = "Utility"; + var mySwitch = new MySwitch(); + Window window = Window.Instance; + window.Add(mySwitch); + Tizen.NUI.Components.StyleManager.Instance.Theme = "Food"; + await Task.Delay(500); + Assert.AreEqual(true, mySwitch.ThemeChangeFlag, "OnThemeChangedEvent trigger Check Fail."); + window.Remove(mySwitch); + } + + public class MySwitch : Switch + { + public bool UpdateFlag = false; + public bool ThemeChangeFlag = false; + + protected override void OnUpdate() + { + UpdateFlag = true; + } + + protected override void OnThemeChangedEvent(object sender, Components.StyleManager.ThemeChangeEventArgs e) + { + ThemeChangeFlag = true; + base.OnThemeChangedEvent(sender, e); + } + + protected override Attributes GetAttributes() + { + return base.GetAttributes(); + } + + public Attributes TestGetAttributes() + { + return GetAttributes(); + } + } + + [Test] + [Category("P1")] + [Description("Test OnUpdate. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Switch.OnUpdate M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public async Task OnUpdate_CHECK_VALUE() + { + /* TEST CODE */ + var mySwitch = new MySwitch(); + mySwitch.BackgroundColor = Color.Red; + mySwitch.Size2D = new Size2D(200, 200); + Window.Instance.Add(mySwitch); + await Task.Delay(500); + Assert.AreEqual(true, mySwitch.UpdateFlag, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test GetAttributes. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Switch.GetAttributes M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void GetAttributes_CHECK_VALUE() + { + /* TEST CODE */ + var mySwitch = new MySwitch(); + var attr = mySwitch.TestGetAttributes(); + Assert.IsNotNull(attr, "Should be not null!"); + Assert.IsInstanceOf(attr, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test Dispose, try to dispose the Switch.")] + [Property("SPEC", "Tizen.NUI.Components.Switch.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Dispose_TEST() + { + /* TEST CODE */ + try + { + Switch mySwitch = new Switch(); + mySwitch.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 SwitchStyle : StyleBase + { + private string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png"; + protected override Attributes GetAttributes() + { + SwitchAttributes attributes = new SwitchAttributes + { + IsSelectable = true, + SwitchBackgroundImageAttributes = new ImageAttributes + { + Size2D = new Size2D(96, 60), + ResourceURL = new StringSelector + { + All = _image_path + }, + }, + SwitchHandlerImageAttributes = new ImageAttributes + { + Size2D = new Size2D(60, 60), + ResourceURL = new StringSelector + { + All = _image_path + }, + }, + }; + + return attributes; + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSwitchAttributes.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSwitchAttributes.cs new file mode 100755 index 000000000..e7a6a9e60 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSSwitchAttributes.cs @@ -0,0 +1,155 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Components; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.SwitchAttributes Tests")] + public class SwitchAttributesTests + { + 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!"); + App.MainTitleChangeText("SwitchAttributesTests"); + App.MainTitleChangeBackgroundColor(null); + + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test SwitchAttributes empty constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.SwitchAttributes.SwitchAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void SwitchAttributes_CHECK_VALUE() + { + /* TEST CODE */ + var switchAttributes = new SwitchAttributes(); + Assert.IsNotNull(switchAttributes, "Should be not null!"); + Assert.IsInstanceOf(switchAttributes, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test SwitchAttributes copy constructor. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.SwitchAttributes.SwitchAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "SwitchAttributes")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void SwitchAttributes_SwitchAttributes_CHECK_VALUE() + { + /* TEST CODE */ + var attrs = new SwitchAttributes + { + IsSelectable = true, + SwitchBackgroundImageAttributes = new ImageAttributes + { + ResourceURL = new StringSelector + { + All = _image_path + }, + }, + SwitchHandlerImageAttributes = new ImageAttributes + { + Size2D = new Size2D(60, 60), + ResourceURL = new StringSelector + { + All = _image_path + }, + }, + }; + var switchAttributes = new SwitchAttributes(attrs); + Assert.IsNotNull(switchAttributes, "Should be not null!"); + Assert.IsInstanceOf(switchAttributes, "Should be equal!"); + + } + + [Test] + [Category("P1")] + [Description("Test SwitchHandlerImageAttributes. Check whether SwitchHandlerImageAttributes is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.SwitchAttributes.SwitchHandlerImageAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void SwitchHandlerImageAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var switchAttributes = new SwitchAttributes(); + switchAttributes.SwitchHandlerImageAttributes = new ImageAttributes(); + Assert.IsNotNull(switchAttributes.SwitchHandlerImageAttributes, "Should be not null!"); + Assert.IsInstanceOf(switchAttributes.SwitchHandlerImageAttributes, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test SwitchBackgroundImageAttributes. Check whether SwitchBackgroundImageAttributes is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.SwitchAttributes.SwitchBackgroundImageAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void SwitchBackgroundImageAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var switchAttributes = new SwitchAttributes(); + switchAttributes.SwitchBackgroundImageAttributes = new ImageAttributes(); + Assert.IsNotNull(switchAttributes.SwitchBackgroundImageAttributes, "Should be not null!"); + Assert.IsInstanceOf(switchAttributes.SwitchBackgroundImageAttributes, "Should be equals!"); + } + + [Test] + [Category("P1")] + [Description("Test Clone. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.SwitchAttributes.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Ma Junqing, junqing.ma@samsung.com")] + public void Clone_CHECK_VALUE() + { + SwitchAttributes switchAttributes = new SwitchAttributes + { + IsSelectable = true, + SwitchBackgroundImageAttributes = new ImageAttributes + { + ResourceURL = new StringSelector + { + All = _image_path + }, + }, + SwitchHandlerImageAttributes = new ImageAttributes + { + Size2D = new Size2D(60, 60), + ResourceURL = new StringSelector + { + All = _image_path + }, + }, + }; + var attr = switchAttributes.Clone() as SwitchAttributes; + Assert.IsNotNull(attr, "Should be not null!"); + Assert.IsInstanceOf(attr, "Should be equals!"); + Assert.AreEqual(_image_path, attr.SwitchHandlerImageAttributes.ResourceURL.All, "Should be equals!"); + + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTab.ItemChangeEventArgs.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTab.ItemChangeEventArgs.cs new file mode 100755 index 000000000..8d12e6f25 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTab.ItemChangeEventArgs.cs @@ -0,0 +1,69 @@ +using NUnit.Framework; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Tab.ItemChangeEventArgs Tests")] + public class ItemChangedEventArgsTests + { + private const string TAG = "Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("ItemChangeEventArgsTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a ItemChangeEventArgs object. Check whether ItemChangeEventArgs is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.Tab.ItemChangeEventArgs.ItemChangeEventArgs C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void ItemChangeEventArgs_INIT() + { + var eventArgs = new Tab.ItemChangeEventArgs(); + Assert.IsNotNull(eventArgs, "Should be not null!"); + Assert.IsInstanceOf(eventArgs, "Should return ItemChangeEventArgs instance."); + } + + [Test] + [Category("P1")] + [Description("Test PreviousIndex. Check whether PreviousIndex is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Tab.ItemChangeEventArgs.PreviousIndex A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void PreviousIndex_SET_GET_VALUE() + { + var eventArgs = new Tab.ItemChangeEventArgs(); + eventArgs.PreviousIndex = 1; + Assert.AreEqual(1, eventArgs.PreviousIndex, "Retrieved PreviousIndex should be equal to set value."); + } + + [Test] + [Category("P1")] + [Description("Test CurrentIndex. Check whether CurrentIndex is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.Tab.ItemChangeEventArgs.CurrentIndex A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void CurrentIndex_SET_GET_VALUE() + { + var eventArgs = new Tab.ItemChangeEventArgs(); + eventArgs.CurrentIndex = 2; + Assert.AreEqual(2, eventArgs.CurrentIndex, "Retrieved CurrentIndex should be equal to set value."); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTab.TabItemData.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTab.TabItemData.cs new file mode 100755 index 000000000..b869c5fe2 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTab.TabItemData.cs @@ -0,0 +1,55 @@ +using NUnit.Framework; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Tab.TabItemData Tests")] + public class TabItemDataTests + { + private const string TAG = "Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("TabItemDataTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test TabItemData. Check whether TabItemData is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.Tab.TabItemData.TabItemData C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void TabItemData_INIT() + { + var tabItemData = new Tab.TabItemData(); + Assert.IsNotNull(tabItemData, "Can't create success object TabItemData"); + Assert.IsInstanceOf(tabItemData, "Should be an instance of TabItemData type."); + } + + [Test] + [Category("P1")] + [Description("Test Text. Check whether Text works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Tab.TabItemData.Text A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void Text_SET_GET_VALUE() + { + var tabItemData = new Tab.TabItemData(); + tabItemData.Text = "Main"; + Assert.AreEqual("Main", tabItemData.Text, "Retrieved Text should be equal to set value"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTab.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTab.cs new file mode 100755 index 000000000..412b49364 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTab.cs @@ -0,0 +1,634 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI.Components.Test; +using Tizen.NUI.BaseComponents; +using System.Threading.Tasks; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Tab Tests")] + public class TabTests + { + private const string TAG = "Components"; + private bool _checkValue; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("TabTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + private void OnItemChangedEvent(object obj, Tab.ItemChangeEventArgs args) + { + _checkValue = true; + } + + [Test] + [Category("P1")] + [Description("Test Construct. Check whether Tab construct.")] + [Property("SPEC", "Tizen.NUI.Components.Tab.Tab C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + [Property("COVPARAM", "")] + public void Tab_INIT() + { + var temp_view = new Tab(); + Assert.IsNotNull(temp_view, "Should be not null!"); + Assert.IsInstanceOf(temp_view, "Should return Tab instance."); + } + + [Test] + [Category("P1")] + [Description("Create a Tab object with attributes. Check whether object whose text is initialized is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.Tab.Tab C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "TabAttributes")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Tab_INIT_WITH_TabAttributes() + { + /* TEST CODE */ + var tab = new Tab(new TabAttributes()); + Assert.IsNotNull(tab, "Can't create success object Tab"); + Assert.IsInstanceOf(tab, "Should be an instance of textLabel type."); + } + + [Test] + [Category("P1")] + [Description("Create a Tab object with string. Check whether object whose text is initialized is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.Tab.Tab C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "string")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Tab_INIT_WITH_STRING() + { + /* TEST CODE */ + StyleManager.Instance.RegisterStyle("DefaultTab", "Utility", typeof(UtilityTabStyle), true); + + var tab = new Tab("DefaultTab"); + Assert.IsNotNull(tab, "Can't create success object Tab"); + Assert.IsInstanceOf(tab, "Should be an instance of Tab type."); + } + + [Test] + [Category("P1")] + [Description("Test SelectedItemIndex. Check whether SelectedItemIndex works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Tab.SelectedItemIndex A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void SelectedItemIndex_SET_GET_VALUE() + { + /* TEST CODE */ + var tab = new Tab(); + tab.SelectedItemIndex = 0; + Assert.AreEqual(0, tab.SelectedItemIndex, "Retrieved SelectedItemIndex should be equal to set value"); + } + + + [Test] + [Category("P1")] + [Description("Test IsNatureTextWidth. Check whether IsNatureTextWidth works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Tab.IsNatureTextWidth A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void IsNatureTextWidth_SET_GET_VALUE() + { + /* TEST CODE */ + var tab = new Tab(); + Assert.IsInstanceOf(tab, "Should be an instance of Tab type"); + tab.IsNatureTextWidth = true; + Assert.AreEqual(true, tab.IsNatureTextWidth, "Retrieved IsNatureTextWidth should be equal to set value"); + tab.IsNatureTextWidth = false; + Assert.AreEqual(false, tab.IsNatureTextWidth, "Retrieved IsNatureTextWidth should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test ItemGap. Check whether ItemGap works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Tab.ItemGap A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void ItemGap_SET_GET_VALUE() + { + /* TEST CODE */ + var tab = new Tab(); + Assert.IsInstanceOf(tab, "Should be an instance of Tab type"); + tab.ItemGap = 25; + Assert.AreEqual(25, tab.ItemGap, "Retrieved ItemGap should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test LeftSpace. Check whether LeftSpace works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Tab.LeftSpace A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void LeftSpace_SET_GET_VALUE() + { + /* TEST CODE */ + var tab = new Tab(); + Assert.IsInstanceOf(tab, "Should be an instance of Tab type"); + tab.LeftSpace = 25; + Assert.AreEqual(25, tab.LeftSpace, "Retrieved LeftSpace should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test BottomSpace. Check whether BottomSpace works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Tab.BottomSpace A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void BottomSpace_SET_GET_VALUE() + { + /* TEST CODE */ + var tab = new Tab(); + Assert.IsInstanceOf(tab, "Should be an instance of Tab type"); + tab.BottomSpace = 25; + Assert.AreEqual(25, tab.BottomSpace, "Retrieved BottomSpace should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test RightSpace. Check whether RightSpace works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Tab.RightSpace A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void RightSpace_SET_GET_VALUE() + { + /* TEST CODE */ + var tab = new Tab(); + Assert.IsInstanceOf(tab, "Should be an instance of Tab type"); + tab.RightSpace = 25; + Assert.AreEqual(25, tab.RightSpace, "Retrieved RightSpace should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test TopSpace. Check whether TopSpace works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Tab.TopSpace A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void TopSpace_SET_GET_VALUE() + { + /* TEST CODE */ + var tab = new Tab(); + Assert.IsInstanceOf(tab, "Should be an instance of Tab type"); + tab.TopSpace = 25; + Assert.AreEqual(25, tab.TopSpace, "Retrieved TopSpace should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test UnderLineSize2D. Check whether UnderLineSize2D works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Tab.UnderLineSize2D A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void UnderLineSize2D_SET_GET_VALUE() + { + /* TEST CODE */ + var tab = new Tab(); + Assert.IsInstanceOf(tab, "Should be an instance of Tab type"); + tab.UnderLineSize2D = new Size2D(100, 100); + Assert.AreEqual(100, tab.UnderLineSize2D.Width, "Retrieved UnderLineSize2D width should be equal to set value"); + Assert.AreEqual(100, tab.UnderLineSize2D.Height, "Retrieved UnderLineSize2D height should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test UnderLineBackgroundColor. Check whether UnderLineBackgroundColor works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Tab.UnderLineBackgroundColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void UnderLineBackgroundColor_SET_GET_VALUE() + { + /* TEST CODE */ + var tab = new Tab(); + Color color = Color.Red; + tab.UnderLineBackgroundColor = color; + Assert.AreEqual(color.R, tab.UnderLineBackgroundColor.R, "Retrieved UnderLineBackgroundColor should be equal to set value"); + Assert.AreEqual(color.G, tab.UnderLineBackgroundColor.G, "Retrieved UnderLineBackgroundColor should be equal to set value"); + Assert.AreEqual(color.B, tab.UnderLineBackgroundColor.B, "Retrieved UnderLineBackgroundColor should be equal to set value"); + Assert.AreEqual(color.A, tab.UnderLineBackgroundColor.A, "Retrieved TextColor should be equal to set value"); + } + + + [Test] + [Category("P1")] + [Description("Test PointSize. Check whether PointSize works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Tab.PointSize A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void PointSize_SET_GET_VALUE() + { + /* TEST CODE */ + var tab = new Tab(); + tab.PointSize = 38; + + Assert.AreEqual(38, tab.PointSize, "Should be equal!"); + } + + + [Test] + [Category("P1")] + [Description("Test FontFamily. Check whether FontFamily works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Tab.FontFamily A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void FontFamily_SET_GET_VALUE() + { + /* TEST CODE */ + var tab = new Tab(); + tab.FontFamily = "FontFamily"; + Assert.AreEqual("FontFamily", tab.FontFamily, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test TextColor. Check whether TextColor works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Tab.TextColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void TextColor_SET_GET_VALUE() + { + /* TEST CODE */ + var tab = new Tab(); + Color color = Color.Red; + tab.TextColor = color; + Assert.AreEqual(color.R, tab.TextColor.R, "Retrieved TextColor should be equal to set value"); + Assert.AreEqual(color.G, tab.TextColor.G, "Retrieved TextColor should be equal to set value"); + Assert.AreEqual(color.B, tab.TextColor.B, "Retrieved TextColor should be equal to set value"); + Assert.AreEqual(color.A, tab.TextColor.A, "Retrieved TextColor should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test TextColorSelector. Check whether TextColorSelector works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Tab.TextColorSelector A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void TextColorSelector_SET_GET_VALUE() + { + /* TEST CODE */ + var tab = new Tab(); + Color color = Color.Red; + tab.TextColorSelector = new ColorSelector() {All=Color.Red}; + Assert.AreEqual(color.R, tab.TextColorSelector.All.R, "Retrieved TextColorSelector should be equal to set value"); + Assert.AreEqual(color.G, tab.TextColorSelector.All.G, "Retrieved TextColorSelector should be equal to set value"); + Assert.AreEqual(color.B, tab.TextColorSelector.All.B, "Retrieved TextColorSelector should be equal to set value"); + Assert.AreEqual(color.A, tab.TextColorSelector.All.A, "Retrieved TextColorSelector should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test AddItem. Check whether table view add child")] + [Property("SPEC", "Tizen.NUI.Components.Tab.AddItem M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void AddItem_CHECK_RETURN_VALUE() + { + try + { + var tab = new Tab(); + var temActor = new View(); + temActor.Name = "ChildActor"; + tab.AddItem(new Tab.TabItemData() { Text = "Main" }); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test InsertItem. Check whether table view add child")] + [Property("SPEC", "Tizen.NUI.Components.Tab.InsertItem M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void InsertItem_CHECK_RETURN_VALUE() + { + try + { + var testView = new Tab(); + var temActor = new View(); + temActor.Name = "ChildActor"; + testView.InsertItem(new Tab.TabItemData() { Text = "" }, 0); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test DeleteItem. Check whether table view add child")] + [Property("SPEC", "Tizen.NUI.Components.Tab.DeleteItem M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void DeleteItem_CHECK_RETURN_VALUE() + { + try + { + var testView = new Tab(); + var temActor = new View(); + temActor.Name = "ChildActor"; + testView.DeleteItem(0); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test GetAttributes. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Tab.GetAttributes M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void GetAttributes_CHECK_VALUE() + { + /* TEST CODE */ + try + { + var myTab = new MyTab(); + Assert.IsTrue(myTab.flagGetAttributes, "GetAttributes trigger Check Fail."); + } + 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 OnUpdate. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Tab.OnUpdate M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public async Task OnUpdate_CHECK_VALUE() + { + /* TEST CODE */ + var myTab = new MyTab(); + Window.Instance.Add(myTab); + try + { + await Task.Delay(200); + Assert.IsTrue(myTab.flagOnUpdate, "OnUpdate trigger Check Fail."); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + finally + { + Window.Instance.Remove(myTab); + } + } + + [Test] + [Category("P1")] + [Description("Test OnThemeChangedEvent. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Tab.OnThemeChangedEvent M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public async Task OnThemeChangedEvent_CHECK_VALUE() + { + /* TEST CODE */ + StyleManager.Instance.Theme = "Utility"; + var myTab = new MyTab(); + Window.Instance.Add(myTab); + try + { + StyleManager.Instance.Theme = "Food"; + await Task.Delay(200); + Assert.IsTrue(myTab.flagOnThemeChangedEvent, "OnThemeChangedEvent trigger Check Fail."); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + finally + { + Window.Instance.Remove(myTab); + } + } + + [Test] + [Category("P1")] + [Description("Test LayoutChild. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Tab.LayoutChild M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public async Task LayoutChild_CHECK_VALUE() + { + /* TEST CODE */ + var myTab = new MyTab(); + Window.Instance.Add(myTab); + try + { + await Task.Delay(200); + Assert.IsTrue(myTab.flagLayoutChild, "OnUpdate trigger Check Fail."); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + finally + { + Window.Instance.Remove(myTab); + } + } + + [Test] + [Category("P1")] + [Description("Test ItemChangedEvent. Check Event Handler of Value Change.")] + [Property("SPEC", "Tizen.NUI.Components.Tab.ItemChangedEvent E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public async Task ItemChangedEvent_CHECK_EVENT() + { + var myTab = new MyTab() + { + Size2D = new Size2D(700, 108), + Position2D = new Position2D(100, 300), + BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.5f), + IsNatureTextWidth = true, + ItemGap = 40, + LeftSpace = 56, + RightSpace = 56, + TopSpace = 1, + BottomSpace = 0, + UnderLineSize2D = new Size2D(1, 3), + UnderLineBackgroundColor = Color.Cyan, + PointSize = 25, + TextColorSelector = new ColorSelector + { + Normal = Color.Black, + Selected = Color.Blue, + }, + }; + for (int i = 0; i < 2; i++) + { + Tab.TabItemData item = new Tab.TabItemData(); + item.Text = "Tab " + i; + myTab.AddItem(item); + } + try + { + myTab.SelectedItemIndex = 0; + Window.Instance.Add(myTab); + _checkValue = false; + myTab.ItemChangedEvent += OnItemChangedEvent; + myTab.SelectedItemIndex = 1; + await Task.Delay(200); + Assert.IsTrue(_checkValue, "Item change event should received"); + myTab.ItemChangedEvent -= OnItemChangedEvent; + } + catch(Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + finally + { + Window.Instance.Remove(myTab); + } + } + + [Test] + [Category("P1")] + [Description("Test Dispose, try to dispose the Tab.")] + [Property("SPEC", "Tizen.NUI.Components.Tab.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Dispose_CHECK_RETURN_TYPE() + { + /* TEST CODE */ + try + { + var tab = new Tab(); + tab.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 MyTab : Tab + { + public bool flagGetAttributes = false; + public bool flagOnUpdate = false; + public bool flagOnThemeChangedEvent = false; + public bool flagLayoutChild = false; + + public MyTab() : base() + { } + + public MyTab(string style) : base(style) + { } + + protected override Attributes GetAttributes() + { + flagGetAttributes = true; + return new TabAttributes(); + } + + protected override void OnUpdate() + { + base.OnUpdate(); + flagOnUpdate = true; + } + + protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e) + { + flagOnThemeChangedEvent = true; + } + + protected override void LayoutChild() + { + base.LayoutChild(); + flagLayoutChild = true; + } + } + + internal class UtilityTabStyle : StyleBase + { + protected override Attributes GetAttributes() + { + TabAttributes attributes = new TabAttributes + { + Space = new Vector4(56, 56, 1, 0), + UnderLineAttributes = new ViewAttributes + { + Size2D = new Size2D(1, 3), + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft, + PivotPoint = Tizen.NUI.PivotPoint.BottomLeft, + BackgroundColor = new ColorSelector { All = Color.Blue }, + }, + TextAttributes = new TextAttributes + { + PointSize = new FloatSelector { All = 25 }, + TextColor = new ColorSelector + { + Normal = Color.Black, + Selected = Color.Green + }, + }, + }; + return attributes; + } + } +} \ No newline at end of file diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTabAttributes.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTabAttributes.cs new file mode 100755 index 000000000..52c8c5633 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTabAttributes.cs @@ -0,0 +1,160 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.TabAttributes Tests")] + public class TabAttributesTests + { + private const string TAG = "Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("TabAttributesTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a TabAttributes object. Check whether TabAttributes is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.TabAttributes.TabAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void TabAttributes_INIT() + { + /* TEST CODE */ + var tabAttributes = new TabAttributes(); + Assert.IsNotNull(tabAttributes, "Can't create success object TabAttributes"); + Assert.IsInstanceOf(tabAttributes, "Should be an instance of TabAttributes type."); + } + + [Test] + [Category("P1")] + [Description("Create a TabAttributes object. Check whether TabAttributes is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.TabAttributes.TabAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "TabAttributes")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void TabAttributes_INIT_WITH_TabAttributes() + { + /* TEST CODE */ + var tabAttributes = new TabAttributes(); + var tabAttributes2 = new TabAttributes(tabAttributes); + Assert.IsNotNull(tabAttributes2, "Can't create success object TabAttributes"); + Assert.IsInstanceOf(tabAttributes2, "Should be an instance of TabAttributes type."); + } + + [Test] + [Category("P1")] + [Description("Test UnderLineAttributes. Check whether UnderLineAttributes is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.TabAttributes.UnderLineAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void UnderLineAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var tabAttributes = new TabAttributes(); + var viewAttributes = new ViewAttributes() { PaddingLeft = 30 }; + tabAttributes.UnderLineAttributes = viewAttributes; + Assert.AreEqual(viewAttributes.PaddingLeft, tabAttributes.UnderLineAttributes.PaddingLeft, "Retrieved UnderLineAttributes should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test TextAttributes. Check whether TextAttributes is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.TabAttributes.TextAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void TextAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var tabAttributes = new TabAttributes(); + var textAttributes = new TextAttributes() { FontFamily = "test" }; + tabAttributes.TextAttributes = textAttributes; + Assert.AreEqual(textAttributes.FontFamily, tabAttributes.TextAttributes.FontFamily, "Retrieved TextAttributes should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test IsNatureTextWidth. Check whether IsNatureTextWidth is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.TabAttributes.IsNatureTextWidth A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void IsNatureTextWidth_SET_GET_VALUE() + { + /* TEST CODE */ + var tabAttributes = new TabAttributes(); + tabAttributes.IsNatureTextWidth = false; + Assert.AreEqual(false, tabAttributes.IsNatureTextWidth, "Retrieved IsNatureTextWidth should be equal to set value"); + tabAttributes.IsNatureTextWidth = true; + Assert.AreEqual(true, tabAttributes.IsNatureTextWidth, "Retrieved IsNatureTextWidth should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test ItemGap. Check whether ItemGap is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.TabAttributes.ItemGap A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void ItemGap_SET_GET_VALUE() + { + /* TEST CODE */ + var tabAttributes = new TabAttributes(); + tabAttributes.ItemGap = 10; + Assert.AreEqual(10, tabAttributes.ItemGap, "Retrieved ItemGap should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test Space. Check whether Space is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.TabAttributes.Space A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Space_SET_GET_VALUE() + { + /* TEST CODE */ + var tabAttributes = new TabAttributes(); + Vector4 vector4 = new Vector4(5, 10, 5, 10); + tabAttributes.Space = vector4; + Assert.AreEqual(vector4.X, tabAttributes.Space.X, "Retrieved Space should be equal to set value"); + Assert.AreEqual(vector4.Y, tabAttributes.Space.Y, "Retrieved Space should be equal to set value"); + Assert.AreEqual(vector4.Z, tabAttributes.Space.Z, "Retrieved Space should be equal to set value"); + Assert.AreEqual(vector4.W, tabAttributes.Space.W, "Retrieved Space should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test Clone. Check whether Clone works or not")] + [Property("SPEC", "Tizen.NUI.Components.TabAttributes.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Clone_CHECK_RETURN_VALUE() + { + var tabAttributes = new TabAttributes(); + tabAttributes.IsNatureTextWidth = true; + var tabAttributes2 = tabAttributes.Clone() as TabAttributes; + Assert.AreEqual(tabAttributes.IsNatureTextWidth, tabAttributes2.IsNatureTextWidth, "Retrieved IsNatureTextWidth should be equal to clone value"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTextAttributes.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTextAttributes.cs new file mode 100755 index 000000000..f92e3737f --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTextAttributes.cs @@ -0,0 +1,416 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.TextAttributes Tests")] + public class TextAttributesTests + { + private const string TAG = "NUI.Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("TextAttributesTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a TextAttributes object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.TextAttributes.TextAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void TextAttributes_INIT() + { + /* TEST CODE */ + var textAttributes = new TextAttributes(); + Assert.IsNotNull(textAttributes, "Can't create success object TextAttributes"); + Assert.IsInstanceOf(textAttributes, "Should be an instance of TextAttributes type."); + } + + [Test] + [Category("P1")] + [Description("Create a TextAttributes object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.TextAttributes.TextAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "TextAttributes")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void TextAttributes_INIT_WITH_TEXTATTRIBUTES() + { + /* TEST CODE */ + var textAttributes1 = new TextAttributes(); + var textAttributes = new TextAttributes(textAttributes1); + Assert.IsNotNull(textAttributes, "Can't create success object TextAttributes"); + Assert.IsInstanceOf(textAttributes, "Should be an instance of TextAttributes type."); + } + + [Test] + [Category("P1")] + [Description("Test ShadowColor.Check whether ShadowColor is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.TextAttributes.ShadowColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ShadowColor_SET_GET_VALUE() + { + /* TEST CODE */ + var textAttributes = new TextAttributes(); + textAttributes.ShadowColor = new ColorSelector { All = new Color(1.0f, 0.45f, 1.0f, 1.0f) }; + Assert.AreEqual(1.0f, textAttributes.ShadowColor.All.R, "Should be equal to 1.0f!"); + Assert.AreEqual(0.45f, textAttributes.ShadowColor.All.G, "Should be equal to 0.45f!"); + Assert.AreEqual(1.0f, textAttributes.ShadowColor.All.B, "Should be equal to 1.0f!"); + Assert.AreEqual(1.0f, textAttributes.ShadowColor.All.A, "Should be equal to 1.0f!"); + } + + [Test] + [Category("P1")] + [Description("Test ShadowOffset.Check whether ShadowOffset is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.TextAttributes.ShadowOffset A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ShadowOffset_SET_GET_VALUE() + { + /* TEST CODE */ + var textAttributes = new TextAttributes(); + textAttributes.ShadowOffset = new Vector2Selector { All = new Vector2(10, 20) }; + Assert.AreEqual(10, textAttributes.ShadowOffset.All.X, "Should be equal to 10f!"); + Assert.AreEqual(20, textAttributes.ShadowOffset.All.Y, "Should be equal to 20f!"); + } + + [Test] + [Category("P1")] + [Description("Test PointSize.Check whether PointSize is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.TextAttributes.PointSize A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void PointSize_SET_GET_VALUE() + { + /* TEST CODE */ + var textAttributes = new TextAttributes(); + textAttributes.PointSize = new FloatSelector { All = 30 }; + Assert.AreEqual(30, textAttributes.PointSize.All, "Should be equal to 30!"); + } + + [Test] + [Category("P1")] + [Description("Test FontFamily.Check whether FontFamily is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.TextAttributes.FontFamily A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void FontFamily_SET_GET_VALUE() + { + /* TEST CODE */ + var textAttributes = new TextAttributes(); + textAttributes.FontFamily = "Sumsung400"; + Assert.AreEqual("Sumsung400", textAttributes.FontFamily, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test TextColor.Check whether TextColor is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.TextAttributes.TextColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void TextColor_SET_GET_VALUE() + { + /* TEST CODE */ + var textAttributes = new TextAttributes(); + textAttributes.TextColor = new ColorSelector { All = new Color(1.0f, 0.45f, 1.0f, 1.0f) }; + Assert.AreEqual(1.0f, textAttributes.TextColor.All.R, "Should be equal to 1.0f!"); + Assert.AreEqual(0.45f, textAttributes.TextColor.All.G, "Should be equal to 0.45f!"); + Assert.AreEqual(1.0f, textAttributes.TextColor.All.B, "Should be equal to 1.0f!"); + Assert.AreEqual(1.0f, textAttributes.TextColor.All.A, "Should be equal to 1.0f!"); + } + + [Test] + [Category("P1")] + [Description("Test LineSpacing.Check whether LineSpacing is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.TextAttributes.LineSpacing A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void LineSpacing_SET_GET_VALUE() + { + /* TEST CODE */ + var textAttributes = new TextAttributes(); + textAttributes.LineSpacing = 30; + Assert.AreEqual(30, textAttributes.LineSpacing, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test AutoScrollStopMode.Check whether AutoScrollStopMode is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.TextAttributes.AutoScrollStopMode A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void AutoScrollStopMode_SET_GET_VALUE() + { + /* TEST CODE */ + var textAttributes = new TextAttributes(); + textAttributes.AutoScrollStopMode = AutoScrollStopMode.FinishLoop; + Assert.AreEqual(AutoScrollStopMode.FinishLoop, textAttributes.AutoScrollStopMode, "Should be equal!"); + textAttributes.AutoScrollStopMode = AutoScrollStopMode.Immediate; + Assert.AreEqual(AutoScrollStopMode.Immediate, textAttributes.AutoScrollStopMode, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test AutoScrollLoopDelay.Check whether AutoScrollLoopDelay is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.TextAttributes.AutoScrollLoopDelay A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void AutoScrollLoopDelay_SET_GET_VALUE() + { + /* TEST CODE */ + var textAttributes = new TextAttributes(); + textAttributes.AutoScrollLoopDelay = 30; + Assert.AreEqual(30, textAttributes.AutoScrollLoopDelay, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test AutoScrollGap.Check whether AutoScrollGap is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.TextAttributes.AutoScrollGap A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void AutoScrollGap_SET_GET_VALUE() + { + /* TEST CODE */ + var textAttributes = new TextAttributes(); + textAttributes.AutoScrollGap = 30; + Assert.AreEqual(30, textAttributes.AutoScrollGap, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test AutoScrollLoopCount.Check whether AutoScrollLoopCount is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.TextAttributes.AutoScrollLoopCount A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void AutoScrollLoopCount_SET_GET_VALUE() + { + /* TEST CODE */ + var textAttributes = new TextAttributes(); + textAttributes.AutoScrollLoopCount = 30; + Assert.AreEqual(30, textAttributes.AutoScrollLoopCount, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test AutoScrollSpeed.Check whether AutoScrollSpeed is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.TextAttributes.AutoScrollSpeed A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void AutoScrollSpeed_SET_GET_VALUE() + { + /* TEST CODE */ + var textAttributes = new TextAttributes(); + textAttributes.AutoScrollSpeed = 30; + Assert.AreEqual(30, textAttributes.AutoScrollSpeed, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test EnableAutoScroll.Check whether EnableAutoScroll is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.TextAttributes.EnableAutoScroll A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void EnableAutoScroll_SET_GET_VALUE() + { + /* TEST CODE */ + var textAttributes = new TextAttributes(); + textAttributes.EnableAutoScroll = true; + Assert.IsTrue(textAttributes.EnableAutoScroll, "Should be equal!"); + textAttributes.EnableAutoScroll = false; + Assert.IsFalse(textAttributes.EnableAutoScroll, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test EnableMarkup.Check whether EnableMarkup is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.TextAttributes.EnableMarkup A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void EnableMarkup_SET_GET_VALUE() + { + /* TEST CODE */ + var textAttributes = new TextAttributes(); + textAttributes.EnableMarkup = true; + Assert.IsTrue(textAttributes.EnableMarkup, "Should be equal!"); + textAttributes.EnableMarkup = false; + Assert.IsFalse(textAttributes.EnableMarkup, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test VerticalAlignment.Check whether VerticalAlignment is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.TextAttributes.VerticalAlignment A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void VerticalAlignment_SET_GET_VALUE() + { + /* TEST CODE */ + var textAttributes = new TextAttributes(); + textAttributes.VerticalAlignment = VerticalAlignment.Top; + Assert.AreEqual(VerticalAlignment.Top, textAttributes.VerticalAlignment, "Should be equal!"); + textAttributes.VerticalAlignment = VerticalAlignment.Center; + Assert.AreEqual(VerticalAlignment.Center, textAttributes.VerticalAlignment, "Should be equal!"); + textAttributes.VerticalAlignment = VerticalAlignment.Bottom; + Assert.AreEqual(VerticalAlignment.Bottom, textAttributes.VerticalAlignment, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test HorizontalAlignment.Check whether HorizontalAlignment is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.TextAttributes.HorizontalAlignment A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void HorizontalAlignment_SET_GET_VALUE() + { + /* TEST CODE */ + var textAttributes = new TextAttributes(); + textAttributes.HorizontalAlignment = HorizontalAlignment.Begin; + Assert.AreEqual(HorizontalAlignment.Begin, textAttributes.HorizontalAlignment, "Should be equal!"); + textAttributes.HorizontalAlignment = HorizontalAlignment.Center; + Assert.AreEqual(HorizontalAlignment.Center, textAttributes.HorizontalAlignment, "Should be equal!"); + textAttributes.HorizontalAlignment = HorizontalAlignment.End; + Assert.AreEqual(HorizontalAlignment.End, textAttributes.HorizontalAlignment, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test MultiLine.Check whether MultiLine is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.TextAttributes.MultiLine A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void MultiLine_SET_GET_VALUE() + { + /* TEST CODE */ + var textAttributes = new TextAttributes(); + textAttributes.MultiLine = true; + Assert.IsTrue(textAttributes.MultiLine, "Should be equal!"); + textAttributes.MultiLine = false; + Assert.IsFalse(textAttributes.MultiLine, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test TranslatableText.Check whether TranslatableText is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.TextAttributes.TranslatableText A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void TranslatableText_SET_GET_VALUE() + { + /* TEST CODE */ + var textAttributes = new TextAttributes(); + textAttributes.TranslatableText = new StringSelector { All = "Text" }; + Assert.AreEqual("Text", textAttributes.TranslatableText.All, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test Text.Check whether Text is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.TextAttributes.Text A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Text_SET_GET_VALUE() + { + /* TEST CODE */ + var textAttributes = new TextAttributes(); + textAttributes.Text = new StringSelector { All = "Text" }; + Assert.AreEqual("Text", textAttributes.Text.All, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test OutstrokeColor.Check whether OutstrokeColor is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.TextAttributes.OutstrokeColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void OutstrokeColor_SET_GET_VALUE() + { + /* TEST CODE */ + var textAttributes = new TextAttributes(); + textAttributes.OutstrokeColor = new ColorSelector { All = new Color(1.0f, 0.45f, 1.0f, 1.0f) }; + Assert.AreEqual(1.0f, textAttributes.OutstrokeColor.All.R, "Should be equal to 1.0f!"); + Assert.AreEqual(0.45f, textAttributes.OutstrokeColor.All.G, "Should be equal to 0.45f!"); + Assert.AreEqual(1.0f, textAttributes.OutstrokeColor.All.B, "Should be equal to 1.0f!"); + Assert.AreEqual(1.0f, textAttributes.OutstrokeColor.All.A, "Should be equal to 1.0f!"); + } + + [Test] + [Category("P1")] + [Description("Test OutstrokeThickness.Check whether OutstrokeThickness is readable ahd writeable.")] + [Property("SPEC", "Tizen.NUI.Components.TextAttributes.OutstrokeThickness A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void OutstrokeThickness_SET_GET_VALUE() + { + /* TEST CODE */ + var textAttributes = new TextAttributes(); + textAttributes.OutstrokeThickness = new IntSelector { All = 10 }; + Assert.AreEqual(10, textAttributes.OutstrokeThickness.All, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test Clone. Check Whether Clone works or not")] + [Property("SPEC", "Tizen.NUI.Components.TextAttributes.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Clone_TEST() + { + /* TEST CODE */ + try + { + var textAttributes = new TextAttributes(); + textAttributes.Text = new StringSelector() { All = "Text" }; ; + var attributes = textAttributes.Clone() as TextAttributes; + Assert.IsNotNull(attributes, "Should be not null"); + Assert.IsInstanceOf(attributes, "Should be an instance of TextAttributes type."); + Assert.AreEqual("Text", attributes.Text.All, "Should be equal!"); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTextFieldAttributes.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTextFieldAttributes.cs new file mode 100755 index 000000000..71b74ac13 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTextFieldAttributes.cs @@ -0,0 +1,353 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.TextFieldAttributes Tests")] + public class TextFieldAttributesTests + { + private const string TAG = "Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("TextFieldAttributesTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a TextFieldAttributes object. Check whether TextFieldAttributes is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.TextFieldAttributes.TextFieldAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void TextFieldAttributes_INIT() + { + /* TEST CODE */ + var textFieldAttributes = new TextFieldAttributes(); + Assert.IsNotNull(textFieldAttributes, "Can't create success object TextFieldAttributes"); + Assert.IsInstanceOf(textFieldAttributes, "Should be an instance of TextFieldAttributes type."); + } + + [Test] + [Category("P1")] + [Description("Create a TextFieldAttributes object. Check whether TextFieldAttributes is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.TextFieldAttributes.TextFieldAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "TextFieldAttributes")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void TextFieldAttributes_INIT_WITH_TextFieldAttributes() + { + /* TEST CODE */ + var textFieldAttributes = new TextFieldAttributes(); + var textFieldAttributes2 = new TextFieldAttributes(textFieldAttributes); + Assert.IsNotNull(textFieldAttributes2, "Can't create success object TextFieldAttributes"); + Assert.IsInstanceOf(textFieldAttributes2, "Should be an instance of TextFieldAttributes type."); + } + + [Test] + [Category("P1")] + [Description("Test Text. Check whether Text is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.TextFieldAttributes.Text A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Text_SET_GET_VALUE() + { + /* TEST CODE */ + var textFieldAttributes = new TextFieldAttributes(); + StringSelector stringSelector = new StringSelector() { All = "Test"}; + textFieldAttributes.Text = stringSelector; + Assert.AreEqual("Test", textFieldAttributes.Text.All, "Retrieved Text should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test PlaceholderText. Check whether PlaceholderText is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.TextFieldAttributes.PlaceholderText A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void PlaceholderText_SET_GET_VALUE() + { + /* TEST CODE */ + var textFieldAttributes = new TextFieldAttributes(); + StringSelector stringSelector = new StringSelector() { All = "test" }; + textFieldAttributes.PlaceholderText = stringSelector; + Assert.AreEqual(stringSelector.All, textFieldAttributes.PlaceholderText.All, "Retrieved PlaceholderText should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test TranslatablePlaceholderText. Check whether TranslatablePlaceholderText is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.TextFieldAttributes.TranslatablePlaceholderText A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void TranslatablePlaceholderText_SET_GET_VALUE() + { + /* TEST CODE */ + var textFieldAttributes = new TextFieldAttributes(); + StringSelector stringSelector = new StringSelector() { All = "test" }; + textFieldAttributes.TranslatablePlaceholderText = stringSelector; + Assert.AreEqual(stringSelector.All, textFieldAttributes.TranslatablePlaceholderText.All, "Retrieved TranslatablePlaceholderText should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test HorizontalAlignment. Check whether HorizontalAlignment is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.TextFieldAttributes.HorizontalAlignment A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void HorizontalAlignment_SET_GET_VALUE() + { + /* TEST CODE */ + var textFieldAttributes = new TextFieldAttributes(); + textFieldAttributes.HorizontalAlignment = HorizontalAlignment.Begin; + Assert.AreEqual(HorizontalAlignment.Begin, textFieldAttributes.HorizontalAlignment, "Retrieved HorizontalAlignment should be equal to set value"); + textFieldAttributes.HorizontalAlignment = HorizontalAlignment.Center; + Assert.AreEqual(HorizontalAlignment.Center, textFieldAttributes.HorizontalAlignment, "Retrieved HorizontalAlignment should be equal to set value"); + textFieldAttributes.HorizontalAlignment = HorizontalAlignment.End; + Assert.AreEqual(HorizontalAlignment.End, textFieldAttributes.HorizontalAlignment, "Retrieved HorizontalAlignment should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test VerticalAlignment. Check whether VerticalAlignment is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.TextFieldAttributes.VerticalAlignment A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void VerticalAlignment_SET_GET_VALUE() + { + /* TEST CODE */ + var textFieldAttributes = new TextFieldAttributes(); + textFieldAttributes.VerticalAlignment = VerticalAlignment.Top; + Assert.AreEqual(VerticalAlignment.Top, textFieldAttributes.VerticalAlignment, "Retrieved VerticalAlignment should be equal to set value"); + textFieldAttributes.VerticalAlignment = VerticalAlignment.Center; + Assert.AreEqual(VerticalAlignment.Center, textFieldAttributes.VerticalAlignment, "Retrieved VerticalAlignment should be equal to set value"); + textFieldAttributes.VerticalAlignment = VerticalAlignment.Bottom; + Assert.AreEqual(VerticalAlignment.Bottom, textFieldAttributes.VerticalAlignment, "Retrieved VerticalAlignment should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test EnableMarkup. Check whether EnableMarkup is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.TextFieldAttributes.EnableMarkup A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void EnableMarkup_SET_GET_VALUE() + { + /* TEST CODE */ + var textFieldAttributes = new TextFieldAttributes(); + textFieldAttributes.EnableMarkup = false; + Assert.AreEqual(false, textFieldAttributes.EnableMarkup, "Retrieved EnableMarkup should be equal to set value"); + textFieldAttributes.EnableMarkup = true; + Assert.AreEqual(true, textFieldAttributes.EnableMarkup, "Retrieved EnableMarkup should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test TextColor. Check whether TextColor is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.TextFieldAttributes.TextColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void TextColor_SET_GET_VALUE() + { + /* TEST CODE */ + var textFieldAttributes = new TextFieldAttributes(); + ColorSelector colorSelector = new ColorSelector() { All = new Color(1.0f, 0.5f, 1.0f, 1.0f) }; + textFieldAttributes.TextColor = colorSelector; + Assert.AreEqual(colorSelector.All.R, textFieldAttributes.TextColor.All.R, "Retrieved TextColor should be equal to set value"); + Assert.AreEqual(colorSelector.All.G, textFieldAttributes.TextColor.All.G, "Retrieved TextColor should be equal to set value"); + Assert.AreEqual(colorSelector.All.B, textFieldAttributes.TextColor.All.B, "Retrieved TextColor should be equal to set value"); + Assert.AreEqual(colorSelector.All.A, textFieldAttributes.TextColor.All.A, "Retrieved TextColor should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test PlaceholderTextColor. Check whether PlaceholderTextColor is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.TextFieldAttributes.PlaceholderTextColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void PlaceholderTextColor_SET_GET_VALUE() + { + /* TEST CODE */ + var textFieldAttributes = new TextFieldAttributes(); + ColorSelector colorSelector = new ColorSelector() { All = new Color(1.0f, 0.5f, 1.0f, 1.0f) }; + textFieldAttributes.PlaceholderTextColor = colorSelector; + Assert.AreEqual(colorSelector.All.R, textFieldAttributes.PlaceholderTextColor.All.R, "Retrieved PlaceholderTextColor should be equal to set value"); + Assert.AreEqual(colorSelector.All.G, textFieldAttributes.PlaceholderTextColor.All.G, "Retrieved PlaceholderTextColor should be equal to set value"); + Assert.AreEqual(colorSelector.All.B, textFieldAttributes.PlaceholderTextColor.All.B, "Retrieved PlaceholderTextColor should be equal to set value"); + Assert.AreEqual(colorSelector.All.A, textFieldAttributes.PlaceholderTextColor.All.A, "Retrieved PlaceholderTextColor should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test PrimaryCursorColor. Check whether PrimaryCursorColor is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.TextFieldAttributes.PrimaryCursorColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void PrimaryCursorColor_SET_GET_VALUE() + { + /* TEST CODE */ + var textFieldAttributes = new TextFieldAttributes(); + ColorSelector colorSelector = new ColorSelector() { All = new Color(1.0f, 0.5f, 1.0f, 1.0f) }; + textFieldAttributes.PrimaryCursorColor = colorSelector; + Assert.AreEqual(colorSelector.All.R, textFieldAttributes.PrimaryCursorColor.All.R, "Retrieved PrimaryCursorColor should be equal to set value"); + Assert.AreEqual(colorSelector.All.G, textFieldAttributes.PrimaryCursorColor.All.G, "Retrieved PrimaryCursorColor should be equal to set value"); + Assert.AreEqual(colorSelector.All.B, textFieldAttributes.PrimaryCursorColor.All.B, "Retrieved PrimaryCursorColor should be equal to set value"); + Assert.AreEqual(colorSelector.All.A, textFieldAttributes.PrimaryCursorColor.All.A, "Retrieved PrimaryCursorColor should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test SecondaryCursorColor. Check whether SecondaryCursorColor is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.TextFieldAttributes.SecondaryCursorColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void SecondaryCursorColor_SET_GET_VALUE() + { + /* TEST CODE */ + var textFieldAttributes = new TextFieldAttributes(); + ColorSelector colorSelector = new ColorSelector() { All = new Color(1.0f, 0.5f, 1.0f, 1.0f) }; + textFieldAttributes.SecondaryCursorColor = colorSelector; + Assert.AreEqual(colorSelector.All.R, textFieldAttributes.SecondaryCursorColor.All.R, "Retrieved SecondaryCursorColor should be equal to set value"); + Assert.AreEqual(colorSelector.All.G, textFieldAttributes.SecondaryCursorColor.All.G, "Retrieved SecondaryCursorColor should be equal to set value"); + Assert.AreEqual(colorSelector.All.B, textFieldAttributes.SecondaryCursorColor.All.B, "Retrieved SecondaryCursorColor should be equal to set value"); + Assert.AreEqual(colorSelector.All.A, textFieldAttributes.SecondaryCursorColor.All.A, "Retrieved SecondaryCursorColor should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test FontFamily. Check whether FontFamily is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.TextFieldAttributes.FontFamily A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void FontFamily_SET_GET_VALUE() + { + /* TEST CODE */ + var textFieldAttributes = new TextFieldAttributes(); + textFieldAttributes.FontFamily = "test"; + Assert.AreEqual("test", textFieldAttributes.FontFamily, "Retrieved FontFamily should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test PointSize. Check whether PointSize is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.TextFieldAttributes.PointSize A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void PointSize_SET_GET_VALUE() + { + /* TEST CODE */ + var textFieldAttributes = new TextFieldAttributes(); + FloatSelector floatSelector = new FloatSelector() { All = 15.0f }; + textFieldAttributes.PointSize = floatSelector; + Assert.AreEqual(floatSelector.All, textFieldAttributes.PointSize.All, "Retrieved PointSize should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test EnableCursorBlink. Check whether EnableCursorBlink is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.TextFieldAttributes.EnableCursorBlink A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void EnableCursorBlink_SET_GET_VALUE() + { + /* TEST CODE */ + var textFieldAttributes = new TextFieldAttributes(); + textFieldAttributes.EnableCursorBlink = false; + Assert.AreEqual(false, textFieldAttributes.EnableCursorBlink, "Retrieved EnableCursorBlink should be equal to set value"); + textFieldAttributes.EnableCursorBlink = true; + Assert.AreEqual(true, textFieldAttributes.EnableCursorBlink, "Retrieved EnableCursorBlink should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test EnableSelection. Check whether EnableSelection is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.TextFieldAttributes.EnableSelection A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void EnableSelection_SET_GET_VALUE() + { + /* TEST CODE */ + var textFieldAttributes = new TextFieldAttributes(); + textFieldAttributes.EnableSelection = false; + Assert.AreEqual(false, textFieldAttributes.EnableSelection, "Retrieved EnableSelection should be equal to set value"); + textFieldAttributes.EnableSelection = true; + Assert.AreEqual(true, textFieldAttributes.EnableSelection, "Retrieved EnableSelection should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test CursorWidth. Check whether CursorWidth is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.TextFieldAttributes.CursorWidth A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void CursorWidth_SET_GET_VALUE() + { + /* TEST CODE */ + var textFieldAttributes = new TextFieldAttributes(); + textFieldAttributes.CursorWidth = 2; + Assert.AreEqual(2, textFieldAttributes.CursorWidth, "Retrieved CursorWidth should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test EnableEllipsis. Check whether EnableEllipsis is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.TextFieldAttributes.EnableEllipsis A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void EnableEllipsis_SET_GET_VALUE() + { + /* TEST CODE */ + var textFieldAttributes = new TextFieldAttributes(); + textFieldAttributes.EnableEllipsis = false; + Assert.AreEqual(false, textFieldAttributes.EnableEllipsis, "Retrieved EnableEllipsis should be equal to set value"); + textFieldAttributes.EnableEllipsis = true; + Assert.AreEqual(true, textFieldAttributes.EnableEllipsis, "Retrieved EnableEllipsis should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test Clone. Check whether Clone works or not")] + [Property("SPEC", "Tizen.NUI.Components.TextFieldAttributes.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Clone_CHECK_RETURN_VALUE() + { + var textFieldAttributes = new TextFieldAttributes(); + textFieldAttributes.FontFamily = "test"; + var textFieldAttributes2 = textFieldAttributes.Clone() as TextFieldAttributes; + Assert.AreEqual(textFieldAttributes.FontFamily, textFieldAttributes2.FontFamily, "Retrieved FontFamily should be equal to clone value"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSToast.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSToast.cs new file mode 100755 index 000000000..7ad444ee2 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSToast.cs @@ -0,0 +1,478 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI.Components.Test; +using Tizen.NUI.BaseComponents; +using System.Threading.Tasks; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Toast Tests")] + public class ToastTests + { + private const string TAG = "Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("ToastTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test Construct. Check whether Toast construct.")] + [Property("SPEC", "Tizen.NUI.Components.Toast.Toast C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + [Property("COVPARAM", "")] + public void Toast_INIT() + { + var toast = new Toast(); + Assert.IsNotNull(toast, "Should be not null!"); + Assert.IsInstanceOf(toast, "Should return Toast instance."); + } + + [Test] + [Category("P1")] + [Description("Create a Toast object with attributes. Check whether object whose text is initialized is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.Toast.Toast C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "ToastAttributes")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Toast_INIT_WITH_ToastAttributes() + { + /* TEST CODE */ + var toast = new Toast(new ToastAttributes()); + Assert.IsNotNull(toast, "Can't create success object Toast"); + Assert.IsInstanceOf(toast, "Should be an instance of Toast type."); + } + + [Test] + [Category("P1")] + [Description("Create a Toast object with string. Check whether object whose text is initialized is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.Toast.Toast C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "string")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Toast_INIT_WITH_STRING() + { + /* TEST CODE */ + StyleManager.Instance.RegisterStyle("BasicShortToast", null, typeof(BasicShortToasStyle)); + var toast = new Toast("BasicShortToast"); + Assert.IsNotNull(toast, "Can't create success object Toast"); + Assert.IsInstanceOf(toast, "Should be an instance of Toast type."); + } + + [Test] + [Category("P1")] + [Description("Test TextArray. Check whether TextArray works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Toast.TextArray A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void TextArray_SET_GET_VALUE() + { + /* TEST CODE */ + var toast = new Toast(); + string[] textArraySet = new string[] { "aaa", "bbb", "ccc" }; + toast.TextArray = textArraySet; + string[] textArrayGet = toast.TextArray; + Assert.AreEqual(textArraySet[0], textArrayGet[0], "Retrieved TextArray should be equal to set value"); + Assert.AreEqual(textArraySet[1], textArrayGet[1], "Retrieved TextArray should be equal to set value"); + Assert.AreEqual(textArraySet[2], textArrayGet[2], "Retrieved TextArray should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test PointSize. Check whether PointSize works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Toast.PointSize A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void PointSize_SET_GET_VALUE() + { + /* TEST CODE */ + var toast = new Toast(); + Assert.IsInstanceOf(toast, "Should be an instance of Toast type"); + toast.PointSize = 10; + Assert.AreEqual(10, toast.PointSize, "Retrieved PointSize should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test FontFamily. Check whether FontFamily works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Toast.FontFamily A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void FontFamily_SET_GET_VALUE() + { + /* TEST CODE */ + var toast = new Toast(); + Assert.IsInstanceOf(toast, "Should be an instance of Toast type"); + toast.FontFamily = "Test"; + Assert.AreEqual("Test", toast.FontFamily, "Retrieved FontFamily should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test TextColor. Check whether TextColor works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Toast.TextColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void TextColor_SET_GET_VALUE() + { + /* TEST CODE */ + var toast = new Toast(); + Assert.IsInstanceOf(toast, "Should be an instance of Toast type"); + Color textColor = new Color(1.0f, 0.0f, 0.0f, 1.0f); + toast.TextColor = textColor; + Assert.AreEqual(textColor.R, toast.TextColor.R, "Retrieved TextColor should be equal to set value"); + Assert.AreEqual(textColor.G, toast.TextColor.G, "Retrieved TextColor should be equal to set value"); + Assert.AreEqual(textColor.B, toast.TextColor.B, "Retrieved TextColor should be equal to set value"); + Assert.AreEqual(textColor.A, toast.TextColor.A, "Retrieved TextColor should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test TextAlignment. Check whether TextAlignment works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Toast.TextAlignment A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void TextAlignment_SET_GET_VALUE() + { + /* TEST CODE */ + var toast = new Toast(); + Assert.IsInstanceOf(toast, "Should be an instance of Toast type"); + toast.TextAlignment = HorizontalAlignment.Begin; + Assert.AreEqual(HorizontalAlignment.Begin, toast.TextAlignment, "Retrieved TextAlignment should be equal to set value"); + toast.TextAlignment = HorizontalAlignment.Center; + Assert.AreEqual(HorizontalAlignment.Center, toast.TextAlignment, "Retrieved TextAlignment should be equal to set value"); + toast.TextAlignment = HorizontalAlignment.End; + Assert.AreEqual(HorizontalAlignment.End, toast.TextAlignment, "Retrieved TextAlignment should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test BackgroundImageURL. Check whether BackgroundImageURL works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Toast.BackgroundImageURL A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void BackgroundImageURL_SET_GET_VALUE() + { + /* TEST CODE */ + var toast = new Toast(); + Assert.IsInstanceOf(toast, "Should be an instance of Toast type"); + toast.BackgroundImageURL = "test.png"; + Assert.AreEqual("test.png", toast.BackgroundImageURL, "Retrieved BackgroundImageURL should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test BackgroundImageBorder. Check whether BackgroundImageBorder works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Toast.BackgroundImageBorder A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void BackgroundImageBorder_SET_GET_VALUE() + { + /* TEST CODE */ + var toast = new Toast(); + Assert.IsInstanceOf(toast, "Should be an instance of Toast type"); + toast.BackgroundImageBorder = new Rectangle(5, 5, 5, 5); + Assert.AreEqual(5, toast.BackgroundImageBorder.X, "Retrieved BackgroundImageBorder should be equal to set value"); + Assert.AreEqual(5, toast.BackgroundImageBorder.Y, "Retrieved BackgroundImageBorder should be equal to set value"); + Assert.AreEqual(5, toast.BackgroundImageBorder.Width, "Retrieved BackgroundImageBorder should be equal to set value"); + Assert.AreEqual(5, toast.BackgroundImageBorder.Height, "Retrieved BackgroundImageBorder should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test TextPaddingLeft. Check whether TextPaddingLeft works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Toast.TextPaddingLeft A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing teng, xb.teng@samsung.com")] + public void TextPaddingLeft_SET_GET_VALUE() + { + /* TEST CODE */ + var toast = new Toast(); + Assert.IsInstanceOf(toast, "Should be an instance of Toast type"); + toast.TextPaddingLeft = 30; + Assert.AreEqual(30, toast.TextPaddingLeft, "Retrieved TextPaddingLeft should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test TextPaddingRight. Check whether TextPaddingRight works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Toast.TextPaddingRight A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void TextPaddingRight_SET_GET_VALUE() + { + /* TEST CODE */ + var toast = new Toast(); + toast.TextPaddingRight = 30; + Assert.AreEqual(30, toast.TextPaddingRight, "Retrieved TextPaddingRight should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test TextPaddingTop. Check whether TextPaddingTop works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Toast.TextPaddingTop A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void TextPaddingTop_SET_GET_VALUE() + { + /* TEST CODE */ + var toast = new Toast(); + toast.TextPaddingTop = 38; + Assert.AreEqual(38, toast.TextPaddingTop, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test TextPaddingBottom. Check whether TextPaddingBottom works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Toast.TextPaddingBottom A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void TextPaddingBottom_SET_GET_VALUE() + { + /* TEST CODE */ + var toast = new Toast(); + toast.TextPaddingBottom = 38; + Assert.AreEqual(38, toast.TextPaddingBottom, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test TextLineHeight. Check whether TextLineHeight works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Toast.TextLineHeight A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void TextLineHeight_SET_GET_VALUE() + { + /* TEST CODE */ + var toast = new Toast(); + toast.TextLineHeight = 50; + Assert.AreEqual(50, toast.TextLineHeight, "Retrieved TextLineHeight should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test TextLineSpace. Check whether TextLineSpace works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Toast.TextLineSpace A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void TextLineSpace_SET_GET_VALUE() + { + /* TEST CODE */ + var toast = new Toast(); + toast.TextLineSpace = 30; + Assert.AreEqual(30, toast.TextLineSpace, "Retrieved TextLineSpace should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test Duration. Check whether Duration works or not.")] + [Property("SPEC", "Tizen.NUI.Components.Toast.Duration A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Duration_SET_GET_VALUE() + { + /* TEST CODE */ + var toast = new Toast(); + toast.Duration = 30; + Assert.AreEqual(30, toast.Duration, "Retrieved Duration should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test GetAttributes. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Toast.GetAttributes M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void GetAttributes_CHECK_VALUE() + { + /* TEST CODE */ + try + { + var myToast = new MyToast(); + Assert.IsTrue(myToast.flagGetAttributes, "GetAttributes trigger Check Fail."); + } + 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 OnUpdate. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Toast.OnUpdate M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public async Task OnUpdate_CHECK_VALUE() + { + /* TEST CODE */ + var myToast = new MyToast(); + Window.Instance.Add(myToast); + try + { + await Task.Delay(200); + Assert.IsTrue(myToast.flagOnUpdate, "OnUpdate trigger Check Fail."); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + finally + { + Window.Instance.Remove(myToast); + } + } + + [Test] + [Category("P1")] + [Description("Test LayoutChild. Check it has been triggered")] + [Property("SPEC", "Tizen.NUI.Components.Toast.LayoutChild M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public async Task LayoutChild_CHECK_VALUE() + { + /* TEST CODE */ + var myToast = new MyToast(); + Window.Instance.Add(myToast); + try + { + await Task.Delay(200); + Assert.IsTrue(myToast.flagLayoutChild, "OnUpdate trigger Check Fail."); + } + catch (Exception e) + { + Tizen.Log.Error(TAG, "Caught Exception" + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); + Assert.Fail("Caught Exception" + e.ToString()); + } + finally + { + Window.Instance.Remove(myToast); + } + } + + [Test] + [Category("P1")] + [Description("Test Dispose, try to dispose the Toast.")] + [Property("SPEC", "Tizen.NUI.Components.Toast.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Dispose_CHECK_RETURN_TYPE() + { + /* TEST CODE */ + try + { + Toast toast = new Toast(); + toast.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 MyToast : Toast + { + public bool flagGetAttributes = false; + public bool flagOnUpdate = false; + public bool flagLayoutChild = false; + + public MyToast() : base() + { } + + public MyToast(string style) : base(style) + { } + + protected override Attributes GetAttributes() + { + flagGetAttributes = true; + return new ToastAttributes(); + } + + protected override void OnUpdate() + { + base.OnUpdate(); + flagOnUpdate = true; + } + + protected override void LayoutChild() + { + base.LayoutChild(); + flagLayoutChild = true; + } + } + + internal class BasicShortToasStyle : StyleBase + { + protected override Attributes GetAttributes() + { + ToastAttributes attributes = new ToastAttributes + { + Size2D = new Tizen.NUI.Size2D(512, 132), + BackgroundImageAttributes = new ImageAttributes + { + ResourceURL = new StringSelector + { + All = "12. Toast Popup/toast_background.png", + }, + Border = new RectangleSelector + { + All = new Tizen.NUI.Rectangle(64, 64, 4, 4) + } + }, + + TextAttributes = new TextAttributes + { + PaddingTop = 38, + PaddingBottom = 38, + PaddingLeft = 96, + PaddingRight = 96, + PointSize = new FloatSelector { All = 26, }, + TextColor = new ColorSelector { All = Color.White, } + } + }; + return attributes; + } + } +} \ No newline at end of file diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSToastAttributes.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSToastAttributes.cs new file mode 100755 index 000000000..27ab0f07d --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSToastAttributes.cs @@ -0,0 +1,154 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components.Test; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.ToastAttributes Tests")] + public class ToastAttributesTests + { + private const string TAG = "Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("ToastAttributesTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a ToastAttributes object. Check whether ToastAttributes is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.ToastAttributes.ToastAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void ToastAttributes_INIT() + { + /* TEST CODE */ + var toastAttributes = new ToastAttributes(); + Assert.IsNotNull(toastAttributes, "Can't create success object ToastAttributes"); + Assert.IsInstanceOf(toastAttributes, "Should be an instance of ToastAttributes type."); + } + + [Test] + [Category("P1")] + [Description("Create a ToastAttributes object. Check whether ToastAttributes is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.ToastAttributes.ToastAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "ToastAttributes")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void ToastAttributes_INIT_WITH_ToastAttributes() + { + /* TEST CODE */ + var toastAttributes = new ToastAttributes(); + var toastAttributes2 = new ToastAttributes(toastAttributes); + Assert.IsNotNull(toastAttributes2, "Can't create success object ToastAttributes"); + Assert.IsInstanceOf(toastAttributes2, "Should be an instance of ToastAttributes type."); + } + + [Test] + [Category("P1")] + [Description("Test BackgroundImageAttributes. Check whether BackgroundImageAttributes works or not.")] + [Property("SPEC", "Tizen.NUI.Components.ToastAttributes.BackgroundImageAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void BackgroundImageAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var toastAttributes = new ToastAttributes(); + var imageAttributes = new ImageAttributes() { ResourceURL = new StringSelector() { All = "test.png" } }; + toastAttributes.BackgroundImageAttributes = imageAttributes; + Assert.AreEqual(imageAttributes.ResourceURL.All, toastAttributes.BackgroundImageAttributes.ResourceURL.All, "Retrieved BackgroundImageAttributes should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test TextAttributes. Check whether TextAttributes works or not.")] + [Property("SPEC", "Tizen.NUI.Components.ToastAttributes.TextAttributes A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void TextAttributes_SET_GET_VALUE() + { + /* TEST CODE */ + var toastAttributes = new ToastAttributes(); + var textAttributes = new TextAttributes() { Text = new StringSelector() { All = "test" } }; + toastAttributes.TextAttributes = textAttributes; + Assert.AreEqual(textAttributes.Text.All, toastAttributes.TextAttributes.Text.All, "Retrieved TextAttributes should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test TextLineHeight. Check whether TextLineHeight works or not.")] + [Property("SPEC", "Tizen.NUI.Components.ToastAttributes.TextLineHeight A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void TextLineHeight_SET_GET_VALUE() + { + /* TEST CODE */ + var toastAttributes = new ToastAttributes(); + toastAttributes.TextLineHeight = 30; + Assert.AreEqual(30, toastAttributes.TextLineHeight, "Retrieved TextLineHeight should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test TextLineSpace. Check whether TextLineSpace works or not.")] + [Property("SPEC", "Tizen.NUI.Components.ToastAttributes.TextLineSpace A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void TextLineSpace_SET_GET_VALUE() + { + /* TEST CODE */ + var toastAttributes = new ToastAttributes(); + toastAttributes.TextLineSpace = 30; + Assert.AreEqual(30, toastAttributes.TextLineSpace, "Retrieved TextLineSpace should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test Duration. Check whether Duration works or not.")] + [Property("SPEC", "Tizen.NUI.Components.ToastAttributes.Duration A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA","PRW")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Duration_SET_GET_VALUE() + { + /* TEST CODE */ + var toastAttributes = new ToastAttributes(); + toastAttributes.Duration = 30; + Assert.AreEqual(30, toastAttributes.Duration, "Retrieved Duration should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test Clone. Check whether Clone works or not")] + [Property("SPEC", "Tizen.NUI.Components.ToastAttributes.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")] + public void Clone_CHECK_RETURN_VALUE() + { + var toastAttributes = new ToastAttributes(); + toastAttributes.Duration = 30; + var toastAttributes2 = toastAttributes.Clone() as ToastAttributes; + Assert.AreEqual(toastAttributes.Duration, toastAttributes2.Duration, "Retrieved Duration should be equal to clone value"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSVector2Selector.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSVector2Selector.cs new file mode 100755 index 000000000..0eb85862c --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSVector2Selector.cs @@ -0,0 +1,65 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.Vector2Selector Tests")] + public class Vector2SelectorTests + { + private const string TAG = "NUI.Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("Vector2SelectorTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a Vector2Selector object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.Vector2Selector.Vector2Selector C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Vector2Selector_INIT() + { + /* TEST CODE */ + var vector2Selector = new Vector2Selector(); + Assert.IsNotNull(vector2Selector, "Can't create success object Vector2Selector"); + Assert.IsInstanceOf(vector2Selector, "Should be an instance of Vector2Selector type."); + } + + [Test] + [Category("P1")] + [Description("Test Clone. Check Whether Clone works or not")] + [Property("SPEC", "Tizen.NUI.Components.Vector2Selector.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Clone_TEST() + { + /* TEST CODE */ + var vector2Selector1 = new Vector2Selector(); + vector2Selector1.All = new Vector2(10.0f, 10.0f); + var vector2SelectorSelector = vector2Selector1.Clone(); + Assert.IsNotNull(vector2SelectorSelector, "should be not null!"); + Assert.AreEqual(10.0f, vector2SelectorSelector.All.X, "Should be equal!"); + Assert.AreEqual(10.0f, vector2SelectorSelector.All.Y, "Should be equal!"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSViewAttributes.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSViewAttributes.cs new file mode 100755 index 000000000..2154a8052 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSViewAttributes.cs @@ -0,0 +1,356 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; +using Tizen.NUI.Components.Test; +using System.Threading.Tasks; + +namespace Tizen.NUI.Components.Tests +{ + [TestFixture] + [Description("Tizen.NUI.Components.ViewAttributes Tests")] + public class ViewAttributesTests + { + private const string TAG = "NUI.Components"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("ViewAttributesTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a ViewAttributes object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.ViewAttributes.ViewAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ViewAttributes_INIT() + { + /* TEST CODE */ + var viewAttributes = new ViewAttributes(); + Assert.IsNotNull(viewAttributes, "Can't create success object ViewAttributes"); + Assert.IsInstanceOf(viewAttributes, "Should be an instance of ViewAttributes type."); + } + + [Test] + [Category("P1")] + [Description("Create a ViewAttributes object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.ViewAttributes.ViewAttributes C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "ViewAttributes")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ViewAttributes_INIT_WITH_VIEWATTRIBUTES() + { + /* TEST CODE */ + var viewAttributes1 = new ViewAttributes(); + var viewAttributes = new ViewAttributes(viewAttributes1); + Assert.IsNotNull(viewAttributes, "Can't create success object ViewAttributes"); + Assert.IsInstanceOf(viewAttributes, "Should be an instance of ViewAttributes type."); + } + + [Test] + [Category("P1")] + [Description("Test PaddingRight.Check whether PaddingRight is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ViewAttributes.PaddingRight A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void PaddingRight_SET_GET_VALUE() + { + /* TEST CODE */ + var viewAttributes = new ViewAttributes(); + viewAttributes.PaddingRight = 10; + Assert.AreEqual(10, viewAttributes.PaddingRight, "Should be equal to 10!"); + } + + [Test] + [Category("P1")] + [Description("Test PaddingLeft.Check whether PaddingLeft is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ViewAttributes.PaddingLeft A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void PaddingLeft_SET_GET_VALUE() + { + /* TEST CODE */ + var viewAttributes = new ViewAttributes(); + viewAttributes.PaddingLeft = 10; + Assert.AreEqual(10, viewAttributes.PaddingLeft, "Should be equal to 10!"); + } + [Test] + [Category("P1")] + [Description("Test PaddingTop.Check whether PaddingTop is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ViewAttributes.PaddingTop A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void PaddingTop_SET_GET_VALUE() + { + /* TEST CODE */ + var viewAttributes = new ViewAttributes(); + viewAttributes.PaddingTop = 10; + Assert.AreEqual(10, viewAttributes.PaddingTop, "Should be equal to 10!"); + } + + [Test] + [Category("P1")] + [Description("Test PaddingBottom.Check whether PaddingBottom is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ViewAttributes.PaddingBottom A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void PaddingBottom_SET_GET_VALUE() + { + /* TEST CODE */ + var viewAttributes = new ViewAttributes(); + viewAttributes.PaddingBottom = 10; + Assert.AreEqual(10, viewAttributes.PaddingBottom, "Should be equal to 10!"); + } + + [Test] + [Category("P1")] + [Description("Test Opacity.Check whether Opacity is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ViewAttributes.Opacity A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Opacity_SET_GET_VALUE() + { + /* TEST CODE */ + var viewAttributes = new ViewAttributes(); + viewAttributes.Opacity = new FloatSelector { All = 1.0f }; + Assert.AreEqual(1.0f, viewAttributes.Opacity.All, "Should be equal to 1.0f!"); + } + + [Test] + [Category("P1")] + [Description("Test SizeModeFactor.Check whether SizeModeFactor is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ViewAttributes.SizeModeFactor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void SizeModeFactor_SET_GET_VALUE() + { + /* TEST CODE */ + var viewAttributes = new ViewAttributes(); + viewAttributes.SizeModeFactor = new Vector3(1.0f, 0.45f, 1.0f); + Assert.AreEqual(1.0f, viewAttributes.SizeModeFactor.X, "Should be equal to 1.0f!"); + Assert.AreEqual(0.45f, viewAttributes.SizeModeFactor.Y, "Should be equal to 0.45f!"); + Assert.AreEqual(1.0f, viewAttributes.SizeModeFactor.Z, "Should be equal to 1.0f!"); + } + + [Test] + [Category("P1")] + [Description("Test MinimumSize.Check whether MinimumSize is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ViewAttributes.MinimumSize A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void MinimumSize_SET_GET_VALUE() + { + /* TEST CODE */ + var viewAttributes = new ViewAttributes(); + viewAttributes.MinimumSize = new Size2D(200, 200); + Assert.AreEqual(200, viewAttributes.MinimumSize.Width, "Should be equal to 200!"); + Assert.AreEqual(200, viewAttributes.MinimumSize.Height, "Should be equal to 200!"); + } + + [Test] + [Category("P1")] + [Description("Test HeightResizePolicy.Check whether HeightResizePolicy is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ViewAttributes.HeightResizePolicy A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void HeightResizePolicy_SET_GET_VALUE() + { + /* TEST CODE */ + var viewAttributes = new ViewAttributes(); + viewAttributes.HeightResizePolicy = ResizePolicyType.Fixed; + Assert.AreEqual(ResizePolicyType.Fixed, viewAttributes.HeightResizePolicy, "Should be equal!"); + viewAttributes.HeightResizePolicy = ResizePolicyType.UseNaturalSize; + Assert.AreEqual(ResizePolicyType.UseNaturalSize, viewAttributes.HeightResizePolicy, "Should be equal!"); + viewAttributes.HeightResizePolicy = ResizePolicyType.FillToParent; + Assert.AreEqual(ResizePolicyType.FillToParent, viewAttributes.HeightResizePolicy, "Should be equal!"); + viewAttributes.HeightResizePolicy = ResizePolicyType.SizeRelativeToParent; + Assert.AreEqual(ResizePolicyType.SizeRelativeToParent, viewAttributes.HeightResizePolicy, "Should be equal!"); + viewAttributes.HeightResizePolicy = ResizePolicyType.SizeFixedOffsetFromParent; + Assert.AreEqual(ResizePolicyType.SizeFixedOffsetFromParent, viewAttributes.HeightResizePolicy, "Should be equal!"); + viewAttributes.HeightResizePolicy = ResizePolicyType.FitToChildren; + Assert.AreEqual(ResizePolicyType.FitToChildren, viewAttributes.HeightResizePolicy, "Should be equal!"); + viewAttributes.HeightResizePolicy = ResizePolicyType.DimensionDependency; + Assert.AreEqual(ResizePolicyType.DimensionDependency, viewAttributes.HeightResizePolicy, "Should be equal!"); + viewAttributes.HeightResizePolicy = ResizePolicyType.UseAssignedSize; + Assert.AreEqual(ResizePolicyType.UseAssignedSize, viewAttributes.HeightResizePolicy, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test WidthResizePolicy.Check whether WidthResizePolicy is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ViewAttributes.WidthResizePolicy A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void WidthResizePolicy_SET_GET_VALUE() + { + /* TEST CODE */ + var viewAttributes = new ViewAttributes(); + viewAttributes.WidthResizePolicy = ResizePolicyType.Fixed; + Assert.AreEqual(ResizePolicyType.Fixed, viewAttributes.WidthResizePolicy, "Should be equal!"); + viewAttributes.WidthResizePolicy = ResizePolicyType.UseNaturalSize; + Assert.AreEqual(ResizePolicyType.UseNaturalSize, viewAttributes.WidthResizePolicy, "Should be equal!"); + viewAttributes.WidthResizePolicy = ResizePolicyType.FillToParent; + Assert.AreEqual(ResizePolicyType.FillToParent, viewAttributes.WidthResizePolicy, "Should be equal!"); + viewAttributes.WidthResizePolicy = ResizePolicyType.SizeRelativeToParent; + Assert.AreEqual(ResizePolicyType.SizeRelativeToParent, viewAttributes.WidthResizePolicy, "Should be equal!"); + viewAttributes.WidthResizePolicy = ResizePolicyType.SizeFixedOffsetFromParent; + Assert.AreEqual(ResizePolicyType.SizeFixedOffsetFromParent, viewAttributes.WidthResizePolicy, "Should be equal!"); + viewAttributes.WidthResizePolicy = ResizePolicyType.FitToChildren; + Assert.AreEqual(ResizePolicyType.FitToChildren, viewAttributes.WidthResizePolicy, "Should be equal!"); + viewAttributes.WidthResizePolicy = ResizePolicyType.DimensionDependency; + Assert.AreEqual(ResizePolicyType.DimensionDependency, viewAttributes.WidthResizePolicy, "Should be equal!"); + viewAttributes.WidthResizePolicy = ResizePolicyType.UseAssignedSize; + Assert.AreEqual(ResizePolicyType.UseAssignedSize, viewAttributes.WidthResizePolicy, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test PivotPoint.Check whether PivotPoint is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ViewAttributes.PivotPoint A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void PivotPoint_SET_GET_VALUE() + { + /* TEST CODE */ + var viewAttributes = new ViewAttributes(); + viewAttributes.PivotPoint = new Vector3(1.0f, 0.45f, 1.0f); + Assert.AreEqual(1.0f, viewAttributes.PivotPoint.X, "Should be equal to 1.0f!"); + Assert.AreEqual(0.45f, viewAttributes.PivotPoint.Y, "Should be equal to 0.45f!"); + Assert.AreEqual(1.0f, viewAttributes.PivotPoint.Z, "Should be equal to 1.0f!"); + } + + [Test] + [Category("P1")] + [Description("Test ParentOrigin.Check whether ParentOrigin is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ViewAttributes.ParentOrigin A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void ParentOrigin_SET_GET_VALUE() + { + /* TEST CODE */ + var viewAttributes = new ViewAttributes(); + viewAttributes.ParentOrigin = new Vector3(1.0f, 0.45f, 1.0f); + Assert.AreEqual(1.0f, viewAttributes.ParentOrigin.X, "Should be equal to 1.0f!"); + Assert.AreEqual(0.45f, viewAttributes.ParentOrigin.Y, "Should be equal to 0.45f!"); + Assert.AreEqual(1.0f, viewAttributes.ParentOrigin.Z, "Should be equal to 1.0f!"); + } + + [Test] + [Category("P1")] + [Description("Test PositionUsesPivotPoint.Check whether PositionUsesPivotPoint is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ViewAttributes.PositionUsesPivotPoint A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void PositionUsesPivotPoint_SET_GET_VALUE() + { + /* TEST CODE */ + var viewAttributes = new ViewAttributes(); + viewAttributes.PositionUsesPivotPoint = true; + Assert.IsTrue(viewAttributes.PositionUsesPivotPoint, "Should be equal!"); + viewAttributes.PositionUsesPivotPoint = false; + Assert.IsFalse(viewAttributes.PositionUsesPivotPoint, "Should be equal!"); + } + + [Test] + [Category("P1")] + [Description("Test BackgroundColor.Check whether BackgroundColor is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ViewAttributes.BackgroundColor A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void BackgroundColor_SET_GET_VALUE() + { + /* TEST CODE */ + var viewAttributes = new ViewAttributes(); + viewAttributes.BackgroundColor = new ColorSelector { All = new Color(1.0f, 0.45f, 1.0f, 1.0f) }; + Assert.AreEqual(1.0f, viewAttributes.BackgroundColor.All.R, "Should be equal to 1.0f!"); + Assert.AreEqual(0.45f, viewAttributes.BackgroundColor.All.G, "Should be equal to 0.45f!"); + Assert.AreEqual(1.0f, viewAttributes.BackgroundColor.All.B, "Should be equal to 1.0f!"); + Assert.AreEqual(1.0f, viewAttributes.BackgroundColor.All.A, "Should be equal to 1.0f!"); + } + + [Test] + [Category("P1")] + [Description("Test Size2D.Check whether Size2D is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ViewAttributes.Size2D A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Size2D_SET_GET_VALUE() + { + /* TEST CODE */ + var viewAttributes = new ViewAttributes(); + viewAttributes.Size2D = new Size2D(200, 200); + Assert.AreEqual(200, viewAttributes.Size2D.Width, "Should be equal to 200!"); + Assert.AreEqual(200, viewAttributes.Size2D.Height, "Should be equal to 200!"); + } + + [Test] + [Category("P1")] + [Description("Test Position2D.Check whether Position2D is readable and writeable.")] + [Property("SPEC", "Tizen.NUI.Components.ViewAttributes.Position2D A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Position2D_SET_GET_VALUE() + { + /* TEST CODE */ + var viewAttributes = new ViewAttributes(); + viewAttributes.Position2D = new Position2D(200, 200); + Assert.AreEqual(200, viewAttributes.Position2D.X, "Should be equal to 200!"); + Assert.AreEqual(200, viewAttributes.Position2D.Y, "Should be equal to 200!"); + } + + [Test] + [Category("P1")] + [Description("Test Clone. Check Whether Clone works or not")] + [Property("SPEC", "Tizen.NUI.Components.ViewAttributes.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Feng Jin, feng16.jin@samsung.com")] + public void Clone_TEST() + { + /* TEST CODE */ + try + { + var viewAttributes = new ViewAttributes(); + viewAttributes.Opacity = new FloatSelector() { All = 1.0f }; + var attributes = viewAttributes.Clone() as ViewAttributes; + Assert.IsNotNull(attributes, "Should be not null!"); + Assert.IsInstanceOf(attributes, "Should be an instance of ViewAttributes type."); + Assert.AreEqual(1.0f, attributes.Opacity.All, "Should be equal!"); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/tizen-manifest.xml b/tct-suite-vs/Tizen.NUI.Components.Tests/tizen-manifest.xml new file mode 100755 index 000000000..22fc896fa --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/tizen-manifest.xml @@ -0,0 +1,12 @@ + + + + + Tizen.NUI.Components.Tests.png + + + + http://tizen.org/privilege/appmanager.launch + + +