From: ChulSeung Kim Date: Wed, 7 Jun 2017 12:01:31 +0000 (+0900) Subject: Modify AppShortcutTestCases X-Git-Tag: submit/tizen/20170808.015446~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=84ae867371a0166335dc5ba58fab2f0aa932eb09;p=profile%2Ftv%2Fapps%2Fdotnet%2Fhome.git Modify AppShortcutTestCases Change-Id: I9a5928821fc26edbb2d7be90ff05c140be787844 --- diff --git a/HomeUnitTest/AppShortcutTestCases.cs b/HomeUnitTest/AppShortcutTestCases.cs index e777fb4..0484e2e 100644 --- a/HomeUnitTest/AppShortcutTestCases.cs +++ b/HomeUnitTest/AppShortcutTestCases.cs @@ -90,15 +90,34 @@ namespace HomeUnitTest Console.Out.WriteLine("App ID : " + app.AppID); Console.Out.WriteLine("Installed Date : " + app.Installed); + Assert.AreNotEqual(app.AppID, null, + "AppID is required!!!"); + // Err : CurrentStateDescription should not be null Assert.AreNotEqual(app.CurrentStateDescription, null, - "StateDescription CurrentStateDescription is null!!!"); + "CurrentStateDescription is null!!!"); + + // Err : type of Action should be the AppControlAction + Assert.IsTrue(app.CurrentStateDescription.Action is AppControlAction, + "AppShortcut's action should be AppControlAction!!!"); + + // Err : Action in CurrentStateDescription should not be null + Assert.AreNotEqual(app.CurrentStateDescription.Action, null, + "StateDescription should have Action!!!"); + + // Err : Label in CurrentStateDescription should not be null + Assert.AreNotEqual(app.CurrentStateDescription.Label, null, + "StateDescription should have Label!!!"); + + // Err : IconPath in CurrentStateDescription should not be null + Assert.AreNotEqual(app.CurrentStateDescription.IconPath, null, + "StateDescription should have App Icon!!!"); // Err : removable app property check if (app.CurrentStateDescription.Label.Contains("removable") && app.IsRemovable == false) { - Assert.Fail("Removable is failed"); + Assert.Fail("Setting Removable flag is wrong"); } // Err : Invalid state description removing. diff --git a/HomeUnitTest/RecentTestCases.cs b/HomeUnitTest/RecentTestCases.cs index e9cba17..b0fae05 100644 --- a/HomeUnitTest/RecentTestCases.cs +++ b/HomeUnitTest/RecentTestCases.cs @@ -46,7 +46,7 @@ namespace HomeUnitTest { var recents = controller.GetList(); - // R : MAX number of recent = 10 + // Req : MAX number of recent = 10 if (recents.Count() > 10) { Assert.Fail("Too many Recent!!!, Returned = " + recents.Count()); @@ -73,7 +73,7 @@ namespace HomeUnitTest break; } - // R : Invalid Recent(id, label has 'invalid') should not included!!! + // Req : Invalid Recent(id, label has 'invalid') should not included!!! if (recent.CurrentStateDescription == null || recent.CurrentStateDescription.Label.ToLower().Contains("invalid")) { @@ -81,7 +81,7 @@ namespace HomeUnitTest } } - // R : Test Sample Recent is consist of App and Media types. + // Err : Test Sample Recents are consist of App and Media types both. if (isAllMedias || isAllApps) { Assert.Fail("Invalid Recent list, All Media({0}), All Apps({1})", isAllMedias, isAllApps); diff --git a/LibTVRefCommonPortable/Models/AppShortcutController.cs b/LibTVRefCommonPortable/Models/AppShortcutController.cs index e6cbdd5..37df5c0 100755 --- a/LibTVRefCommonPortable/Models/AppShortcutController.cs +++ b/LibTVRefCommonPortable/Models/AppShortcutController.cs @@ -56,8 +56,8 @@ namespace LibTVRefCommonPortable.Models var defaultStateDescription = new StateDescription() { - Label = item.Applabel, - IconPath = item.IconPath, + Label = item.Applabel ?? "No Name", + IconPath = item.IconPath ?? DefaultAppIcon, Action = new AppControlAction() { AppID = item.AppID, diff --git a/LibTVRefCommonPortable/Models/ManagedApps.cs b/LibTVRefCommonPortable/Models/ManagedApps.cs index 4f39126..b6b00b1 100644 --- a/LibTVRefCommonPortable/Models/ManagedApps.cs +++ b/LibTVRefCommonPortable/Models/ManagedApps.cs @@ -78,6 +78,11 @@ namespace LibTVRefCommonPortable.Models /// If the application isn't pinnable return 'true' public static bool IsNonPinnableApps(string appID) { + if (appID == null) + { + return true; + } + if (appID.CompareTo(TVHomeAppID) == 0 || appID.CompareTo(TVAppsAppID) == 0 || appID.CompareTo(MediaHubAppID) == 0 || @@ -96,6 +101,11 @@ namespace LibTVRefCommonPortable.Models /// If the application have to be hidden, return 'true' public static bool IsHiddenRecentApp(string appID) { + if (appID == null) + { + return true; + } + if (appID.CompareTo(TVHomeAppID) == 0 || appID.CompareTo(TVAppsAppID) == 0 || appID.CompareTo(MediaHubAppID) == 0 || diff --git a/LibTVRefCommonPortable/Stubs/ApplicationManagerAPITestStub.cs b/LibTVRefCommonPortable/Stubs/ApplicationManagerAPITestStub.cs index f19f7e8..082dc66 100644 --- a/LibTVRefCommonPortable/Stubs/ApplicationManagerAPITestStub.cs +++ b/LibTVRefCommonPortable/Stubs/ApplicationManagerAPITestStub.cs @@ -69,6 +69,28 @@ namespace LibTVRefCommonPortable.Stubs InstalledTime = new DateTime(2017, 05, 02), }); + installedApps.Add(new InstalledApp + { + Applabel = "invalid.app3.noid", + IconPath = "path/app3", + InstalledTime = new DateTime(2017, 05, 02), + }); + + installedApps.Add(new InstalledApp + { + Applabel = "app4.noicon", + AppID = "app4.noicon", + InstalledTime = new DateTime(2017, 05, 02), + }); + + installedApps.Add(new InstalledApp + { + Applabel = "app5.nolabel", + AppID = "app5.nolabel", + IconPath = "path/app5", + InstalledTime = new DateTime(2017, 05, 02), + }); + installedApps.Add(new InstalledApp { Applabel = "invalid.org.tizen.xahome",