From 7657eb8992312a2ea58d7f12f974402e0dc412be Mon Sep 17 00:00:00 2001 From: Jaehyun Cho Date: Fri, 15 Oct 2021 15:33:13 +0900 Subject: [PATCH] [NUI][TCSACR-466] Add TCT for ImageView.AdjustViewSize TCT patch for https://code.sec.samsung.net/jira/browse/TCSACR-466 TCT is added for new API ImageView.AdjustViewSize Change-Id: I6a484875bd811ce32d3a56ef2e0979c47239fe72 --- .../Tizen.NUI.Tests/testcase/TSImageView.cs | 99 +++++++++++++++++++++- 1 file changed, 98 insertions(+), 1 deletion(-) diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSImageView.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSImageView.cs index 6a654f2..3a2c0bd 100755 --- a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSImageView.cs +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSImageView.cs @@ -473,5 +473,102 @@ namespace Tizen.NUI.Tests imageView.Unparent(); } + [Test] + [Category("P1")] + [Description("Test AdjustViewSize. Check whether AdjustViewSize is readable and writable with true value.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.ImageView.AdjustViewSize A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "jae_hyun.cho@samsung.com")] + public async Task AdjustViewSize_SET_GET_TRUE_VALUE() + { + /* TEST CODE */ + var parentView = new View() + { + Layout = new AbsoluteLayout(), + WidthSpecification = 512, + HeightSpecification = 256, + }; + + Assert.IsNotNull(parentView, "Should not be a Null : View"); + Assert.IsInstanceOf(parentView, "Should be an instance of : View"); + + var imageView = new ImageView(image_path) + { + FittingMode = FittingModeType.ShrinkToFit, + WidthSpecification = LayoutParamPolicies.WrapContent, + HeightSpecification = LayoutParamPolicies.MatchParent, + }; + + Assert.IsNotNull(imageView, "Should not be a Null : ImageView"); + Assert.IsInstanceOf(imageView, "Should be an instance of : ImageView"); + + imageView.ResourceUrl = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture2.jpg"; + + imageView.AdjustViewSize = true; + + Assert.IsNotNull(Window.Instance, "Should not be a Null : Window.Instance"); + Assert.IsInstanceOf(Window.Instance, "Should be an instance of : Window.Instance"); + + Window.Instance.Add(parentView); + parentView.Add(imageView); + + await Task.Delay(1000); + + Assert.AreEqual(true, imageView.AdjustViewSize, "Retrieved AdjustViewSize should be equal to set value"); + Assert.AreEqual(imageView.Size2D.Width, imageView.Size2D.Height, "Retrieved Width should be equal to Height because image's aspect ratio 1 is respected by AdjustViewSize true"); + + imageView.Unparent(); + parentView.Unparent(); + } + + [Test] + [Category("P1")] + [Description("Test AdjustViewSize. Check whether AdjustViewSize is readable and writable with false value.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.ImageView.AdjustViewSize A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "jae_hyun.cho@samsung.com")] + public async Task AdjustViewSize_SET_GET_FALSE_VALUE() + { + /* TEST CODE */ + var parentView = new View() + { + Layout = new AbsoluteLayout(), + WidthSpecification = 512, + HeightSpecification = 256, + }; + + Assert.IsNotNull(parentView, "Should not be a Null : View"); + Assert.IsInstanceOf(parentView, "Should be an instance of : View"); + + var imageView = new ImageView(image_path) + { + FittingMode = FittingModeType.ShrinkToFit, + WidthSpecification = LayoutParamPolicies.WrapContent, + HeightSpecification = LayoutParamPolicies.MatchParent, + }; + + Assert.IsNotNull(imageView, "Should not be a Null : ImageView"); + Assert.IsInstanceOf(imageView, "Should be an instance of : ImageView"); + + imageView.ResourceUrl = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture2.jpg"; + + imageView.AdjustViewSize = false; + + Assert.IsNotNull(Window.Instance, "Should not be a Null : Window.Instance"); + Assert.IsInstanceOf(Window.Instance, "Should be an instance of : Window.Instance"); + + Window.Instance.Add(parentView); + parentView.Add(imageView); + + await Task.Delay(1000); + + Assert.AreEqual(false, imageView.AdjustViewSize, "Retrieved AdjustViewSize should be equal to set value"); + Assert.AreNotEqual(imageView.Size2D.Width, imageView.Size2D.Height, "Retrieved Width should not be equal to Height because image's aspect ratio 1 is not respected by AdjustViewSize false"); + + imageView.Unparent(); + parentView.Unparent(); + } } -} \ No newline at end of file +} -- 2.7.4