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;
19 using Tizen.Applications;
21 using Tizen.NUI.BaseComponents;
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;
48 protected override void OnCreate()
52 tlog.Debug(tag, "OnCreate() START!");
54 mainPid = Process.GetCurrentProcess().Id;
55 mainTid = Thread.CurrentThread.ManagedThreadId;
57 window = NUIApplication.GetDefaultWindow();
58 window.BackgroundColor = Color.Green;
62 Size = new Size(100, 100),
63 BackgroundColor = Color.White,
64 PositionUsesPivotPoint = true,
65 ParentOrigin = ParentOrigin.Center,
66 PivotPoint = PivotPoint.Center,
69 layer = window.GetDefaultLayer();
72 mainTitle = new TextLabel()
75 Text = title + $"Process ID: {Process.GetCurrentProcess().Id} \nThread ID: {Thread.CurrentThread.ManagedThreadId}\n",
77 BackgroundColor = Color.Cyan,
78 Size = new Size(window.WindowSize.Width * 0.9f, window.WindowSize.Height * 0.9f, 0),
79 PositionUsesPivotPoint = true,
80 ParentOrigin = ParentOrigin.Center,
81 PivotPoint = PivotPoint.Center,
85 tlog.Debug(tag, "OnCreate() END!");
87 timer = new Timer(1000);
93 private bool OnTick(object obj, EventArgs e)
95 TRunner t = new TRunner();
99 App.MainTitleChangeText("Finished!");
105 static public async Task MainTitleChangeBackgroundColor(Color color)
109 mainTitle.BackgroundColor = color;
110 await Task.Delay(900);
114 static public async Task MainTitleChangeText(string tcTitle)
118 var processId = Process.GetCurrentProcess().Id;
119 var threadId = Thread.CurrentThread.ManagedThreadId;
121 mainTitle.Text = $"{title}\nProcess ID: {processId}\nThread ID: {threadId}\n TC: {tcTitle}";
122 await Task.Delay(20);
124 tlog.Debug(tag, $"{title}\nProcess ID: {processId}\nThread ID: {threadId}\n TC: {tcTitle}");
128 protected override void OnAppControlReceived(AppControlReceivedEventArgs e)
130 base.OnAppControlReceived(e);
131 tlog.Debug(tag, $"### OnAppControlReceived() START!");
134 protected override void OnResume()
138 tlog.Debug(tag, $"### OnResume() START!");
140 // TRunner t = new TRunner();
141 // t.LoadTestsuite();
144 tlog.Debug(tag, $"OnResume() END!");
147 protected override void OnPause()
152 protected override void OnTerminate()
154 timer.Tick -= OnTick;
155 mainTitle.GetParent().Remove(mainTitle);
157 root.GetParent().Remove(root);
164 static void Main(string[] args)
166 tlog.Debug(tag, "NUI RUN!");
167 App example = new App();