From 73c7f147f398936a5d5c97db3ba91b51d236d2c2 Mon Sep 17 00:00:00 2001 From: SukhyungKang Date: Wed, 18 Oct 2023 10:22:23 +0900 Subject: [PATCH] [RemoteView][Non-ACR] fix tct fail when the widget feature is disabled Change-Id: Ib83821b48be6f8d2f9d4641b96439b760f6703d6 Signed-off-by: SukhyungKang --- .../testcase/TSRemoteView.cs | 50 ++++--- .../testcase/TSRemoteViewFactory.cs | 162 +++++++++++++++------ 2 files changed, 152 insertions(+), 60 deletions(-) diff --git a/tct-suite-vs/Tizen.RemoteView.Tests/testcase/TSRemoteView.cs b/tct-suite-vs/Tizen.RemoteView.Tests/testcase/TSRemoteView.cs index 96546f1..111a790 100755 --- a/tct-suite-vs/Tizen.RemoteView.Tests/testcase/TSRemoteView.cs +++ b/tct-suite-vs/Tizen.RemoteView.Tests/testcase/TSRemoteView.cs @@ -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 + { + if (_window == null) + _window = new Window(Application.Current.ApplicationInfo.ApplicationId); + + _window.Show(); + _background = new Background(_window) + { + 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"); + } + 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] diff --git a/tct-suite-vs/Tizen.RemoteView.Tests/testcase/TSRemoteViewFactory.cs b/tct-suite-vs/Tizen.RemoteView.Tests/testcase/TSRemoteViewFactory.cs index 00d6e7a..2a53a55 100755 --- a/tct-suite-vs/Tizen.RemoteView.Tests/testcase/TSRemoteViewFactory.cs +++ b/tct-suite-vs/Tizen.RemoteView.Tests/testcase/TSRemoteViewFactory.cs @@ -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 { - 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(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(myRemoteView); + Log.Debug("[TCT]", "END"); + } + 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 + { + 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(myRemoteView1); + Log.Debug("[TCT]", "END"); + } + 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(myRemoteView1); - Log.Debug("[TCT]", "END"); } [Test] @@ -174,16 +205,27 @@ namespace Tizen.Applications.Tests */ Log.Debug("[TCT]", "START"); - if (!_flag) + try + { + 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(myRemoteView1); + Log.Debug("[TCT]", "END"); + } + 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(myRemoteView1); - Log.Debug("[TCT]", "END"); } [Test] @@ -203,16 +245,27 @@ namespace Tizen.Applications.Tests */ Log.Debug("[TCT]", "START"); - if (!_flag) + try + { + 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(myRemoteView1); + Log.Debug("[TCT]", "END"); + } + 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(myRemoteView1); - Log.Debug("[TCT]", "END"); } [Test] @@ -232,16 +285,27 @@ namespace Tizen.Applications.Tests */ Log.Debug("[TCT]", "START"); - if (!_flag) + try + { + 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(myRemoteView1); + Log.Debug("[TCT]", "END"); + } + 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(myRemoteView1); - Log.Debug("[TCT]", "END"); } [Test] @@ -260,10 +324,22 @@ namespace Tizen.Applications.Tests */ Log.Debug("[TCT]", "START"); - if (!_flag) + try + { + if (!_flag) + { + RemoteViewFactory.Init(_window); + _flag = true; + } + } + 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 -- 2.7.4