From 92e9c8a32ad501e50ae34869295f43c6985f1a37 Mon Sep 17 00:00:00 2001 From: RinaYou Date: Wed, 9 May 2018 19:33:49 +0900 Subject: [PATCH] [Xamarin.Forms][Non-ACR] Enhance TCs for coverage Change-Id: I08d14b4420c3e413221a0621ce9b2b7fa5dbdc53 Signed-off-by: Rina You --- .../testcase/TSAbsoluteLayout.cs | 29 ++++++++++++++++++++++ .../Tizen.XamarinForms2.Tests/testcase/TSColor.cs | 16 ++++++++++++ .../testcase/TSItemsViewTemplate.cs | 4 +-- .../testcase/TSLayoutTemplate.cs | 6 ++--- .../Tizen.XamarinForms4.Tests/testcase/TSPage.cs | 2 +- .../testcase/TSRelativeLayout.cs | 29 +++++++++++++++++++++- .../testcase/TSResourceDictionary.cs | 17 +++++++++++++ .../testcase/TSStackLayout.cs | 21 ++++++++++++++++ 8 files changed, 117 insertions(+), 7 deletions(-) diff --git a/tct-suite-vs/Tizen.XamarinForms1.Tests/testcase/TSAbsoluteLayout.cs b/tct-suite-vs/Tizen.XamarinForms1.Tests/testcase/TSAbsoluteLayout.cs index 82fa197..987bdb1 100755 --- a/tct-suite-vs/Tizen.XamarinForms1.Tests/testcase/TSAbsoluteLayout.cs +++ b/tct-suite-vs/Tizen.XamarinForms1.Tests/testcase/TSAbsoluteLayout.cs @@ -246,6 +246,35 @@ namespace Xamarin.Forms.Core.UnitTests [Test] [Category("P1")] + [Description("Check whether on method works properly or not.")] + [Property("SPEC", "Xamarin.Forms.AbsoluteLayout.On M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public void On_METHOD() + { + /**TEST CODE**/ + var mAbsoluteLayout = new SubAbsoluteLayout() + { + Children = + { + new Label() { + Text = "My Tex", + FontSize = 12 + }, + new Button() + { + Text = "My Button", + BorderColor = new Color(0,0,0,0) + } + } + }; + var config = mAbsoluteLayout.On(); + Assert.IsInstanceOf>(config, "config is not AbsoluteLayout"); + } + + [Test] + [Category("P1")] [Description("Check override method OnChildAdded is invoked when its child is added.")] [Property("SPEC", "Xamarin.Forms.AbsoluteLayout.OnChildAdded M")] [Property("SPEC_URL", "-")] diff --git a/tct-suite-vs/Tizen.XamarinForms2.Tests/testcase/TSColor.cs b/tct-suite-vs/Tizen.XamarinForms2.Tests/testcase/TSColor.cs index 1d33336..b2155b1 100755 --- a/tct-suite-vs/Tizen.XamarinForms2.Tests/testcase/TSColor.cs +++ b/tct-suite-vs/Tizen.XamarinForms2.Tests/testcase/TSColor.cs @@ -291,6 +291,22 @@ namespace Xamarin.Forms.Core.UnitTests [Test] [Category("P1")] + [Description("check whether FormUint method works properly or not.")] + [Property("SPEC", "Xamarin.Forms.Color.FromHsla M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Pham Phuong Dong, dong.phuong@samsung.com")] + public void FromUnit_COLOR_RETURN() + { + Random rd = new Random(); + int num = rd.Next(1, 255); + var color = Color.FromUint((uint)num); + Assert.IsNotNull(color, "This object is not null"); + Assert.IsInstanceOf(color); + } + + [Test] + [Category("P1")] [Description("Checl value returned by FromHsla.")] [Property("SPEC", "Xamarin.Forms.Color.Hue")] [Property("SPEC_URL", "-")] diff --git a/tct-suite-vs/Tizen.XamarinForms4.Tests/testcase/TSItemsViewTemplate.cs b/tct-suite-vs/Tizen.XamarinForms4.Tests/testcase/TSItemsViewTemplate.cs index cd58516..577fe10 100755 --- a/tct-suite-vs/Tizen.XamarinForms4.Tests/testcase/TSItemsViewTemplate.cs +++ b/tct-suite-vs/Tizen.XamarinForms4.Tests/testcase/TSItemsViewTemplate.cs @@ -20,8 +20,8 @@ using NUnit.Framework.TUnit; using XamarinForTizen; using XamarinForTizen.Tizen; using System.Threading.Tasks; -using AutoTemplate; - +using AutoTemplate; + namespace Xamarin.Forms.Core.UnitTests { [TestFixture] diff --git a/tct-suite-vs/Tizen.XamarinForms4.Tests/testcase/TSLayoutTemplate.cs b/tct-suite-vs/Tizen.XamarinForms4.Tests/testcase/TSLayoutTemplate.cs index 848188b..7fbf78a 100755 --- a/tct-suite-vs/Tizen.XamarinForms4.Tests/testcase/TSLayoutTemplate.cs +++ b/tct-suite-vs/Tizen.XamarinForms4.Tests/testcase/TSLayoutTemplate.cs @@ -12,9 +12,9 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License - */ - -using AutoTemplate; + */ + +using AutoTemplate; using NUnit.Framework; using NUnit.Framework.TUnit; using System.Threading.Tasks; diff --git a/tct-suite-vs/Tizen.XamarinForms4.Tests/testcase/TSPage.cs b/tct-suite-vs/Tizen.XamarinForms4.Tests/testcase/TSPage.cs index b6a0d67..77c3767 100755 --- a/tct-suite-vs/Tizen.XamarinForms4.Tests/testcase/TSPage.cs +++ b/tct-suite-vs/Tizen.XamarinForms4.Tests/testcase/TSPage.cs @@ -21,7 +21,7 @@ using XamarinForTizen.Tizen; using XamarinForTizen; using System.Threading.Tasks; using Xamarin.Forms.Platform.Tizen.Native; -using AutoTemplate; +using AutoTemplate; namespace Xamarin.Forms.Core.UnitTests { diff --git a/tct-suite-vs/Tizen.XamarinForms4.Tests/testcase/TSRelativeLayout.cs b/tct-suite-vs/Tizen.XamarinForms4.Tests/testcase/TSRelativeLayout.cs index 3f03150..239ebd6 100755 --- a/tct-suite-vs/Tizen.XamarinForms4.Tests/testcase/TSRelativeLayout.cs +++ b/tct-suite-vs/Tizen.XamarinForms4.Tests/testcase/TSRelativeLayout.cs @@ -22,7 +22,7 @@ using System.Linq.Expressions; using System.Threading.Tasks; using XamarinForTizen.Tizen; using XamarinForTizen; -using AutoTemplate; +using AutoTemplate; namespace Xamarin.Forms.Core.UnitTests { @@ -203,6 +203,33 @@ namespace Xamarin.Forms.Core.UnitTests [Test] [Category("P1")] + [Description("Check whether on method works properly or not.")] + [Property("SPEC", "Xamarin.Forms.RelativeLayout.On M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public void On_METHOD() + { + var label1 = new Label() + { + Text = "label1 test", + TextColor = new Color(0.1, 0, 0.2), + FontSize = 10 + }; + var label2 = new Label() + { + Text = "label2 test", + TextColor = new Color(0.1, 0.2, 0.3), + FontSize = 10 + }; + _relativeLayout.Children.Add(label1, Constraint.Constant(0), Constraint.Constant(0), Constraint.Constant(100), Constraint.Constant(100)); + _relativeLayout.Children.Add(label2, Constraint.Constant(100), Constraint.Constant(0), Constraint.Constant(100), Constraint.Constant(100)); + var config = _relativeLayout.On(); + Assert.IsInstanceOf>(config, "config is not RelativeLayout"); + } + + [Test] + [Category("P1")] [Description("Check whether OnAdded() is called after after a view is added to relative layout or not.")] [Property("SPEC", "Xamarin.Forms.RelativeLayout.OnAdded M")] [Property("SPEC_URL", "-")] diff --git a/tct-suite-vs/Tizen.XamarinForms4.Tests/testcase/TSResourceDictionary.cs b/tct-suite-vs/Tizen.XamarinForms4.Tests/testcase/TSResourceDictionary.cs index de23a55..5ee031d 100755 --- a/tct-suite-vs/Tizen.XamarinForms4.Tests/testcase/TSResourceDictionary.cs +++ b/tct-suite-vs/Tizen.XamarinForms4.Tests/testcase/TSResourceDictionary.cs @@ -330,5 +330,22 @@ namespace Xamarin.Forms.Core.UnitTestss var getType = resourceDic.MergedWith; Assert.AreEqual(type, getType, "Set and get value of MergedWith is not correct"); } + + [Test] + [Category("P1")] + [Description("Check whether MergedDictionaries works properly")] + [Property("SPEC", "Xamarin.Forms.ResourceDictionary.MergedDictionaries A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Vu Nhu Anh, anh.vn@samsung.com")] + public void MergedDictionaries_SET_GET() + { + var rd = new ResourceDictionary(); + rd.MergedDictionaries.Add(new ResourceDictionary() { { "hello", "bar11" } }); + rd.MergedDictionaries.Add(new ResourceDictionary() { { "hello", "bar12" } }); + rd.MergedDictionaries.Add(new ResourceDictionary() { { "hello", "bar13" } }); + + Assert.AreNotEqual(0, rd.MergedDictionaries.Count); + } } } diff --git a/tct-suite-vs/Tizen.XamarinForms5.Tests/testcase/TSStackLayout.cs b/tct-suite-vs/Tizen.XamarinForms5.Tests/testcase/TSStackLayout.cs index fd4bfe9..ee9ccfd 100755 --- a/tct-suite-vs/Tizen.XamarinForms5.Tests/testcase/TSStackLayout.cs +++ b/tct-suite-vs/Tizen.XamarinForms5.Tests/testcase/TSStackLayout.cs @@ -194,5 +194,26 @@ namespace Xamarin.Forms.Core.UnitTests await Task.Delay(500); } + [Test] + [Category("P1")] + [Description("Check whether on method works properly or not.")] + [Property("SPEC", "Xamarin.Forms.StackLayout.On M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public void On_METHOD() + { + var subStackLayout = new CustomStackLayout(); + var label = new Label() + { + Text = "Label Test" + }; + ContentPage mContentPage = new ContentPage + { + Content = subStackLayout + }; + var config = subStackLayout.On(); + Assert.IsInstanceOf> (config, "config is not IPlatformElementConfiguration"); + } } } -- 2.7.4