Modify AppShortcutTestCases
authorChulSeung Kim <charles0.kim@samsung.com>
Wed, 7 Jun 2017 12:01:31 +0000 (21:01 +0900)
committerChulSeung Kim <charles0.kim@samsung.com>
Thu, 8 Jun 2017 09:34:56 +0000 (18:34 +0900)
Change-Id: I9a5928821fc26edbb2d7be90ff05c140be787844

HomeUnitTest/AppShortcutTestCases.cs
HomeUnitTest/RecentTestCases.cs
LibTVRefCommonPortable/Models/AppShortcutController.cs
LibTVRefCommonPortable/Models/ManagedApps.cs
LibTVRefCommonPortable/Stubs/ApplicationManagerAPITestStub.cs

index e777fb4..0484e2e 100644 (file)
@@ -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.
index e9cba17..b0fae05 100644 (file)
@@ -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);
index e6cbdd5..37df5c0 100755 (executable)
@@ -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,
index 4f39126..b6b00b1 100644 (file)
@@ -78,6 +78,11 @@ namespace LibTVRefCommonPortable.Models
         /// <returns>If the application isn't pinnable return 'true'</returns>
         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
         /// <returns>If the application have to be hidden, return 'true'</returns>
         public static bool IsHiddenRecentApp(string appID)
         {
+            if (appID == null)
+            {
+                return true;
+            }
+
             if (appID.CompareTo(TVHomeAppID) == 0 ||
                   appID.CompareTo(TVAppsAppID) == 0 ||
                   appID.CompareTo(MediaHubAppID) == 0 ||
index f19f7e8..082dc66 100644 (file)
@@ -71,6 +71,28 @@ namespace LibTVRefCommonPortable.Stubs
 
                 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",
                     AppID = "org.tizen.xahome",
                     IconPath = "path/app3",