From: jeon Date: Tue, 14 Jul 2020 11:25:23 +0000 (+0900) Subject: [NUI.WindowSystem][TCSACR-326][Add WindowSystem QuickPanelClient's TCs] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6abfe9acdd3a22469aede3ddb4da8896d577646b;p=test%2Ftct%2Fcsharp%2Fapi.git [NUI.WindowSystem][TCSACR-326][Add WindowSystem QuickPanelClient's TCs] - This is test for Tizen.NUI.WindowSystem module added since Tizen 6.0 - TizenShell and QuickPanelClient classes are added. - TizenShell class is a control handle for this WindowSystem.Shell system. - QuickPanelClient class is controlling and getting status about quickpanel service window. - Add - QuickPanelClient_INIT - Test a QuickPanelClient class is create well. QuickPanelClient class is created with three different types SystemDefault, ContextMenu, AppsMenu. So in this testcase tests QuickPanelClient class is created well with these types. - QuickPanelClient_INIT_FAILED - Test a QuickPanelClient class creates failed with serveral cases. - Visible_CHECK_RETURN_VALUE - Test a get Visible property value well. - Scrollable_CHECK_RETURN_VALUE - Test a get/set Scrollable property value well. - Orientation_CHECK_RETURN_VALUE - Test a get Orientation property value well. - Show_CHECK - Test a Show method works well - Hide_CHECK - Test a Hide method works well - VisibleChanged_EVENT - Test a VisibleChanged event callback is triggered well. - TizenShell_INIT - Test a TizenShell class is created well. - OrientationChanged_EVENT - Test a OrientationChanged event callback is triggered well. This is Manual Test Change-Id: Ia9b265d12062858bf173f449972034f7c25dad96 --- diff --git a/release/csharp-tct_6.0_dotnet/csharp-tct_6.0_dotnet/package/mobile/Tizen.NUI.WindowSystem.Manual.Tests-6.0.zip b/release/csharp-tct_6.0_dotnet/csharp-tct_6.0_dotnet/package/mobile/Tizen.NUI.WindowSystem.Manual.Tests-6.0.zip new file mode 100755 index 000000000..fa1a16f2c Binary files /dev/null and b/release/csharp-tct_6.0_dotnet/csharp-tct_6.0_dotnet/package/mobile/Tizen.NUI.WindowSystem.Manual.Tests-6.0.zip differ diff --git a/release/csharp-tct_6.0_dotnet/csharp-tct_6.0_dotnet/package/mobile/Tizen.NUI.WindowSystem.Tests-6.0.zip b/release/csharp-tct_6.0_dotnet/csharp-tct_6.0_dotnet/package/mobile/Tizen.NUI.WindowSystem.Tests-6.0.zip new file mode 100644 index 000000000..a894ac90b Binary files /dev/null and b/release/csharp-tct_6.0_dotnet/csharp-tct_6.0_dotnet/package/mobile/Tizen.NUI.WindowSystem.Tests-6.0.zip differ diff --git a/release/csharp-tct_6.0_dotnet/csharp-tct_6.0_dotnet/package/pkg_infos/mobile_pkg_info.xml b/release/csharp-tct_6.0_dotnet/csharp-tct_6.0_dotnet/package/pkg_infos/mobile_pkg_info.xml index 909a2c3ff..b63e4efca 100755 --- a/release/csharp-tct_6.0_dotnet/csharp-tct_6.0_dotnet/package/pkg_infos/mobile_pkg_info.xml +++ b/release/csharp-tct_6.0_dotnet/csharp-tct_6.0_dotnet/package/pkg_infos/mobile_pkg_info.xml @@ -438,6 +438,18 @@ 2096 mobile/Tizen.NUI.Tests-6.0.zip + + 0 + 1 + 1 + mobile/Tizen.NUI.WindowSystem.Manual.Tests-6.0.zip + + + 12 + 0 + 12 + mobile/Tizen.NUI.WindowSystem.Tests-6.0.zip + 28 0 diff --git a/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/ManualTestPage.cs b/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/ManualTestPage.cs new file mode 100644 index 000000000..9b757ebef --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/ManualTestPage.cs @@ -0,0 +1,852 @@ +/* +* Copyright (c) 2020 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.Components; +using Tizen.Applications; +using System.Runtime.CompilerServices; + +namespace Tizen.NUI.WindowSystem.Tests +{ + class ManualTestNUI + { + class ListBridge : FlexibleViewAdapter + { + private List _mDatas; + private List _mlistItem; + + public ListBridge(List datas, List item) + { + _mDatas = datas; + _mlistItem = item; + } + + public void UpdateItemData(int position, List item) + { + _mlistItem = item; + } + + public override FlexibleViewViewHolder OnCreateViewHolder(int viewType) + { + FlexibleViewViewHolder viewHolder = new FlexibleViewViewHolder(new Button()); + return viewHolder; + } + + public override void OnBindViewHolder(FlexibleViewViewHolder holder, int position) + { + string testcaseName = "#." + (position + 1).ToString() + _mDatas[position]; + string resultText = "[" + _mlistItem[(int)position].Result + "]"; + string text = testcaseName + resultText; + + Button btn = holder.ItemView as Button; + if (btn) + { + btn.Focusable = true; + btn.Text = text; + btn.Name = position.ToString(); + btn.PointSize = ManualTest.GetPointSize(); + btn.Size = new Size(Window.Instance.Size.Width, Window.Instance.Size.Height * 0.046f); + btn.TextColor = new Color(0, 0, 0, 1); + btn.ImageShadow = new ImageShadow + { + Url = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/rectangle_btn_shadow.png", + Border = new Rectangle(5, 5, 5, 5) + }; + btn.BackgroundImage = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/rectangle_toggle_btn_normal.png"; + btn.BackgroundImageBorder = new Rectangle(5, 5, 5, 5); + btn.FocusGained += (obj, e) => + { + btn.BackgroundImage = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/rectangle_point_btn_normal.png"; + }; + btn.FocusLost += (obj, e) => + { + btn.BackgroundImage = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/rectangle_toggle_btn_normal.png"; + }; + btn.ParentOrigin = Position.ParentOriginTopLeft; + btn.PivotPoint = PivotPoint.TopLeft; + btn.TextAlignment = HorizontalAlignment.Begin; + btn.CellIndex = new Vector2(position, 0); + } + } + + public override void OnDestroyViewHolder(FlexibleViewViewHolder holder) + { + if (holder.ItemView != null) + { + holder.ItemView.Dispose(); + } + } + + public override int GetItemCount() + { + return _mDatas.Count; + } + } + + private List _tcIDList; + private List _listItem; + private TSettings _tsettings; + private TRunner _tRunner; + private Button _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 + private float _pointSize = 20.0f; + + //Save the information of every single test case + private List _tcInfoList; + private List _currentTCInfo; + + private static ManualTestNUI _instance; + private static Object _lockObject = new object(); + + //Show the result of all the test case + private TextLabel _summaryLabel; + private View _initView; + private View _detailView; + private View _caseView; + private FlexibleView _initList; + private ListBridge _adapter; + private TableView _detailList; + private View _buttonContainer; + private View _buttonContainer2; + private TableView _firstPageContainer; + private Button _run; + private Button _runButton; + + //Always save the current TC number; + private int _currentTCNum = 0; + + + public static ManualTestNUI GetInstance() + { + lock (_lockObject) + { + if (_instance == null) + { + _instance = new ManualTestNUI(); + } + } + return _instance; + } + + private ManualTestNUI() + { + Initialize(); + } + public void Initialize() + { + Tizen.Log.Fatal("NUI", "Initialize window's width is " + Window.Instance.Size.Width + " Dpi is " + Window.Instance.Dpi.Length()); + Window.Instance.BackgroundColor = Color.White; + + _toastMessage = new ToastMessage(); + _pointSize = ManualTest.GetPointSize(); + RunType.Value = RunType.MANUAL; + _tRunner = new TRunner(); + _tRunner.LoadTestsuite(); + _tRunner.SingleTestDone += OnSingleTestDone; + _tcIDList = new List(); + _listItem = new List(); + _listNotPass = TSettings.GetInstance().GetNotPassListManual(); + int count = 0; + if (_listNotPass.Count == 0) + { + foreach (KeyValuePair pair in _tRunner.GetTestList()) + { + count++; + _listItem.Add(new ItemData { No = count, TCName = pair.Key, Result = StrResult.NOTRUN }); + _tcIDList.Add(pair.Key); + } + } + else + { + foreach (var tc in _listNotPass) + { + count++; + _listItem.Add(new ItemData { No = count, TCName = tc, Result = StrResult.NOTRUN }); + _tcIDList.Add(tc); + } + } + Tizen.Log.Fatal("NUI", "TCT : count:" + count.ToString()); + foreach (String nameTc in _tcIDList) + { + Tizen.Log.Fatal("NUI", "TCT : TCName:" + nameTc.ToString()); + } + + _tsettings = TSettings.GetInstance(); + _tsettings.IsManual = true; + + InitData(); + _caseView = new View(); + + _summaryLabel = new TextLabel(); + _summaryLabel.PointSize = _pointSize; + _summaryLabel.Size = new Size(Window.Instance.Size.Width, Window.Instance.Size.Height * 0.055f); + _summaryLabel.ParentOrigin = Position.ParentOriginTopLeft; + _summaryLabel.PivotPoint = PivotPoint.TopLeft; + _summaryLabel.HorizontalAlignment = HorizontalAlignment.Center; + _summaryLabel.VerticalAlignment = VerticalAlignment.Center; + Window.Instance.GetDefaultLayer().Add(_summaryLabel); + SetSummaryResult(); + + _initView = new View(); + _initView.Size = new Size(Window.Instance.Size.Width, Window.Instance.Size.Height * 0.9f); + _initView.Position = new Position(0.0f, (int)(Window.Instance.Size.Height * 0.0648), 0.0f); + _initView.ParentOrigin = Position.ParentOriginTopLeft; + _initView.PivotPoint = PivotPoint.TopLeft; + InitializeFirstPage(); + _initView.Show(); + Window.Instance.GetDefaultLayer().Add(_initView); + + _detailView = new View(); + _detailView.Size = new Size(Window.Instance.Size.Width, Window.Instance.Size.Height * 0.9f); + _detailView.Position = new Position(0.0f, (int)(Window.Instance.Size.Height * 0.0648), 0.0f); + _detailView.ParentOrigin = Position.ParentOriginTopLeft; + _detailView.PivotPoint = PivotPoint.TopLeft; + InitializeDetailPage(); + _detailView.Hide(); + Window.Instance.GetDefaultLayer().Add(_detailView); + + FocusManager.Instance.SetCurrentFocusView(_run); + } + + void SetCommonButtonStyle(Button btn, string text) + { + if (!btn) return; + btn.Focusable = true; + btn.Text = text; + btn.PointSize = _pointSize; + float buttonWidth = ManualTest.IsMobile() ? Window.Instance.Size.Width * 0.18f : Window.Instance.Size.Width * 0.06f; + btn.Size = new Size(buttonWidth, Window.Instance.Size.Height * 0.046f); + btn.TextColor = new Color(0, 0, 0, 1); + btn.ImageShadow = new ImageShadow + { + Url = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/rectangle_btn_shadow.png", + Border = new Rectangle(5, 5, 5, 5) + }; + btn.BackgroundImage = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/rectangle_toggle_btn_normal.png"; + btn.BackgroundImageBorder = new Rectangle(5, 5, 5, 5); + btn.ParentOrigin = Position.ParentOriginTopLeft; + btn.PivotPoint = PivotPoint.TopLeft; + btn.FocusGained += (obj, e) => + { + btn.BackgroundImage = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/rectangle_point_btn_normal.png"; + }; + btn.FocusLost += (obj, e) => + { + btn.BackgroundImage = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/rectangle_toggle_btn_normal.png"; + }; + } + + void InitializeFirstPage() + { + //Create Run Button, when you Click it, then the first test case will be executed. + _doneButton = new Button(); + SetCommonButtonStyle(_doneButton, "Done"); + _doneButton.Clicked += (obj, ee) => + { + TSettings.GetInstance().SubmitManualResult(); + }; + + _run = new Button(); + SetCommonButtonStyle(_run, "Runner"); + _run.Clicked += (obj, ee) => + { + Tizen.Log.Fatal("NUI", "Check all the test case from the first one."); + _currentTCNum = 0; + _initView.Hide(); + _caseView.Hide(); + UpdateDetailPage(); + _detailView.Show(); + FocusManager.Instance.SetCurrentFocusView(_runButton); + }; + _run.RightFocusableView = _doneButton; + _doneButton.LeftFocusableView = _run; + + //To show all the test case information(Number _className._TCName [result]). + _initList = new FlexibleView(); + _initList.Position = new Position(0, Window.Instance.Size.Height * 0.0925f); + _initList.Size = new Size(Window.Instance.Size.Width, Window.Instance.Size.Height * 0.74f); + _adapter = new ListBridge(_tcIDList, _listItem); + _initList.SetAdapter(_adapter); + LinearLayoutManager layoutManager = new LinearLayoutManager(LinearLayoutManager.VERTICAL); + _initList.SetLayoutManager(layoutManager); + _initList.FocusedItemIndex = 0; + _initList.Focusable = true; + _initList.ItemClicked += (obj, e) => + { + Button button = e.ClickedView.ItemView as Button; + if (button) + { + Tizen.Log.Fatal("NUI", "Item clicked!!::" + button.Name); + _currentTCNum = int.Parse(button.Name); + _initView.Hide(); + UpdateDetailPage(); + _caseView.Hide(); + _detailView.Show(); + FocusManager.Instance.SetCurrentFocusView(_runButton); + } + }; + _initList.FocusGained += (obj, e) => + { + FlexibleViewViewHolder holder = _initList?.FindViewHolderForAdapterPosition(0); + if (holder != null && holder.ItemView != null) + { + FocusManager.Instance.SetCurrentFocusView(holder.ItemView); + _currentTCNum = 0; + } + }; + _initList.FocusLost += (obj, e) => + { + _currentTCNum = 0; + }; + _initList.KeyEvent += (obj, e) => + { + if (e.Key.State == Key.StateType.Down) + { + Tizen.Log.Fatal("NUI", "KeyEvent~KeyPressedName = " + e.Key.KeyPressedName + ",KeyCode = " + e.Key.KeyCode); + if (e.Key.KeyPressedName == "Up") + { + if (_currentTCNum == 0) + { + FocusManager.Instance.SetCurrentFocusView(_run); + } + else + { + FlexibleViewViewHolder holder = _initList?.FindViewHolderForAdapterPosition(_currentTCNum - 1); + if (holder != null && holder.ItemView != null) + { + FocusManager.Instance.SetCurrentFocusView(holder.ItemView); + _currentTCNum--; + } + } + } + else if (e.Key.KeyPressedName == "Down") + { + if (_currentTCNum == _initList.ChildCount - 1) + { + _currentTCNum = 0; + } + else + { + _currentTCNum++; + } + FlexibleViewViewHolder holder = _initList?.FindViewHolderForAdapterPosition(_currentTCNum); + if (holder != null && holder.ItemView != null) + { + FocusManager.Instance.SetCurrentFocusView(holder.ItemView); + } + } + else if (e.Key.KeyPressedName == "Return") + { + _initView.Hide(); + UpdateDetailPage(); + _caseView.Hide(); + _detailView.Show(); + FocusManager.Instance.SetCurrentFocusView(_runButton); + } + } + return true; + }; + + _firstPageContainer = new TableView(1, 2); + _firstPageContainer.PivotPoint = Position.PivotPointTopLeft; + _firstPageContainer.ParentOrigin = Position.ParentOriginTopLeft; + _firstPageContainer.Size = new Size(Window.Instance.Size.Width, Window.Instance.Size.Height * 0.1f); + _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.AddChild(_doneButton, new TableView.CellPosition(0, 0)); + _firstPageContainer.AddChild(_run, new TableView.CellPosition(0, 1)); + _run.DownFocusableView = _initList; + _doneButton.DownFocusableView = _initList; + + _initView.Add(_firstPageContainer); + _initView.Add(_initList); + Tizen.Log.Fatal("NUI", "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", "UpdateDetailPage:"); + CreateTestCase(); + } + + void InitializeDetailPage() + { + _detailList = new TableView(23, 1); + _detailList.Focusable = true; + _detailList.Size = new Size(Window.Instance.Size.Width * 0.9739f, Window.Instance.Size.Height * 0.4629f); + _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 View(); + _buttonContainer.PivotPoint = PivotPoint.TopLeft; + _buttonContainer.ParentOrigin = Position.ParentOriginTopLeft; + _buttonContainer.Position = new Position(0, Window.Instance.Size.Height * 0.68f, 0); + _buttonContainer.Size = new Size(Window.Instance.Size.Width * 0.8f, Window.Instance.Size.Height * 0.1f); + _buttonContainer.Focusable = true; + + _buttonContainer2 = new View(); + _buttonContainer2.PivotPoint = PivotPoint.TopLeft; + _buttonContainer2.ParentOrigin = Position.ParentOriginTopLeft; + _buttonContainer2.Position = new Position(0, Window.Instance.Size.Height * 0.8f, 0); + _buttonContainer2.Size = new Size(Window.Instance.Size.Width * 0.8f, Window.Instance.Size.Height * 0.1f); + _buttonContainer2.Focusable = true; + + var flexlayout = new FlexLayout(); + flexlayout.Direction = FlexLayout.FlexDirection.Row; + flexlayout.Justification = FlexLayout.FlexJustification.SpaceBetween; + _buttonContainer.Layout = flexlayout; + var flexlayout2 = new FlexLayout(); + flexlayout2.Direction = FlexLayout.FlexDirection.Row; + flexlayout2.Justification = FlexLayout.FlexJustification.SpaceBetween; + _buttonContainer2.Layout = flexlayout2; + CreateButtons(); + _detailView.Add(_buttonContainer); + _detailView.Add(_buttonContainer2); + } + + //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", "Print the CurrentTCNum here::" + _currentTCNum); + _detailList = new TableView(10, 1); + _detailList.Focusable = true; + _detailList.Size = new Size(Window.Instance.Size.Width * 0.9739f, Window.Instance.Size.Height * 0.3703f); + _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; + } + } + + public void ScreenChangedToHome() + { + Clear(); + if (!ManualTest.IsConfirmed()) + { + _tsettings.TCResult = StrResult.NOTRUN; + ManualTest.Confirm(); + } + else + { + _detailView.Hide(); + _initView.Show(); + FocusManager.Instance.SetCurrentFocusView(_run); + } + } + + //Create all the function buttons here, such as PASS, FAIL..... + void CreateButtons() + { + _notRun = new TextLabel(); + _notRun.HorizontalAlignment = HorizontalAlignment.Center; + _notRun.VerticalAlignment = VerticalAlignment.Center; + _notRun.PointSize = _pointSize; + _notRun.Text = "Not Run"; + float buttonWidth = ManualTest.IsMobile() ? Window.Instance.Size.Width * 0.18f : Window.Instance.Size.Width * 0.06f; + _notRun.Size = new Size(buttonWidth, Window.Instance.Size.Height * 0.046f); + + _passButton = new Button(); + SetCommonButtonStyle(_passButton, "Pass"); + _passButton.Clicked += (obj, ee) => + { + Clear(); + if (!ManualTest.IsConfirmed()) + { + _tsettings.TCResult = StrResult.PASS; + ManualTest.Confirm(); + } + Tizen.Log.Fatal("TBT", "Pass Button clicked!"); + }; + + _failButton = new Button(); + SetCommonButtonStyle(_failButton, "Fail"); + _failButton.Clicked += (obj, ee) => + { + Clear(); + if (!ManualTest.IsConfirmed()) + { + _tsettings.TCResult = StrResult.FAIL; + ManualTest.Confirm(); + } + Tizen.Log.Fatal("TBT", "Fail Button clicked!"); + }; + + _blockButton = new Button(); + SetCommonButtonStyle(_blockButton, "Block"); + _blockButton.Clicked += (obj, ee) => + { + Clear(); + if (!ManualTest.IsConfirmed()) + { + _tsettings.TCResult = StrResult.BLOCK; + ManualTest.Confirm(); + } + }; + + _runButton = new Button(); + SetCommonButtonStyle(_runButton, "Run"); + _runButton.Clicked += (obj, ee) => + { + Clear(); + //should update the _caseView by the test case + _tsettings.Testcase_ID = _tcIDList[_currentTCNum]; + _tsettings.TCResult = ""; + _tRunner.Execute(); + }; + + _homeButton = new Button(); + SetCommonButtonStyle(_homeButton, "Home"); + _homeButton.Clicked += (obj, ee) => + { + ScreenChangedToHome(); + }; + + _preButton = new Button(); + SetCommonButtonStyle(_preButton, "<<"); + _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(); + } + } + }; + + _nextButton = new Button(); + SetCommonButtonStyle(_nextButton, ">>"); + _nextButton.Clicked += (obj, ee) => + { + Clear(); + if (!ManualTest.IsConfirmed()) + { + _tsettings.TCResult = StrResult.NOTRUN; + ManualTest.Confirm(); + } + if (_currentTCNum + 1 != ResultNumber.Total) + { + Tizen.Log.Fatal("NUI", "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(); + } + }; + + _passButton.RightFocusableView = _failButton; + _passButton.DownFocusableView = _homeButton; + _failButton.LeftFocusableView = _passButton; + _failButton.RightFocusableView = _blockButton; + _blockButton.LeftFocusableView = _failButton; + _blockButton.RightFocusableView = _runButton; + _blockButton.DownFocusableView = _preButton; + _runButton.LeftFocusableView = _blockButton; + _runButton.DownFocusableView = _nextButton; + _homeButton.UpFocusableView = _passButton; + _homeButton.RightFocusableView = _preButton; + _preButton.UpFocusableView = _blockButton; + _preButton.LeftFocusableView = _homeButton; + _preButton.RightFocusableView = _nextButton; + _nextButton.UpFocusableView = _runButton; + _nextButton.LeftFocusableView = _preButton; + + _buttonContainer.Add(_passButton); + _buttonContainer.Add(_failButton); + _buttonContainer.Add(_blockButton); + _buttonContainer.Add(_runButton); + _buttonContainer2.Add(_homeButton); + _buttonContainer2.Add(_notRun); + _buttonContainer2.Add(_preButton); + _buttonContainer2.Add(_nextButton); + } + + public void ExecuteTC(View view) + { + Tizen.Log.Fatal("NUI", "Execute the manual test case!"); + + _caseView = view; + _caseView.ParentOrigin = Position.ParentOriginTopLeft; + _caseView.PivotPoint = PivotPoint.TopLeft; + _caseView.Position = new Position(Window.Instance.Size.Width * 0.01f, Window.Instance.Size.Height * 0.74f, 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", "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", "Runner OnKeyPressed Down..." + e.Key.KeyPressedName); + + if (e.Key.State == Key.StateType.Down) + { + if (e.Key.KeyPressedName == "Up") + { + Tizen.Log.Fatal("NUI", "Set current focus view :: doneButton"); + FocusManager.Instance.SetCurrentFocusView(_doneButton); + } + } + return false; + } + + private bool OnDownButtonKeyPressed(object source, View.KeyEventArgs e) + { + Tizen.Log.Fatal("NUI", "DownButton OnKeyPressed Down..." + e.Key.KeyPressedName); + + if (e.Key.State == Key.StateType.Down) + { + if (e.Key.KeyPressedName == "Down") + { + Tizen.Log.Fatal("NUI", "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", "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 void CreateDetailList() + { + Tizen.Log.Fatal("NUI", "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 * 0.9895), (int)(Window.Instance.Size.Height * 0.0462)); + 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)) + { + IEnumerator customAttributes = pair.Value.Method.MethodInfo.CustomAttributes.GetEnumerator(); + List preconditions = new List(); + preconditions.Add("Preconditions:"); + List steps = new List(); + steps.Add("Steps:"); + List postconditions = new List(); + postconditions.Add("Postconditions:\n"); + + 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", "The CurrentTCNum::" + _currentTCNum); + } + + private void OnSingleTestDone(object sender, SingleTestDoneEventArgs e) + { + //Test when will this event will be triggered + Tizen.Log.Fatal("NUI", "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; + } + + FlexibleViewViewHolder holder = _initList?.FindViewHolderForAdapterPosition(_currentTCNum); + if (holder != null) + { + string testcaseName = "#." + (_currentTCNum + 1).ToString() + _tcIDList[_currentTCNum]; + string resultText = "[" + _listItem[(int)_currentTCNum].Result + "]"; + string text = testcaseName + resultText; + Button btn = holder.ItemView as Button; + btn.Text = text; + _adapter?.UpdateItemData(_currentTCNum, _listItem); + } + + SetSummaryResult(); + _notRun.Text = _listItem[_currentTCNum].Result; + } + } +} + + diff --git a/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/Program.cs b/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/Program.cs new file mode 100644 index 000000000..2b1a5969e --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/Program.cs @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using NUnitLite.TUnit; +using Tizen.NUI; + +namespace Tizen.NUI.WindowSystem.Tests +{ + public class App : Tizen.NUI.NUIApplication + { + protected override void OnCreate() + { + Window window = Window.Instance; + window.AddAvailableOrientation(Window.WindowOrientation.Landscape); + window.AddAvailableOrientation(Window.WindowOrientation.PortraitInverse); + window.AddAvailableOrientation(Window.WindowOrientation.LandscapeInverse); + window.AddAvailableOrientation(Window.WindowOrientation.Portrait); + if (ManualTest.IsWearable()) + WearableManualTestNUI.GetInstance(); + else + ManualTestNUI.GetInstance(); + } + + static void Main(string[] args) + { + Tizen.Log.Fatal("NUI", "Manual TCT for NUI.WindowSystem start!"); + App example = new App(); + example.Run(args); + } + }; +} diff --git a/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/Tizen.NUI.WindowSystem.Manual.Tests.csproj b/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/Tizen.NUI.WindowSystem.Manual.Tests.csproj new file mode 100755 index 000000000..9793845c5 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/Tizen.NUI.WindowSystem.Manual.Tests.csproj @@ -0,0 +1,40 @@ + + + + + Exe + tizen80 + Tizen + + + + + true + + + + portable + + + None + + + + + + + + + + + Runtime + + + + + + + + + + diff --git a/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/Tizen.NUI.WindowSystem.Manual.Tests.sln b/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/Tizen.NUI.WindowSystem.Manual.Tests.sln new file mode 100644 index 000000000..c38334383 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/Tizen.NUI.WindowSystem.Manual.Tests.sln @@ -0,0 +1,120 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29920.165 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.NUI.WindowSystem.Manual.Tests", "Tizen.NUI.WindowSystem.Manual.Tests.csproj", "{D92BEEAC-3B2A-45F8-8C53-53B92550404A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.framework", "..\nunit.framework\nunit.framework.csproj", "{B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunitlite", "..\nunitlite\nunitlite.csproj", "{FDB8025A-C029-461F-895E-287B4C65939B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManualTemplate", "..\Template\ManualTemplate\ManualTemplate.csproj", "{269F89A7-E648-4811-8421-844E00ACF5F0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManualTemplateForWearable", "..\Template\ManualTemplateForWearable\ManualTemplateForWearable.csproj", "{D36CED01-29BD-4EB3-8903-62E0BF2A822D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.NUI.Wearable.Manual.Tests", "..\Tizen.NUI.Wearable.Manual.Tests\Tizen.NUI.Wearable.Manual.Tests.csproj", "{25619FDE-C80D-4A16-8D42-CCB06155E31D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.NUI.Manual.Tests", "..\Tizen.NUI.Manual.Tests\Tizen.NUI.Manual.Tests.csproj", "{951B597E-74C3-4698-8333-2A7CD59E4BB2}" +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 + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.Build.0 = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.Build.0 = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.Build.0 = Release|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|x64.ActiveCfg = Debug|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|x64.Build.0 = Debug|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|x86.ActiveCfg = Debug|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|x86.Build.0 = Debug|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|Any CPU.Build.0 = Release|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|x64.ActiveCfg = Release|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|x64.Build.0 = Release|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|x86.ActiveCfg = Release|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|x86.Build.0 = Release|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|x64.ActiveCfg = Debug|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|x64.Build.0 = Debug|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|x86.ActiveCfg = Debug|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|x86.Build.0 = Debug|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|Any CPU.Build.0 = Release|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|x64.ActiveCfg = Release|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|x64.Build.0 = Release|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|x86.ActiveCfg = Release|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|x86.Build.0 = Release|Any CPU + {25619FDE-C80D-4A16-8D42-CCB06155E31D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {25619FDE-C80D-4A16-8D42-CCB06155E31D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {25619FDE-C80D-4A16-8D42-CCB06155E31D}.Debug|x64.ActiveCfg = Debug|Any CPU + {25619FDE-C80D-4A16-8D42-CCB06155E31D}.Debug|x64.Build.0 = Debug|Any CPU + {25619FDE-C80D-4A16-8D42-CCB06155E31D}.Debug|x86.ActiveCfg = Debug|Any CPU + {25619FDE-C80D-4A16-8D42-CCB06155E31D}.Debug|x86.Build.0 = Debug|Any CPU + {25619FDE-C80D-4A16-8D42-CCB06155E31D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {25619FDE-C80D-4A16-8D42-CCB06155E31D}.Release|Any CPU.Build.0 = Release|Any CPU + {25619FDE-C80D-4A16-8D42-CCB06155E31D}.Release|x64.ActiveCfg = Release|Any CPU + {25619FDE-C80D-4A16-8D42-CCB06155E31D}.Release|x64.Build.0 = Release|Any CPU + {25619FDE-C80D-4A16-8D42-CCB06155E31D}.Release|x86.ActiveCfg = Release|Any CPU + {25619FDE-C80D-4A16-8D42-CCB06155E31D}.Release|x86.Build.0 = Release|Any CPU + {951B597E-74C3-4698-8333-2A7CD59E4BB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {951B597E-74C3-4698-8333-2A7CD59E4BB2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {951B597E-74C3-4698-8333-2A7CD59E4BB2}.Debug|x64.ActiveCfg = Debug|Any CPU + {951B597E-74C3-4698-8333-2A7CD59E4BB2}.Debug|x64.Build.0 = Debug|Any CPU + {951B597E-74C3-4698-8333-2A7CD59E4BB2}.Debug|x86.ActiveCfg = Debug|Any CPU + {951B597E-74C3-4698-8333-2A7CD59E4BB2}.Debug|x86.Build.0 = Debug|Any CPU + {951B597E-74C3-4698-8333-2A7CD59E4BB2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {951B597E-74C3-4698-8333-2A7CD59E4BB2}.Release|Any CPU.Build.0 = Release|Any CPU + {951B597E-74C3-4698-8333-2A7CD59E4BB2}.Release|x64.ActiveCfg = Release|Any CPU + {951B597E-74C3-4698-8333-2A7CD59E4BB2}.Release|x64.Build.0 = Release|Any CPU + {951B597E-74C3-4698-8333-2A7CD59E4BB2}.Release|x86.ActiveCfg = Release|Any CPU + {951B597E-74C3-4698-8333-2A7CD59E4BB2}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {ED382B91-9930-40B6-B3D7-362304C78680} + EndGlobalSection +EndGlobal diff --git a/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/Utils.cs b/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/Utils.cs new file mode 100644 index 000000000..f4e1b5132 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/Utils.cs @@ -0,0 +1,266 @@ +/* + * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Threading.Tasks; +using System.Runtime.InteropServices; +using System.Collections.Generic; +using System.ComponentModel; +using Tizen.NUI.BaseComponents; +using Tizen.NUI; + +namespace Tizen.NUI.WindowSystem.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 float GetPointSize() + { + float retValue = 10.0f; //default + string value; + Tizen.System.Information.TryGetValue("tizen.org/feature/profile", out value); + switch (value) + { + case "wearable": + retValue = 4.0f; + break; + case "mobile": + retValue = 5.0f; + break; + case "tv": + retValue = 20.0f; + break; + } + return retValue; + } + + 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.WindowSystem.Manual.Tests/WearableManualTestPage.cs b/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/WearableManualTestPage.cs new file mode 100644 index 000000000..7369aa98a --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/WearableManualTestPage.cs @@ -0,0 +1,716 @@ +/* +* Copyright (c) 2020 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.Components; + +namespace Tizen.NUI.WindowSystem.Tests +{ + class WearableManualTestNUI + { + class ListBridge : FlexibleViewAdapter + { + private List _mDatas; + private List _mlistItem; + + public ListBridge(List datas, List item) + { + _mDatas = datas; + _mlistItem = item; + } + + public void UpdateItemData(int position, List item) + { + _mlistItem = item; + } + + public override FlexibleViewViewHolder OnCreateViewHolder(int viewType) + { + FlexibleViewViewHolder viewHolder = new FlexibleViewViewHolder(new Button(new ButtonStyle())); + return viewHolder; + } + + public override void OnBindViewHolder(FlexibleViewViewHolder holder, int position) + { + string testcaseName = "#." + (position + 1).ToString() + _mDatas[position]; + string resultText = "[" + _mlistItem[(int)position].Result + "]"; + string text = testcaseName + resultText; + + Button btn = holder.ItemView as Button; + if (btn) + { + btn.Size = new Size(Window.Instance.Size.Width, 120); + btn.Name = position.ToString(); + btn.Text = text; + btn.PointSize = 4.0f; + btn.TextAlignment = HorizontalAlignment.Begin; + btn.TextColor = Color.White; + btn.BackgroundImage = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/controller_btn_check_on.png"; + btn.BackgroundImageBorder = new Rectangle(5, 5, 5, 5); + } + } + + public override void OnDestroyViewHolder(FlexibleViewViewHolder holder) + { + if (holder.ItemView != null) + { + holder.ItemView.Dispose(); + } + } + + public override int GetItemCount() + { + return _mDatas.Count; + } + } + + class DetailListBridge : FlexibleViewAdapter + { + private List _mDatas; + + public DetailListBridge(List datas) + { + _mDatas = datas; + } + + public override FlexibleViewViewHolder OnCreateViewHolder(int viewType) + { + FlexibleViewViewHolder viewHolder = new FlexibleViewViewHolder(new TextLabel()); + return viewHolder; + } + + public override void OnBindViewHolder(FlexibleViewViewHolder holder, int position) + { + TextLabel label = holder.ItemView as TextLabel; + if (label) + { + label.TextColor = Color.White; + label.ParentOrigin = ParentOrigin.TopLeft; + label.PivotPoint = PivotPoint.TopLeft; + label.Position = new Position(0.0f, 0.0f, 0.0f); + label.Size = new Size(Window.Instance.Size.Width - 100, _detailScrollHeight); + label.HorizontalAlignment = HorizontalAlignment.Begin; + label.VerticalAlignment = VerticalAlignment.Center; + label.PointSize = 3.0f; + label.MultiLine = true; + label.Text = _mDatas[position]; + } + } + + public override void OnDestroyViewHolder(FlexibleViewViewHolder holder) + { + if (holder.ItemView != null) + { + holder.ItemView.Dispose(); + } + } + + public override int GetItemCount() + { + return _mDatas.Count; + } + } + + private List _tcIDList; + private List _listItem; + private TSettings _tsettings; + private TRunner _tRunner; + private Button _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; + + //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 FlexibleView _initList; + private ListBridge _adapter; + private FlexibleView _detailList; + private DetailListBridge _adapter_detail; + private View _caseView; + private Button _run; + private Button _runButton; + + //Always save the current TC number; + private int _currentTCNum = 0; + 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", "Initialize========================================="); + 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", "TCT : count:" + count.ToString()); + foreach (String nameTc in _tcIDList) + { + Tizen.Log.Fatal("NUI", "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 SetCommonButtonStyle(Button btn, string text) + { + if (!btn) return; + btn.Text = text; + btn.PointSize = 4.0f; + btn.TextColor = new Color(0, 0, 0, 1); + btn.BackgroundImage = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/controller_btn_check_on.png"; + btn.BackgroundImageBorder = new Rectangle(5, 5, 5, 5); + btn.TextColor = Color.White; + } + + void InitializeFirstPage() + { + //Create Run Button, when you Click it, then the first test case will be executed. + _doneButton = new Button(new ButtonStyle()); + _doneButton.Position = new Position(0, 0); + _doneButton.Size = new Size(120, 60); + SetCommonButtonStyle(_doneButton, "Done"); + _doneButton.ClickEvent += (obj, ee) => + { + TSettings.GetInstance().SubmitManualResult(); + }; + + _run = new Button(new ButtonStyle()); + _run.Position2D = new Position2D(150, 0); + _run.Size = new Size(120, 60); + SetCommonButtonStyle(_run, "Runner"); + _run.ClickEvent += (obj, ee) => + { + Tizen.Log.Fatal("NUI", "Check all the test case from the first one."); + _currentTCNum = 0; + _initView.Hide(); + _caseView.Hide(); + UpdateDetailPage(); + _detailView.Show(); + }; + + CreateInitList(); + + _initView.Add(_doneButton); + _initView.Add(_run); + _initView.Add(_initList); + Tizen.Log.Fatal("NUI", "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", "UpdateDetailPage::::::::::::::::::::::"); + CreateTestCase(); + } + + void InitializeDetailPage() + { + _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(); + //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", "Print the CurrentTCNum here::" + _currentTCNum); + CreateDetailList(); + 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.Size = new Size(40, 30); + _notRun.PointSize = 2.5f; + _notRun.Position = new Position(100, 32); + _notRun.HorizontalAlignment = HorizontalAlignment.Center; + _notRun.VerticalAlignment = VerticalAlignment.Center; + _notRun.MultiLine = true; + _notRun.Text = "Not Run"; + _passButton = new Button(new ButtonStyle()); + SetCommonButtonStyle(_passButton, "P"); + _passButton.Size = new Size(70, 30); + _passButton.Position = new Position(0, 0); + _passButton.ClickEvent += (obj, ee) => + { + Clear(); + if (!ManualTest.IsConfirmed()) + { + _tsettings.TCResult = StrResult.PASS; + ManualTest.Confirm(); + } + Tizen.Log.Fatal("TBT", "Pass Button clicked!"); + }; + + _failButton = new Button(new ButtonStyle()); + SetCommonButtonStyle(_failButton, "F"); + _failButton.Size = new Size(70, 30); + _failButton.Position = new Position(72, 0); + _failButton.ClickEvent += (obj, ee) => + { + Clear(); + if (!ManualTest.IsConfirmed()) + { + _tsettings.TCResult = StrResult.FAIL; + ManualTest.Confirm(); + } + Tizen.Log.Fatal("TBT", "Fail Button clicked!"); + }; + + _blockButton = new Button(new ButtonStyle()); + SetCommonButtonStyle(_blockButton, "B"); + _blockButton.Size = new Size(70, 30); + _blockButton.Position = new Position(144, 0); + _blockButton.ClickEvent += (obj, ee) => + { + Clear(); + if (!ManualTest.IsConfirmed()) + { + _tsettings.TCResult = StrResult.BLOCK; + ManualTest.Confirm(); + } + }; + + _runButton = new Button(new ButtonStyle()); + SetCommonButtonStyle(_runButton, "R"); + _runButton.Size = new Size(70, 30); + _runButton.Position = new Position(216, 0); + _runButton.ClickEvent += (obj, ee) => + { + Clear(); + _tsettings.Testcase_ID = _tcIDList[_currentTCNum]; + _tsettings.TCResult = ""; + _tRunner.Execute(); + }; + + _homeButton = new Button(new ButtonStyle()); + SetCommonButtonStyle(_homeButton, "H"); + _homeButton.Size = new Size(70, 30); + _homeButton.Position = new Position(0, 32); + _homeButton.ClickEvent += (obj, ee) => + { + Clear(); + if (!ManualTest.IsConfirmed()) + { + _tsettings.TCResult = StrResult.NOTRUN; + ManualTest.Confirm(); + } + else + { + _detailView.Hide(); + _initView.Show(); + } + }; + + _preButton = new Button(new ButtonStyle()); + SetCommonButtonStyle(_preButton, "<<"); + _preButton.Size = new Size(60, 30); + _preButton.Position = new Position(160, 32); + _preButton.ClickEvent += (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(); + } + } + }; + + _nextButton = new Button(new ButtonStyle()); + SetCommonButtonStyle(_nextButton, ">>"); + _nextButton.Size = new Size(60, 30); + _nextButton.Position = new Position(222, 32); + _nextButton.ClickEvent += (obj, ee) => + { + Clear(); + if (!ManualTest.IsConfirmed()) + { + _tsettings.TCResult = StrResult.NOTRUN; + ManualTest.Confirm(); + } + if (_currentTCNum + 1 != ResultNumber.Total) + { + Tizen.Log.Fatal("NUI", "Print the [not run] CurrentTCNum::" + _currentTCNum); + _currentTCNum++; + _notRun.Text = _listItem[_currentTCNum].Result; + UpdateDetailPage(); + } + }; + + 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(30, 170); + + 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", "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 void CreateInitList() + { + Tizen.Log.Fatal("ManualTCT", "CreateInitList"); + _initList = new FlexibleView(); + _initList.ParentOrigin = ParentOrigin.TopLeft; + _initList.PivotPoint = PivotPoint.TopLeft; + _initList.Size = new Size(Window.Instance.Size.Width, 400); + _initList.Position = new Position(0, 80); + _initList.ClippingMode = ClippingModeType.ClipChildren; + _adapter = new ListBridge(_tcIDList, _listItem); + _initList.SetAdapter(_adapter); + LinearLayoutManager layoutManager = new LinearLayoutManager(LinearLayoutManager.VERTICAL); + _initList.SetLayoutManager(layoutManager); + _initList.FocusedItemIndex = 0; + _initList.ItemClicked += (obj, e) => + { + Button button = e.ClickedView.ItemView as Button; + if (button) + { + Tizen.Log.Fatal("TBT", "Item clicked!!::" + button.Name); + _currentTCNum = int.Parse(button.Name); + _initView.Hide(); + UpdateDetailPage(); + _caseView.Hide(); + _detailView.Show(); + } + }; + } + + private void CreateDetailList() + { + Tizen.Log.Fatal("NUI", "Print the CreateDetailList::count: " + _currentTCInfo.Count); + _description.Text = _currentTCInfo[0]; + + _detailList = new FlexibleView(); + _detailList.ParentOrigin = ParentOrigin.TopLeft; + _detailList.PivotPoint = PivotPoint.TopLeft; + _detailList.Size = new Size(Window.Instance.Size.Width - 100, _detailScrollHeight); + _detailList.Position = new Position(30, 20); + _detailList.BackgroundColor = Color.Black; + _detailList.ClippingMode = ClippingModeType.ClipChildren; + _adapter_detail = new DetailListBridge(_currentTCInfo); + _detailList.SetAdapter(_adapter_detail); + LinearLayoutManager layoutManager = new LinearLayoutManager(LinearLayoutManager.VERTICAL); + _detailList.SetLayoutManager(layoutManager); + _detailView.Add(_detailList); + } + + //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", "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", "the CurrentTCNum::" + _currentTCNum); + } + + private void OnSingleTestDone(object sender, SingleTestDoneEventArgs e) + { + //Test when will this event will be triggered + Tizen.Log.Fatal("NUI", "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; + } + + FlexibleViewViewHolder holder = _initList?.FindViewHolderForAdapterPosition(_currentTCNum); + if (holder != null) + { + string testcaseName = "#." + (_currentTCNum + 1).ToString() + _tcIDList[_currentTCNum]; + string resultText = "[" + _listItem[(int)_currentTCNum].Result + "]"; + string text = testcaseName + resultText; + Button btn = holder.ItemView as Button; + btn.Text = text; + _adapter?.UpdateItemData(_currentTCNum, _listItem); + } + SetSummaryResult(); + _notRun.Text = _listItem[_currentTCNum].Result; + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/res/images/controller_btn_check_on.png b/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/res/images/controller_btn_check_on.png new file mode 100644 index 000000000..9a3af3a09 Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/res/images/controller_btn_check_on.png differ diff --git a/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/res/images/rectangle_btn_shadow.png b/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/res/images/rectangle_btn_shadow.png new file mode 100644 index 000000000..df385f1ac Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/res/images/rectangle_btn_shadow.png differ diff --git a/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/res/images/rectangle_point_btn_normal.png b/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/res/images/rectangle_point_btn_normal.png new file mode 100644 index 000000000..677963924 Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/res/images/rectangle_point_btn_normal.png differ diff --git a/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/res/images/rectangle_toggle_btn_normal.png b/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/res/images/rectangle_toggle_btn_normal.png new file mode 100644 index 000000000..a73694bd6 Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/res/images/rectangle_toggle_btn_normal.png differ diff --git a/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/shared/res/Tizen.NUI.WindowSystem.Manual.Tests.png b/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/shared/res/Tizen.NUI.WindowSystem.Manual.Tests.png new file mode 100755 index 000000000..9765b1bda Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/shared/res/Tizen.NUI.WindowSystem.Manual.Tests.png differ diff --git a/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/testcase/TSQuickPanelClient.cs b/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/testcase/TSQuickPanelClient.cs new file mode 100644 index 000000000..18c755276 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/testcase/TSQuickPanelClient.cs @@ -0,0 +1,69 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.BaseComponents; +using System.Threading.Tasks; +using Tizen.NUI.WindowSystem; +using ElmSharp; +using Microsoft.VisualBasic.FileIO; + +namespace Tizen.NUI.WindowSystem.Tests +{ + [TestFixture] + [Description("Tizen.NUI.WindowSystem.Shell.QuickPanelClient Tests")] + public class QuickPanelClientTests + { + private string TAG = "NUI"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + public void OnOrientationEvent(object sender, Window.WindowOrientation state) + { + ManualTest.Confirm(); + } + + [Test] + [Category("P1")] + [Description("Check whether Orientation event handler add/remove successfully or not.")] + [Property("SPEC", "Tizen.NUI.WindowSystem.Shell.QuickPanelClient.OrientationChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "JeongHyun Kang, jhyuni.kang@samsung.com")] + [Precondition(1, "Turn on the Auto Rotation option")] + [Precondition(2, "Currently this TC is only run in mobile profile. If not, this TC will be PASS.")] + [Step(1, "Click run TC")] + [Step(2, "Rotate Device")] + [Step(3, "Check the label on the right of the home button is changed to \"Pass\"")] + [Postcondition(1, "N/A")] + public async Task OrientationChanged_EVENT() + { + /* TEST CODE */ + Shell.TizenShell tzsh = new Shell.TizenShell(); + Window win = NUIApplication.GetDefaultWindow(); + var qpClient = new Shell.QuickPanelClient(tzsh, win, Shell.QuickPanelClient.Types.SystemDefault); + + if (!ManualTest.IsMobile()) + { + ManualTest.Confirm(); + } + else + { + qpClient.OrientationChanged += OnOrientationEvent; + await ManualTest.WaitForConfirm(); + qpClient.OrientationChanged -= OnOrientationEvent; + } + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/tizen-manifest.xml b/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/tizen-manifest.xml new file mode 100755 index 000000000..6cdf28bab --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.WindowSystem.Manual.Tests/tizen-manifest.xml @@ -0,0 +1,16 @@ + + + + + Tizen.NUI.WindowSystem.Manual.Tests.png + + + + http://tizen.org/privilege/appmanager.launch + + diff --git a/tct-suite-vs/Tizen.NUI.WindowSystem.Tests/Program.cs b/tct-suite-vs/Tizen.NUI.WindowSystem.Tests/Program.cs new file mode 100644 index 000000000..f7bb57ab4 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.WindowSystem.Tests/Program.cs @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2018 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; + +namespace Tizen.NUI.Test +{ + class Program : Tizen.NUI.NUIApplication + { + public static Window win; + static TextLabel MainTitle; + static readonly string Title = "Tizen.NUI.WindowSystem Auto TCT \n\n"; + static readonly float TextSize = 10.0f; + + protected override void OnCreate() + { + base.OnCreate(); + Random rand = new Random(); + + Console.WriteLine("TCT : OnCreate()"); + win = this.Window; + win.Title = "NUIWindowSystemTest"; + win.BackgroundColor = Color.Red; + + MainTitle = new TextLabel(); + MainTitle.MultiLine = true; + MainTitle.Text = Title; + 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(win.WindowSize.Width / 2, win.WindowSize.Height / 2); + MainTitle.PositionUsesPivotPoint = true; + MainTitle.ParentOrigin = ParentOrigin.Center; + MainTitle.PivotPoint = PivotPoint.Center; + win.Add(MainTitle); + } + + protected override void OnResume() + { + base.OnResume(); + + TRunner t = new TRunner(); + t.LoadTestsuite(); + t.Execute(); + } + + protected override void OnTerminate() + { + base.OnTerminate(); + Exit(); + } + + static void Main(string[] args) + { + Console.WriteLine("TCT : Main()"); + var app = new Program(); + app.Run(args); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.WindowSystem.Tests/Tizen.NUI.WindowSystem.Tests.csproj b/tct-suite-vs/Tizen.NUI.WindowSystem.Tests/Tizen.NUI.WindowSystem.Tests.csproj new file mode 100644 index 000000000..add5f5cbf --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.WindowSystem.Tests/Tizen.NUI.WindowSystem.Tests.csproj @@ -0,0 +1,41 @@ + + + + + Exe + tizen80 + Tizen + + + + + true + + + + portable + + + None + + + + + + + + + + + Runtime + + + + + + + + + + + diff --git a/tct-suite-vs/Tizen.NUI.WindowSystem.Tests/Tizen.NUI.WindowSystem.Tests.sln b/tct-suite-vs/Tizen.NUI.WindowSystem.Tests/Tizen.NUI.WindowSystem.Tests.sln new file mode 100644 index 000000000..a7f307f3f --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.WindowSystem.Tests/Tizen.NUI.WindowSystem.Tests.sln @@ -0,0 +1,78 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29920.165 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.NUI.WindowSystem.Tests", "Tizen.NUI.WindowSystem.Tests.csproj", "{D92BEEAC-3B2A-45F8-8C53-53B92550404A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.framework", "..\nunit.framework\nunit.framework.csproj", "{B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunitlite", "..\nunitlite\nunitlite.csproj", "{FDB8025A-C029-461F-895E-287B4C65939B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoTemplate", "..\Template\AutoTemplate\AutoTemplate.csproj", "{B11ABB0C-C3C1-4B5C-8251-A15628A775F3}" +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 + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.Build.0 = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.Build.0 = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.Build.0 = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.ActiveCfg = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.Build.0 = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.ActiveCfg = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.Build.0 = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.Build.0 = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.ActiveCfg = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.Build.0 = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.ActiveCfg = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {ED382B91-9930-40B6-B3D7-362304C78680} + EndGlobalSection +EndGlobal diff --git a/tct-suite-vs/Tizen.NUI.WindowSystem.Tests/shared/res/Tizen.NUI.WindowSystem.Tests.png b/tct-suite-vs/Tizen.NUI.WindowSystem.Tests/shared/res/Tizen.NUI.WindowSystem.Tests.png new file mode 100755 index 000000000..9765b1bda Binary files /dev/null and b/tct-suite-vs/Tizen.NUI.WindowSystem.Tests/shared/res/Tizen.NUI.WindowSystem.Tests.png differ diff --git a/tct-suite-vs/Tizen.NUI.WindowSystem.Tests/testcase/TSQuickPanelClient.cs b/tct-suite-vs/Tizen.NUI.WindowSystem.Tests/testcase/TSQuickPanelClient.cs new file mode 100644 index 000000000..da4adfe4d --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.WindowSystem.Tests/testcase/TSQuickPanelClient.cs @@ -0,0 +1,409 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.BaseComponents; +using System.Threading.Tasks; +using Tizen.NUI.WindowSystem; + +namespace Tizen.NUI.WindowSystem.Tests +{ + [TestFixture] + [Description("Tizen.NUI.WindowSystem.Shell.QuickPanelClient Tests")] + public class QuickPanelClientTests + { + private string TAG = "NUI"; + private bool _triggered = false; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a QuickPanelClient. Check whether QuickPanelClient is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.WindowSystem.Shell.QuickPanelClient.QuickPanelClient C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "TizenShell, Window, Types")] + [Property("AUTHOR", "JeongHyun Kang, jhyuni.kang@samsung.com")] + public void QuickPanelClient_INIT() + { + /* TEST CODE */ + Shell.TizenShell tzsh = new Shell.TizenShell(); + Window win = NUIApplication.GetDefaultWindow(); + var qpClientDefault = new Shell.QuickPanelClient(tzsh, win, Shell.QuickPanelClient.Types.SystemDefault); + Assert.IsNotNull(qpClientDefault, "The instance should be not null"); + Assert.IsInstanceOf(qpClientDefault, "Should return QuickPanelClient instance."); + + var qpClientContext = new Shell.QuickPanelClient(tzsh, win, Shell.QuickPanelClient.Types.ContextMenu); + Assert.IsNotNull(qpClientContext, "The instance should be not null"); + Assert.IsInstanceOf(qpClientContext, "Should return QuickPanelClient instance."); + + var qpClientApps = new Shell.QuickPanelClient(tzsh, win, Shell.QuickPanelClient.Types.AppsMenu); + Assert.IsNotNull(qpClientApps, "The instance should be not null"); + Assert.IsInstanceOf(qpClientApps, "Should return QuickPanelClient instance."); + } + + [Test] + [Category("P2")] + [Description("Create a QuickPanelClient. Check whether QuickPanelClient created failed with null TizenShell or not.")] + [Property("SPEC", "Tizen.NUI.WindowSystem.Shell.QuickPanelClient.QuickPanelClient C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTX")] + [Property("COVPARAM", "TizenShell, Window, Types")] + [Property("AUTHOR", "JeongHyun Kang, jhyuni.kang@samsung.com")] + public void QuickPanelClient_INIT_FAILED1() + { + /* TEST CODE */ + Window win = NUIApplication.GetDefaultWindow(); + try + { + var qpClientDefault = new Shell.QuickPanelClient(null, win, Shell.QuickPanelClient.Types.SystemDefault); + } + catch (ArgumentNullException e) + { + Assert.Pass("ArgumentException: passed."); + } + } + + [Test] + [Category("P2")] + [Description("Create a QuickPanelClient. Check whether QuickPanelClient created failed with null Window or not.")] + [Property("SPEC", "Tizen.NUI.WindowSystem.Shell.QuickPanelClient.QuickPanelClient C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTX")] + [Property("COVPARAM", "TizenShell, Window, Types")] + [Property("AUTHOR", "JeongHyun Kang, jhyuni.kang@samsung.com")] + public void QuickPanelClient_INIT_FAILED2() + { + /* TEST CODE */ + Shell.TizenShell tzsh = new Shell.TizenShell(); + try + { + var qpClientDefault = new Shell.QuickPanelClient(tzsh, null, Shell.QuickPanelClient.Types.SystemDefault); + } + catch (ArgumentNullException e) + { + Assert.Pass("ArugumentNullException: passed."); + } + } + + [Test] + [Category("P2")] + [Description("Create a QuickPanelClient. Check whether QuickPanelClient created failed with Unknown Type or not.")] + [Property("SPEC", "Tizen.NUI.WindowSystem.Shell.QuickPanelClient.QuickPanelClient C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTX")] + [Property("COVPARAM", "TizenShell, Window, Types")] + [Property("AUTHOR", "JeongHyun Kang, jhyuni.kang@samsung.com")] + public void QuickPanelClient_INIT_FAILED3() + { + /* TEST CODE */ + Shell.TizenShell tzsh = new Shell.TizenShell(); + Window win = NUIApplication.GetDefaultWindow(); + try + { + var qpClientDefault = new Shell.QuickPanelClient(tzsh, win, Shell.QuickPanelClient.Types.Unknown); + } + catch (ArgumentException e) + { + Assert.Pass("ArugumentException: passed."); + } + } + + [Test] + [Category("P1")] + [Description("Get a visible state of quickpanel service window. Check whether getting a visible state successfully or not.")] + [Property("SPEC", "Tizen.NUI.WindowSystem.Shell.QuickPanelClient.Visible A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "JeongHyun Kang, jhyuni.kang@samsung.com")] + public void Visible_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + Shell.TizenShell tzsh = new Shell.TizenShell(); + Window win = NUIApplication.GetDefaultWindow(); + var qpClient = new Shell.QuickPanelClient(tzsh, win, Shell.QuickPanelClient.Types.SystemDefault); + var visible = Shell.QuickPanelClient.VisibleState.Unknown; + + try + { + visible = qpClient.Visible; + Assert.AreNotEqual(Shell.QuickPanelClient.VisibleState.Unknown, visible, "Get a invalid visible state"); + } + catch (InvalidOperationException e) + { + Tizen.Log.Info(TAG, "This system has no quickpanel: " + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "This system has no quickpanel: " + e.ToString()); + Assert.Pass("This system has no quickpanel"); + } + catch (ArgumentException 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()); + } + catch (Exception e) + { + Assert.True(false, "should not throw exception(" + e.Message + ")"); + } + } + + [Test] + [Category("P1")] + [Description("Get/set a scrollable state of quickpanel service window. Check whether getting/setting a scrollable state successfully or not.")] + [Property("SPEC", "Tizen.NUI.WindowSystem.Shell.QuickPanelClient.Scrollable A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "JeongHyun Kang, jhyuni.kang@samsung.com")] + public void Scrollable_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + Shell.TizenShell tzsh = new Shell.TizenShell(); + Window win = NUIApplication.GetDefaultWindow(); + var qpClient = new Shell.QuickPanelClient(tzsh, win, Shell.QuickPanelClient.Types.SystemDefault); + var scrollable = Shell.QuickPanelClient.ScrollableState.Unknown; + + try + { + scrollable = Shell.QuickPanelClient.ScrollableState.Unset; + qpClient.Scrollable = scrollable; + Assert.AreEqual(qpClient.Scrollable, scrollable, "Scrollable property is invalid"); + + scrollable = Shell.QuickPanelClient.ScrollableState.Set; + qpClient.Scrollable = scrollable; + Assert.AreEqual(qpClient.Scrollable, scrollable, "Scrollable property is invalid"); + } + catch (InvalidOperationException e) + { + Tizen.Log.Info(TAG, "This system has no quickpanel: " + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "This system has no quickpanel: " + e.ToString()); + Assert.Pass("This system has no quickpanel"); + } + catch (ArgumentException 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()); + } + catch (Exception e) + { + Assert.True(false, "should not throw exception(" + e.Message + ")"); + } + } + + [Test] + [Category("P2")] + [Description("Set a scrollable state of quickpanel service window. Check whether setting a scrollable state failed with Unknown State.")] + [Property("SPEC", "Tizen.NUI.WindowSystem.Shell.QuickPanelClient.Scrollable A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "JeongHyun Kang, jhyuni.kang@samsung.com")] + public void Scrollable_CHECK_RETURN_VALUE_FAILED() + { + /* TEST CODE */ + Shell.TizenShell tzsh = new Shell.TizenShell(); + Window win = NUIApplication.GetDefaultWindow(); + var qpClient = new Shell.QuickPanelClient(tzsh, win, Shell.QuickPanelClient.Types.SystemDefault); + var scrollable = Shell.QuickPanelClient.ScrollableState.Unknown; + + try + { + qpClient.Scrollable = scrollable; + Assert.IsTrue(false, "This operation should raise ArgumentException"); + } + catch (InvalidOperationException e) + { + Tizen.Log.Info(TAG, "This system has no quickpanel: " + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "This system has no quickpanel: " + e.ToString()); + Assert.Pass("This system has no quickpanel"); + } + catch (ArgumentException e) + { + Assert.Pass("ArugumentException: passed."); + } + catch (Exception e) + { + Assert.True(false, "should not throw exception(" + e.Message + ")"); + } + } + + [Test] + [Category("P1")] + [Description("Get a orientation state of quickpanel service window. Check whether getting a orientation state successfully or not.")] + [Property("SPEC", "Tizen.NUI.WindowSystem.Shell.QuickPanelClient.Orientation A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "JeongHyun Kang, jhyuni.kang@samsung.com")] + public void Orientation_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + Shell.TizenShell tzsh = new Shell.TizenShell(); + Window win = NUIApplication.GetDefaultWindow(); + var qpClient = new Shell.QuickPanelClient(tzsh, win, Shell.QuickPanelClient.Types.SystemDefault); + var orientation = Window.WindowOrientation.Portrait; + + try + { + orientation = qpClient.Orientation; + Assert.IsInstanceOf(orientation, "Should return Window.WindowOrientation instance."); + } + catch (InvalidOperationException e) + { + Tizen.Log.Info(TAG, "This system has no quickpanel: " + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "This system has no quickpanel: " + e.ToString()); + Assert.Pass("This system has no quickpanel"); + } + catch (ArgumentException 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()); + } + catch (Exception e) + { + Assert.True(false, "should not throw exception(" + e.Message + ")"); + } + } + + [Test] + [Category("P1")] + [Description("Show a quickpanel service window. Check whether show a quickpanel service window successfully or not.")] + [Property("SPEC", "Tizen.NUI.WindowSystem.Shell.QuickPanelClient.Show M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "JeongHyun Kang, jhyuni.kang@samsung.com")] + public void Show_CHECK() + { + /* TEST CODE */ + Shell.TizenShell tzsh = new Shell.TizenShell(); + Window win = NUIApplication.GetDefaultWindow(); + var qpClient = new Shell.QuickPanelClient(tzsh, win, Shell.QuickPanelClient.Types.SystemDefault); + + try + { + qpClient.Show(); + } + catch (InvalidOperationException e) + { + Tizen.Log.Info(TAG, "This system has no quickpanel: " + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "This system has no quickpanel: " + e.ToString()); + Assert.Pass("This system has no quickpanel"); + } + catch (ArgumentException 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()); + } + catch (Exception e) + { + Assert.True(false, "should not throw exception(" + e.Message + ")"); + } + } + + [Test] + [Category("P1")] + [Description("Hide a quickpanel service window. Check whether hide a quickpanel service window successfully or not.")] + [Property("SPEC", "Tizen.NUI.WindowSystem.Shell.QuickPanelClient.Hide M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "JeongHyun Kang, jhyuni.kang@samsung.com")] + public void Hide_CHECK() + { + /* TEST CODE */ + Shell.TizenShell tzsh = new Shell.TizenShell(); + Window win = NUIApplication.GetDefaultWindow(); + var qpClient = new Shell.QuickPanelClient(tzsh, win, Shell.QuickPanelClient.Types.SystemDefault); + + try + { + qpClient.Hide(); + } + catch (InvalidOperationException e) + { + Tizen.Log.Info(TAG, "This system has no quickpanel: " + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "This system has no quickpanel: " + e.ToString()); + Assert.Pass("This system has no quickpanel"); + } + catch (ArgumentException 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()); + } + catch (Exception e) + { + Assert.True(false, "should not throw exception(" + e.Message + ")"); + } + } + + public void OnVisibleEvent(object sender, Shell.QuickPanelClient.VisibleState state) + { + _triggered = true; + } + + [Test] + [Category("P1")] + [Description("Check whether VisibleChanged event is triggered.")] + [Property("SPEC", "Tizen.NUI.WindowSystem.Shell.QuickPanelClient.VisibleChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "JeongHyun Kang, jhyuni.kang@samsung.com")] + public async Task VisibleChanged_EVENT() + { + /* TEST CODE */ + Shell.TizenShell tzsh = new Shell.TizenShell(); + Window win = NUIApplication.GetDefaultWindow(); + var qpClient = new Shell.QuickPanelClient(tzsh, win, Shell.QuickPanelClient.Types.SystemDefault); + + qpClient.VisibleChanged += OnVisibleEvent; + _triggered = false; + + try + { + qpClient.Show(); + } + catch (InvalidOperationException e) + { + Tizen.Log.Info(TAG, "This system has no quickpanel: " + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "This system has no quickpanel: " + e.ToString()); + Assert.Pass("This system has no quickpanel"); + } + catch (Exception e) + { + Assert.True(false, "should not throw exception(" + e.Message + ")"); + } + + try + { + qpClient.Hide(); + } + catch (InvalidOperationException e) + { + Tizen.Log.Info(TAG, "This system has no quickpanel: " + e.ToString()); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "This system has no quickpanel: " + e.ToString()); + Assert.Pass("This system has no quickpanel"); + } + catch (Exception e) + { + Assert.True(false, "should not throw exception(" + e.Message + ")"); + } + + await Task.Delay(500); + Assert.AreEqual(true, _triggered, "Should be true"); + qpClient.VisibleChanged -= OnVisibleEvent; + _triggered = false; + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.WindowSystem.Tests/testcase/TSTizenShell.cs b/tct-suite-vs/Tizen.NUI.WindowSystem.Tests/testcase/TSTizenShell.cs new file mode 100644 index 000000000..402faea09 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.WindowSystem.Tests/testcase/TSTizenShell.cs @@ -0,0 +1,45 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.BaseComponents; +using System.Threading.Tasks; +using Tizen.NUI.WindowSystem; + +namespace Tizen.NUI.WindowSystem.Tests +{ + [TestFixture] + [Description("Tizen.NUI.WindowSystem.Shell.TizenShell Tests")] + public class TizenShellTests + { + private string TAG = "NUI"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a TIzen Shell. Check whether tizen shell is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.WindowSystem.Shell.TizenShell.TizenShell C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "JeongHyun Kang, jhyuni.kang@samsung.com")] + public void TizenShell_INIT() + { + /* TEST CODE */ + var tzsh = new Shell.TizenShell(); + Assert.IsNotNull(tzsh, "The instance should be not null"); + Assert.IsInstanceOf(tzsh, "Should return TizenShell instance."); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.WindowSystem.Tests/tizen-manifest.xml b/tct-suite-vs/Tizen.NUI.WindowSystem.Tests/tizen-manifest.xml new file mode 100755 index 000000000..dbb5aab97 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.WindowSystem.Tests/tizen-manifest.xml @@ -0,0 +1,16 @@ + + + + + Tizen.NUI.WindowSystem.Tests.png + + + + http://tizen.org/privilege/appmanager.launch + +