[NUI][TCSACR-517][Add Camera, and SceneView class] 52/282952/7
authorseungho <sbsh.baek@samsung.com>
Thu, 13 Oct 2022 12:55:35 +0000 (21:55 +0900)
committerseungho <sbsh.baek@samsung.com>
Thu, 27 Oct 2022 07:17:43 +0000 (16:17 +0900)
Change-Id: I41f76594a92780f770c8cb1e3ddc0d5a2499920c
Signed-off-by: seungho <sbsh.baek@samsung.com>
tct-suite-vs/Tizen.NUI.Scene3D.Tests/testcase/TSCamera.cs [new file with mode: 0755]
tct-suite-vs/Tizen.NUI.Scene3D.Tests/testcase/TSSceneView.cs [new file with mode: 0755]

diff --git a/tct-suite-vs/Tizen.NUI.Scene3D.Tests/testcase/TSCamera.cs b/tct-suite-vs/Tizen.NUI.Scene3D.Tests/testcase/TSCamera.cs
new file mode 100755 (executable)
index 0000000..4b27dfa
--- /dev/null
@@ -0,0 +1,185 @@
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using Tizen.NUI;
+using Tizen.NUI.Components;
+using Tizen.NUI.Scene3D;
+using System.Threading.Tasks;
+using Tizen.NUI.Scene3D.Test;
+
+namespace Tizen.NUI.Scene3D.Tests
+{
+    [TestFixture]
+    [Description("Tizen.NUI.Scene3D Tests")]
+    public class CameraTests
+    {
+        private string TAG = "NUI";
+
+        [SetUp]
+        public void Init()
+        {
+            Tizen.Log.Info(TAG, "Init() is called!");
+            App.MainTitleChangeText("CameraTest");
+            App.MainTitleChangeBackgroundColor(null);
+        }
+
+        [TearDown]
+        public void Destroy()
+        {
+            Tizen.Log.Info(TAG, "Destroy() is called!");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Create a Camera object. Check whether Camera is successfully created or not.")]
+        [Property("SPEC", "Tizen.NUI.Scene3D.Camera.Camera C")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "CONSTR")]
+        [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+        public void Camera_INIT()
+        {
+            /* TEST CODE */
+            var camera = new Camera();
+            Assert.IsNotNull(camera, "Can't create success object Camera.");
+            Assert.IsInstanceOf<Camera>(camera, "Construct Camera Fail");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Copy a Camera object. Check whether Camera is successfully copied or not.")]
+        [Property("SPEC", "Tizen.NUI.Scene3D.Camera.Camera C")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "CONSTR")]
+        [Property("COVPARAM", "Camera")]
+        [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+        public void Camera_INIT_2()
+        {
+            /* TEST CODE */
+            var camera = new Camera();
+            var camera2 = new Camera(camera);
+            Assert.IsNotNull(camera2, "Can't copy success object Camera.");
+            Assert.IsInstanceOf<Camera>(camera2, "Construct Camera Fail");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test ProjectionMode. Get the ProjectionModeType.Perspective.")]
+        [Property("SPEC", "Tizen.NUI.Scene3D.Camera.ProjectionMode A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRE")]
+        [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+        public void ProjectionMode_GET_ENUM_PERSPECTIVE()
+        {
+            /* TEST CODE */
+            var camera = new Camera();
+            camera.ProjectionMode = Tizen.NUI.Scene3D.Camera.ProjectionModeType.Perspective;
+            Assert.IsTrue(camera.ProjectionMode == Tizen.NUI.Scene3D.Camera.ProjectionModeType.Perspective, "Should be true!");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test ProjectionMode. Get the ProjectionModeType.Orthographic.")]
+        [Property("SPEC", "Tizen.NUI.Scene3D.Camera.ProjectionMode A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRE")]
+        [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+        public void ProjectionMode_GET_ENUM_ORTHOGRAPHIC()
+        {
+            /* TEST CODE */
+            var camera = new Camera();
+            camera.ProjectionMode = Tizen.NUI.Scene3D.Camera.ProjectionModeType.Orthographic;
+            Assert.IsTrue(camera.ProjectionMode == Tizen.NUI.Scene3D.Camera.ProjectionModeType.Orthographic, "Should be true!");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test ProjectionMode. Get the ProjectionMode from handle instance.")]
+        [Property("SPEC", "Tizen.NUI.Scene3D.Camera.ProjectionMode A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRW")]
+        [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+        public void ProjectionMode_SET_GET_VALUE()
+        {
+            /* TEST CODE */
+            var camera = new Camera();
+            camera.ProjectionMode = Tizen.NUI.Scene3D.Camera.ProjectionModeType.Perspective;
+            Assert.IsTrue(camera.ProjectionMode == Tizen.NUI.Scene3D.Camera.ProjectionModeType.Perspective, "Should be true!");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test FieldOfView. Get the FieldOfView from handle instance.")]
+        [Property("SPEC", "Tizen.NUI.Scene3D.Camera.FieldOfView A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRW")]
+        [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+        public void FieldOfView_SET_GET_VALUE()
+        {
+            /* TEST CODE */
+            var camera = new Camera();
+            Radian fov = new Radian(new Degree(45.0f));
+            camera.FieldOfView = fov;
+            Assert.IsTrue(camera.FieldOfView.Value == fov.Value, "Should be true!");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test OrthographicSize. Get the OrthographicSize from handle instance.")]
+        [Property("SPEC", "Tizen.NUI.Scene3D.Camera.OrthographicSize A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRW")]
+        [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+        public void OrthographicSize_SET_GET_VALUE()
+        {
+            /* TEST CODE */
+            var camera = new Camera();
+            camera.OrthographicSize = 2.0f;
+            Assert.IsTrue(camera.OrthographicSize == 2.0f, "Should be true!");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test NearPlaneDistance. Get the NearPlaneDistance from handle instance.")]
+        [Property("SPEC", "Tizen.NUI.Scene3D.Camera.NearPlaneDistance A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRW")]
+        [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+        public void NearPlaneDistance_SET_GET_VALUE()
+        {
+            /* TEST CODE */
+            var camera = new Camera();
+            camera.NearPlaneDistance = 2.0f;
+            Assert.IsTrue(camera.NearPlaneDistance == 2.0f, "Should be true!");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test FarPlaneDistance. Get the FarPlaneDistance from handle instance.")]
+        [Property("SPEC", "Tizen.NUI.Scene3D.Camera.FarPlaneDistance A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRW")]
+        [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+        public void FarPlaneDistance_SET_GET_VALUE()
+        {
+            /* TEST CODE */
+            var camera = new Camera();
+            camera.FarPlaneDistance = 2.0f;
+            Assert.IsTrue(camera.FarPlaneDistance == 2.0f, "Should be true!");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test AspectRatio. Get the AspectRatio from handle instance.")]
+        [Property("SPEC", "Tizen.NUI.Scene3D.Camera.AspectRatio A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRO")]
+        [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+        public void AspectRatio_GET_VALUE()
+        {
+            /* TEST CODE */
+            var camera = new Camera();
+            float aspectRatio = 800.0f / 480.0f;
+            Assert.IsTrue(camera.AspectRatio == aspectRatio, "Should be true!");
+        }
+    }
+}
diff --git a/tct-suite-vs/Tizen.NUI.Scene3D.Tests/testcase/TSSceneView.cs b/tct-suite-vs/Tizen.NUI.Scene3D.Tests/testcase/TSSceneView.cs
new file mode 100755 (executable)
index 0000000..978887a
--- /dev/null
@@ -0,0 +1,285 @@
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using Tizen.NUI;
+using Tizen.NUI.Components;
+using Tizen.NUI.Scene3D;
+using System.Threading.Tasks;
+using Tizen.NUI.Scene3D.Test;
+
+namespace Tizen.NUI.Scene3D.Tests
+{
+    [TestFixture]
+    [Description("Tizen.NUI.Scene3D Tests")]
+    public class SceneViewTests
+    {
+        private string TAG = "NUI";
+        private string diffuseIBLPath = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/Irradiance.ktx";
+        private string specularIBLPath = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/Radiance.ktx";
+        private string modelPath = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/models/BoxAnimated.gltf";
+
+        [SetUp]
+        public void Init()
+        {
+            Tizen.Log.Info(TAG, "Init() is called!");
+            App.MainTitleChangeText("SceneViewTest");
+            App.MainTitleChangeBackgroundColor(null);
+        }
+
+        [TearDown]
+        public void Destroy()
+        {
+            Tizen.Log.Info(TAG, "Destroy() is called!");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Create a SceneView object. Check whether SceneView is successfully created or not.")]
+        [Property("SPEC", "Tizen.NUI.Scene3D.SceneView.SceneView C")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "CONSTR")]
+        [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+        public void SceneView_INIT()
+        {
+            /* TEST CODE */
+            var sceneView = new SceneView();
+            Assert.IsNotNull(sceneView, "Can't create success object SceneView.");
+            Assert.IsInstanceOf<SceneView>(sceneView, "Construct SceneView Fail");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Copy a SceneView object. Check whether SceneView is successfully copied or not.")]
+        [Property("SPEC", "Tizen.NUI.Scene3D.SceneView.SceneView C")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "CONSTR")]
+        [Property("COVPARAM", "SceneView")]
+        [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+        public void SceneView_INIT_2()
+        {
+            /* TEST CODE */
+            var sceneView = new SceneView();
+            var sceneView2 = new SceneView(sceneView);
+            Assert.IsNotNull(sceneView2, "Can't copy success object SceneView.");
+            Assert.IsInstanceOf<SceneView>(sceneView2, "Construct SceneView Fail");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test ImageBasedLightScaleFactor. Get the ImageBasedLightScaleFactor from handle instance.")]
+        [Property("SPEC", "Tizen.NUI.Scene3D.SceneView.ImageBasedLightScaleFactor A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRW")]
+        [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+        public void ImageBasedLightScaleFactor_SET_GET_VALUE()
+        {
+            /* TEST CODE */
+            var sceneView = new SceneView();
+            sceneView.ImageBasedLightScaleFactor = 0.5f;
+            Assert.IsTrue(sceneView.ImageBasedLightScaleFactor == 0.5f, "Should be true!");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test AddCamera. Check whether AddCamera works without error.")]
+        [Property("SPEC", "Tizen.NUI.Scene3D.SceneView.AddCamera M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+        public void AddCamera_CHECK_RETURN_VALUE()
+        {
+            /* TEST CODE */
+            var sceneView = new SceneView();
+            var camera = new Camera();
+            Assert.IsTrue(sceneView.GetCameraCount() == 1, "Should be true!");
+            sceneView.AddCamera(camera);
+            Assert.IsTrue(sceneView.GetCameraCount() == 2, "Should be true!");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test RemoveCamera. Check whether RemoveCamera works without error.")]
+        [Property("SPEC", "Tizen.NUI.Scene3D.SceneView.RemoveCamera M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+        public void RemoveCamera_CHECK_RETURN_VALUE()
+        {
+            /* TEST CODE */
+            var sceneView = new SceneView();
+            var camera = new Camera();
+            Assert.IsTrue(sceneView.GetCameraCount() == 1, "Should be true!");
+            sceneView.AddCamera(camera);
+            Assert.IsTrue(sceneView.GetCameraCount() == 2, "Should be true!");
+            sceneView.RemoveCamera(camera);
+            Assert.IsTrue(sceneView.GetCameraCount() == 1, "Should be true!");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test GetCameraCount. Check whether GetCameraCount works without error.")]
+        [Property("SPEC", "Tizen.NUI.Scene3D.SceneView.GetCameraCount M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+        public void GetCameraCount_CHECK_RETURN_VALUE()
+        {
+            /* TEST CODE */
+            var sceneView = new SceneView();
+            Assert.IsTrue(sceneView.GetCameraCount() == 1, "Should be true!");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test GetCamera. Check whether GetCamera works without error.")]
+        [Property("SPEC", "Tizen.NUI.Scene3D.SceneView.GetCamera M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("COVPARAM", "uint")]
+        [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+        public void GetCamera_CHECK_RETURN_VALUE_WITH_UINT()
+        {
+            /* TEST CODE */
+            var sceneView = new SceneView();
+            var camera = new Camera();
+            sceneView.AddCamera(camera);
+            var cameraRet = sceneView.GetCamera(1u);
+            Assert.IsTrue(cameraRet == camera, "Should be true!");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test GetCamera. Check whether GetCamera works without error.")]
+        [Property("SPEC", "Tizen.NUI.Scene3D.SceneView.GetCamera M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("COVPARAM", "string")]
+        [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+        public void GetCamera_CHECK_RETURN_VALUE_WITH_STRING()
+        {
+            /* TEST CODE */
+            var sceneView = new SceneView();
+            var camera = new Camera();
+            camera.Name = "camera1";
+            sceneView.AddCamera(camera);
+            var cameraRet = sceneView.GetCamera("camera1");
+            Assert.IsTrue(cameraRet == camera, "Should be true!");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test SelectCamera. Check whether SelectCamera works without error.")]
+        [Property("SPEC", "Tizen.NUI.Scene3D.SceneView.SelectCamera M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("COVPARAM", "uint")]
+        [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+        public void SelectCamera_CHECK_RETURN_VALUE_WITH_UINT()
+        {
+            /* TEST CODE */
+            var sceneView = new SceneView();
+            var camera = new Camera();
+            sceneView.AddCamera(camera);
+            sceneView.SelectCamera(1u);
+            var cameraRet = sceneView.GetSelectedCamera();
+            Assert.IsTrue(cameraRet == camera, "Should be true!");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test SelectCamera. Check whether SelectCamera works without error.")]
+        [Property("SPEC", "Tizen.NUI.Scene3D.SceneView.SelectCamera M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("COVPARAM", "string")]
+        [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+        public void SelectCamera_CHECK_RETURN_VALUE_WITH_STRING()
+        {
+            /* TEST CODE */
+            var sceneView = new SceneView();
+            var camera = new Camera();
+            camera.Name = "camera1";
+            sceneView.AddCamera(camera);
+            sceneView.SelectCamera("camera1");
+            var cameraRet = sceneView.GetSelectedCamera();
+            Assert.IsTrue(cameraRet == camera, "Should be true!");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test CameraTransition. Check whether CameraTransition works without error.")]
+        [Property("SPEC", "Tizen.NUI.Scene3D.SceneView.CameraTransition M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("COVPARAM", "uint, int, Tizen.NUI.AlphaFunction")]
+        [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+        public void CameraTransition_CHECK_RETURN_VALUE_WITH_UINT_INT_ALPHAFUNCTION()
+        {
+            /* TEST CODE */
+            var sceneView = new SceneView();
+            var camera = new Camera();
+            Tizen.NUI.AlphaFunction alphaFunction = null;
+            sceneView.AddCamera(camera);
+            sceneView.CameraTransition(1u, 500, alphaFunction);
+            var cameraRet = sceneView.GetSelectedCamera();
+            Assert.IsTrue(cameraRet == camera, "Should be true!");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test CameraTransition. Check whether CameraTransition works without error.")]
+        [Property("SPEC", "Tizen.NUI.Scene3D.SceneView.CameraTransition M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("COVPARAM", "string, int, Tizen.NUI.AlphaFunction")]
+        [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+        public void CameraTransition_CHECK_RETURN_VALUE_WITH_STRING_INT_ALPHAFUNCTION()
+        {
+            /* TEST CODE */
+            var sceneView = new SceneView();
+            var camera = new Camera();
+            Tizen.NUI.AlphaFunction alphaFunction = null;
+            camera.Name = "camera1";
+            sceneView.AddCamera(camera);
+            sceneView.CameraTransition("camera1", 500, alphaFunction);
+            var cameraRet = sceneView.GetSelectedCamera();
+            Assert.IsTrue(cameraRet == camera, "Should be true!");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test GetSelectedCamera. Check whether GetSelectedCamera works without error.")]
+        [Property("SPEC", "Tizen.NUI.Scene3D.SceneView.GetSelectedCamera M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+        public void GetSelectedCamera_CHECK_RETURN_VALUE()
+        {
+            /* TEST CODE */
+            var sceneView = new SceneView();
+            var cameraRet = sceneView.GetSelectedCamera();
+            Assert.IsTrue(cameraRet != null, "Should be true!");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test SetImageBasedLightSource. Check whether SetImageBasedLightSource works without error.")]
+        [Property("SPEC", "Tizen.NUI.Scene3D.SceneView.SetImageBasedLightSource M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+        public void SetImageBasedLightSource_CHECK_RETURN_VALUE()
+        {
+            /* TEST CODE */
+            var sceneView = new SceneView();
+            try
+            {
+                sceneView.SetImageBasedLightSource(diffuseIBLPath, specularIBLPath);
+            }
+            catch (Exception e)
+            {
+                Assert.Fail("Caught Exception" + e.ToString());
+            }
+        }
+    }
+}