[RemoteView][Non-ACR] fix tct fail when the widget feature is disabled 72/300172/6
authorSukhyungKang <shine.kang@samsung.com>
Wed, 18 Oct 2023 01:22:23 +0000 (10:22 +0900)
committerSukhyungKang <shine.kang@samsung.com>
Wed, 18 Oct 2023 23:13:57 +0000 (08:13 +0900)
Change-Id: Ib83821b48be6f8d2f9d4641b96439b760f6703d6
Signed-off-by: SukhyungKang <shine.kang@samsung.com>
tct-suite-vs/Tizen.RemoteView.Tests/testcase/TSRemoteView.cs
tct-suite-vs/Tizen.RemoteView.Tests/testcase/TSRemoteViewFactory.cs

index 96546f1..111a790 100755 (executable)
@@ -22,6 +22,7 @@ using System.Threading.Tasks;
 using Tizen;
 using Tizen.Applications;
 using ElmSharp;
+using Tizen.System;
 
 namespace Tizen.Applications.Tests
 {
@@ -36,28 +37,43 @@ namespace Tizen.Applications.Tests
         private RemoteView _remoteView;
         private double _period = 0;
 
+        private bool _isWidgetSupported = false;
+
         [SetUp]
         public void Init()
         {
             Log.Debug("[TCT]", "START");
-            if (_window == null)
-                _window = new Window(Application.Current.ApplicationInfo.ApplicationId);
-
-            _window.Show();
-            _background = new Background(_window)
+            Information.TryGetValue("http://tizen.org/feature/shell.appwidget", out _isWidgetSupported);
+            try\r
+            {\r
+                if (_window == null)\r
+                    _window = new Window(Application.Current.ApplicationInfo.ApplicationId);\r
+\r
+                _window.Show();\r
+                _background = new Background(_window)\r
+                {\r
+                    AlignmentX = -1,\r
+                    AlignmentY = -1,\r
+                    WeightX = 1,\r
+                    WeightY = 1,\r
+                    Color = Color.Black\r
+                };\r
+                _background.Show();\r
+                _window.AddResizeObject(_background);\r
+\r
+                RemoteViewFactory.Init(_window);\r
+                _remoteView = RemoteViewFactory.Create(_window, _widgetId, _content, _period, true, true, true);\r
+                Log.Debug("[TCT]", "END");\r
+            }
+            catch (NotSupportedException)
             {
-                AlignmentX = -1,
-                AlignmentY = -1,
-                WeightX = 1,
-                WeightY = 1,
-                Color = Color.Black
-            };
-            _background.Show();
-            _window.AddResizeObject(_background);
-
-            RemoteViewFactory.Init(_window);
-            _remoteView = RemoteViewFactory.Create(_window, _widgetId, _content, _period, true, true, true);
-            Log.Debug("[TCT]", "END");
+                Assert.IsTrue(_isWidgetSupported == false, "Invalid NotSupportedException");
+                Assert.Pass("widget feature disabled pass");
+            }
+            catch (Exception e)
+            {
+                Assert.Fail("There should be no exception " + e.ToString());
+            }
         }
 
         [TearDown]
index 00d6e7a..2a53a55 100755 (executable)
@@ -22,6 +22,7 @@ using System.Threading.Tasks;
 using Tizen;
 using Tizen.Applications;
 using ElmSharp;
+using Tizen.System;
 
 namespace Tizen.Applications.Tests
 {
@@ -36,6 +37,8 @@ namespace Tizen.Applications.Tests
         private double _period = 0;
         private bool _flag;
 
+        private bool _isWidgetSupported = false;
+
         [SetUp]
         public void Init()
         {
@@ -53,6 +56,8 @@ namespace Tizen.Applications.Tests
             _background.Show();
             _window.AddResizeObject(_background);
             _flag = false;
+
+            Information.TryGetValue("http://tizen.org/feature/shell.appwidget", out _isWidgetSupported);
             Log.Debug("[TCT]", "END");
         }
 
@@ -92,6 +97,10 @@ namespace Tizen.Applications.Tests
                 RemoteViewFactory.Init(_window);
                 _flag = true;
             }
