--- /dev/null
+using System;
+using System.Runtime.InteropServices;
+using Tizen.Applications;
+using Tizen.NUI;
+using Tizen.NUI.UIComponents;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Constants;
+using Tizen;
+
+namespace NUIApplicationsManualWearableTests
+{
+ /// <summary>
+ /// A sample of NUIApplication
+ /// </summary>
+ class NUIApplicationsManualWearableTests : NUIApplication
+ {
+ public delegate void AddIdleTest();
+ public void OnButtonPressed()
+ {
+ Log.Fatal("TCT", "Call Exit()");
+ Exit();
+ }
+ protected override void OnPreCreate()
+ {
+ Log.Fatal("TCT", "[TestCase][OnPreCreate][NUIApplication] Pass");
+ base.OnPreCreate();
+ }
+ protected override void OnCreate()
+ {
+ base.OnCreate();\r
+\r
+ PushButton pauseButton = new PushButton();
+ pauseButton.Size2D = new Size2D(120, 60);
+ pauseButton.Position2D = new Position2D(-150, -300);
+ pauseButton.Label = CreateTextVisual("Pause", Color.White);
+ pauseButton.Clicked += (obj, ee) =>
+ {
+ OnPause();
+ return false;
+ };
+ Window.Instance.GetDefaultLayer().Add(pauseButton);\r
+
+
+ PushButton resumeButton = new PushButton();
+ resumeButton.Size2D = new Size2D(120, 60);
+ resumeButton.Position2D = new Position2D(-30, -300);
+ resumeButton.Label = CreateTextVisual("Resume", Color.White);
+ resumeButton.Clicked += (obj, e) =>
+ {
+ OnResume();
+ return true;
+ };
+ Window.Instance.GetDefaultLayer().Add(resumeButton);
+
+ PushButton exitButton = new PushButton();
+ exitButton.Size2D = new Size2D(120, 60);
+ exitButton.Position2D = new Position2D(-150, -150);
+ exitButton.Label = CreateTextVisual("Exit", Color.White);
+
+ exitButton.Clicked += (obj, e) =>
+ {
+ Exit();
+ return true;
+ };
+ Window.Instance.GetDefaultLayer().Add(exitButton);
+
+ PushButton addIdleButton = new PushButton();
+ addIdleButton.Size2D = new Size2D(120, 60);
+ addIdleButton.Position2D = new Position2D(-30, -150);
+ addIdleButton.Label = CreateTextVisual("AddIdle", Color.White);
+ addIdleButton.Clicked += (obj, e) =>
+ {
+ AddIdleTest addIdleTest = new AddIdleTest(MyDelegate);
+ AddIdle(addIdleTest);
+ return true;
+ };\r
+\r
+ Window.Instance.GetDefaultLayer().Add(addIdleButton);
+
+ pauseButton.DownFocusableView = resumeButton;
+ resumeButton.UpFocusableView = pauseButton;
+ resumeButton.DownFocusableView = exitButton;
+ exitButton.UpFocusableView = resumeButton;
+ exitButton.DownFocusableView = addIdleButton;
+ addIdleButton.UpFocusableView = exitButton;
+
+
+ FocusManager.Instance.SetCurrentFocusView(pauseButton);
+
+
+ Log.Fatal("TCT", "[TestCase][OnCreate][NUIApplication] Pass");
+ }\r
+\r
+ private PropertyMap CreateTextVisual(string text, Color color)
+ {
+ PropertyMap map = new PropertyMap();
+ map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Text));
+ map.Add(TextVisualProperty.Text, new PropertyValue(text));
+ map.Add(TextVisualProperty.TextColor, new PropertyValue(color));
+ map.Add(TextVisualProperty.PointSize, new PropertyValue(6.0f));
+ map.Add(TextVisualProperty.HorizontalAlignment, new PropertyValue("CENTER"));
+ map.Add(TextVisualProperty.VerticalAlignment, new PropertyValue("BOTTOM"));
+ return map;
+ }
+ public static void MyDelegate()
+ {
+ Log.Fatal("TCT", "[TestCase][AddIdle][NUIApplication] Pass");
+ }
+
+ protected override void OnResume()
+ {
+ Log.Fatal("TCT", "[TestCase][OnResume][NUIApplication] Pass");
+ base.OnResume();
+ }
+
+ protected override void OnPause()
+ {
+ Log.Fatal("TCT", "[TestCase][OnPause][NUIApplication] Pass");
+ base.OnPause();
+ }
+
+ protected override void OnTerminate()
+ {
+ Log.Fatal("TCT", "NUIApplication::OnTerminate()");
+ Log.Fatal("TCT", "[TestCase][OnTerminate][NUIApplication] Pass");
+ base.OnTerminate();
+ }
+
+ protected override void OnAppControlReceived(AppControlReceivedEventArgs e)
+ {
+ Log.Fatal("TCT", "NUIApplication::OnAppControlReceived()");
+ if (e.ReceivedAppControl != null)
+ {
+ Log.Fatal("TCT", "[TestCase][Test_Properties] ReceivedAppControl properties is not null");
+ Log.Fatal("TCT", "[TestCase][Test_Properties] ReceivedAppControl Type: " + e.ReceivedAppControl.GetType());
+ }
+ Log.Fatal("TCT", "[TestCase][OnAppControlReceived][NUIApplication] Pass");
+
+ base.OnAppControlReceived(e);
+ ShowPropertiesInfo();
+ }
+
+ protected override void OnLocaleChanged(LocaleChangedEventArgs e)
+ {
+ Log.Fatal("TCT", "NUIApplication::OnLocaleChanged()");
+ if (e.Locale != null)
+ {
+ Log.Fatal("TCT", "[Test_Properties] Locale properties is not null");
+ Log.Fatal("TCT", "[Test_Properties] Current value of Locale : " + e.Locale);
+ Log.Fatal("TCT", "[Test_Properties] Locale type: " + e.Locale.GetType());
+ }
+
+ Log.Fatal("TCT", "[TestCase][OnLocaleChanged][NUIApplication] Pass");
+ base.OnLocaleChanged(e);
+ }
+
+ protected override void OnRegionFormatChanged(RegionFormatChangedEventArgs e)
+ {
+ Log.Fatal("TCT", "NUIApplication::OnRegionFormatChanged()");
+ if (e != null)
+ {
+ Log.Fatal("TCT", "[Test_Properties] Region properties is not null");
+ Log.Fatal("TCT", "[Test_Properties] Current value of Region : " + e.Region);
+ Log.Fatal("TCT", "[Test_Properties] Region type: " + e.Region.GetType());
+ }
+
+ Log.Fatal("TCT", "[TestCase][OnRegionFormatChanged][NUIApplication] Pass");
+ base.OnRegionFormatChanged(e);
+ }
+
+ protected override void OnDeviceOrientationChanged(DeviceOrientationEventArgs e)
+ {
+ Log.Fatal("TCT", "NUIApplication::OnDeviceOrientationChanged()");
+ if (e != null)
+ {
+ Log.Fatal("TCT", "[Test_Properties] DeviceOrientation properties is not null");
+ Log.Fatal("TCT", "[Test_Properties] Current value of DeviceOrientation : " + e.DeviceOrientation);
+ Log.Fatal("TCT", "[Test_Properties] DeviceOrientation type: " + e.DeviceOrientation.GetType());
+ }
+
+ Log.Fatal("TCT", "[TestCase][OnDeviceOrientationChanged][NUIApplication] Pass");
+ base.OnDeviceOrientationChanged(e);
+ }
+
+ protected override void OnLowMemory(LowMemoryEventArgs e)
+ {
+ Log.Fatal("TCT", "NUIApplication::OnLowMemory()");
+ if (e.LowMemoryStatus != LowMemoryStatus.None)
+ {
+ Log.Fatal("TCT", "[Test_Properties] LowMemoryStatus properties is not null");
+ Log.Fatal("TCT", "[Test_Properties] Current value of LowMemoryStatus : " + e.LowMemoryStatus.ToString());
+ Log.Fatal("TCT", "[Test_Properties] LowMemoryStatus type: " + e.LowMemoryStatus.GetType());
+ }
+ Log.Fatal("TCT", "[TestCase][OnLowMemory][NUIApplication] Pass");
+
+ base.OnLowMemory(e);
+ }
+
+ protected override void OnLowBattery(LowBatteryEventArgs e)
+ {
+ Log.Fatal("TCT", "NUIApplication::OnLowBattery()");
+ if (e.LowBatteryStatus != LowBatteryStatus.None)
+ {
+ Log.Fatal("TCT", "[Test_Properties] LowBatteryStatus properties is not null");
+ Log.Fatal("TCT", "[Test_Properties] Current value of LowBatteryStatus : " + e.LowBatteryStatus.ToString());
+ Log.Fatal("TCT", "[Test_Properties] LowBatteryStatus type: " + e.LowBatteryStatus.GetType());
+ }
+
+ Log.Fatal("TCT", "[TestCase][OnLowBattery][NUIApplication] Pass");
+
+ base.OnLowBattery(e);
+ }
+
+ public override void Run(string[] args)
+ {
+ Created += Created_Event_Test;
+ AppControlReceived += AppControlReceived_Event_Test;
+ LocaleChanged += LocaleChanged_Event_Test;
+ LowMemory += LowMemory_Event_Test;
+ LowBattery += LowBattery_Event_Test;
+ Terminated += Terminated_Event_Test;
+ Paused += Paused_Event_Test;
+ Resumed += Resumed_Event_Test;
+ DeviceOrientationChanged += DeviceOrientationCHanged_Event_Test;
+ RegionFormatChanged += RegionFormatChanged_Event_Test;
+
+ Log.Fatal("TCT", "[TestCase][Run][NUIApplication] Pass");
+
+ base.Run(args);
+ }
+
+ private void Terminated_Event_Test(object sender, EventArgs e)
+ {
+ /*
+ * SCENARIO:
+ * Launch app
+ * -> If log show "NUIApplication::Terminated_Event_Test()" -> PASS
+ */
+ Log.Fatal("TCT", "NUIApplication::Terminated_Event_Test");
+ Log.Fatal("TCT", "[TestCase][Terminated_Event_Test][NUIApplication] Pass");
+ }
+
+ private void LocaleChanged_Event_Test(object sender, LocaleChangedEventArgs e)
+ {
+ /*
+ * SCENARIO:
+ * Launch app
+ * -> If log show "NUIApplication::LocaleChanged_Event_Test()" -> PASS
+ */
+ Log.Fatal("TCT", "NUIApplication::LocaleChanged_Event_Test");
+ Log.Fatal("TCT", "NUIApplication::LocaleChanged_Event_Test: new located - " + e.Locale);
+ Log.Fatal("TCT", "[TestCase][LocaleChanged_Event_Test][NUIApplication] Pass");
+ }
+
+ private void RegionFormatChanged_Event_Test(object sender, RegionFormatChangedEventArgs e)
+ {
+ Log.Fatal("TCT", "NUIApplication::RegionFormatChanged_Event_Test");
+ Log.Fatal("TCT", "NUIApplication::RegionFormatChanged_Event_Test: new region - " + e.Region);
+ Log.Fatal("TCT", "[TestCase][RegionFormatChanged_Event_Test][NUIApplication] Pass");
+ }
+
+ private void DeviceOrientationCHanged_Event_Test(object sender, DeviceOrientationEventArgs e)
+ {
+ Log.Fatal("TCT", "NUIApplication::DeviceOrientationCHanged_Event_Test");
+ Log.Fatal("TCT", "NUIApplication::DeviceOrientationCHanged_Event_Test: new located - " + e.DeviceOrientation);
+ Log.Fatal("TCT", "[TestCase][DeviceOrientationCHanged_Event_Test][NUIApplication] Pass");
+ }
+
+ private void LowMemory_Event_Test(object sender, LowMemoryEventArgs e)
+ {
+ /*
+ * SCENARIO:
+ * Launch app
+ * -> If log show "NUIApplication::LowMemory_Event_Test()" -> PASS
+ */
+ Log.Fatal("TCT", "NUIApplication::LowMemory_Event_Test");
+ if (e.LowMemoryStatus == LowMemoryStatus.None)
+ {
+ Log.Fatal("TCT", "NUIApplication::LowMemory_Event_Test: LowMemoryStatus.None");
+ }
+ else if (e.LowMemoryStatus == LowMemoryStatus.Normal)
+ {
+ Log.Fatal("TCT", "NUIApplication::LowMemory_Event_Test: LowMemoryStatus.Normal");
+ }
+ else if (e.LowMemoryStatus == LowMemoryStatus.SoftWarning)
+ {
+ Log.Fatal("TCT", "NUIApplication::LowMemory_Event_Test: LowMemoryStatus.SoftWarning");
+ }
+ else if (e.LowMemoryStatus == LowMemoryStatus.HardWarning)
+ {
+ Log.Fatal("TCT", "NUIApplication::LowMemory_Event_Test: LowMemoryStatus.HardWarning");
+ }
+ Log.Fatal("TCT", "[TestCase][LowMemory_Event_Test][NUIApplication] Pass");
+ }
+
+ private void LowBattery_Event_Test(object sender, LowBatteryEventArgs e)
+ {
+ Log.Fatal("TCT", "NUIApplication::LowBattery_Event_Test");
+
+ if (e.LowBatteryStatus == LowBatteryStatus.CriticalLow)
+ {
+ Log.Fatal("TCT", "NUIApplication::LowBattery_Event_Test: LowMemoryStatus.CriticalLow");
+ }
+ Log.Fatal("TCT", "[TestCase][LowBattery_Event_Test][NUIApplication] Pass");
+ }
+
+ private void AppControlReceived_Event_Test(object sender, AppControlReceivedEventArgs e)
+ {
+ /*
+ * SCENARIO:
+ * Launch app
+ * -> If log show "NUIApplication::AppControlReceived_Event_Test()" -> PASS
+ */
+ Log.Fatal("TCT", "NUIApplication::AppControlReceived_Event_Test");
+ Log.Fatal("TCT", "[TestCase][AppControlReceived_Event_Test][NUIApplication] Pass");
+ }
+
+ private void Created_Event_Test(object sender, EventArgs e)
+ {
+ /*
+ * SCENARIO:
+ * Launch app
+ * -> If log show "NUIApplication::Created_Event_Test()" -> PASS
+ */
+ Log.Fatal("TCT", "NUIApplication::Created_Event_Test");
+ Log.Fatal("TCT", "[TestCase][Created_Event_Test][NUIApplication] Pass");
+ }
+ public void Paused_Event_Test(object sender, EventArgs e)
+ {
+ /*
+ * PRECONDITION
+ * 1. Open NUIApplication app.
+ * 2. Open other app.
+ */
+ Log.Fatal("TCT", "[TestCase][Paused_Event_Test][NUIApplication] Pass");
+ }
+ public void Resumed_Event_Test(object sender, EventArgs e)
+ {
+ /*
+ * PRECONDITION
+ * 1. Open NUIApplication app.
+ * 2. Open other app.
+ * 3. Long press HOME button and tap to NUIApplicaton shortcut.
+ */
+ Log.Fatal("TCT", "NUIApplication Resumed event occur!");
+ Log.Fatal("TCT", "[TestCase][Resumed_Event_Test][NUIApplication] Pass");
+ }
+
+ public override void Exit()
+ {
+ Log.Fatal("TCT", "[TestCase][Exit][NUIApplication] Pass");
+ base.Exit();
+ }
+ void ShowPropertiesInfo()
+ {
+ if (base.ApplicationInfo != null)
+ {
+ Log.Fatal("TCT", "[Info] ApplicationInfo is not null");
+ Log.Fatal("TCT", "[Info] ApplicationInfo.ApplicationId = " + base.ApplicationInfo.ApplicationId);
+ Log.Fatal("TCT", "[Info] ApplicationInfo.ApplicationType = " + base.ApplicationInfo.ApplicationType);
+ Log.Fatal("TCT", "[Info] ApplicationInfo.ExecutablePath = " + base.ApplicationInfo.ExecutablePath);
+ Log.Fatal("TCT", "[Info] ApplicationInfo.ExternalSharedDataPath = " + base.ApplicationInfo.ExternalSharedDataPath);
+ Log.Fatal("TCT", "[Info] ApplicationInfo.IconPath = " + base.ApplicationInfo.IconPath);
+ Log.Fatal("TCT", "[Info] ApplicationInfo.IsNoDisplay = " + base.ApplicationInfo.IsNoDisplay);
+ Log.Fatal("TCT", "[Info] ApplicationInfo.IsOnBoot = " + base.ApplicationInfo.IsOnBoot);
+ Log.Fatal("TCT", "[Info] ApplicationInfo.IsPreload = " + base.ApplicationInfo.IsPreload);
+ Log.Fatal("TCT", "[Info] ApplicationInfo.Label = " + base.ApplicationInfo.Label);
+ Log.Fatal("TCT", "[Info] ApplicationInfo.Metadata Count = " + base.ApplicationInfo.Metadata.Count);
+ foreach (var item in base.ApplicationInfo.Metadata)
+ {
+ Log.Fatal("TCT", "[Info] ApplicationInfo.Metadata, Key: " + item.Key + " Value: " + item.Value);
+ }
+ Log.Fatal("TCT", "[Info] ApplicationInfo.PackageId = " + base.ApplicationInfo.PackageId);
+ Log.Fatal("TCT", "[Info] ApplicationInfo.SharedDataPath = " + base.ApplicationInfo.SharedDataPath);
+ Log.Fatal("TCT", "[Info] ApplicationInfo.SharedResourcePath = " + base.ApplicationInfo.SharedResourcePath);
+ Log.Fatal("TCT", "[Info] ApplicationInfo.SharedTrustedPath = " + base.ApplicationInfo.SharedTrustedPath);
+ }
+ if (base.DirectoryInfo != null)
+ {
+ Log.Fatal("TCT", "[Info] DirectoryInfo is not null");
+ Log.Fatal("TCT", "[Info] DirectoryInfo.Cache = " + base.DirectoryInfo.Cache);
+ Log.Fatal("TCT", "[Info] DirectoryInfo.Data = " + base.DirectoryInfo.Data);
+ Log.Fatal("TCT", "[Info] DirectoryInfo.ExpansionPackageResource = " + base.DirectoryInfo.ExpansionPackageResource);
+ Log.Fatal("TCT", "[Info] DirectoryInfo.ExternalCache = " + base.DirectoryInfo.ExternalCache);
+ Log.Fatal("TCT", "[Info] DirectoryInfo.ExternalData = " + base.DirectoryInfo.ExternalData);
+ Log.Fatal("TCT", "[Info] DirectoryInfo.ExternalSharedData = " + base.DirectoryInfo.ExternalSharedData);
+ Log.Fatal("TCT", "[Info] DirectoryInfo.Resource = " + base.DirectoryInfo.Resource);
+ Log.Fatal("TCT", "[Info] DirectoryInfo.SharedData = " + base.DirectoryInfo.SharedData);
+ Log.Fatal("TCT", "[Info] DirectoryInfo.SharedResource = " + base.DirectoryInfo.SharedResource);
+ Log.Fatal("TCT", "[Info] DirectoryInfo.SharedTrusted = " + base.DirectoryInfo.SharedTrusted);
+ }
+
+ Log.Fatal("TCT", "[Info] Current == this : " + (Current == this));
+ Log.Fatal("TCT", "[Info] Current.ApplicationInfo.ApplicationId = " + Current.ApplicationInfo.ApplicationId);
+ }
+
+ }
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ Log.Warn("WATCH", "[TestCase][TCT] Main ");
+
+ NUIApplicationsManualWearableTests app = new NUIApplicationsManualWearableTests();
+ app.Run(args);
+ }
+ }
+}