From: Hwankyu Jhun Date: Mon, 10 Dec 2018 00:20:06 +0000 (+0900) Subject: [Applications][TCSACR-198][Add a new testcase] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a75bf4f7b6c3aa750ab6ee6089862d6cddb001e5;p=test%2Ftct%2Fcsharp%2Fapi.git [Applications][TCSACR-198][Add a new testcase] Added: - SendLaunchRequestAsync_TO_UI_APP() Change-Id: I06df5e25a09b0be2ed2986ce2558f914270df4b0 Signed-off-by: Hwankyu Jhun --- diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/code/Reply/Reply.sln b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/Reply/Reply.sln new file mode 100755 index 000000000..f9097d3a1 --- /dev/null +++ b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/Reply/Reply.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28010.2050 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Reply", "Reply\Reply.csproj", "{7ABD6289-AA0F-4268-A633-8B54C1759E4D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7ABD6289-AA0F-4268-A633-8B54C1759E4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7ABD6289-AA0F-4268-A633-8B54C1759E4D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7ABD6289-AA0F-4268-A633-8B54C1759E4D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7ABD6289-AA0F-4268-A633-8B54C1759E4D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {297EF507-9B6A-48C8-BCA8-700F28D05D7D} + EndGlobalSection +EndGlobal diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/code/Reply/Reply/Reply.cs b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/Reply/Reply/Reply.cs new file mode 100755 index 000000000..86b1807da --- /dev/null +++ b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/Reply/Reply/Reply.cs @@ -0,0 +1,84 @@ +using System; +using Tizen; +using Tizen.Applications; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; + +namespace Reply +{ + class Program : NUIApplication + { + static private string LogTag = "Reply"; + + protected override void OnCreate() + { + base.OnCreate(); + Initialize(); + Log.Info(LogTag, "OnCreate()"); + } + + protected override void OnAppControlReceived(AppControlReceivedEventArgs e) + { + base.OnAppControlReceived(e); + Log.Info(LogTag, "OnAppControlReceived()"); + if (e.ReceivedAppControl.IsReplyRequest == true) + { + AppControl replyRequest = new AppControl(); + e.ReceivedAppControl.ReplyToLaunchRequest(replyRequest, AppControlReplyResult.Succeeded); + Log.Info(LogTag, "ReplyToLaunchRequest()"); + } + } + + protected override void OnResume() + { + base.OnResume(); + Log.Info(LogTag, "OnResume()"); + } + + protected override void OnPause() + { + base.OnPause(); + Log.Info(LogTag, "OnPause()"); + } + + protected override void OnTerminate() + { + base.OnTerminate(); + Log.Info(LogTag, "OnTerminte()"); + } + + void Initialize() + { + Window.Instance.KeyEvent += OnKeyEvent; + + TextLabel text = new TextLabel("Hello Tizen NUI World"); + text.HorizontalAlignment = HorizontalAlignment.Center; + text.VerticalAlignment = VerticalAlignment.Center; + text.TextColor = Color.Blue; + text.PointSize = 12.0f; + text.HeightResizePolicy = ResizePolicyType.FillToParent; + text.WidthResizePolicy = ResizePolicyType.FillToParent; + Window.Instance.GetDefaultLayer().Add(text); + + Animation animation = new Animation(2000); + animation.AnimateTo(text, "Orientation", new Rotation(new Radian(new Degree(180.0f)), PositionAxis.X), 0, 500); + animation.AnimateTo(text, "Orientation", new Rotation(new Radian(new Degree(0.0f)), PositionAxis.X), 500, 1000); + animation.Looping = true; + animation.Play(); + } + + public void OnKeyEvent(object sender, Window.KeyEventArgs e) + { + if (e.Key.State == Key.StateType.Down && (e.Key.KeyPressedName == "XF86Back" || e.Key.KeyPressedName == "Escape")) + { + Exit(); + } + } + + static void Main(string[] args) + { + var app = new Program(); + app.Run(args); + } + } +} diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/code/Reply/Reply/Reply.csproj b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/Reply/Reply/Reply.csproj new file mode 100755 index 000000000..5f980d92d --- /dev/null +++ b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/Reply/Reply/Reply.csproj @@ -0,0 +1,28 @@ + + + + Exe + netcoreapp2.0 + + + + portable + + + None + + + + + + + + + + Runtime + + + + + + diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/code/Reply/Reply/shared/res/Reply.png b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/Reply/Reply/shared/res/Reply.png new file mode 100755 index 000000000..9f3cb9860 Binary files /dev/null and b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/Reply/Reply/shared/res/Reply.png differ diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/code/Reply/Reply/tizen-manifest.xml b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/Reply/Reply/tizen-manifest.xml new file mode 100755 index 000000000..a8ca162d6 --- /dev/null +++ b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/Reply/Reply/tizen-manifest.xml @@ -0,0 +1,15 @@ + + + + + + Reply.png + + + diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/org.tizen.example.Reply-1.0.0.tpk b/tct-suite-vs/Resource/Tizen.Applications.Tests/org.tizen.example.Reply-1.0.0.tpk new file mode 100755 index 000000000..8d4ceca69 Binary files /dev/null and b/tct-suite-vs/Resource/Tizen.Applications.Tests/org.tizen.example.Reply-1.0.0.tpk differ diff --git a/tct-suite-vs/Tizen.Applications.Tests/testcase/TSAppControl.cs b/tct-suite-vs/Tizen.Applications.Tests/testcase/TSAppControl.cs index 736fcc310..afeb64bbc 100755 --- a/tct-suite-vs/Tizen.Applications.Tests/testcase/TSAppControl.cs +++ b/tct-suite-vs/Tizen.Applications.Tests/testcase/TSAppControl.cs @@ -18,6 +18,7 @@ namespace Tizen.Applications.Tests private const string MyAppId1 = "org.tizen.SampleServiceApp2.Tizen"; private const string MyUIAppId = "org.tizen.example.UIApp.Tizen"; private static bool _flag; + private static bool _replyFlag = false; [SetUp] public static void Init() @@ -430,5 +431,52 @@ namespace Tizen.Applications.Tests AppControl MyAppControl = new AppControl(); Assert.Throws(() => Tizen.Applications.AppControl.SendTerminateRequest(MyAppControl)); } + + static void ReplyReceivedCallback(Tizen.Applications.AppControl launchRequest, Tizen.Applications.AppControl replyRequest, AppControlReplyResult result) + { + if (result == AppControlReplyResult.Succeeded) + _replyFlag = true; + } + + [Test] + [Category("P1")] + [Description("Test : Send Launch Request Asynchronously - UI app should be launched")] + [Property("SPEC", "Tizen.Applications.AppControl.SendLaunchRequestAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")] + [Property("COVPARAM", "Tizen.Applications.AppControl, Tizen.Applications.AppControlReplyCallback")] + public async Task SendLaunchRequestAsync_TO_UI_APP() + { + + /* PRECONDITION + * Install org.tizen.example.Reply.tpk + * Privilege: http://tizen.org/privilege/appmanager.launch + * */ + + /* TEST CODE */ + bool isRunning = false; + string appId = "org.tizen.example.Reply"; + + _appControl = new Tizen.Applications.AppControl(); + Assert.IsNotNull(_appControl, "Object should not be null after initializing"); + + _appControl.Operation = AppControlOperations.Default; + _appControl.ApplicationId = appId; + + AppControlResult result = await Tizen.Applications.AppControl.SendLaunchRequestAsync(_appControl, ReplyReceivedCallback); + Assert.AreEqual(result, AppControlResult.None, "The result should be None."); + _runningApps = ApplicationManager.GetRunningApplicationsAsync(); + _list = await _runningApps; + foreach (var app in _list) + { + if (app.ApplicationId == appId) + isRunning = true; + } + Assert.IsTrue(isRunning, appId + " should be running after launching request has sent"); + + await Task.Delay(5000); + Assert.IsTrue (_replyFlag, " The flag should be true"); + } } }