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 Tizen.NUI.Components;
22 using System.Threading;
23 using System.Diagnostics;
24 using System.Threading.Tasks;
26 namespace Tizen.NUI.Devel.Tests
28 using tlog = Tizen.Log;
29 public class App : Tizen.NUI.NUIApplication
31 static string tag = "NUITEST";
35 tlog.Debug(tag, "Call App()");
39 public static TextLabel mainTitle;
40 static string title = "NUI Auto TCT \n\n";
41 float textSize = 30.0f;
44 public static int mainPid;
45 public static int mainTid;
47 protected override void OnCreate()
51 tlog.Debug(tag, "OnCreate() START!");
53 mainPid = Process.GetCurrentProcess().Id;
54 mainTid = Thread.CurrentThread.ManagedThreadId;
56 window = NUIApplication.GetDefaultWindow();
57 window.BackgroundColor = Color.Green;
61 Size = new Size(100, 100),
62 BackgroundColor = Color.White,
63 PositionUsesPivotPoint = true,
64 ParentOrigin = ParentOrigin.Center,
65 PivotPoint = PivotPoint.Center,
68 layer = window.GetDefaultLayer();
71 mainTitle = new TextLabel()
74 Text = title + $"Process ID: {Process.GetCurrentProcess().Id} \nThread ID: {Thread.CurrentThread.ManagedThreadId}\n",
76 BackgroundColor = Color.Cyan,
77 Size = new Size(window.WindowSize.Width * 0.9f, window.WindowSize.Height * 0.9f, 0),
78 PositionUsesPivotPoint = true,
79 ParentOrigin = ParentOrigin.Center,
80 PivotPoint = PivotPoint.Center,
84 tlog.Debug(tag, "OnCreate() END!");
87 static public async Task MainTitleChangeBackgroundColor(Color color)
91 mainTitle.BackgroundColor = color;
92 await Task.Delay(900);
96 static public async Task MainTitleChangeText(string tcTitle)
100 var processId = Process.GetCurrentProcess().Id;
101 var threadId = Thread.CurrentThread.ManagedThreadId;
103 mainTitle.Text = $"{title}\nProcess ID: {processId}\nThread ID: {threadId}\n TC: {tcTitle}";
104 await Task.Delay(20);
106 tlog.Debug(tag, $"{title}\nProcess ID: {processId}\nThread ID: {threadId}\n TC: {tcTitle}");
110 protected override void OnResume()
114 tlog.Debug(tag, $"### OnResume() START!");
116 TRunner t = new TRunner();
120 tlog.Debug(tag, $"OnResume() END!");
123 protected override void OnPause()
128 protected override void OnTerminate()
134 static void Main(string[] args)
136 tlog.Debug(tag, "NUI RUN!");
137 App example = new App();