using NUnit.Framework.TUnit;
using System.Reflection;
using Tizen.NUI.BaseComponents;
-using Tizen.NUI.UIComponents;
+using Tizen.NUI.Components;
+using Tizen.Applications;
namespace Tizen.NUI.Wearable.Tests
{
class ManualTestNUI
{
+ class ListBridge : FlexibleView.Adapter
+ {
+ private List<string> _mDatas;
+ private List<ItemData> _mlistItem;
+
+ public ListBridge(List<string> datas, List<ItemData> item)
+ {
+ _mDatas = datas;
+ _mlistItem = item;
+ }
+
+ public void UpdateItemData(List<ItemData> item)
+ {
+ _mlistItem = item;
+ }
+
+ public override FlexibleView.ViewHolder OnCreateViewHolder(int viewType)
+ {
+ FlexibleView.ViewHolder viewHolder = new FlexibleView.ViewHolder(new Button());
+ return viewHolder;
+ }
+
+ public override void OnBindViewHolder(FlexibleView.ViewHolder 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 = (Window.Instance.Size.Width / Window.Instance.Dpi.Length()) * 1.06f;
+ btn.Size = new Size(Window.Instance.Size.Width * 0.4f, Window.Instance.Size.Height * 0.046f);
+ btn.Style.Text.TextColor = new Color(0, 0, 0, 1);
+ btn.Style.ImageShadow = new ImageShadow
+ {
+ Url = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/rectangle_btn_shadow.png",
+ Border = new Rectangle(5, 5, 5, 5)
+ };
+ btn.Style.BackgroundImage = new Selector<string>
+ {
+ Focused = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/rectangle_point_btn_normal.png",
+ Other = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/rectangle_toggle_btn_normal.png"
+ };
+ btn.FocusGained += OnFocusGained;
+ btn.FocusLost += OnFocusLost;
+ btn.Style.BackgroundImageBorder = new Rectangle(5, 5, 5, 5);
+ btn.ParentOrigin = Position.ParentOriginTopLeft;
+ btn.PivotPoint = PivotPoint.TopLeft;
+ btn.TextAlignment = HorizontalAlignment.Begin;
+ btn.CellIndex = new Vector2(position, 0);
+ }
+ }
+
+ public override void OnDestroyViewHolder(FlexibleView.ViewHolder holder)
+ {
+ if (holder.ItemView != null)
+ {
+ Button btn = holder.ItemView as Button;
+ btn.FocusGained -= OnFocusGained;
+ btn.FocusLost -= OnFocusLost;
+ holder.ItemView.Dispose();
+ }
+ }
+
+ public override int GetItemCount()
+ {
+ return _mDatas.Count;
+ }
+
+ private void OnFocusGained(object sender, EventArgs e)\r
+ {\r
+ Button btn = sender as Button;\r
+ btn.Style.BackgroundImage = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/rectangle_point_btn_normal.png";\r
+ }\r
+\r
+ private void OnFocusLost(object sender, EventArgs e)\r
+ {\r
+ Button btn = sender as Button;\r
+ btn.Style.BackgroundImage = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/rectangle_toggle_btn_normal.png";\r
+ }
+
+ }
+
private List<string> _tcIDList;
private List<ItemData> _listItem;
private TSettings _tsettings;
private TRunner _tRunner;
- private NavigationButton _pressButton = NavigationButton.NA;
- private PushButton passButton, failButton, blockButton, homeButton, preButton, nextButton, doneButton;
- private TextLabel notRun;
+ private 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";
//For TV KantM
//private static float PointSize = 30.0f;
//private static float ButtonSizeWidth = 200;
- private static float PointSize = 5.0f;
- private static float PixelSize = 20.0f;
+ private static float _pointSize = 5.0f;
+ private static float _pixelSize = 20.0f;
//Save the information of every single test case
- private List<TestcaseInfo> TCInfoList;
- private List<string> CurrentTCInfo;
+ private List<TestcaseInfo> _tcInfoList;
+ private List<string> _currentTCInfo;
- private static ManualTestNUI instance;
- private static Object lockObject = new object();
+ private static ManualTestNUI _instance;
+ private static Object _lockObject = new object();
//Show the result of all the test case
private TextLabel _summaryLabel;
- ScrollView _scrollView;
private View _initView;
private View _detailView;
- private TableView _initList;
- private TableView _detailList;
private View _caseView;
- private TableView _buttonContainer;
+ private FlexibleView _initList;
+ private ListBridge _adapter;
+ private TableView _detailList;
+ private View _buttonContainer;
+ private View _buttonContainer2;
private TableView _firstPageContainer;
- private PushButton run;
- private PushButton runButton;
- private PushButton[] buttonList;
+ private Button _run;
+ private Button _runButton;
//Always save the current TC number;
- private int CurrentTCNum = 0;
-
- private const float RowSpacing = 0.0f;
- private const float TopMargin = 0.0f;
- private const float BottomMargin = 0.0f;
- private const float SideMargin = 5.0f;
- private const float ItemHeight = 30.0f;
+ private int _currentTCNum = 0;
public static ManualTestNUI GetInstance()
{
- lock (lockObject)
+ lock (_lockObject)
{
- if (instance == null)
+ if (_instance == null)
{
- instance = new ManualTestNUI();
+ _instance = new ManualTestNUI();
}
}
- return instance;
+ return _instance;
}
private ManualTestNUI()
{
Initialize();
}
+
public void Initialize()
{
Tizen.Log.Fatal("NUI", "NUI Initialize");
- PointSize = (1.0f / Window.Instance.Dpi.Length()) * 2000.0f;
+ _pointSize = (1.0f / Window.Instance.Dpi.Length()) * 2000.0f;
RunType.Value = RunType.MANUAL;
_tRunner = new TRunner();
_tRunner.LoadTestsuite();
Tizen.Log.Fatal("NUI", "TCT : TCName:" + nameTc.ToString());
}
-
_tsettings = TSettings.GetInstance();
_tsettings.IsManual = true;
window.BackgroundColor = Color.White;
_summaryLabel = new TextLabel();
- _summaryLabel.PixelSize = PixelSize;
- _summaryLabel.Size2D = new Size2D((int)Window.Instance.Size.Width, 60);
+ _summaryLabel.PixelSize = _pixelSize;
+ _summaryLabel.Size = new Size((int)Window.Instance.Size.Width, 60);
_summaryLabel.ParentOrigin = Position.ParentOriginTopLeft;
_summaryLabel.PivotPoint = PivotPoint.TopLeft;
_summaryLabel.Position = new Position(0, 5, 0);
window.GetDefaultLayer().Add(_summaryLabel);
_initView = new View();
- _initView.Size2D = new Size2D((int)Window.Instance.Size.Width, (int)Window.Instance.Size.Height - 65);
+ _initView.Size = new Size((int)Window.Instance.Size.Width, (int)Window.Instance.Size.Height - 65);
_initView.ParentOrigin = Position.ParentOriginTopLeft;
_initView.PivotPoint = PivotPoint.TopLeft;
_initView.Position = new Position(0.0f, 70.0f, 0.0f);
_initView.Show();
_detailView = new View();
- _initView.Size2D = new Size2D((int)Window.Instance.Size.Width, (int)Window.Instance.Size.Height - 65);
+ _detailView.Size = new Size((int)Window.Instance.Size.Width, (int)Window.Instance.Size.Height - 65);
_detailView.ParentOrigin = Position.ParentOriginTopLeft;
_detailView.PivotPoint = PivotPoint.TopLeft;
_detailView.Position = new Position(0.0f, 70.0f, 0.0f);
window.GetDefaultLayer().Add(_initView);
window.GetDefaultLayer().Add(_detailView);
- FocusManager.Instance.SetCurrentFocusView(run);
+ FocusManager.Instance.SetCurrentFocusView(_run);
}
- void InitializeFirstPage()
+ void SetCommonButtonStyle(Button btn, string text)
{
- //Create Run Button, when you Click it, then the first test case will be executed.
- doneButton = new PushButton();
- doneButton.Focusable = true;
- doneButton.LabelText = "Done";
- doneButton.Clicked += (obj, ee) =>
+ if (!btn) return;
+ btn.Focusable = true;
+ btn.Text = text;
+ btn.PointSize = _pointSize;
+ btn.Size = new Size(Window.Instance.Size.Width * 0.06f, Window.Instance.Size.Height * 0.046f);
+ btn.Style.Text.TextColor = new Color(0, 0, 0, 1);
+ btn.Style.ImageShadow = new ImageShadow
{
- TSettings.GetInstance().SubmitManualResult();
- return false;
+ Url = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/rectangle_btn_shadow.png",
+ Border = new Rectangle(5, 5, 5, 5)
};
-
- run = new PushButton();
- run.LabelText = "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);
- return false;
+ btn.Style.BackgroundImage = new Selector<string>
+ {
+ Focused = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/rectangle_point_btn_normal.png",
+ Other = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/rectangle_toggle_btn_normal.png"
};
+ btn.Style.BackgroundImageBorder = new Rectangle(5, 5, 5, 5);
+ btn.ParentOrigin = Position.ParentOriginTopLeft;
+ btn.PivotPoint = PivotPoint.TopLeft;
+ btn.FocusGained += OnFocusGained;
+ btn.FocusLost += OnFocusLost;
+ }
+
+ void InitializeFirstPage()
+ {
+ //Create Run Button, when you Click it, then the first test case will be executed.
+ _doneButton = new Button();
+ SetCommonButtonStyle(_doneButton, "Done");
+ _doneButton.ClickEvent += OnDoneButtonClicked;
- run.RightFocusableView = doneButton;
- doneButton.LeftFocusableView = run;
+ _run = new Button();
+ SetCommonButtonStyle(_run, "Runner");
+ _run.ClickEvent += OnRunnerButtonClicked;
+ _run.RightFocusableView = _doneButton;
+ _doneButton.LeftFocusableView = _run;
//To show all the test case information(Number _className._TCName [result]).
- _initList = new TableView((uint)_tcIDList.Count, 1);
+ _initList = new FlexibleView();
+ _initList.Position = new Position(0, Window.Instance.Size.Height * 0.0925f);
+ _initList.Size = new Size(Window.Instance.Size.Width * 0.5f, Window.Instance.Size.Height * 0.79f);
+ _adapter = new ListBridge(_tcIDList, _listItem);
+ _initList.SetAdapter(_adapter);
+ LinearLayoutManager layoutManager = new LinearLayoutManager(LinearLayoutManager.VERTICAL);
+ _initList.SetLayoutManager(layoutManager);
+ _initList.FocusedItemIndex = 0;
_initList.Focusable = true;
- _initList.CellPadding = new Vector2(0, 0);
- _initList.Size2D = new Size2D(Window.Instance.Size.Width - 50, _tcIDList.Count * 50);
- _initList.ParentOrigin = Position.ParentOriginTopLeft;
- _initList.PivotPoint = PivotPoint.TopLeft;
- _initList.Position = new Position(0.0f, 0.0f, 0.0f);
- CreateInitList();
-
- run.DownFocusableView = _initList;
- doneButton.DownFocusableView = _initList;
- _initList.UpFocusableView = run;
-
- _firstPageContainer = new TableView(2, 2);
+ _initList.ItemClickEvent += OnItemClickEvent;
+ _initList.FocusGained += OnInitListFocusGained;
+ _initList.FocusLost += OnInitListFocusLost;
+ _initList.KeyEvent += OnInitListKeyEvent;
+
+ _firstPageContainer = new TableView(1, 2);
_firstPageContainer.PivotPoint = Position.PivotPointTopLeft;
_firstPageContainer.ParentOrigin = Position.ParentOriginTopLeft;
- _firstPageContainer.Position = new Position(0, 3, 0);
- _firstPageContainer.Size2D = new Size2D((int)Window.Instance.Size.Width - 200, 200);
- _firstPageContainer.Focusable = (true);
+ _firstPageContainer.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.SetCellAlignment(new TableView.CellPosition(1), HorizontalAlignmentType.Center, VerticalAlignmentType.Center);
- _firstPageContainer.CellPadding = new Vector2(0, 0);
-
- _firstPageContainer.AddChild(doneButton, new TableView.CellPosition(0, 0));
- _firstPageContainer.AddChild(run, new TableView.CellPosition(0, 1));
-
-
- _scrollView = new ScrollView();
- _scrollView.ClippingMode = ClippingModeType.ClipChildren;
- _scrollView.BackgroundColor = Color.Transparent;
- _scrollView.Size2D = new Size2D(Window.Instance.Size.Width, Window.Instance.Size.Height);
- _scrollView.Position2D = new Position2D(0, 0);
- _scrollView.Scrolling = true;
-
- PropertyMap rulerMap = new PropertyMap();
- rulerMap.Add((int)ScrollModeType.XAxisScrollEnabled, new PropertyValue(false));
- rulerMap.Add((int)ScrollModeType.YAxisScrollEnabled, new PropertyValue(true));
- rulerMap.Add((int)ScrollModeType.YAxisSnapToInterval, new PropertyValue(100));
- rulerMap.Add((int)ScrollModeType.YAxisScrollBoundary, new PropertyValue(60 * (_tcIDList.Count+1)));
- _scrollView.ScrollMode = rulerMap;
-
- _scrollView.Add(_initList);
- _firstPageContainer.AddChild(_scrollView, new TableView.CellPosition(1, 0, 1, 2));
+ _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);
+ 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).
{
_detailList = new TableView(23, 1);
_detailList.Focusable = true;
- _detailList.Size2D = new Size2D(Window.Instance.Size.Width - 50, 500);
+ _detailList.Size = new Size(Window.Instance.Size.Width - 50, 500);
_detailList.ParentOrigin = Position.ParentOriginTopLeft;
_detailList.PivotPoint = PivotPoint.TopLeft;
_detailList.Position = new Position(0.0f, 0.0f, 0.0f);
_detailView.Add(_detailList);
//To Place the function button, such as PASS, FAIL.....
- _buttonContainer = new TableView(2, 4);
- _buttonContainer.SetSizeModeFactor(new Vector3(0.0f, 0.9f, 0.0f));
- _buttonContainer.PivotPoint = PivotPoint.TopCenter;
+ _buttonContainer = new View();
+ _buttonContainer.PivotPoint = PivotPoint.TopLeft;
_buttonContainer.ParentOrigin = Position.ParentOriginTopLeft;
- _buttonContainer.Position = new Position(0, Window.Instance.Size.Height * 0.6f, 0);
- _buttonContainer.Size2D = new Size2D((int)Window.Instance.Size.Width, 300);
- _buttonContainer.Focusable = (true);
+ _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
_detailView.Remove(_detailList);
_detailList.Dispose();
}
- Tizen.Log.Fatal("NUI", "Print the CurrentTCNum here::" + CurrentTCNum);
+ Tizen.Log.Fatal("NUI", "Print the CurrentTCNum here::" + _currentTCNum);
_detailList = new TableView(10, 1);
_detailList.Focusable = true;
- _detailList.Size2D = new Size2D(Window.Instance.Size.Width - 50, 400);
+ _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)
+ if (_notRun)
{
- notRun.Text = _listItem[CurrentTCNum].Result;
+ _notRun.Text = _listItem[_currentTCNum].Result;
}
}
//Create all the function buttons here, such as PASS, FAIL.....
void CreateButtons()
{
-
- notRun = new TextLabel();
- notRun.SizeWidth = 200;
- notRun.PixelSize = PixelSize;
- notRun.HorizontalAlignment = HorizontalAlignment.Begin;
- notRun.Text = "Not Run";
-
- passButton = new PushButton();
- passButton.Focusable = true;
- passButton.LabelText = "Pass";
- passButton.Clicked += (obj, ee) =>
- {
-
- Clear();
- if (!ManualTest.IsConfirmed())
- {
- _tsettings.TCResult = StrResult.PASS;
- ManualTest.Confirm();
- }
- Tizen.Log.Fatal("TBT", "Pass Button clicked!");
- return true;
- };
-
- failButton = new PushButton();
- failButton.Focusable = true;
- failButton.LabelText = "Fail";
- failButton.Clicked += (obj, ee) =>
- {
- Clear();
- if (!ManualTest.IsConfirmed())
- {
- _tsettings.TCResult = StrResult.FAIL;
- ManualTest.Confirm();
- }
- Tizen.Log.Fatal("TBT", "Fail Button clicked!");
- return true;
- };
-
- blockButton = new PushButton();
- blockButton.Focusable = true;
- blockButton.LabelText = "Block";
- blockButton.Clicked += (obj, ee) =>
- {
- Clear();
- if (!ManualTest.IsConfirmed())
- {
- _tsettings.TCResult = StrResult.BLOCK;
- ManualTest.Confirm();
- }
- return true;
- };
-
- runButton = new PushButton();
- runButton.Focusable = true;
- runButton.LabelText = "Run";
- runButton.Clicked += (obj, ee) =>
- {
- Clear();
- //should update the _caseView by the test case
- _pressButton = NavigationButton.NA;
- _tsettings.Testcase_ID = _tcIDList[CurrentTCNum];
- _tsettings.TCResult = "";
- _tRunner.Execute();
- return true;
- };
-
- homeButton = new PushButton();
- homeButton.Focusable = true;
- homeButton.LabelText = "Home";
- homeButton.Clicked += (obj, ee) =>
- {
- Clear();
- _pressButton = NavigationButton.Home;
- if (!ManualTest.IsConfirmed())
- {
- _tsettings.TCResult = StrResult.NOTRUN;
- ManualTest.Confirm();
- }
- else
- {
- _detailView.Hide();
- _initView.Show();
- FocusManager.Instance.SetCurrentFocusView(run);
- }
- return true;
- };
-
- preButton = new PushButton();
- preButton.Focusable = true;
- preButton.LabelText = "<<";
- preButton.Clicked += (obj, ee) =>
- {
- Clear();
- if (!ManualTest.IsConfirmed())
- {
- _tsettings.TCResult = StrResult.NOTRUN;
- ManualTest.Confirm();
- }
- else
- {
- if (CurrentTCNum != 0)
- {
- CurrentTCNum--;
- notRun.Text = _listItem[CurrentTCNum].Result;
- ManualTest.Confirm();
- UpdateDetailPage();
- }
- }
- return true;
- };
- nextButton = new PushButton();
- nextButton.Focusable = true;
- nextButton.LabelText = ">>";
- nextButton.Clicked += (obj, ee) =>
- {
- Clear();
- if (!ManualTest.IsConfirmed())
- {
- _tsettings.TCResult = StrResult.NOTRUN;
- ManualTest.Confirm();
- }
- if (CurrentTCNum + 1 != ResultNumber.Total)
- {
- Tizen.Log.Fatal("NUI", "Print the [not run] CurrentTCNum::" + CurrentTCNum);
- CurrentTCNum++;
- notRun.Text = _listItem[CurrentTCNum].Result;
- UpdateDetailPage();
- }
- return true;
- };
-
- _buttonContainer.AddChild(passButton, new TableView.CellPosition(0, 0));
- _buttonContainer.AddChild(failButton, new TableView.CellPosition(0, 1));
- _buttonContainer.AddChild(blockButton, new TableView.CellPosition(0, 2));
- _buttonContainer.AddChild(runButton, new TableView.CellPosition(0, 3));
- _buttonContainer.AddChild(homeButton, new TableView.CellPosition(1, 0));
- _buttonContainer.AddChild(notRun, new TableView.CellPosition(1, 1));
- _buttonContainer.AddChild(preButton, new TableView.CellPosition(1, 2));
- _buttonContainer.AddChild(nextButton, new TableView.CellPosition(1, 3));
+ _notRun = new TextLabel();
+ _notRun.HorizontalAlignment = HorizontalAlignment.Begin;
+ _notRun.PointSize = _pointSize;
+ _notRun.Text = "Not Run";
+ _notRun.Size = new Size(Window.Instance.Size.Width * 0.06f, Window.Instance.Size.Height * 0.046f);
+
+ _passButton = new Button();
+ SetCommonButtonStyle(_passButton, "Pass");
+ _passButton.ClickEvent += OnPassButtonClicked;
+ _failButton = new Button();
+ SetCommonButtonStyle(_failButton, "Fail");
+ _failButton.ClickEvent += OnFailButtonClicked;
+
+ _blockButton = new Button();
+ SetCommonButtonStyle(_blockButton, "Block");
+ _blockButton.ClickEvent += OnBlockButtonClicked;
+
+ _runButton = new Button();
+ SetCommonButtonStyle(_runButton, "Run");
+ _runButton.ClickEvent += OnRunButtonClicked;
+
+ _homeButton = new Button();
+ SetCommonButtonStyle(_homeButton, "Home");
+ _homeButton.ClickEvent += OnHomeButtonClicked;
+
+ _preButton = new Button();
+ SetCommonButtonStyle(_preButton, "<<");
+ _preButton.ClickEvent += OnPreButtonClicked;
+
+ _nextButton = new Button();
+ SetCommonButtonStyle(_nextButton, ">>");
+ _nextButton.ClickEvent += OnNextButtonClicked;
+
+ _runButton.DownFocusableView = _nextButton;
+ _runButton.LeftFocusableView = _blockButton;
+ _runButton.RightFocusableView = _homeButton;
+ _blockButton.LeftFocusableView = _failButton;
+ _blockButton.RightFocusableView = _runButton;
+ _failButton.RightFocusableView = _blockButton;
+ _failButton.LeftFocusableView = _passButton;
+ _passButton.RightFocusableView = _failButton;
+ _passButton.DownFocusableView = _homeButton;
+ _homeButton.UpFocusableView = _passButton;
+ _homeButton.LeftFocusableView = _runButton;
+ _homeButton.RightFocusableView = _preButton;
+ _preButton.UpFocusableView = _runButton;
+ _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)
{
if (e.Key.KeyPressedName == "Down")
{
- FocusManager.Instance.SetCurrentFocusView(passButton);
+ FocusManager.Instance.SetCurrentFocusView(_passButton);
}
}
if (e.Key.KeyPressedName == "Up")
{
Tizen.Log.Fatal("NUI", "Set current focus view :: doneButton");
- FocusManager.Instance.SetCurrentFocusView(doneButton);
+ FocusManager.Instance.SetCurrentFocusView(_doneButton);
}
}
return false;
if (e.Key.KeyPressedName == "Down")
{
Tizen.Log.Fatal("NUI", "Set current focus view :: run");
- FocusManager.Instance.SetCurrentFocusView(run);
+ FocusManager.Instance.SetCurrentFocusView(_run);
}
}
return false;
public void ClearTestCase(View view)
{
- FocusManager.Instance.SetCurrentFocusView(runButton);
+ FocusManager.Instance.SetCurrentFocusView(_runButton);
Tizen.Log.Fatal("NUI", "Clear test case!");
_detailView.Remove(view);
}
+ public void Dispose()\r
+ {\r
+ if (_passButton)\r
+ {\r
+ _passButton.ClickEvent -= OnPassButtonClicked;\r
+ _passButton.FocusGained -= OnFocusGained;\r
+ _passButton.FocusLost -= OnFocusLost;\r
+ _passButton.GetParent()?.Remove(_passButton);\r
+ _passButton.Dispose();\r
+ _passButton = null;\r
+ }\r
+ if (_failButton)
+ {
+ _failButton.ClickEvent -= OnFailButtonClicked;
+ _failButton.FocusGained -= OnFocusGained;\r
+ _failButton.FocusLost -= OnFocusLost;
+ _failButton.GetParent()?.Remove(_failButton);\r
+ _failButton.Dispose();\r
+ _failButton = null;
+ }
+ if (_blockButton)
+ {
+ _blockButton.ClickEvent -= OnBlockButtonClicked;
+ _blockButton.FocusGained -= OnFocusGained;\r
+ _blockButton.FocusLost -= OnFocusLost;
+ _blockButton.GetParent()?.Remove(_blockButton);\r
+ _blockButton.Dispose();\r
+ _blockButton = null;
+ }\r
+ if (_runButton)
+ {
+ _runButton.ClickEvent -= OnRunButtonClicked;
+ _runButton.FocusGained -= OnFocusGained;\r
+ _runButton.FocusLost -= OnFocusLost;
+ _runButton.GetParent()?.Remove(_runButton);\r
+ _runButton.Dispose();\r
+ _runButton = null;
+ }\r
+ if (_homeButton)
+ {
+ _homeButton.ClickEvent -= OnHomeButtonClicked;
+ _homeButton.FocusGained -= OnFocusGained;\r
+ _homeButton.FocusLost -= OnFocusLost;
+ _homeButton.GetParent()?.Remove(_homeButton);\r
+ _homeButton.Dispose();\r
+ _homeButton = null;
+ }\r
+ if (_preButton)
+ {
+ _preButton.ClickEvent -= OnPreButtonClicked;
+ _preButton.FocusGained -= OnFocusGained;\r
+ _preButton.FocusLost -= OnFocusLost;
+ _preButton.GetParent()?.Remove(_preButton);\r
+ _preButton.Dispose();\r
+ _preButton = null;
+ }\r
+ if (_nextButton)
+ {
+ _nextButton.ClickEvent -= OnNextButtonClicked;
+ _nextButton.FocusGained -= OnFocusGained;\r
+ _nextButton.FocusLost -= OnFocusLost;
+ _nextButton.GetParent()?.Remove(_nextButton);\r
+ _nextButton.Dispose();\r
+ _nextButton = null;
+ }
+
+ if(_detailView)\r
+ {\r
+ _detailView.GetParent()?.Remove(_detailView);\r
+ _detailView.Dispose();\r
+ _detailView = null;\r
+ }
+ if (_initList)\r
+ {\r
+ _initList.ItemClickEvent -= OnItemClickEvent;\r
+ _initList.FocusGained -= OnInitListFocusGained;\r
+ _initList.FocusLost -= OnInitListFocusLost;\r
+ _initList.KeyEvent -= OnInitListKeyEvent;\r
+ _initList.GetParent()?.Remove(_initList);\r
+ _initList.Dispose();\r
+ _initList = null;\r
+ }
+ if (_doneButton)\r
+ {\r
+ _doneButton.ClickEvent -= OnDoneButtonClicked;\r
+ _doneButton.FocusGained -= OnFocusGained;\r
+ _doneButton.FocusLost -= OnFocusLost;\r
+ _doneButton.GetParent()?.Remove(_doneButton);\r
+ _doneButton.Dispose();\r
+ _doneButton = null;\r
+ }
+ if (_run)\r
+ {\r
+ _run.ClickEvent -= OnRunnerButtonClicked;\r
+ _run.FocusGained -= OnFocusGained;\r
+ _run.FocusLost -= OnFocusLost;\r
+ _run.GetParent()?.Remove(_run);\r
+ _run.Dispose();\r
+ _run = null;\r
+ }
+
+ if (_initView)\r
+ {\r
+ _initView.GetParent()?.Remove(_initView);\r
+ _initView.Dispose();\r
+ _initView = null;\r
+ }
+ }
+
//Use to update the _summaryLabel.
private void SetSummaryResult()
{
return map;
}
- private void CreateInitList()
- {
- int tcNum = _tcIDList.Count;
- Tizen.Log.Fatal("NUI", "_tcIDList.Count: " + _tcIDList.Count);
- buttonList = new PushButton[tcNum];
- for (int index = 0; index < tcNum; index++)
- {
- string name = _tcIDList[index];
- string testcaseName = "#." + (index + 1).ToString() + name;
- string resultText = "[" + _listItem[(int)index].Result + "]";
- string text = testcaseName + resultText;
- buttonList[index] = new PushButton();
- buttonList[index].CellIndex = new Vector2(index, 0);
- buttonList[index].Name = index.ToString();
- buttonList[index].Focusable = true;
- buttonList[index].Label = CreateTextMap(PointSize, text);
- buttonList[index].ParentOrigin = Position.ParentOriginTopLeft;
- buttonList[index].PivotPoint = PivotPoint.TopLeft;
- buttonList[index].Position = new Position(0.0f, 0.0f, 0.0f);
- buttonList[index].Clicked += (obj, e) =>
- {
- PushButton button = obj as PushButton;
-
- Tizen.Log.Fatal("TBT", "Item clicked!!::" + button.Name);
- CurrentTCNum = int.Parse(button.Name);
- _initView.Hide();
- UpdateDetailPage();
- _caseView.Hide();
- _detailView.Show();
- FocusManager.Instance.SetCurrentFocusView(runButton);
- return false;
- };
- buttonList[index].FocusGained += ManualTestNUI_FocusGained;
- _initList.AddChild(buttonList[index], new TableView.CellPosition((uint)index, 0));
-
- }
- }
-
- private void ManualTestNUI_FocusGained(object sender, EventArgs e)
- {
- var item = sender as PushButton;
- if (item != null)
- {
- uint idx = UInt32.Parse(item.Name);
- _scrollView.ScrollTo(new Vector2(0, 30 * idx));
- }
- }
-
private void CreateDetailList()
{
Tizen.Log.Fatal("NUI", "Print the CreateDetailList::");
- int senNum = CurrentTCInfo.Count;
+ int senNum = _currentTCInfo.Count;
for (int index = 0; index < senNum; index++)
{
TextLabel description = new TextLabel();
description.Position = new Position(0.0f, 0.0f, 0.0f);
description.Size2D = new Size2D((int)Window.Instance.Size.Width - 20, 50);
description.HorizontalAlignment = HorizontalAlignment.Begin;
- description.PointSize = PointSize;
- description.Text = CurrentTCInfo[(int)index];
+ description.PointSize = _pointSize;
+ description.Text = _currentTCInfo[(int)index];
_detailList.AddChild(description, new TableView.CellPosition((uint)index, 0));
}
}
ResultNumber.Pass = 0;
ResultNumber.Fail = 0;
ResultNumber.Block = 0;
- TCInfoList = new List<TestcaseInfo>();
+ _tcInfoList = new List<TestcaseInfo>();
foreach (KeyValuePair<string, ITest> pair in _tRunner.GetTestList())
{
List<string> preconditions = new List<string>();
postconditions.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);
}
}
- TCInfoList.Add(new TestcaseInfo
+ _tcInfoList.Add(new TestcaseInfo
{
TestcaseName = pair.Key,
Preconditions = preconditions,
//The data in CurrentTCInfo list will be show in _detailList.
void UpdateCurrentTCInfo()
{
- CurrentTCInfo = new List<string>();
- 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 = new List<string>();
+ 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]);
+ _currentTCInfo.Add(_tcInfoList[_currentTCNum].Preconditions[index]);
}
- for(int index = 0; index < TCInfoList[CurrentTCNum].Steps.Count; index++ )
+ for(int index = 0; index < _tcInfoList[_currentTCNum].Steps.Count; index++ )
{
- CurrentTCInfo.Add(TCInfoList[CurrentTCNum].Steps[index]);
+ _currentTCInfo.Add(_tcInfoList[_currentTCNum].Steps[index]);
}
- for(int index = 0; index < TCInfoList[CurrentTCNum].Postconditions.Count; index++ )
+ for(int index = 0; index < _tcInfoList[_currentTCNum].Postconditions.Count; index++ )
{
- CurrentTCInfo.Add(TCInfoList[CurrentTCNum].Postconditions[index]);
+ _currentTCInfo.Add(_tcInfoList[_currentTCNum].Postconditions[index]);
}
- Tizen.Log.Fatal("NUI", "The CurrentTCNum::" + CurrentTCNum);
+ 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))
+ if (_listItem[_currentTCNum].Result.Contains(StrResult.FAIL))
{
ResultNumber.Fail = ResultNumber.Fail - 1;
}
- else if (_listItem[CurrentTCNum].Result.Contains(StrResult.PASS))
+ else if (_listItem[_currentTCNum].Result.Contains(StrResult.PASS))
{
ResultNumber.Pass = ResultNumber.Pass - 1;
}
- else if (_listItem[CurrentTCNum].Result.Contains(StrResult.BLOCK))
+ else if (_listItem[_currentTCNum].Result.Contains(StrResult.BLOCK))
ResultNumber.Block = ResultNumber.Block - 1;
// Update new result
- _listItem[CurrentTCNum].Result = e.Result;
+ _listItem[_currentTCNum].Result = e.Result;
if (e.Result.Contains(StrResult.PASS))
{
ResultNumber.Pass += 1;
ResultNumber.Block += 1;
}
- _initList.RemoveChildAt(new TableView.CellPosition((uint)CurrentTCNum, 0));
- string name = _tcIDList[CurrentTCNum];
- string testcaseName = "#." + (CurrentTCNum + 1).ToString() + name;
- string resultText = "[" + _listItem[(int)CurrentTCNum].Result + "]";
- string text = testcaseName + resultText;
- PushButton button = new PushButton();
- button.CellIndex = new Vector2(CurrentTCNum, 0);
- button.Name = CurrentTCNum.ToString();
- button.Focusable = true;
- button.Label = CreateTextMap(PointSize, text);
- button.ParentOrigin = Position.ParentOriginTopLeft;
- button.PivotPoint = PivotPoint.TopLeft;
- button.Position = new Position(0.0f, 0.0f, 0.0f);
- button.Clicked += (obj, ee) =>
- {
- Tizen.Log.Fatal("NUI", "Item clicked clicked!!::" + ((int)button.CellIndex.X).ToString());
- CurrentTCNum = (int)button.CellIndex.X;
- _initView.Hide();
- UpdateDetailPage();
- _caseView.Hide();
- _detailView.Show();
- FocusManager.Instance.SetCurrentFocusView(runButton);
- return false;
- };
- _initList.AddChild(button, new TableView.CellPosition((uint)CurrentTCNum, 0));
+ FlexibleView.ViewHolder 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(_listItem);
+ }
+
SetSummaryResult();
- notRun.Text = _listItem[CurrentTCNum].Result;
+ _notRun.Text = _listItem[_currentTCNum].Result;
+ }
+
+ private void OnItemClickEvent(object sender, FlexibleView.ItemClickEventArgs e)\r
+ {\r
+ Button button = e.ClickedView.ItemView as Button;\r
+ if (button)\r
+ {\r
+ Tizen.Log.Fatal("NUI", "Item clicked!!::" + button.Name);\r
+ _currentTCNum = int.Parse(button.Name);\r
+ _initView.Hide();\r
+ UpdateDetailPage();\r
+ _caseView.Hide();\r
+ _detailView.Show();\r
+ FocusManager.Instance.SetCurrentFocusView(_runButton);\r
+ }\r
+ }
+
+ private void OnInitListFocusGained(object sender, EventArgs e)\r
+ {\r
+ FlexibleView.ViewHolder holder = _initList?.FindViewHolderForAdapterPosition(0);\r
+ if (holder != null && holder.ItemView != null)\r
+ {\r
+ FocusManager.Instance.SetCurrentFocusView(holder.ItemView);\r
+ _currentTCNum = 0;\r
+ }\r
+ }\r
+\r
+ private void OnInitListFocusLost(object sender, EventArgs e)\r
+ {\r
+ _currentTCNum = 0;\r
+ }
+
+ private bool OnInitListKeyEvent(object sender, View.KeyEventArgs e)\r
+ {\r
+ if (e.Key.State == Key.StateType.Down)\r
+ {\r
+ Tizen.Log.Fatal("NUI", "KeyEvent~KeyPressedName = " + e.Key.KeyPressedName + ",KeyCode = " + e.Key.KeyCode);\r
+ if (e.Key.KeyPressedName == "Up")\r
+ {\r
+ if (_currentTCNum == 0)\r
+ {\r
+ FocusManager.Instance.SetCurrentFocusView(_run);\r
+ }\r
+ else\r
+ {\r
+ FlexibleView.ViewHolder holder = _initList?.FindViewHolderForAdapterPosition(_currentTCNum - 1);\r
+ if (holder != null && holder.ItemView != null)\r
+ {\r
+ FocusManager.Instance.SetCurrentFocusView(holder.ItemView);\r
+ _currentTCNum--;\r
+ }\r
+ }\r
+ }\r
+ else if (e.Key.KeyPressedName == "Down")\r
+ {\r
+ if (_currentTCNum == _initList.ChildCount - 1)\r
+ {\r
+ _currentTCNum = 0;\r
+ }\r
+ else\r
+ {\r
+ _currentTCNum++;\r
+ }\r
+ FlexibleView.ViewHolder holder = _initList?.FindViewHolderForAdapterPosition(_currentTCNum);\r
+ if (holder != null && holder.ItemView != null)\r
+ {\r
+ FocusManager.Instance.SetCurrentFocusView(holder.ItemView);\r
+ }\r
+ }\r
+ else if (e.Key.KeyPressedName == "Return")\r
+ {\r
+ _initView.Hide();\r
+ UpdateDetailPage();\r
+ _caseView.Hide();\r
+ _detailView.Show();\r
+ FocusManager.Instance.SetCurrentFocusView(_runButton);\r
+ }\r
+ }\r
+ return true;\r
+ }\r
+\r
+ private void OnDoneButtonClicked(object sender, Button.ClickEventArgs e)\r
+ {\r
+ TSettings.GetInstance().SubmitManualResult();
+ }
+
+ private void OnRunnerButtonClicked(object sender, Button.ClickEventArgs e)\r
+ {\r
+ Tizen.Log.Fatal("NUI", "Check all the test case from the first one.");\r
+ _currentTCNum = 0;\r
+ _initView.Hide();\r
+ _caseView.Hide();\r
+ UpdateDetailPage();\r
+ _detailView.Show();\r
+ FocusManager.Instance.SetCurrentFocusView(_runButton);
}
+
+ private void OnPassButtonClicked(object sender, Button.ClickEventArgs e)\r
+ {\r
+ Clear();\r
+ if (!ManualTest.IsConfirmed())\r
+ {\r
+ _tsettings.TCResult = StrResult.PASS;\r
+ ManualTest.Confirm();\r
+ }\r
+ Tizen.Log.Fatal("TBT", "Pass Button clicked!");
+ }
+
+ private void OnFailButtonClicked(object sender, Button.ClickEventArgs e)\r
+ {\r
+ Clear();\r
+ if (!ManualTest.IsConfirmed())\r
+ {\r
+ _tsettings.TCResult = StrResult.FAIL;\r
+ ManualTest.Confirm();\r
+ }\r
+ Tizen.Log.Fatal("TBT", "Fail Button clicked!");
+ }
+
+ private void OnBlockButtonClicked(object sender, Button.ClickEventArgs e)\r
+ {\r
+ Clear();\r
+ if (!ManualTest.IsConfirmed())\r
+ {\r
+ _tsettings.TCResult = StrResult.BLOCK;\r
+ ManualTest.Confirm();\r
+ }
+ }\r
+\r
+ private void OnRunButtonClicked(object sender, Button.ClickEventArgs e)\r
+ {\r
+ Clear();\r
+ //should update the _caseView by the test case\r
+ _tsettings.Testcase_ID = _tcIDList[_currentTCNum];\r
+ _tsettings.TCResult = "";\r
+ _tRunner.Execute();
+ }
+
+ private void OnHomeButtonClicked(object sender, Button.ClickEventArgs e)\r
+ {\r
+ Clear();\r
+ if (!ManualTest.IsConfirmed())\r
+ {\r
+ _tsettings.TCResult = StrResult.NOTRUN;\r
+ ManualTest.Confirm();\r
+ }\r
+ else\r
+ {\r
+ _detailView.Hide();\r
+ _initView.Show();\r
+ FocusManager.Instance.SetCurrentFocusView(_run);\r
+ }
+ }\r
+\r
+ private void OnPreButtonClicked(object sender, Button.ClickEventArgs e)\r
+ {\r
+ Clear();\r
+ if (!ManualTest.IsConfirmed())\r
+ {\r
+ _tsettings.TCResult = StrResult.NOTRUN;\r
+ ManualTest.Confirm();\r
+ }\r
+ else\r
+ {\r
+ if (_currentTCNum != 0)\r
+ {\r
+ _currentTCNum--;\r
+ _notRun.Text = _listItem[_currentTCNum].Result;\r
+ ManualTest.Confirm();\r
+ UpdateDetailPage();\r
+ }\r
+ }
+ }
+
+ private void OnNextButtonClicked(object sender, Button.ClickEventArgs e)\r
+ {\r
+ Clear();\r
+ if (!ManualTest.IsConfirmed())\r
+ {\r
+ _tsettings.TCResult = StrResult.NOTRUN;\r
+ ManualTest.Confirm();\r
+ }\r
+ if (_currentTCNum + 1 != ResultNumber.Total)\r
+ {\r
+ Tizen.Log.Fatal("NUI", "Print the [not run] CurrentTCNum::" + _currentTCNum);\r
+ _currentTCNum++;\r
+ _notRun.Text = _listItem[_currentTCNum].Result;\r
+ UpdateDetailPage();\r
+ }
+ }
+
+ private void OnFocusGained(object sender, EventArgs e)\r
+ {\r
+ Button btn = sender as Button;\r
+ btn.Style.BackgroundImage = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/rectangle_point_btn_normal.png";\r
+ }
+
+ private void OnFocusLost(object sender, EventArgs e)\r
+ {\r
+ Button btn = sender as Button;\r
+ btn.Style.BackgroundImage = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/rectangle_toggle_btn_normal.png";\r
+ }
+
}
}
}
}
+ protected override void OnTerminate()
+ {\r
+ //Tizen.Log.Fatal("NUI", "### OnTerminate() START!");\r
+ if (ManualTest.IsWearable())
+ {
+ WearableManualTestNUI.GetInstance().Dispose();
+ }
+ else
+ {
+ ManualTestNUI.GetInstance().Dispose();
+ }
+
+ Exit();
+ base.OnTerminate();
+
+ //Tizen.Log.Fatal("NUI", "### OnTerminate() END!");
+ }
+
static void Main(string[] args)
{
Tizen.Log.Fatal("NUI", "Manual TCT for NUI start!");
using NUnit.Framework.TUnit;
using System.Reflection;
using Tizen.NUI.BaseComponents;
-using Tizen.NUI.UIComponents;
+using Tizen.NUI.Components;
namespace Tizen.NUI.Wearable.Tests
{
class WearableManualTestNUI
{
- private bool _isSelectRunButton;
+ class ListBridge : FlexibleView.Adapter
+ {
+ private List<string> _mDatas;
+ private List<ItemData> _mlistItem;
+
+ public ListBridge(List<string> datas, List<ItemData> item)
+ {
+ _mDatas = datas;
+ _mlistItem = item;
+ }
+
+ public void UpdateItemData(List<ItemData> item)
+ {
+ _mlistItem = item;
+ }
+
+ public override FlexibleView.ViewHolder OnCreateViewHolder(int viewType)
+ {
+ FlexibleView.ViewHolder viewHolder = new FlexibleView.ViewHolder(new ListItemView());
+ return viewHolder;
+ }
+
+ public override void OnBindViewHolder(FlexibleView.ViewHolder holder, int position)
+ {
+ string testcaseID = "#." + (position + 1).ToString();
+ string caseName = _mDatas[position];
+ string resultText = "[" + _mlistItem[(int)position].Result + "]";
+
+ ListItemView item = holder.ItemView as ListItemView;
+ if (item)
+ {
+ item.Size = new Size(Window.Instance.Size.Width, 120);
+ item.Name = position.ToString();
+ item.CaseID = testcaseID;
+ item.CaseName = caseName;
+ item.CaseResult = resultText;
+ }
+ }
+
+ public override void OnDestroyViewHolder(FlexibleView.ViewHolder holder)
+ {
+ if (holder.ItemView != null)
+ {
+ holder.ItemView.Dispose();
+ }
+ }
+
+ public override int GetItemCount()
+ {
+ return _mDatas.Count;
+ }
+ }
+
+ class ListItemView : View
+ {
+ private TextLabel _mID;
+ private TextLabel _mName;
+ private TextLabel _mResult;
+
+ public ListItemView()
+ {
+ WidthResizePolicy = ResizePolicyType.FillToParent;
+ HeightResizePolicy = ResizePolicyType.FillToParent;
+
+ _mID = new TextLabel();
+ _mID.TextColor = Color.White;
+ _mID.PointSize = 4.0f;
+ _mID.VerticalAlignment = VerticalAlignment.Center;
+ _mID.ParentOrigin = NUI.ParentOrigin.TopLeft;
+ _mID.PivotPoint = NUI.PivotPoint.TopLeft;
+ _mID.Size2D = new Size2D(40, _scrollHeight);
+ _mID.Position2D = new Position2D(0, 0);
+ Add(_mID);
+
+ _mName = new TextLabel();
+ _mName.ParentOrigin = NUI.ParentOrigin.TopLeft;
+ _mName.PivotPoint = NUI.PivotPoint.TopLeft;
+ _mName.Position = new Position(33, 0.0f, 0.0f);
+ _mName.Size = new Size(255, _scrollHeight);
+ _mName.VerticalAlignment = VerticalAlignment.Bottom;
+ _mName.PointSize = 4.0f;
+ _mName.TextColor = Color.Green;
+ _mName.MultiLine = true;
+ _mName.BackgroundImage = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/tw_bottom_btn_bg.png";
+ Add(_mName);
+
+ _mResult = new TextLabel();
+ _mResult.TextColor = Color.White;
+ _mResult.PointSize = 3.0f;
+ _mResult.ParentOrigin = NUI.ParentOrigin.TopLeft;
+ _mResult.PivotPoint = NUI.PivotPoint.TopLeft;
+ _mResult.Position = new Position(285.0f, 0.0f, 0.0f);
+ _mResult.Size2D = new Size2D(65, _scrollHeight);
+ _mResult.VerticalAlignment = VerticalAlignment.Center;
+ _mResult.HorizontalAlignment = HorizontalAlignment.Center;
+ Add(_mResult);
+ }
+
+ public string CaseID
+ {
+ get
+ {
+ return _mID.Text;
+ }
+ set
+ {
+ _mID.Text = value;
+ }
+ }
+
+ public string CaseName
+ {
+ get
+ {
+ return _mName.Text;
+ }
+ set
+ {
+ _mName.Text = value;
+ }
+ }
+
+ public string CaseResult
+ {
+ get
+ {
+ return _mResult.Text;
+ }
+ set
+ {
+ _mResult.Text = value;
+ }
+ }
+ }
+
+ class DetailListBridge : FlexibleView.Adapter
+ {
+ private List<string> _mDatas;
+
+ public DetailListBridge(List<string> datas)
+ {
+ _mDatas = datas;
+ }
+
+ public override FlexibleView.ViewHolder OnCreateViewHolder(int viewType)
+ {
+ FlexibleView.ViewHolder viewHolder = new FlexibleView.ViewHolder(new TextLabel());
+ return viewHolder;
+ }
+
+ public override void OnBindViewHolder(FlexibleView.ViewHolder 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(FlexibleView.ViewHolder holder)
+ {
+ if (holder.ItemView != null)
+ {
+ holder.ItemView.Dispose();
+ }
+ }
+
+ public override int GetItemCount()
+ {
+ return _mDatas.Count;
+ }
+ }
+
private List<string> _tcIDList;
private List<ItemData> _listItem;
private TSettings _tsettings;
private TRunner _tRunner;
private NavigationButton _pressButton = NavigationButton.NA;
- private PushButton passButton, failButton, blockButton, homeButton, preButton, nextButton, doneButton;
- private TextLabel notRun;
+ private 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 static float PointSize = 5.0f;
+ private static float _pointSize = 5.0f;
//Save the information of every single test case
- private List<TestcaseInfo> TCInfoList;
- private List<string> CurrentTCInfo;
+ private List<TestcaseInfo> _tcInfoList;
+ private List<string> _currentTCInfo;
- private static WearableManualTestNUI instance;
- private static Object lockObject = new object();
+ private static WearableManualTestNUI _instance;
+ private static Object _lockObject = new object();
//Show the result of all the test case
private TextLabel _summaryLabel1, _summaryLabel2, _description;
private View _initView;
private View _detailView;
-
- private ScrollView _initList;
- private ScrollView _detailList;
-
+ private FlexibleView _initList;
+ private ListBridge _adapter;
+ private FlexibleView _detailList;
+ private DetailListBridge _adapter_detail;
private View _caseView;
- private PushButton run;
- private PushButton runButton;
- private PushButton[] buttonList;
-
- private TextLabel[] resultList;
+ private Button _run;
+ private Button _runButton;
//Always save the current TC number;
- private int CurrentTCNum = 0;
+ private int _currentTCNum = 0;
private static int _scrollWidth = Window.Instance.Size.Width;
private static int _scrollHeight = 120;
private static int _detailScrollHeight = 60;
+ private bool _isSelectRunButton;
public static WearableManualTestNUI GetInstance()
{
- lock (lockObject)
+ lock (_lockObject)
{
- if (instance == null)
+ if (_instance == null)
{
- instance = new WearableManualTestNUI();
+ _instance = new WearableManualTestNUI();
}
}
- return instance;
+ return _instance;
}
private WearableManualTestNUI()
{
_isSelectRunButton = false;
Window.Instance.BackgroundColor = new Color(0.1f, 0.1f, 0.1f, 1.0f);
- Tizen.Log.Fatal("NUI", "Initialize=========================================");
- PointSize = (1.0f / Window.Instance.Dpi.Length()) * 2000.0f;
+ Tizen.Log.Fatal("ManualTCT", "Initialize=========================================");
+ Tizen.Log.Fatal("ManualTCT", $"App resource path: {Tizen.Applications.Application.Current.DirectoryInfo.Resource}");
+ _pointSize = (1.0f / Window.Instance.Dpi.Length()) * 2000.0f;
RunType.Value = RunType.MANUAL;
_tRunner = new TRunner();
_tRunner.LoadTestsuite();
_tcIDList.Add(pair.Key);
count++;
}
- Tizen.Log.Fatal("NUI", "TCT : count:" + count.ToString());
+ Tizen.Log.Fatal("ManualTCT", "TCT : count:" + count.ToString());
foreach (String nameTc in _tcIDList)
{
- Tizen.Log.Fatal("NUI", "TCT : TCName:" + nameTc.ToString());
+ Tizen.Log.Fatal("ManualTCT", "TCT : TCName:" + nameTc.ToString());
}
window.GetDefaultLayer().Add(_detailView);
}
+ void SetCommonButtonStyle(Button btn, string text, int? left = null)
+ {
+ if (null == btn) return;
+ btn.Style.Text.Text = text;
+ btn.Style.Text.TextColor = Color.Green;
+ if (left.HasValue) // for detail buttons
+ {
+ btn.Style.Text.Position = new Position(left.Value, 0);
+ btn.Style.Text.Size = new Size(30, 30);
+ btn.Style.Text.PointSize = _pointSize;
+ }
+ else // for home buttons
+ {
+ btn.Style.Text.PointSize = 6.0f;
+ }
+ btn.Style.Text.VerticalAlignment = VerticalAlignment.Bottom;
+ btn.Style.Text.HorizontalAlignment = HorizontalAlignment.Center;
+ btn.Style.BackgroundImage = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/tw_bottom_btn_bg.png";
+ }
+
void InitializeFirstPage()
{
//Create Run Button, when you Click it, then the first test case will be executed.
- doneButton = new PushButton();
- doneButton.Size2D = new Size2D(120, 60);
- doneButton.Position2D = new Position2D(-150, -200);
- //doneButton.Position2D = new Position2D(50, 0);
- doneButton.Label = CreateTextVisual("Done", Color.White);
- doneButton.Clicked += (obj, ee) =>
- {
- TSettings.GetInstance().SubmitManualResult();
- return false;
- };
-
- run = new PushButton();
- run.Size2D = new Size2D(120, 60);
- run.Position2D = new Position2D(20, -200);
- //run.Position2D = new Position2D(180, 0);
- run.Label = CreateTextVisual("Runner", Color.White); ;
- run.Clicked += (obj, ee) =>
- {
- Tizen.Log.Fatal("NUI", "Check all the test case from the first one.");
- CurrentTCNum = 0;
- _initView.Hide();
- _caseView.Hide();
- UpdateDetailPage();
- _detailView.Show();
- return false;
- };
-
- _initList = new ScrollView();
- _initList.Size2D = new Size2D(_scrollWidth, _scrollHeight);
- _initList.ParentOrigin = ParentOrigin.TopLeft;
- _initList.PivotPoint = PivotPoint.TopLeft;
- _initList.Position2D = new Position2D(0, 80);
- _initList.ClippingMode = ClippingModeType.ClipChildren;
+ _doneButton = new Button();
+ _doneButton.Size = new Size(120, 60);
+ _doneButton.Position = new Position(30, 0);//-150, -200
+ SetCommonButtonStyle(_doneButton, "Done");
+ _doneButton.ClickEvent += OnDoneButtonClicked;
+
+ _run = new Button();
+ _run.Size = new Size(120, 60);
+ _run.Position = new Position(180, 0); //20, -200
+ SetCommonButtonStyle(_run, "Runner");
+ _run.ClickEvent += OnRunnerButtonClicked;
+
CreateInitList();
- _initView.Add(doneButton);
- _initView.Add(run);
+ _initView.Add(_doneButton);
+ _initView.Add(_run);
_initView.Add(_initList);
- Tizen.Log.Fatal("NUI", "TCT : InitializeFirstPage:");
+ Tizen.Log.Fatal("ManualTCT", "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::::::::::::::::::::::");
+ Tizen.Log.Fatal("ManualTCT", "UpdateDetailPage::::::::::::::::::::::");
CreateTestCase();
}
void InitializeDetailPage()
{
- _detailList = new ScrollView();
- _detailList.BackgroundColor = Color.Black;
- _detailList.Size2D = new Size2D(_scrollWidth - 100, _detailScrollHeight);
- _detailList.ParentOrigin = ParentOrigin.TopLeft;
- _detailList.PivotPoint = PivotPoint.TopLeft;
- _detailList.Position2D = new Position2D(30, 20);
- _detailList.ClippingMode = ClippingModeType.ClipChildren;
-
_description = new TextLabel();
_description.TextColor = Color.White;
_description.PointSize = 3.0f;
_detailView.Add(_description);
CreateDetailList();
- _detailView.Add(_detailList);
//To Place the function button, such as PASS, FAIL.....
CreateButtons();
_detailView.Remove(_detailList);
_detailList.Dispose();
}
- Tizen.Log.Fatal("NUI", "Print the CurrentTCNum here::" + CurrentTCNum);
+ Tizen.Log.Fatal("ManualTCT", "Print the CurrentTCNum here::" + _currentTCNum);
- _detailList = new ScrollView();
- _detailList.BackgroundColor = Color.Black;
- _detailList.Size2D = new Size2D(_scrollWidth - 100, _detailScrollHeight);
- _detailList.ParentOrigin = ParentOrigin.TopLeft;
- _detailList.PivotPoint = PivotPoint.TopLeft;
- _detailList.Position2D = new Position2D(30, 20);
- _detailList.ClippingMode = ClippingModeType.ClipChildren;
CreateDetailList();
- _detailView.Add(_detailList);
- if (notRun)
+ if (_notRun)
{
- notRun.Text = _listItem[CurrentTCNum].Result;
+ _notRun.Text = _listItem[_currentTCNum].Result;
}
}
+
private TextLabel CreateTextLabel(string textStr, int left)
{
TextLabel text = new TextLabel();
text.PointSize = 5.0f;
text.VerticalAlignment = VerticalAlignment.Bottom;
text.HorizontalAlignment = HorizontalAlignment.Center;
- text.Size2D = new Size2D(30, 30);
- text.Position2D = new Position2D(left, 0);
+ text.Size = new Size(30, 30);
+ text.Position = new Position(left, 0);
return text;
}
+
//Create all the function buttons here, such as PASS, FAIL.....
void CreateButtons()
{
-
- notRun = new TextLabel();
- notRun.TextColor = Color.White;
- notRun.Size2D = new Size2D(40, 30);
- notRun.PointSize = 2.5f;
- notRun.Position2D = new Position2D(260, 118);
- notRun.HorizontalAlignment = HorizontalAlignment.Center;
- notRun.VerticalAlignment = VerticalAlignment.Center;
- notRun.MultiLine = true;
- notRun.Text = "Not Run";
-
- TextLabel pass = CreateTextLabel("P", 20);
- passButton = new PushButton();
- passButton.Size2D = new Size2D(70, 30);
- passButton.Position2D = new Position2D(0, 0);
- passButton.LabelText = "";
- passButton.Add(pass);
- passButton.Clicked += (obj, ee) =>
- {
-
- Clear();
- if (!ManualTest.IsConfirmed())
- {
- _tsettings.TCResult = StrResult.PASS;
- ManualTest.Confirm();
- }
- Tizen.Log.Fatal("TBT", "Pass Button clicked!");
- return true;
- };
-
- TextLabel fail = CreateTextLabel("F", 20);
- failButton = new PushButton();
- failButton.Size2D = new Size2D(70, 30);
- failButton.Position2D = new Position2D(72, 0);
- failButton.LabelText = "";
- failButton.Add(fail);
- failButton.Clicked += (obj, ee) =>
- {
- Clear();
- if (!ManualTest.IsConfirmed())
- {
- _tsettings.TCResult = StrResult.FAIL;
- ManualTest.Confirm();
- }
- Tizen.Log.Fatal("TBT", "Fail Button clicked!");
- return true;
- };
-
- TextLabel block = CreateTextLabel("B", 20);
- blockButton = new PushButton();
- blockButton.Size2D = new Size2D(70, 30);
- blockButton.Position2D = new Position2D(144, 0);
- blockButton.LabelText = "";
- blockButton.Add(block);
- blockButton.Clicked += (obj, ee) =>
- {
- Clear();
- if (!ManualTest.IsConfirmed())
- {
- _tsettings.TCResult = StrResult.BLOCK;
- ManualTest.Confirm();
- }
- return true;
- };
-
- TextLabel run = CreateTextLabel("R", 20);
- runButton = new PushButton();
- runButton.Size2D = new Size2D(70, 30);
- runButton.Position2D = new Position2D(216, 0);
- runButton.LabelText = "";
- runButton.Add(run);
- runButton.Clicked += (obj, ee) =>
- {
- if(_isSelectRunButton == false)\r
- {\r
- _isSelectRunButton = true;\r
- Clear();\r
- //should update the _caseView by the test case\r
- _pressButton = NavigationButton.NA;\r
- _tsettings.Testcase_ID = _tcIDList[CurrentTCNum];\r
- _tsettings.TCResult = "";\r
- _tRunner.Execute();\r
- }
- return true;
- };
-
- TextLabel home = CreateTextLabel("H", 15);
- homeButton = new PushButton();
- homeButton.Size2D = new Size2D(60, 30);
- homeButton.Position2D = new Position2D(15, 32);
- homeButton.LabelText = "";
- homeButton.Add(home);
- homeButton.Clicked += (obj, ee) =>
- {
- Clear();
- _pressButton = NavigationButton.Home;
- if (!ManualTest.IsConfirmed())
- {
- _tsettings.TCResult = StrResult.NOTRUN;
- ManualTest.Confirm();
- }
- else
- {
- _detailView.Hide();
- _initView.Show();
- }
- return true;
- };
-
- TextLabel pre = CreateTextLabel("<<", 15);
- preButton = new PushButton();
- preButton.Size2D = new Size2D(60, 30);
- preButton.Position2D = new Position2D(128, 32);
- preButton.LabelText = "";
- preButton.Add(pre);
- preButton.Clicked += (obj, ee) =>
- {
- Clear();
- if (!ManualTest.IsConfirmed())
- {
- _tsettings.TCResult = StrResult.NOTRUN;
- ManualTest.Confirm();
- }
- else
- {
- if (CurrentTCNum != 0)
- {
- CurrentTCNum--;
- notRun.Text = _listItem[CurrentTCNum].Result;
- ManualTest.Confirm();
- UpdateDetailPage();
- }
- }
- return true;
- };
-
- TextLabel next = CreateTextLabel(">>", 15);
- nextButton = new PushButton();
- nextButton.Size2D = new Size2D(60, 30);
- nextButton.Position2D = new Position2D(193, 32);
- nextButton.Add(next);
- nextButton.LabelText = "";
- nextButton.Clicked += (obj, ee) =>
- {
- Clear();
- if (!ManualTest.IsConfirmed())
- {
- _tsettings.TCResult = StrResult.NOTRUN;
- ManualTest.Confirm();
- }
- if (CurrentTCNum + 1 != ResultNumber.Total)
- {
- Tizen.Log.Fatal("NUI", "Print the [not run] CurrentTCNum::" + CurrentTCNum);
- CurrentTCNum++;
- notRun.Text = _listItem[CurrentTCNum].Result;
- UpdateDetailPage();
- }
- return true;
- };
+ _passButton = new Button();
+ SetCommonButtonStyle(_passButton, "P", 20);
+ _passButton.Size = new Size(70, 30);
+ _passButton.Position = new Position(0, 0);
+ _passButton.ClickEvent += OnPassButtonClicked;
+
+ _failButton = new Button();
+ SetCommonButtonStyle(_failButton, "F", 20);
+ _failButton.Size = new Size(70, 30);
+ _failButton.Position = new Position(72, 0);
+ _failButton.ClickEvent += OnFailButtonClicked;
+
+ _blockButton = new Button();
+ SetCommonButtonStyle(_blockButton, "B", 20);
+ _blockButton.Size = new Size(70, 30);
+ _blockButton.Position = new Position(144, 0);
+ _blockButton.ClickEvent += OnBlockButtonClicked;
+
+ _runButton = new Button();
+ SetCommonButtonStyle(_runButton, "R", 20);
+ _runButton.Size = new Size(70, 30);
+ _runButton.Position = new Position(216, 0);
+ _runButton.ClickEvent += OnRunButtonClicked;
+
+ _homeButton = new Button();
+ SetCommonButtonStyle(_homeButton, "H", 15);
+ _homeButton.Size = new Size(60, 30);
+ _homeButton.Position = new Position(15, 32);
+ _homeButton.ClickEvent += OnHomeButtonClicked;
+
+ _notRun = new TextLabel();
+ _notRun.TextColor = Color.White;
+ _notRun.Size = new Size(40, 30);
+ _notRun.PointSize = 2.5f;
+ _notRun.Position = new Position(82, 32);
+ _notRun.HorizontalAlignment = HorizontalAlignment.Center;
+ _notRun.VerticalAlignment = VerticalAlignment.Center;
+ _notRun.MultiLine = true;
+ _notRun.Text = "Not Run";
+
+ _preButton = new Button();
+ SetCommonButtonStyle(_preButton, "<<", 15);
+ _preButton.Size = new Size(60, 30);
+ _preButton.Position = new Position(128, 32);
+ _preButton.ClickEvent += OnPreButtonClicked;
+
+ _nextButton = new Button();
+ SetCommonButtonStyle(_nextButton, ">>", 15);
+ _nextButton.Size = new Size(60, 30);
+ _nextButton.Position = new Position(193, 32);
+
+ _nextButton.ClickEvent += OnNextButtonClicked;
View buttonView = new View();
buttonView.ParentOrigin = ParentOrigin.TopLeft;
buttonView.PivotPoint = PivotPoint.TopLeft;
- buttonView.Size2D = new Size2D(Window.Instance.Size.Width, 80);
- buttonView.Position2D = new Position2D(-140, 120);
-
- buttonView.Add(passButton);
- buttonView.Add(failButton);
- buttonView.Add(blockButton);
- buttonView.Add(runButton);
- buttonView.Add(homeButton);
- buttonView.Add(notRun);
- buttonView.Add(preButton);
- buttonView.Add(nextButton);
+ buttonView.Size = new Size(Window.Instance.Size.Width-30, 80);
+ buttonView.Position = new Position(40, 180); // 30, 150
+
+ 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);
}
Tizen.Log.Fatal("ManualTCT", "Execute the manual test case!");
_caseView = view;
- _caseView.ParentOrigin = Position.ParentOriginTopLeft;
+ _caseView.ParentOrigin = ParentOrigin.TopLeft;
_caseView.PivotPoint = PivotPoint.TopLeft;
_caseView.Position = new Position(40.0f, 120.0f, 0.0f);
_detailView.Add(_caseView);
public void ClearTestCase(View view)
{
- Tizen.Log.Fatal("NUI", "Clear test case!");
+ Tizen.Log.Fatal("ManualTCT", "Clear test case!");
_detailView.Remove(view);
}
+ public void Dispose()\r
+ {\r
+ if (_passButton)\r
+ {\r
+ _passButton.ClickEvent -= OnPassButtonClicked;\r
+ _passButton.GetParent()?.Remove(_passButton);\r
+ _passButton.Dispose();\r
+ _passButton = null;\r
+ }\r
+ if (_failButton)
+ {
+ _failButton.ClickEvent -= OnFailButtonClicked;
+ _failButton.GetParent()?.Remove(_failButton);\r
+ _failButton.Dispose();\r
+ _failButton = null;
+ }
+ if (_blockButton)
+ {
+ _blockButton.ClickEvent -= OnBlockButtonClicked;
+ _blockButton.GetParent()?.Remove(_blockButton);\r
+ _blockButton.Dispose();\r
+ _blockButton = null;
+ }\r
+ if (_runButton)
+ {
+ _runButton.ClickEvent -= OnRunButtonClicked;
+ _runButton.GetParent()?.Remove(_runButton);\r
+ _runButton.Dispose();\r
+ _runButton = null;
+ }\r
+ if (_homeButton)
+ {
+ _homeButton.ClickEvent -= OnHomeButtonClicked;
+ _homeButton.GetParent()?.Remove(_homeButton);\r
+ _homeButton.Dispose();\r
+ _homeButton = null;
+ }\r
+ if (_preButton)
+ {
+ _preButton.ClickEvent -= OnPreButtonClicked;
+ _preButton.GetParent()?.Remove(_preButton);\r
+ _preButton.Dispose();\r
+ _preButton = null;
+ }\r
+ if (_nextButton)
+ {
+ _nextButton.ClickEvent -= OnNextButtonClicked;
+ _nextButton.GetParent()?.Remove(_nextButton);\r
+ _nextButton.Dispose();\r
+ _nextButton = null;
+ }
+
+ if (_detailView)\r
+ {\r
+ _detailView.GetParent()?.Remove(_detailView);\r
+ _detailView.Dispose();\r
+ _detailView = null;\r
+ }
+ if (_initList)\r
+ {\r
+ _initList.ItemClickEvent -= OnItemClickEvent;\r
+ _initList.GetParent()?.Remove(_initList);\r
+ _initList.Dispose();\r
+ _initList = null;\r
+ }
+ if (_doneButton)\r
+ {\r
+ _doneButton.ClickEvent -= OnDoneButtonClicked;\r
+ _doneButton.GetParent()?.Remove(_doneButton);\r
+ _doneButton.Dispose();\r
+ _doneButton = null;\r
+ }
+ if (_run)\r
+ {\r
+ _run.ClickEvent -= OnRunnerButtonClicked;\r
+ _run.GetParent()?.Remove(_run);\r
+ _run.Dispose();\r
+ _run = null;\r
+ }
+
+ if (_initView)\r
+ {\r
+ _initView.GetParent()?.Remove(_initView);\r
+ _initView.Dispose();\r
+ _initView = null;\r
+ }\r
+ }
+
//Use to update the _summaryLabel.
private void SetSummaryResult()
{
Tizen.Log.Fatal("ManualTCT", "Set the result Text");
}
- private PropertyMap CreateTextMap(float pointSize, string text)
- {
- PropertyMap map = new PropertyMap();
- map.Insert("visualType", new PropertyValue("TEXT"));
- map.Insert("pointSize", new PropertyValue(pointSize));
- map.Insert("text", new PropertyValue(text));
- return map;
- }
-
private void CreateInitList()
{
- int tcNum = _tcIDList.Count;
- buttonList = new PushButton[tcNum];
- resultList = new TextLabel[tcNum];
- for (int index = 0; index < tcNum; index++)
- {
- string name = _tcIDList[index];
- string testcaseName = "#." + (index + 1).ToString();
- Tizen.Log.Fatal("ManualTCT", "name: " + name);
- TextLabel label = new TextLabel();
- label.TextColor = Color.White;
- label.Text = testcaseName;
- label.PointSize = 4.0f;
- label.VerticalAlignment = VerticalAlignment.Center;
- label.ParentOrigin = ParentOrigin.TopLeft;
- label.PivotPoint = PivotPoint.TopLeft;
- label.Size2D = new Size2D(40, _scrollHeight);
- label.Position2D = new Position2D(0, 0);
-
-
- TextLabel nameLabel = new TextLabel();
- nameLabel.ParentOrigin = ParentOrigin.TopLeft;
- nameLabel.PivotPoint = PivotPoint.TopLeft;
- nameLabel.Text = name;
- nameLabel.VerticalAlignment = VerticalAlignment.Bottom;
- nameLabel.PointSize = 4.0f;
- nameLabel.TextColor = Color.White;
- nameLabel.MultiLine = true;
- nameLabel.Size2D = new Size2D(245, _scrollHeight);
- nameLabel.Position2D = new Position2D(5, 0);
- nameLabel.TextColor = Color.White;
-
- string resultText = "[" + _listItem[(int)index].Result + "]";
- buttonList[index] = new PushButton();
- buttonList[index].Name = index.ToString();
- buttonList[index].ParentOrigin = ParentOrigin.TopLeft;
- buttonList[index].PivotPoint = PivotPoint.TopLeft;
- buttonList[index].Position = new Position(33, 0.0f, 0.0f);
- buttonList[index].Size2D = new Size2D(255, _scrollHeight);
- buttonList[index].LabelText = "";
- buttonList[index].Add(nameLabel);
- buttonList[index].Clicked += (obj, e) =>
- {
- PushButton button = obj as PushButton;
-
- Tizen.Log.Fatal("TBT", "Item clicked!!!!!!!!!!!!!!::" + button.Name);
- CurrentTCNum = int.Parse(button.Name);
- _initView.Hide();
- UpdateDetailPage();
- _caseView.Hide();
- _detailView.Show();
- return false;
- };
-
- resultList[index] = new TextLabel();
- resultList[index].TextColor = Color.White;
- resultList[index].PointSize = 3.0f;
- resultList[index].Name = index.ToString();
- resultList[index].Text = resultText;
- resultList[index].ParentOrigin = ParentOrigin.TopLeft;
- resultList[index].PivotPoint = PivotPoint.TopLeft;
- resultList[index].Position = new Position(285.0f, 0.0f, 0.0f);
- resultList[index].Size2D = new Size2D(65, _scrollHeight);
- resultList[index].VerticalAlignment = VerticalAlignment.Center;
- resultList[index].HorizontalAlignment = HorizontalAlignment.Center;
-
- View pageActor = new View();
- pageActor.WidthResizePolicy = ResizePolicyType.FillToParent;
- pageActor.HeightResizePolicy = ResizePolicyType.FillToParent;
- pageActor.ParentOrigin = ParentOrigin.TopLeft;
- pageActor.PivotPoint = PivotPoint.TopLeft;
- pageActor.Position = new Position(0, index * _scrollHeight, 0.0f);
-
- pageActor.Add(label);
- pageActor.Add(buttonList[index]);
- pageActor.Add(resultList[index]);
- _initList.Add(pageActor);
- }
- _initList.SetAxisAutoLock(false);
- PropertyMap rulerMapY = new PropertyMap();
- rulerMapY.Add((int)ScrollModeType.XAxisScrollEnabled, new PropertyValue(false));
- rulerMapY.Add((int)ScrollModeType.YAxisScrollEnabled, new PropertyValue(true));
- rulerMapY.Add((int)ScrollModeType.YAxisSnapToInterval, new PropertyValue(_scrollHeight));
- rulerMapY.Add((int)ScrollModeType.YAxisScrollBoundary, new PropertyValue(_scrollHeight * tcNum));
- _initList.ScrollMode = rulerMapY;
-
- Tizen.Log.Fatal("ManualTCT", "Initial ScrollView");
+ Tizen.Log.Fatal("ManualTCT", "CreateInitList");
+ _initList = new FlexibleView();
+ _initList.ParentOrigin = ParentOrigin.TopLeft;
+ _initList.PivotPoint = PivotPoint.TopLeft;
+ _initList.Size = new Size(Window.Instance.Size.Width, 120); //400
+ _initList.Position = new Position(0, 80); //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.ItemClickEvent += OnItemClickEvent;
}
private void CreateDetailList()
{
- Tizen.Log.Fatal("NUI", "Print the CreateDetailList::count: " + CurrentTCInfo.Count);
- int senNum = CurrentTCInfo.Count;
- _description.Text = CurrentTCInfo[0];
- for (int index = 1; index < senNum; index++)
- {
- TextLabel description = new TextLabel();
- description.TextColor = Color.White;
- description.ParentOrigin = ParentOrigin.TopLeft;
- description.PivotPoint = PivotPoint.TopLeft;
- description.Position = new Position(0.0f, 0.0f, 0.0f);
- description.Size2D = new Size2D((int)Window.Instance.Size.Width - 100, _detailScrollHeight);
- description.HorizontalAlignment = HorizontalAlignment.Begin;
- description.VerticalAlignment = VerticalAlignment.Center;
- description.PointSize = 3.0f;
- description.MultiLine = true;
- description.Text = CurrentTCInfo[(int)index];
-
- View pageActor = new View();
- pageActor.WidthResizePolicy = ResizePolicyType.FillToParent;
- pageActor.HeightResizePolicy = ResizePolicyType.FillToParent;
- pageActor.ParentOrigin = ParentOrigin.TopLeft;
- pageActor.PivotPoint = PivotPoint.TopLeft;
- pageActor.Position = new Position(0, (index - 1) * _detailScrollHeight, 0.0f);
- pageActor.Add(description);
- _detailList.Add(pageActor);
- }
- _detailList.SetAxisAutoLock(false);
- PropertyMap rulerMapY = new PropertyMap();
- rulerMapY.Add((int)ScrollModeType.XAxisScrollEnabled, new PropertyValue(false));
- rulerMapY.Add((int)ScrollModeType.YAxisScrollEnabled, new PropertyValue(true));
- rulerMapY.Add((int)ScrollModeType.YAxisSnapToInterval, new PropertyValue(_detailScrollHeight));
- rulerMapY.Add((int)ScrollModeType.YAxisScrollBoundary, new PropertyValue(_detailScrollHeight * (senNum - 1)));
- _detailList.ScrollMode = rulerMapY;
+ Tizen.Log.Fatal("ManualTCT", "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
ResultNumber.Pass = 0;
ResultNumber.Fail = 0;
ResultNumber.Block = 0;
- TCInfoList = new List<TestcaseInfo>();
+ _tcInfoList = new List<TestcaseInfo>();
foreach (KeyValuePair<string, ITest> pair in _tRunner.GetTestList())
{
List<string> preconditions = new List<string>();
postconditions.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);
}
}
- TCInfoList.Add(new TestcaseInfo
+ _tcInfoList.Add(new TestcaseInfo
{
TestcaseName = pair.Key,
Preconditions = preconditions,
//The data in CurrentTCInfo list will be show in _detailList.
void UpdateCurrentTCInfo()
{
- CurrentTCInfo = new List<string>();
- 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 = new List<string>();
+ Tizen.Log.Fatal("ManualTCT", "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]);
+ _currentTCInfo.Add(_tcInfoList[_currentTCNum].Preconditions[index]);
}
- for(int index = 0; index < TCInfoList[CurrentTCNum].Steps.Count; index++ )
+ for(int index = 0; index < _tcInfoList[_currentTCNum].Steps.Count; index++ )
{
- CurrentTCInfo.Add(TCInfoList[CurrentTCNum].Steps[index]);
+ _currentTCInfo.Add(_tcInfoList[_currentTCNum].Steps[index]);
}
- for(int index = 0; index < TCInfoList[CurrentTCNum].Postconditions.Count; index++ )
+ for(int index = 0; index < _tcInfoList[_currentTCNum].Postconditions.Count; index++ )
{
- CurrentTCInfo.Add(TCInfoList[CurrentTCNum].Postconditions[index]);
+ _currentTCInfo.Add(_tcInfoList[_currentTCNum].Postconditions[index]);
}
- Tizen.Log.Fatal("NUI", "Ppppppppppppppppppppppprint the CurrentTCNum::" + CurrentTCNum);
+ Tizen.Log.Fatal("ManualTCT", "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!");
+ Tizen.Log.Fatal("ManualTCT", "OnSingleTestDone has been triggered!");
// check old result
- if (_listItem[CurrentTCNum].Result.Contains(StrResult.FAIL))
+ if (_listItem[_currentTCNum].Result.Contains(StrResult.FAIL))
{
ResultNumber.Fail = ResultNumber.Fail - 1;
}
- else if (_listItem[CurrentTCNum].Result.Contains(StrResult.PASS))
+ else if (_listItem[_currentTCNum].Result.Contains(StrResult.PASS))
{
ResultNumber.Pass = ResultNumber.Pass - 1;
}
- else if (_listItem[CurrentTCNum].Result.Contains(StrResult.BLOCK))
+ else if (_listItem[_currentTCNum].Result.Contains(StrResult.BLOCK))
ResultNumber.Block = ResultNumber.Block - 1;
// Update new result
- _listItem[CurrentTCNum].Result = e.Result;
+ _listItem[_currentTCNum].Result = e.Result;
if (e.Result.Contains(StrResult.PASS))
{
ResultNumber.Pass += 1;
{
ResultNumber.Block += 1;
}
- TextLabel label = resultList[CurrentTCNum];
- label.Text = _listItem[(int)CurrentTCNum].Result;
+
+ FlexibleView.ViewHolder holder = _initList?.FindViewHolderForAdapterPosition(_currentTCNum);
+ if (holder != null)
+ {
+ string testcaseName = "#." + (_currentTCNum + 1).ToString() + _tcIDList[_currentTCNum];
+ string resultText = "[" + _listItem[(int)_currentTCNum].Result + "]";
+ ListItemView item = holder.ItemView as ListItemView;
+ item.CaseResult = resultText;
+ _adapter?.UpdateItemData(_listItem);
+ }
SetSummaryResult();
- notRun.Text = _listItem[CurrentTCNum].Result;
+ _notRun.Text = _listItem[_currentTCNum].Result;
}
- private PropertyMap CreateTextVisual(string text, Color color)
- {
- PropertyMap map = new PropertyMap();
- map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Text));
- map.Add(TextVisualProperty.Text, new PropertyValue(text));
- map.Add(TextVisualProperty.TextColor, new PropertyValue(color));
- map.Add(TextVisualProperty.PointSize, new PropertyValue(6.0f));
- map.Add(TextVisualProperty.HorizontalAlignment, new PropertyValue("CENTER"));
- map.Add(TextVisualProperty.VerticalAlignment, new PropertyValue("BOTTOM"));
- return map;
+ private void OnItemClickEvent(object sender, FlexibleView.ItemClickEventArgs e)\r
+ {\r
+ ListItemView item = e.ClickedView.ItemView as ListItemView;\r
+ if (item)\r
+ {\r
+ Tizen.Log.Fatal("ManualTCT", "Item clicked!!::" + item.Name);\r
+ _currentTCNum = int.Parse(item.Name);\r
+ _initView.Hide();\r
+ UpdateDetailPage();\r
+ _caseView.Hide();\r
+ _detailView.Show();\r
+ }\r
+ }
+
+ private void OnDoneButtonClicked(object sender, Button.ClickEventArgs e)\r
+ {\r
+ TSettings.GetInstance().SubmitManualResult();
+ }\r
+\r
+ private void OnRunnerButtonClicked(object sender, Button.ClickEventArgs e)\r
+ {\r
+ Tizen.Log.Fatal("ManualTCT", "Check all the test case from the first one.");\r
+ _currentTCNum = 0;\r
+ _initView.Hide();\r
+ _caseView.Hide();\r
+ UpdateDetailPage();\r
+ _detailView.Show();
+ }\r
+\r
+ private void OnPassButtonClicked(object sender, Button.ClickEventArgs e)\r
+ {\r
+ Clear();\r
+ if (!ManualTest.IsConfirmed())\r
+ {\r
+ _tsettings.TCResult = StrResult.PASS;\r
+ ManualTest.Confirm();\r
+ }\r
+ Tizen.Log.Fatal("TBT", "Pass Button clicked!");\r
+ }
+
+ private void OnFailButtonClicked(object sender, Button.ClickEventArgs e)\r
+ {\r
+ Clear();\r
+ if (!ManualTest.IsConfirmed())\r
+ {\r
+ _tsettings.TCResult = StrResult.FAIL;\r
+ ManualTest.Confirm();\r
+ }\r
+ Tizen.Log.Fatal("TBT", "Fail Button clicked!");\r
+ }
+
+ private void OnBlockButtonClicked(object sender, Button.ClickEventArgs e)\r
+ {\r
+ Clear();\r
+ if (!ManualTest.IsConfirmed())\r
+ {\r
+ _tsettings.TCResult = StrResult.BLOCK;\r
+ ManualTest.Confirm();\r
+ }\r
+ }\r
+\r
+ private void OnRunButtonClicked(object sender, Button.ClickEventArgs e)\r
+ {\r
+ if (_isSelectRunButton == false)\r
+ {\r
+ _isSelectRunButton = true;\r
+ Clear();\r
+ //should update the _caseView by the test case\r
+ _pressButton = NavigationButton.NA;\r
+ _tsettings.Testcase_ID = _tcIDList[_currentTCNum];\r
+ _tsettings.TCResult = "";\r
+ _tRunner.Execute();\r
+ }\r
+ }
+
+ private void OnHomeButtonClicked(object sender, Button.ClickEventArgs e)\r
+ {\r
+ Clear();\r
+ _pressButton = NavigationButton.Home;\r
+ if (!ManualTest.IsConfirmed())\r
+ {\r
+ _tsettings.TCResult = StrResult.NOTRUN;\r
+ ManualTest.Confirm();\r
+ }\r
+ else\r
+ {\r
+ _detailView.Hide();\r
+ _initView.Show();\r
+ }\r
+ }\r
+\r
+ private void OnPreButtonClicked(object sender, Button.ClickEventArgs e)\r
+ {\r
+ Clear();\r
+ if (!ManualTest.IsConfirmed())\r
+ {\r
+ _tsettings.TCResult = StrResult.NOTRUN;\r
+ ManualTest.Confirm();\r
+ }\r
+ else\r
+ {\r
+ if (_currentTCNum != 0)\r
+ {\r
+ _currentTCNum--;\r
+ _notRun.Text = _listItem[_currentTCNum].Result;\r
+ ManualTest.Confirm();\r
+ UpdateDetailPage();\r
+ }\r
+ }\r
+ }
+
+ private void OnNextButtonClicked(object sender, Button.ClickEventArgs e)\r
+ {\r
+ Clear();\r
+ if (!ManualTest.IsConfirmed())\r
+ {\r
+ _tsettings.TCResult = StrResult.NOTRUN;\r
+ ManualTest.Confirm();\r
+ }\r
+ if (_currentTCNum + 1 != ResultNumber.Total)\r
+ {\r
+ Tizen.Log.Fatal("ManualTCT", "Print the [not run] CurrentTCNum::" + _currentTCNum);\r
+ _currentTCNum++;\r
+ _notRun.Text = _listItem[_currentTCNum].Result;\r
+ UpdateDetailPage();\r
+ }\r
}
}
}
using Tizen.Applications;
using Tizen.NUI;
using Tizen.NUI.BaseComponents;
-using Tizen.NUI.UIComponents;
+using Tizen.NUI.Components;
namespace Tizen.NUI.Wearable.Tests
{
private bool _isWearable = false;
private bool _isEmulator = false;
private WearableManualTestNUI _testPage;
- private PushButton _infoButton;
+ private Button _infoButton;
[SetUp]
public void Init()
Log.Info("TCT", "Postconditions for each TEST");
}\r
\r
- private PropertyMap CreateTextMap(float pointSize, string text)
+ private void CreateButton()
{
- PropertyMap map = new PropertyMap();
- map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Text));
- map.Add(TextVisualProperty.Text, new PropertyValue(text));
- map.Add(TextVisualProperty.PointSize, new PropertyValue(pointSize));
+ _infoButton = new Button();
+ _infoButton.Style.Text.Text = "Clicked run, Please refer test step";
+ _infoButton.Style.Text.PointSize = 5.0f;
if (ManualTest.IsWearable())
{
- map.Add(TextVisualProperty.TextColor, new PropertyValue(Color.White));
- map.Add(TextVisualProperty.HorizontalAlignment, new PropertyValue("CENTER"));
- map.Add(TextVisualProperty.VerticalAlignment, new PropertyValue("BOTTOM"));
+ _infoButton.Style.Text.TextColor = Color.White;
+ _infoButton.Style.Text.HorizontalAlignment = HorizontalAlignment.Center;
+ _infoButton.Style.Text.VerticalAlignment = VerticalAlignment.Bottom;
}
- return map;
- }\r
-\r
- private void CreateButton()
- {
- _infoButton = new PushButton();
- _infoButton.Label = CreateTextMap(5.0f, "Clicked run, Please refer test step");\r
- _infoButton.Size2D = new Size2D(300, 50);\r
+ _infoButton.Size = new Size(300, 50);\r
_testPage.ExecuteTC(_infoButton);
}