+            catch (NotSupportedException)
+            {
+                Assert.IsTrue(_isWidgetSupported == false, "Invalid NotSupportedException");
+            }
             catch (Exception e)
             {
                 Assert.Fail(e.ToString());
@@ -116,16 +125,27 @@ namespace Tizen.Applications.Tests
              */
 
             Log.Debug("[TCT]", "START");
-            if (!_flag)
+            try\r
             {
-                RemoteViewFactory.Init(_window);
-                _flag = true;
-            }
+                if (!_flag)
+                {
+                    RemoteViewFactory.Init(_window);
+                    _flag = true;
+                }
 
-            var myRemoteView = RemoteViewFactory.Create(_window, _widgetId, _content, _period, true, true, true);
-            Assert.IsNotNull(myRemoteView, "Object should not be null");
-            Assert.IsInstanceOf<RemoteView>(myRemoteView);
-            Log.Debug("[TCT]", "END");
+                var myRemoteView = RemoteViewFactory.Create(_window, _widgetId, _content, _period, true, true, true);
+                Assert.IsNotNull(myRemoteView, "Object should not be null");
+                Assert.IsInstanceOf<RemoteView>(myRemoteView);
+                Log.Debug("[TCT]", "END");\r
+            }
+            catch (NotSupportedException)
+            {
+                Assert.IsTrue(_isWidgetSupported == false, "Invalid NotSupportedException");
+            }
+            catch (Exception e)
+            {
+                Assert.Fail(e.ToString());
+            }
         }
 
         [Test]
@@ -145,16 +165,27 @@ namespace Tizen.Applications.Tests
              */
 
             Log.Debug("[TCT]", "START");
-            if (!_flag)
+            try\r
+            {\r
+                if (!_flag)
+                {
+                    RemoteViewFactory.Init(_window);
+                    _flag = true;
+                }
+
+                var myRemoteView1 = RemoteViewFactory.Create(_window, _widgetId, _content, _period, false, false, true);
+                Assert.IsNotNull(myRemoteView1, "Object should not be null");
+                Assert.IsInstanceOf<RemoteView>(myRemoteView1);
+                Log.Debug("[TCT]", "END");\r
+            }\r
+            catch (NotSupportedException)
             {
-                RemoteViewFactory.Init(_window);
-                _flag = true;
+                Assert.IsTrue(_isWidgetSupported == false, "Invalid NotSupportedException");
+            }
+            catch (Exception e)
+            {
+                Assert.Fail(e.ToString());
             }
-
-            var myRemoteView1 = RemoteViewFactory.Create(_window, _widgetId, _content, _period, false, false, true);
-            Assert.IsNotNull(myRemoteView1, "Object should not be null");
-            Assert.IsInstanceOf<RemoteView>(myRemoteView1);
-            Log.Debug("[TCT]", "END");
         }
 
         [Test]
@@ -174,16 +205,27 @@ namespace Tizen.Applications.Tests
              */
 
             Log.Debug("[TCT]", "START");
-            if (!_flag)
+            try\r
+            {\r
+                    if (!_flag)
+                {
+                    RemoteViewFactory.Init(_window);
+                    _flag = true;
+                }
+
+                var myRemoteView1 = RemoteViewFactory.Create(_window, _widgetId, _content, _period, true, false, false);
+                Assert.IsNotNull(myRemoteView1, "Object should not be null");
+                Assert.IsInstanceOf<RemoteView>(myRemoteView1);
+                Log.Debug("[TCT]", "END");\r
+            }\r
+            catch (NotSupportedException)
             {
-                RemoteViewFactory.Init(_window);
-                _flag = true;
+                Assert.IsTrue(_isWidgetSupported == false, "Invalid NotSupportedException");
+            }
+            catch (Exception e)
+            {
+                Assert.Fail(e.ToString());
             }
