[MediaTool][TCSACR-174][Add rotate and flip method for MediaTool] 00/188500/2
authorHaesu Gwon <haesu.gwon@samsung.com>
Wed, 5 Sep 2018 11:12:49 +0000 (20:12 +0900)
committerHaesu Gwon <haesu.gwon@samsung.com>
Thu, 6 Sep 2018 03:35:24 +0000 (12:35 +0900)
Change-Id: I8656064c0ea791a4b68234213c25a18bba54230b

tct-suite-vs/Tizen.Multimedia.Tests/testcase/MediaTool/TSMediaPacket.cs [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index f0b1421..8755f18
@@ -87,12 +87,16 @@ namespace Tizen.Multimedia.Tests
             Assert.Throws<ObjectDisposedException>(() => { var v = packet.BufferWrittenLength; });
             Assert.Throws<ObjectDisposedException>(() => { var v = packet.VideoPlanes; });
             Assert.Throws<ObjectDisposedException>(() => { var v = packet.BufferFlags; });
+            Assert.Throws<ObjectDisposedException>(() => { var v = packet.Rotation; });
+            Assert.Throws<ObjectDisposedException>(() => { var v = packet.Flip; });
             #endregion
 
             #region Write operations
             Assert.Throws<ObjectDisposedException>(() => { packet.Pts = 1; });
             Assert.Throws<ObjectDisposedException>(() => { packet.Dts = 1; });
             Assert.Throws<ObjectDisposedException>(() => { packet.BufferFlags = MediaPacketBufferFlags.CodecConfig; });
+            Assert.Throws<ObjectDisposedException>(() => { packet.Rotation = Rotation.Rotate90; });
+            Assert.Throws<ObjectDisposedException>(() => { packet.Flip = Flips.Horizontal; });
             #endregion
         }
 
@@ -345,5 +349,77 @@ namespace Tizen.Multimedia.Tests
                 Assert.AreEqual(flags, packet.BufferFlags);
             }
         }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test all available rotation enums.")]
+        [Property("SPEC", "Tizen.Multimedia.MediaPacket.Rotation A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRE")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public static void Rotation_VALUE()
+        {
+            using (MediaPacket packet = MediaPacket.Create(SimpleFormat))
+            {
+                foreach (Rotation rotation in Enum.GetValues(typeof(Rotation)))
+                {
+                    packet.Rotation = rotation;
+                    Assert.AreEqual(rotation, packet.Rotation);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Test whether Argument exception is thrown when invalid argument is set.")]
+        [Property("SPEC", "Tizen.Multimedia.MediaPacket.Rotation A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public static void Rotation_CHECK_EXCEPTION()
+        {
+            using (MediaPacket packet = MediaPacket.Create(SimpleFormat))
+            {
+                Assert.Throws<ArgumentException>(() => packet.Rotation = (Rotation)(-1));
+
+                Assert.Throws<ArgumentException>(() => packet.Rotation = (Rotation)4);
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test all available flip enums.")]
+        [Property("SPEC", "Tizen.Multimedia.MediaPacket.Flip A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRE")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public static void Flip_VALUE()
+        {
+            using (MediaPacket packet = MediaPacket.Create(SimpleFormat))
+            {
+                foreach (Flips flip in Enum.GetValues(typeof(Flips)))
+                {
+                    packet.Flip = flip;
+                    Assert.AreEqual(flip, packet.Flip);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Test whether Argument exception is thrown when invalid argument is set.")]
+        [Property("SPEC", "Tizen.Multimedia.MediaPacket.Flip A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public static void Flip_CHECK_EXCEPTION()
+        {
+            using (MediaPacket packet = MediaPacket.Create(SimpleFormat))
+            {
+                Assert.Throws<ArgumentException>(() => packet.Flip = (Flips)(-1));
+
+                Assert.Throws<ArgumentException>(() => packet.Flip = (Flips)3);
+            }
+        }
     }
 }