[NUI][TCSACR-466] Add TCT for ImageView.AdjustViewSize 42/265342/1
authorJaehyun Cho <jae_hyun.cho@samsung.com>
Fri, 15 Oct 2021 06:33:13 +0000 (15:33 +0900)
committerJaehyun Cho <jae_hyun.cho@samsung.com>
Fri, 15 Oct 2021 06:33:13 +0000 (15:33 +0900)
TCT patch for https://code.sec.samsung.net/jira/browse/TCSACR-466
TCT is added for new API ImageView.AdjustViewSize

Change-Id: I6a484875bd811ce32d3a56ef2e0979c47239fe72

tct-suite-vs/Tizen.NUI.Tests/testcase/TSImageView.cs

index 6a654f2..3a2c0bd 100755 (executable)
@@ -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<View>(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>(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>(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<View>(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>(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>(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
+}