-
-            var myRemoteView1 = RemoteViewFactory.Create(_window, _widgetId, _content, _period, true, false, false);
-            Assert.IsNotNull(myRemoteView1, "Object should not be null");
-            Assert.IsInstanceOf<RemoteView>(myRemoteView1);
-            Log.Debug("[TCT]", "END");
         }
 
         [Test]
@@ -203,16 +245,27 @@ namespace Tizen.Applications.Tests
              */
 
             Log.Debug("[TCT]", "START");
-            if (!_flag)
+            try\r
+            {\r
+                    if (!_flag)
+                {
+                    RemoteViewFactory.Init(_window);
+                    _flag = true;
+                }
+
+                var myRemoteView1 = RemoteViewFactory.Create(_window, _widgetId, _content, _period, true, false, false);
+                Assert.IsNotNull(myRemoteView1, "Object should not be null");
+                Assert.IsInstanceOf<RemoteView>(myRemoteView1);
+                Log.Debug("[TCT]", "END");\r
+            }\r
+            catch (NotSupportedException)
             {
-                RemoteViewFactory.Init(_window);
-                _flag = true;
+                Assert.IsTrue(_isWidgetSupported == false, "Invalid NotSupportedException");
+            }
+            catch (Exception e)
+            {
+                Assert.Fail(e.ToString());
             }
-
-            var myRemoteView1 = RemoteViewFactory.Create(_window, _widgetId, _content, _period, true, false, false);
-            Assert.IsNotNull(myRemoteView1, "Object should not be null");
-            Assert.IsInstanceOf<RemoteView>(myRemoteView1);
-            Log.Debug("[TCT]", "END");
         }
 
         [Test]
@@ -232,16 +285,27 @@ namespace Tizen.Applications.Tests
              */
 
             Log.Debug("[TCT]", "START");
-            if (!_flag)
+            try\r
+            {\r
+                if (!_flag)
+                {
+                    RemoteViewFactory.Init(_window);
+                    _flag = true;
+                }
+
+                var myRemoteView1 = RemoteViewFactory.Create(_window, _widgetId, _content, _period, false, false, false);
+                Assert.IsNotNull(myRemoteView1, "Object should not be null");
+                Assert.IsInstanceOf<RemoteView>(myRemoteView1);
+                Log.Debug("[TCT]", "END");\r
+            }\r
+            catch (NotSupportedException)
             {
-                RemoteViewFactory.Init(_window);
-                _flag = true;
+                Assert.IsTrue(_isWidgetSupported == false, "Invalid NotSupportedException");
+            }
+            catch (Exception e)
+            {
+                Assert.Fail(e.ToString());
             }
-
-            var myRemoteView1 = RemoteViewFactory.Create(_window, _widgetId, _content, _period, false, false, false);
-            Assert.IsNotNull(myRemoteView1, "Object should not be null");
-            Assert.IsInstanceOf<RemoteView>(myRemoteView1);
-            Log.Debug("[TCT]", "END");
         }
 
         [Test]
@@ -260,10 +324,22 @@ namespace Tizen.Applications.Tests
              */
 
             Log.Debug("[TCT]", "START");
-            if (!_flag)
+            try\r
+            {\r
+                if (!_flag)
+                {
+                    RemoteViewFactory.Init(_window);
+                    _flag = true;
+                }\r
+            }\r
+            catch (NotSupportedException)
             {
-                RemoteViewFactory.Init(_window);
-                _flag = true;
+                Assert.IsTrue(_isWidgetSupported == false, "Invalid NotSupportedException");
+                Assert.Pass("widget feature disabled pass");
+            }
+            catch (Exception e)
+            {
+                Assert.Fail(e.ToString());
             }
 
             try