From 5696f5a16163a3da5b998f6cdbdb329766c76878 Mon Sep 17 00:00:00 2001 From: Dongsug Song Date: Fri, 31 Jul 2020 11:06:50 +0900 Subject: [PATCH] [Non-ACR][NUI][Fix tct fails] - refactoring entry point (main) codes of NUI and NUI.Components - NUIApplication.GetDefaultWindow() is recommended to use - Window.GetDefaultLayer() is recommended to use Change-Id: Ib97d30fe984e8cdcc5b9aa121cbf280208d1145b --- tct-suite-vs/Tizen.NUI.Components.Tests/Program.cs | 123 +++++++++---------- tct-suite-vs/Tizen.NUI.Tests/Program.cs | 135 +++++++++------------ 2 files changed, 120 insertions(+), 138 deletions(-) diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/Program.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/Program.cs index ec63c71..5ca9d88 100755 --- a/tct-suite-vs/Tizen.NUI.Components.Tests/Program.cs +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/Program.cs @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,110 +24,111 @@ using System.Threading.Tasks; namespace Tizen.NUI.Components.Test { - + using tlog = Tizen.Log; public class App : Tizen.NUI.NUIApplication { - static TextLabel MainTitle; - static readonly string Title = "NUI.Components Auto TCT \n\n"; - static readonly float TextSize = 30.0f; - - private static Graphics.BackendType GraphicsBackend() - { - String DALI_VULKAN_BACKEND = Environment.GetEnvironmentVariable("DALI_VULKAN_BACKEND"); - int numVal = 0; - Int32.TryParse(DALI_VULKAN_BACKEND, out numVal); - - if ((Graphics.BackendType)numVal == Graphics.BackendType.Gles) - { - Log.Fatal("NUI.Components", "NUI Vulkan disabled~!"); - return Graphics.BackendType.Gles; - } - - Log.Fatal("NUI.Components", "NUI Vulkan enabled~!"); - return Graphics.BackendType.Vulkan; - } + static string tag = "NUITEST"; - public App() : base(GraphicsBackend(), WindowMode.Opaque, null, null, "") + public App() : base() { - // : base(GraphicsBackend(), WindowMode.Opaque, null, null, "") - Log.Fatal("NUI.Components", "Call App()"); + tlog.Debug(tag, "Call App()"); } + View root; + static TextLabel mainTitle; + static string title = "NUI Auto TCT \n\n"; + float textSize = 30.0f; + Window window; + Layer layer; protected override void OnCreate() { base.OnCreate(); - //Tizen.Log.Fatal("NUI", "### OnCreate() START!"); - Random rand = new Random(); + tlog.Debug(tag, "OnCreate() START!"); - Window window = Window.Instance; + window = NUIApplication.GetDefaultWindow(); window.BackgroundColor = Color.Green; - MainTitle = new TextLabel(); - MainTitle.MultiLine = true; - MainTitle.Text = Title + $"Process ID: {Process.GetCurrentProcess().Id} \nThread ID: {Thread.CurrentThread.ManagedThreadId}\n\n" + "Backend: "; - if (GraphicsBackend() == Graphics.BackendType.Gles) + root = new View() + { + Size = new Size(100, 100), + BackgroundColor = Color.White, + PositionUsesPivotPoint = true, + ParentOrigin = ParentOrigin.Center, + PivotPoint = PivotPoint.Center, + }; + + layer = window.GetDefaultLayer(); + layer.Add(root); + + mainTitle = new TextLabel() { - MainTitle.Text+="GL\n"; + MultiLine = true, + Text = title + $"Process ID: {Process.GetCurrentProcess().Id} \nThread ID: {Thread.CurrentThread.ManagedThreadId}\n", + PixelSize = textSize, + BackgroundColor = Color.Cyan, + Size2D = new Size2D(window.WindowSize.Width / 2, window.WindowSize.Height / 2), + PositionUsesPivotPoint = true, + ParentOrigin = ParentOrigin.Center, + PivotPoint = PivotPoint.Center, + }; + root.Add(mainTitle); + + tlog.Debug(tag, "OnCreate() END!"); + } + + static public async Task MainTitleChangeBackgroundColor(Color color) + { + if (color != null) + { + mainTitle.BackgroundColor = color; + await Task.Delay(900); } - else + } + + static public async Task MainTitleChangeText(string tcTitle) + { + if (tcTitle != null) { - MainTitle.Text+="Vulkan\n"; + var processId = Process.GetCurrentProcess().Id; + var threadId = Thread.CurrentThread.ManagedThreadId; + + mainTitle.Text = $"{title}\nProcess ID: {processId}\nThread ID: {threadId}\n TC: {tcTitle}"; + await Task.Delay(20); + + tlog.Debug(tag, $"{title}\nProcess ID: {processId}\nThread ID: {threadId}\n TC: {tcTitle}"); } - MainTitle.PixelSize = TextSize; - MainTitle.BackgroundColor = new Color(rand.Next(250) / 255.0f, rand.Next(250) / 255.0f, rand.Next(250) / 255.0f, 1.0f); - MainTitle.Size2D = new Size2D(window.WindowSize.Width / 2, window.WindowSize.Height / 2); - MainTitle.PositionUsesPivotPoint = true; - MainTitle.ParentOrigin = ParentOrigin.Center; - MainTitle.PivotPoint = PivotPoint.Center; - window.Add(MainTitle); - - //TRunner t = new TRunner(); - //t.LoadTestsuite(); - //t.Execute(); - - //Tizen.Log.Fatal("NUI", "### OnCreate() END!"); } protected override void OnResume() { base.OnResume(); - //Tizen.Log.Fatal("NUI", $"### OnResume() START!"); + tlog.Debug(tag, $"OnResume() START!"); TRunner t = new TRunner(); t.LoadTestsuite(); t.Execute(); - //Tizen.Log.Fatal("NUI", $"### OnResume() END!"); + tlog.Debug(tag, $"OnResume() END!"); } protected override void OnPause() { base.OnPause(); - - //Tizen.Log.Fatal("NUI", $"### OnPause() START!"); - //TO DO! - //Tizen.Log.Fatal("NUI", $"### OnPause() END!"); } protected override void OnTerminate() { - //Tizen.Log.Fatal("NUI", "### OnTerminate() START!"); - - Exit(); base.OnTerminate(); - - //Tizen.Log.Fatal("NUI", "### OnTerminate() END!"); + Exit(); } static void Main(string[] args) { - Tizen.Log.Fatal("NUI.Components", "NUI RUN!"); + tlog.Debug(tag, "NUI RUN!"); App example = new App(); example.Run(args); } - }; - } diff --git a/tct-suite-vs/Tizen.NUI.Tests/Program.cs b/tct-suite-vs/Tizen.NUI.Tests/Program.cs index eae134d..6f45903 100755 --- a/tct-suite-vs/Tizen.NUI.Tests/Program.cs +++ b/tct-suite-vs/Tizen.NUI.Tests/Program.cs @@ -24,130 +24,111 @@ using System.Threading.Tasks; namespace Tizen.NUI.Test { - + using tlog = Tizen.Log; public class App : Tizen.NUI.NUIApplication { - static TextLabel MainTitle; - static readonly string Title = "NUI Auto TCT \n\n"; - static readonly float TextSize = 30.0f; + static string tag = "NUITEST"; - private static Graphics.BackendType GraphicsBackend() + public App() : base() { - String DALI_VULKAN_BACKEND = Environment.GetEnvironmentVariable("DALI_VULKAN_BACKEND"); - int numVal = 0; - Int32.TryParse(DALI_VULKAN_BACKEND, out numVal); - - if ((Graphics.BackendType)numVal == Graphics.BackendType.Gles) - { - Log.Fatal("NUI", "NUI Vulkan disabled~!"); - return Graphics.BackendType.Gles; - } - - Log.Fatal("NUI", "NUI Vulkan enabled~!"); - return Graphics.BackendType.Vulkan; - } - - public App() : base(GraphicsBackend(), WindowMode.Opaque, null, null, "") - { - // : base(GraphicsBackend(), WindowMode.Opaque, null, null, "") - Log.Fatal("NUI", "Call App()"); + tlog.Debug(tag, "Call App()"); } + View root; + static TextLabel mainTitle; + static string title = "NUI Auto TCT \n\n"; + float textSize = 30.0f; + Window window; + Layer layer; protected override void OnCreate() { base.OnCreate(); - //Tizen.Log.Fatal("NUI", "### OnCreate() START!"); - Random rand = new Random(); + tlog.Debug(tag, "OnCreate() START!"); - Window window = Window.Instance; + window = NUIApplication.GetDefaultWindow(); window.BackgroundColor = Color.Green; - MainTitle = new TextLabel(); - MainTitle.MultiLine = true; - MainTitle.Text = Title + $"Process ID: {Process.GetCurrentProcess().Id} \nThread ID: {Thread.CurrentThread.ManagedThreadId}\n\n" + "Backend: "; - if (GraphicsBackend() == Graphics.BackendType.Gles) - { - MainTitle.Text+="GL\n"; - } - else + root = new View() + { + Size = new Size(100, 100), + BackgroundColor = Color.White, + PositionUsesPivotPoint = true, + ParentOrigin = ParentOrigin.Center, + PivotPoint = PivotPoint.Center, + }; + + layer = window.GetDefaultLayer(); + layer.Add(root); + + mainTitle = new TextLabel() { - MainTitle.Text+="Vulkan\n"; - } - MainTitle.PixelSize = TextSize; - MainTitle.BackgroundColor = new Color(rand.Next(250) / 255.0f, rand.Next(250) / 255.0f, rand.Next(250) / 255.0f, 1.0f); - MainTitle.Size2D = new Size2D(window.WindowSize.Width / 2, window.WindowSize.Height / 2); - MainTitle.PositionUsesPivotPoint = true; - MainTitle.ParentOrigin = ParentOrigin.Center; - MainTitle.PivotPoint = PivotPoint.Center; - window.Add(MainTitle); - - //TRunner t = new TRunner(); - //t.LoadTestsuite(); - //t.Execute(); - - //Tizen.Log.Fatal("NUI", "### OnCreate() END!"); + MultiLine = true, + Text = title + $"Process ID: {Process.GetCurrentProcess().Id} \nThread ID: {Thread.CurrentThread.ManagedThreadId}\n", + PixelSize = textSize, + BackgroundColor = Color.Cyan, + Size2D = new Size2D(window.WindowSize.Width / 2, window.WindowSize.Height / 2), + PositionUsesPivotPoint = true, + ParentOrigin = ParentOrigin.Center, + PivotPoint = PivotPoint.Center, + }; + root.Add(mainTitle); + + tlog.Debug(tag, "OnCreate() END!"); } static public async Task MainTitleChangeBackgroundColor(Color color) { - //if (color == null) - //{ - // Random rand = new Random(); - // color = new Color(rand.Next(250) / 255.0f, rand.Next(250) / 255.0f, rand.Next(250) / 255.0f, 1.0f); - //} - //MainTitle.BackgroundColor = color; - //await Task.Delay(1000); + if (color != null) + { + mainTitle.BackgroundColor = color; + await Task.Delay(900); + } } - static public async Task MainTitleChangeText(string title) + static public async Task MainTitleChangeText(string tcTitle) { - //MainTitle.Text = Title + title; - //MainTitle.PixelSize = TextSize; - //await Task.Delay(1000); - - //Tizen.Log.Fatal("NUI", $"{title} Process ID: {Process.GetCurrentProcess().Id} Thread ID: {Thread.CurrentThread.ManagedThreadId}"); + if (tcTitle != null) + { + var processId = Process.GetCurrentProcess().Id; + var threadId = Thread.CurrentThread.ManagedThreadId; + + mainTitle.Text = $"{title}\nProcess ID: {processId}\nThread ID: {threadId}\n TC: {tcTitle}"; + await Task.Delay(20); + + tlog.Debug(tag, $"{title}\nProcess ID: {processId}\nThread ID: {threadId}\n TC: {tcTitle}"); + } } protected override void OnResume() { base.OnResume(); - //Tizen.Log.Fatal("NUI", $"### OnResume() START!"); + tlog.Debug(tag, $"OnResume() START!"); TRunner t = new TRunner(); t.LoadTestsuite(); t.Execute(); - //Tizen.Log.Fatal("NUI", $"### OnResume() END!"); + tlog.Debug(tag, $"OnResume() END!"); } protected override void OnPause() { base.OnPause(); - - //Tizen.Log.Fatal("NUI", $"### OnPause() START!"); - //TO DO! - //Tizen.Log.Fatal("NUI", $"### OnPause() END!"); } protected override void OnTerminate() { - //Tizen.Log.Fatal("NUI", "### OnTerminate() START!"); - - Exit(); - base.OnTerminate(); - - //Tizen.Log.Fatal("NUI", "### OnTerminate() END!"); + base.OnTerminate(); + Exit(); } static void Main(string[] args) { - Tizen.Log.Fatal("NUI", "NUI RUN!"); + tlog.Debug(tag, "NUI RUN!"); App example = new App(); example.Run(args); } - }; - } -- 2.7.4