2 * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
18 using NUnitLite.TUnit;
20 using Tizen.NUI.BaseComponents;
21 using System.Threading;
22 using System.Diagnostics;
23 using System.Threading.Tasks;
25 namespace Tizen.NUI.Devel.Tests
27 using tlog = Tizen.Log;
28 public class App : Tizen.NUI.NUIApplication
30 static string tag = "NUITEST";
34 tlog.Debug(tag, "Call App()");
38 public static TextLabel mainTitle;
39 static string title = "NUI Auto TCT \n\n";
40 float textSize = 30.0f;
43 public static int mainPid;
44 public static int mainTid;
46 protected override void OnCreate()
50 tlog.Debug(tag, "OnCreate() START!");
52 mainPid = Process.GetCurrentProcess().Id;
53 mainTid = Thread.CurrentThread.ManagedThreadId;
55 window = NUIApplication.GetDefaultWindow();
56 window.BackgroundColor = Color.Green;
60 Size = new Size(100, 100),
61 BackgroundColor = Color.White,
62 PositionUsesPivotPoint = true,
63 ParentOrigin = ParentOrigin.Center,
64 PivotPoint = PivotPoint.Center,
67 layer = window.GetDefaultLayer();
70 mainTitle = new TextLabel()
73 Text = title + $"Process ID: {Process.GetCurrentProcess().Id} \nThread ID: {Thread.CurrentThread.ManagedThreadId}\n",
75 BackgroundColor = Color.Cyan,
76 Size = new Size(window.WindowSize.Width * 0.9f, window.WindowSize.Height * 0.9f, 0),
77 PositionUsesPivotPoint = true,
78 ParentOrigin = ParentOrigin.Center,
79 PivotPoint = PivotPoint.Center,
83 tlog.Debug(tag, "OnCreate() END!");
86 static public async Task MainTitleChangeBackgroundColor(Color color)
90 mainTitle.BackgroundColor = color;
91 await Task.Delay(900);
95 static public async Task MainTitleChangeText(string tcTitle)
99 var processId = Process.GetCurrentProcess().Id;
100 var threadId = Thread.CurrentThread.ManagedThreadId;
102 mainTitle.Text = $"{title}\nProcess ID: {processId}\nThread ID: {threadId}\n TC: {tcTitle}";
103 await Task.Delay(20);
105 tlog.Debug(tag, $"{title}\nProcess ID: {processId}\nThread ID: {threadId}\n TC: {tcTitle}");
109 protected override void OnResume()
113 tlog.Debug(tag, $"### OnResume() START!");
115 TRunner t = new TRunner();
119 tlog.Debug(tag, $"OnResume() END!");
122 protected override void OnPause()
127 protected override void OnTerminate()
133 static void Main(string[] args)
135 tlog.Debug(tag, "NUI RUN!");
136 App example = new App();