/*
-* Copyright (c) 2017 Samsung Electronics Co., Ltd.
+* 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.
using NUnit.Framework.TUnit;
using System.Reflection;
using Tizen.NUI.BaseComponents;
-using Tizen.NUI.Components;
-
+using Tizen.NUI.Components;\r
+\r
namespace Tizen.NUI.Tests
{
class WearableManualTestNUI
public override FlexibleView.ViewHolder OnCreateViewHolder(int viewType)
{
- FlexibleView.ViewHolder viewHolder = new FlexibleView.ViewHolder(new Button());
+ FlexibleView.ViewHolder viewHolder = new FlexibleView.ViewHolder(new Button(new ButtonStyle()));
return viewHolder;
}
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.Style.Text.TextColor = Color.White;
- btn.Style.BackgroundImage = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/controller_btn_check_on.png";
- btn.Style.BackgroundImageBorder = new Rectangle(5, 5, 5, 5);
+ if (btn)\r
+ {\r
+ btn.Size = new Size(Window.Instance.Size.Width, 120);\r
+ btn.Name = position.ToString();\r
+ btn.Text = text;\r
+ btn.PointSize = 4.0f;\r
+ btn.TextAlignment = HorizontalAlignment.Begin;\r
+ btn.Style.Text.TextColor = Color.White;\r
+ btn.Style.BackgroundImage = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/controller_btn_check_on.png";\r
+ btn.Style.BackgroundImageBorder = new Rectangle(5, 5, 5, 5);\r
}
}
{
return _mDatas.Count;
}
- }
-
+ }\r
+\r
class DetailListBridge : FlexibleView.Adapter
{
private List<string> _mDatas;
public override FlexibleView.ViewHolder OnCreateViewHolder(int viewType)
{
- FlexibleView.ViewHolder viewHolder = new FlexibleView.ViewHolder(new Button());
+ 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;
+ TextLabel label = holder.ItemView as TextLabel;
+ if (label)\r
+ {\r
+ label.TextColor = Color.White;\r
+ label.ParentOrigin = ParentOrigin.TopLeft;\r
+ label.PivotPoint = PivotPoint.TopLeft;\r
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.Size = new Size(Window.Instance.Size.Width - 100, _detailScrollHeight);\r
+ label.HorizontalAlignment = HorizontalAlignment.Begin;\r
label.VerticalAlignment = VerticalAlignment.Center;
label.PointSize = 3.0f;
label.MultiLine = true;
label.Text = _mDatas[position];
- }
+ }\r
}
public override void OnDestroyViewHolder(FlexibleView.ViewHolder holder)
private const string PRECONDITION_ATTRIBUTE_NAME = "NUnit.Framework.PreconditionAttribute";
private const string POSTCONDITION_ATTRIBUTE_NAME = "NUnit.Framework.PostconditionAttribute";
private List<string> _listNotPass;
- private float _pointSize = 5.0f;
//Save the information of every single test case
private List<TestcaseInfo> _tcInfoList;
//Show the result of all the test case
private TextLabel _summaryLabel1, _summaryLabel2, _description;
private View _initView;
- private View _detailView;
+ private View _detailView;\r
private FlexibleView _initList;
private ListBridge _adapter;
private FlexibleView _detailList;
{
Window.Instance.BackgroundColor = new Color(0.1f, 0.1f, 0.1f, 1.0f);
Tizen.Log.Fatal("NUI", "Initialize=========================================");
- _pointSize = (Window.Instance.Size.Width / Window.Instance.Dpi.Length()) * 0.28f;
RunType.Value = RunType.MANUAL;
_tRunner = new TRunner();
_tRunner.LoadTestsuite();
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;
window.GetDefaultLayer().Add(_initView);
window.GetDefaultLayer().Add(_detailView);
- }
-
+ }\r
+\r
void SetCommonButtonStyle(Button btn, string text)
{
if (!btn) return;
btn.Text = text;
- btn.PointSize = _pointSize;
+ btn.PointSize = 4.0f;
btn.Style.Text.TextColor = new Selector<Color>
{
Normal = new Color(0, 0, 0, 1),
void InitializeFirstPage()
{
//Create Run Button, when you Click it, then the first test case will be executed.
- _doneButton = new Button();
- _doneButton.Position = new Position(-150, -200);
+ _doneButton = new Button(new ButtonStyle());
+ _doneButton.Position = new Position(0, 0);\r
_doneButton.Size = new Size(120, 60);
- SetCommonButtonStyle(_doneButton, "Done");
+ SetCommonButtonStyle(_doneButton, "Done");\r
_doneButton.ClickEvent += (obj, ee) =>
{
TSettings.GetInstance().SubmitManualResult();
};
- _run = new Button();
- _run.Position2D = new Position2D(20, -200);
- _run.Size = new Size(120, 60);
+ _run = new Button(new ButtonStyle());
+ _run.Position2D = new Position2D(150, 0);\r
+ _run.Size = new Size(120, 60);\r
SetCommonButtonStyle(_run, "Runner");
_run.ClickEvent += (obj, ee) =>
{
_notRun.TextColor = Color.White;
_notRun.Size = new Size(40, 30);
_notRun.PointSize = 2.5f;
- _notRun.Position = new Position(260, 118);
+ _notRun.Position = new Position(100, 32);
_notRun.HorizontalAlignment = HorizontalAlignment.Center;
_notRun.VerticalAlignment = VerticalAlignment.Center;
_notRun.MultiLine = true;
_notRun.Text = "Not Run";
-
- _passButton = new Button();
+ _passButton = new Button(new ButtonStyle());
SetCommonButtonStyle(_passButton, "P");
_passButton.Size = new Size(70, 30);
- _passButton.Position = new Position(0, 0);
+ _passButton.Position = new Position(0, 0);\r
_passButton.ClickEvent += (obj, ee) =>
{
Clear();
_tsettings.TCResult = StrResult.PASS;
ManualTest.Confirm();
}
- Tizen.Log.Fatal("NUI", "Pass Button clicked!");
+ Tizen.Log.Fatal("TBT", "Pass Button clicked!");
};
- _failButton = new Button();
+ _failButton = new Button(new ButtonStyle());
SetCommonButtonStyle(_failButton, "F");
_failButton.Size = new Size(70, 30);
_failButton.Position = new Position(72, 0);
_tsettings.TCResult = StrResult.FAIL;
ManualTest.Confirm();
}
- Tizen.Log.Fatal("NUI", "Fail Button clicked!");
+ Tizen.Log.Fatal("TBT", "Fail Button clicked!");
};
- _blockButton = new Button();
+ _blockButton = new Button(new ButtonStyle());
SetCommonButtonStyle(_blockButton, "B");
_blockButton.Size = new Size(70, 30);
_blockButton.Position = new Position(144, 0);
}
};
- _runButton = new Button();
+ _runButton = new Button(new ButtonStyle());
SetCommonButtonStyle(_runButton, "R");
_runButton.Size = new Size(70, 30);
_runButton.Position = new Position(216, 0);
_tRunner.Execute();
};
- _homeButton = new Button();
+ _homeButton = new Button(new ButtonStyle());
SetCommonButtonStyle(_homeButton, "H");
- _homeButton.Size = new Size(60, 30);
- _homeButton.Position = new Position(15, 32);
+ _homeButton.Size = new Size(70, 30);
+ _homeButton.Position = new Position(0, 32);
_homeButton.ClickEvent += (obj, ee) =>
{
Clear();
}
};
- _preButton = new Button();
- SetCommonButtonStyle(_homeButton, "<<");
+ _preButton = new Button(new ButtonStyle());\r
+ SetCommonButtonStyle(_preButton, "<<");
_preButton.Size = new Size(60, 30);
- _preButton.Position = new Position(128, 32);
+ _preButton.Position = new Position(160, 32);
_preButton.ClickEvent += (obj, ee) =>
{
Clear();
}
};
- _nextButton = new Button();
- SetCommonButtonStyle(_homeButton, ">>");
+ _nextButton = new Button(new ButtonStyle());
+ SetCommonButtonStyle(_nextButton, ">>");
_nextButton.Size = new Size(60, 30);
- _nextButton.Position = new Position(193, 32);
+ _nextButton.Position = new Position(222, 32);
_nextButton.ClickEvent += (obj, ee) =>
{
Clear();
buttonView.ParentOrigin = ParentOrigin.TopLeft;
buttonView.PivotPoint = PivotPoint.TopLeft;
buttonView.Size2D = new Size2D(Window.Instance.Size.Width, 80);
- buttonView.Position2D = new Position2D(-140, 120);
+ buttonView.Position2D = new Position2D(30, 170);
buttonView.Add(_passButton);
buttonView.Add(_failButton);
private void CreateInitList()
{
- Tizen.Log.Fatal("ManualTCT", "CreateInitList");
- _initList = new FlexibleView();
+ Tizen.Log.Fatal("ManualTCT", "CreateInitList");\r
+ _initList = new FlexibleView();\r
_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.PivotPoint = PivotPoint.TopLeft;\r
+ _initList.Size = new Size(Window.Instance.Size.Width, 400);\r
+ _initList.Position = new Position(0, 80);\r
+ _initList.ClippingMode = ClippingModeType.ClipChildren;\r
+ _adapter = new ListBridge(_tcIDList, _listItem);\r
+ _initList.SetAdapter(_adapter);\r
+ LinearLayoutManager layoutManager = new LinearLayoutManager(LinearLayoutManager.VERTICAL);\r
+ _initList.SetLayoutManager(layoutManager);\r
_initList.FocusedItemIndex = 0;
- _initList.ItemClickEvent += (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();
- }
+ _initList.ItemClickEvent += (obj, e) =>\r
+ {\r
+ Button button = e.ClickedView.ItemView as Button;\r
+ if (button)\r
+ {\r
+ Tizen.Log.Fatal("TBT", "Item clicked!!::" + button.Name);\r
+ _currentTCNum = int.Parse(button.Name);\r
+ _initView.Hide();\r
+ UpdateDetailPage();\r
+ _caseView.Hide();\r
+ _detailView.Show();\r
+ }\r
};
}
private void CreateDetailList()
{
- Tizen.Log.Fatal("NUI", "Print the CreateDetailList::count: " + _currentTCInfo.Count);
- _description.Text = _currentTCInfo[0];
-
- _detailList = new FlexibleView();
+ Tizen.Log.Fatal("NUI", "Print the CreateDetailList::count: " + _currentTCInfo.Count);\r
+ _description.Text = _currentTCInfo[0];\r
+\r
+ _detailList = new FlexibleView();\r
_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.PivotPoint = PivotPoint.TopLeft;\r
+ _detailList.Size = new Size(Window.Instance.Size.Width - 100, _detailScrollHeight);\r
+ _detailList.Position = new Position(30, 20);\r
+ _detailList.BackgroundColor = Color.Black;\r
+ _detailList.ClippingMode = ClippingModeType.ClipChildren;\r
+ _adapter_detail = new DetailListBridge(_currentTCInfo);\r
+ _detailList.SetAdapter(_adapter_detail);\r
+ LinearLayoutManager layoutManager = new LinearLayoutManager(LinearLayoutManager.VERTICAL);\r
_detailList.SetLayoutManager(layoutManager);
_detailView.Add(_detailList);
}
void UpdateCurrentTCInfo()
{
_currentTCInfo = new List<string>();
- Tizen.Log.Fatal("NUI.Components", "Print the CurrentTCNum::" + _currentTCNum);
+ 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]);
else if (e.Result.Contains(StrResult.BLOCK))
{
ResultNumber.Block += 1;
- }
-
- 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(_currentTCNum, _listItem);
+ }\r
+\r
+ FlexibleView.ViewHolder holder = _initList?.FindViewHolderForAdapterPosition(_currentTCNum);\r
+ if (holder != null)\r
+ {\r
+ string testcaseName = "#." + (_currentTCNum + 1).ToString() + _tcIDList[_currentTCNum];\r
+ string resultText = "[" + _listItem[(int)_currentTCNum].Result + "]";\r
+ string text = testcaseName + resultText;\r
+ Button btn = holder.ItemView as Button;\r
+ btn.Text = text;\r
+ _adapter?.UpdateItemData(_currentTCNum, _listItem);\r
}
SetSummaryResult();
_notRun.Text = _listItem[_currentTCNum].Result;