From: dongsug.song Date: Tue, 13 Aug 2024 09:11:11 +0000 (+0900) Subject: [NUI] Remove internal ObjectRegistry that is not used X-Git-Tag: submit/tizen/20240821.061804~1^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1e5d40953f43062a71cf46179bb16626f4e59f33;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Remove internal ObjectRegistry that is not used --- diff --git a/src/Tizen.NUI/src/internal/Common/ObjectRegistry.cs b/src/Tizen.NUI/src/internal/Common/ObjectRegistry.cs deleted file mode 100755 index 37bad4c47..000000000 --- a/src/Tizen.NUI/src/internal/Common/ObjectRegistry.cs +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright(c) 2021 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -using System; -using System.Runtime.InteropServices; - -namespace Tizen.NUI -{ - internal class ObjectRegistry : BaseHandle - { - internal ObjectRegistry(global::System.IntPtr cPtr, bool cMemoryOwn) : this(cPtr, cMemoryOwn, cMemoryOwn) - { - } - - internal ObjectRegistry(global::System.IntPtr cPtr, bool cMemoryOwn, bool cRegister) : base(cPtr, cMemoryOwn, cRegister) - { - } - - protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr) - { - Interop.ObjectRegistry.DeleteObjectRegistry(swigCPtr); - } - - public class ObjectCreatedEventArgs : EventArgs - { - private BaseHandle baseHandle; - - public BaseHandle BaseHandle - { - get - { - return baseHandle; - } - set - { - baseHandle = value; - } - } - } - - public class ObjectDestroyedEventArgs : EventArgs - { - private RefObject refObject; - - public RefObject RefObject - { - get - { - return refObject; - } - set - { - refObject = value; - } - } - } - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - private delegate void ObjectCreatedEventCallbackDelegate(IntPtr baseHandle); - private DaliEventHandler objectRegistryObjectCreatedEventHandler; - private ObjectCreatedEventCallbackDelegate objectRegistryObjectCreatedEventCallbackDelegate; - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - private delegate void ObjectDestroyedEventCallbackDelegate(IntPtr fefObject); - private DaliEventHandler objectRegistryObjectDestroyedEventHandler; - private ObjectDestroyedEventCallbackDelegate objectRegistryObjectDestroyedEventCallbackDelegate; - - public event DaliEventHandler ObjectCreated - { - add - { - // Restricted to only one listener - if (objectRegistryObjectCreatedEventHandler == null) - { - objectRegistryObjectCreatedEventHandler += value; - - objectRegistryObjectCreatedEventCallbackDelegate = new ObjectCreatedEventCallbackDelegate(OnObjectCreated); - this.ObjectCreatedSignal().Connect(objectRegistryObjectCreatedEventCallbackDelegate); - } - else - { - Tizen.Log.Error("NUI", "[ObjectRegistry.ObjectCreated] Only one listener is allowed\n"); - } - } - - remove - { - if (objectRegistryObjectCreatedEventHandler != null) - { - objectRegistryObjectCreatedEventHandler -= value; - if (objectRegistryObjectCreatedEventHandler == null) - { - this.ObjectCreatedSignal().Disconnect(objectRegistryObjectCreatedEventCallbackDelegate); - objectRegistryObjectCreatedEventCallbackDelegate = null; - } - } - } - } - - // Callback for ObjectRegistry ObjectCreatedSignal - private void OnObjectCreated(IntPtr baseHandle) - { - ObjectCreatedEventArgs e = new ObjectCreatedEventArgs(); - - // Populate all members of "e" (ObjectCreatedEventArgs) with real data - //e.BaseHandle = BaseHandle.GetBaseHandleFromPtr(baseHandle); //GetBaseHandleFromPtr() is not present in BaseHandle.cs. Not sure what is the reason? - - if (objectRegistryObjectCreatedEventHandler != null) - { - //here we send all data to user event handlers - objectRegistryObjectCreatedEventHandler(this, e); - } - } - - public event DaliEventHandler ObjectDestroyed - { - add - { - // Restricted to only one listener - if (objectRegistryObjectDestroyedEventHandler == null) - { - objectRegistryObjectDestroyedEventHandler += value; - - objectRegistryObjectDestroyedEventCallbackDelegate = new ObjectDestroyedEventCallbackDelegate(OnObjectDestroyed); - this.ObjectDestroyedSignal().Connect(objectRegistryObjectDestroyedEventCallbackDelegate); - } - else - { - Tizen.Log.Error("NUI", "[ObjectRegistry.ObjectDestroyed] Only one listener is allowed\n"); - } - } - - remove - { - if (objectRegistryObjectDestroyedEventHandler != null) - { - objectRegistryObjectDestroyedEventHandler -= value; - if (objectRegistryObjectDestroyedEventHandler == null) - { - this.ObjectDestroyedSignal().Disconnect(objectRegistryObjectDestroyedEventCallbackDelegate); - objectRegistryObjectDestroyedEventCallbackDelegate = null; - } - } - } - } - - // Callback for ObjectRegistry ObjectDestroyedSignal - private void OnObjectDestroyed(IntPtr refObject) - { - ObjectDestroyedEventArgs e = new ObjectDestroyedEventArgs(); - - // Populate all members of "e" (ObjectDestroyedEventArgs) with real data - e.RefObject = RefObject.GetRefObjectFromPtr(refObject); - - if (objectRegistryObjectDestroyedEventHandler != null) - { - //here we send all data to user event handlers - objectRegistryObjectDestroyedEventHandler(this, e); - } - } - - - public ObjectRegistry() : this(Interop.ObjectRegistry.NewObjectRegistry(), true, false) - { - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - public ObjectRegistry Assign(ObjectRegistry rhs) - { - ObjectRegistry ret = new ObjectRegistry(Interop.ObjectRegistry.Assign(SwigCPtr, ObjectRegistry.getCPtr(rhs)), false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public ObjectCreatedSignal ObjectCreatedSignal() - { - ObjectCreatedSignal ret = new ObjectCreatedSignal(Interop.ObjectRegistry.ObjectCreatedSignal(SwigCPtr), false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public ObjectDestroyedSignal ObjectDestroyedSignal() - { - ObjectDestroyedSignal ret = new ObjectDestroyedSignal(Interop.ObjectRegistry.ObjectDestroyedSignal(SwigCPtr), false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - } -} diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.ObjectRegistry.cs b/src/Tizen.NUI/src/internal/Interop/Interop.ObjectRegistry.cs deleted file mode 100755 index fb498a3f5..000000000 --- a/src/Tizen.NUI/src/internal/Interop/Interop.ObjectRegistry.cs +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright(c) 2021 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -namespace Tizen.NUI -{ - internal static partial class Interop - { - internal static partial class ObjectRegistry - { - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_ObjectRegistry__SWIG_0")] - public static extern global::System.IntPtr NewObjectRegistry(); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_ObjectRegistry")] - public static extern void DeleteObjectRegistry(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_ObjectRegistry_Assign")] - public static extern global::System.IntPtr Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_ObjectRegistry_ObjectCreatedSignal")] - public static extern global::System.IntPtr ObjectCreatedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_ObjectRegistry_ObjectDestroyedSignal")] - public static extern global::System.IntPtr ObjectDestroyedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); - } - } -} diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.Stage.cs b/src/Tizen.NUI/src/internal/Interop/Interop.Stage.cs index 9d65c051e..be9877ab2 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.Stage.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.Stage.cs @@ -43,9 +43,6 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Stage_GetDpi")] public static extern global::System.IntPtr GetDpi(global::System.Runtime.InteropServices.HandleRef jarg1); - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Stage_GetObjectRegistry")] - public static extern global::System.IntPtr GetObjectRegistry(global::System.Runtime.InteropServices.HandleRef jarg1); - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Stage_SetRenderingBehavior")] public static extern void SetRenderingBehavior(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); diff --git a/src/Tizen.NUI/src/public/Window/Window.cs b/src/Tizen.NUI/src/public/Window/Window.cs index e8692812a..4dce26fc6 100755 --- a/src/Tizen.NUI/src/public/Window/Window.cs +++ b/src/Tizen.NUI/src/public/Window/Window.cs @@ -1661,26 +1661,6 @@ namespace Tizen.NUI return ret; } - internal ObjectRegistry GetObjectRegistry() - { - global::System.IntPtr cPtr = Interop.Stage.GetObjectRegistry(stageCPtr); - - ObjectRegistry ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as ObjectRegistry; - if (ret != null) - { - global::System.Runtime.InteropServices.HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - Interop.BaseHandle.DeleteBaseHandle(CPtr); - CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - else - { - ret = new ObjectRegistry(cPtr, true); - } - - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior) { Interop.Stage.SetRenderingBehavior(stageCPtr, (int)renderingBehavior); diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/internal/Common/TSObjectRegistry.cs b/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/internal/Common/TSObjectRegistry.cs deleted file mode 100755 index 09e7b568c..000000000 --- a/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/internal/Common/TSObjectRegistry.cs +++ /dev/null @@ -1,178 +0,0 @@ -using global::System; -using NUnit.Framework; -using NUnit.Framework.TUnit; -using Tizen.NUI.Components; -using Tizen.NUI.BaseComponents; - -namespace Tizen.NUI.Devel.Tests -{ - using tlog = Tizen.Log; - - [TestFixture] - [Description("internal/Common/ObjectRegistry")] - public class InternalObjectRegistryTest - { - private const string tag = "NUITEST"; - - [SetUp] - public void Init() - { - tlog.Info(tag, "Init() is called!"); - } - - [TearDown] - public void Destroy() - { - tlog.Info(tag, "Destroy() is called!"); - } - - [Test] - [Category("P1")] - [Description("ObjectRegistry constructor.")] - [Property("SPEC", "Tizen.NUI.ObjectRegistry.ObjectRegistry C")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "CONSTR")] - [Property("COVPARAM", "")] - [Property("AUTHOR", "guowei.wang@samsung.com")] - public void ObjectRegistryConstructor() - { - tlog.Debug(tag, $"ObjectRegistryConstructor START"); - - var testingTarget = new ObjectRegistry(); - Assert.IsNotNull(testingTarget, "null handle"); - Assert.IsInstanceOf(testingTarget, "Should return ObjectRegistry instance."); - - testingTarget.Dispose(); - tlog.Debug(tag, $"ObjectRegistryConstructor END (OK)"); - } - - [Test] - [Category("P1")] - [Description("ObjectRegistry ObjectCreatedEventArgs .")] - [Property("SPEC", "Tizen.NUI.ObjectRegistry.ObjectCreatedEventArgs A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("COVPARAM", "")] - [Property("AUTHOR", "guowei.wang@samsung.com")] - public void ObjectRegistryObjectCreatedEventArgs() - { - tlog.Debug(tag, $"ObjectRegistryObjectCreatedEventArgs START"); - - var testingTarget = new Tizen.NUI.ObjectRegistry.ObjectCreatedEventArgs(); - Assert.IsNotNull(testingTarget, "null handle"); - Assert.IsInstanceOf(testingTarget, "Should return ObjectCreatedEventArgs instance."); - - using (View view = new View()) - { - testingTarget.BaseHandle = view; - tlog.Debug(tag, "BaseHandle : " + testingTarget.BaseHandle); - } - - tlog.Debug(tag, $"ObjectRegistryObjectCreatedEventArgs END (OK)"); - } - - [Test] - [Category("P1")] - [Description("ObjectRegistry ObjectDestroyedEventArgs .")] - [Property("SPEC", "Tizen.NUI.ObjectRegistry.ObjectDestroyedEventArgs A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("COVPARAM", "")] - [Property("AUTHOR", "guowei.wang@samsung.com")] - public void ObjectRegistryObjectDestroyedEventArgs() - { - tlog.Debug(tag, $"ObjectRegistryObjectDestroyedEventArgs START"); - - var testingTarget = new Tizen.NUI.ObjectRegistry.ObjectDestroyedEventArgs(); - Assert.IsNotNull(testingTarget, "null handle"); - Assert.IsInstanceOf(testingTarget, "Should return ObjectDestroyedEventArgs instance."); - - using (View view = new View()) - { - RefObject obj = RefObject.GetRefObjectFromPtr(view.SwigCPtr.Handle); - testingTarget.RefObject = obj; - tlog.Debug(tag, "RefObject : " + testingTarget.RefObject); - } - - tlog.Debug(tag, $"ObjectRegistryObjectDestroyedEventArgs END (OK)"); - } - - [Test] - [Category("P1")] - [Description("ObjectRegistry ObjectRegistry .")] - [Property("SPEC", "Tizen.NUI.ObjectRegistry.ObjectRegistry C")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("COVPARAM", "")] - [Property("AUTHOR", "guowei.wang@samsung.com")] - public void ObjectRegistryObjectRegistry() - { - tlog.Debug(tag, $"ObjectRegistryObjectRegistry START"); - - using (ObjectRegistry obj = new ObjectRegistry(new View().SwigCPtr.Handle, false)) - { - var testingTarget = new ObjectRegistry(obj); - Assert.IsNotNull(testingTarget, "null handle"); - Assert.IsInstanceOf(testingTarget, "Should return ObjectRegistry instance."); - - testingTarget.Dispose(); - } - - tlog.Debug(tag, $"ObjectRegistryObjectRegistry END (OK)"); - } - - [Test] - [Category("P1")] - [Description("ObjectRegistry Assign .")] - [Property("SPEC", "Tizen.NUI.ObjectRegistry.Assign M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("COVPARAM", "")] - [Property("AUTHOR", "guowei.wang@samsung.com")] - public void ObjectRegistryAssign() - { - tlog.Debug(tag, $"ObjectRegistryAssign START"); - - using (ObjectRegistry obj = new ObjectRegistry(new View().SwigCPtr.Handle, false)) - { - var testingTarget = obj.Assign(obj); - Assert.IsNotNull(testingTarget, "null handle"); - Assert.IsInstanceOf(testingTarget, "Should return ObjectRegistry instance."); - - testingTarget.Dispose(); - } - - tlog.Debug(tag, $"ObjectRegistryAssign END (OK)"); - } - - [Test] - [Category("P1")] - [Description("ObjectRegistry ObjectCreatedSignal .")] - [Property("SPEC", "Tizen.NUI.ObjectRegistry.ObjectCreatedSignal M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("COVPARAM", "")] - [Property("AUTHOR", "guowei.wang@samsung.com")] - public void ObjectRegistryObjectCreatedSignal() - { - tlog.Debug(tag, $"ObjectRegistryObjectCreatedSignal START"); - - using (View view = new View()) - { - var testingTarget = new ObjectRegistry(view.SwigCPtr.Handle, false); - Assert.IsNotNull(testingTarget, "null handle"); - Assert.IsInstanceOf(testingTarget, "Should return ObjectRegistry instance."); - - var createdSignal = testingTarget.ObjectCreatedSignal(); - Assert.IsInstanceOf(createdSignal, "Should return ObjectCreatedSignal instance."); - - var destroyedSignal = testingTarget.ObjectDestroyedSignal(); - Assert.IsInstanceOf(destroyedSignal, "Should return ObjectDestroyedSignal instance."); - - testingTarget.Dispose(); - } - - tlog.Debug(tag, $"ObjectRegistryObjectCreatedSignal END (OK)"); - } - } -} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Window/TSWindow.cs b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Window/TSWindow.cs index 2c0f29d99..8dd7347de 100755 --- a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Window/TSWindow.cs +++ b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/Window/TSWindow.cs @@ -319,29 +319,6 @@ namespace Tizen.NUI.Devel.Tests Assert.Pass("WindowGetRenderTaskList"); } - [Test] - [Category("P1")] - [Description("Window GetObjectRegistry")] - [Property("SPEC", "Tizen.NUI.Window.GetObjectRegistry M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - public void WindowGetObjectRegistry() - { - tlog.Debug(tag, $"WindowGetObjectRegistry START"); - try - { - myWin.GetObjectRegistry(); - } - catch (Exception e) - { - Tizen.Log.Error(tag, "Caught Exception" + e.ToString()); - - Assert.Fail("Caught Exception" + e.ToString()); - } - tlog.Debug(tag, $"WindowGetObjectRegistry END (OK)"); - Assert.Pass("WindowGetObjectRegistry"); - } - [Test] [Category("P1")] [Description("Window SetWindowSize")]