[NUI][TCSACR-487] Add DragAndDrop APIs 66/274466/6
authorTaehyub Kim <taehyub.kim@samsung.com>
Thu, 28 Apr 2022 09:03:29 +0000 (02:03 -0700)
committerTaehyub Kim <taehyub.kim@samsung.com>
Thu, 23 Feb 2023 07:26:45 +0000 (16:26 +0900)
Change-Id: I7752dafdf05665a5cbf1caa13832fb3a7665eb04

tct-suite-vs/Tizen.NUI.Tests/testcase/TSDragAndDrop.cs [new file with mode: 0755]

diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSDragAndDrop.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSDragAndDrop.cs
new file mode 100755 (executable)
index 0000000..ae8939f
--- /dev/null
@@ -0,0 +1,133 @@
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Test;
+
+namespace Tizen.NUI.Tests
+{
+
+    [TestFixture]
+    [Description("Tizen.NUI.DragAndDrop Tests")]
+    public class DragAndDropTests
+    {
+        private string TAG = "NUI";
+
+        [SetUp]
+        public void Init()
+        {
+            Tizen.Log.Info(TAG, "Init() is called!");
+            App.MainTitleChangeText("DragAndDropTests");
+            App.MainTitleChangeBackgroundColor(null);
+        }
+
+        [TearDown]
+        public void Destroy()
+        {
+            Tizen.Log.Info(TAG, "Destroy() is called!");
+        }
+
+        private void OnSourceEventFunc(DragSourceEventType type)
+        {
+            Tizen.Log.Info(TAG, "Drag Source Event Function is called!");
+        }
+
+        private void OnTargetEventFunc(View targetView, DragEvent dragEvent)
+        {
+            Tizen.Log.Info(TAG, "Target Event Function is called!");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("DragAndDrop constructor test, create a DragAndDrop instance.")]
+        [Property("SPEC", "Tizen.NUI.DragAndDrop.Instance A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRO")]
+        [Property("AUTHOR", "Taehyub Kim, taehyub.kim@samsung.com")]
+        public void Instance_GET_VALUE()
+        {
+            /* TEST CODE */
+            var dnd = DragAndDrop.Instance;
+            Assert.IsInstanceOf<DragAndDrop>(dnd, "Should return DragAndDrop instance.");
+            Assert.IsNotNull(dnd, "Object should not be null");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test StartDragAndDrop. Check whether the start drag and drop works.")]
+        [Property("SPEC", "Tizen.NUI.DragAndDrop.StartDragAndDrop M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Taehyub Kim, taehyub.kim@samsung.com")]
+        public void StartDragAndDrop_CHECK_RETURN_VALUE()
+        {
+            /* TEST CODE */
+            try
+            {
+                var window = Window.Instance;
+
+                var dnd = DragAndDrop.Instance;
+                var sourceView = new ImageView();
+                window.Add(sourceView);
+
+                var shadowView = new ImageView();
+
+                DragData dragData;
+                dragData.MimeType = "text/uri-list";
+                dragData.Data = "ImagePathHere";
+
+                dnd.StartDragAndDrop(sourceView, shadowView, dragData, OnSourceEventFunc);
+            }
+            catch (Exception e)
+            {
+                Assert.Fail("Caught Exception" + e.ToString());
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test AddListener. Check whether the adding listener works.")]
+        [Property("SPEC", "Tizen.NUI.DragAndDrop.AddListener M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Taehyub Kim, taehyub.kim@samsung.com")]
+        public void AddListener_CHECK_RETURN_VALUE()
+        {
+            /* TEST CODE */
+            try
+            {
+                var dnd = DragAndDrop.Instance;
+                var targetView = new ImageView();
+                dnd.AddListener(targetView, OnTargetEventFunc);
+            }
+            catch (Exception e)
+            {
+                Assert.Fail("Caught Exception" + e.ToString());
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test RemoveListener. Check whether the removing listener works.")]
+        [Property("SPEC", "Tizen.NUI.DragAndDrop.RemoveListener M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Taehyub Kim, taehyub.kim@samsung.com")]
+        public void RemoveListener_CHECK_RETURN_VALUE()
+        {
+            /* TEST CODE */
+            try
+            {
+                var dnd = DragAndDrop.Instance;
+                var targetView = new ImageView();
+                dnd.AddListener(targetView, OnTargetEventFunc);
+                dnd.RemoveListener(targetView, OnTargetEventFunc);
+            }
+            catch (Exception e)
+            {
+                Assert.Fail("Caught Exception" + e.ToString());
+            }
+        }
+    }
+}