From 1e332f0c86715499811407f38fc4cefdfd65c2ee Mon Sep 17 00:00:00 2001 From: Taehyub Kim Date: Thu, 28 Apr 2022 02:03:29 -0700 Subject: [PATCH] [NUI][TCSACR-487] Add DragAndDrop APIs Change-Id: I7752dafdf05665a5cbf1caa13832fb3a7665eb04 --- .../Tizen.NUI.Tests/testcase/TSDragAndDrop.cs | 133 +++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100755 tct-suite-vs/Tizen.NUI.Tests/testcase/TSDragAndDrop.cs 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 index 0000000..ae8939f --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSDragAndDrop.cs @@ -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(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()); + } + } + } +} -- 2.7.4