+++ /dev/null
-/*
- * 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<object, ObjectCreatedEventArgs> objectRegistryObjectCreatedEventHandler;
- private ObjectCreatedEventCallbackDelegate objectRegistryObjectCreatedEventCallbackDelegate;
-
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- private delegate void ObjectDestroyedEventCallbackDelegate(IntPtr fefObject);
- private DaliEventHandler<object, ObjectDestroyedEventArgs> objectRegistryObjectDestroyedEventHandler;
- private ObjectDestroyedEventCallbackDelegate objectRegistryObjectDestroyedEventCallbackDelegate;
-
- public event DaliEventHandler<object, ObjectCreatedEventArgs> 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<object, ObjectDestroyedEventArgs> 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;
- }
- }
-}
+++ /dev/null
-/*
- * 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);
- }
- }
-}
[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);
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);
+++ /dev/null
-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<ObjectRegistry>(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<Tizen.NUI.ObjectRegistry.ObjectCreatedEventArgs>(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<Tizen.NUI.ObjectRegistry.ObjectDestroyedEventArgs>(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<ObjectRegistry>(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<ObjectRegistry>(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<ObjectRegistry>(testingTarget, "Should return ObjectRegistry instance.");
-
- var createdSignal = testingTarget.ObjectCreatedSignal();
- Assert.IsInstanceOf<ObjectCreatedSignal>(createdSignal, "Should return ObjectCreatedSignal instance.");
-
- var destroyedSignal = testingTarget.ObjectDestroyedSignal();
- Assert.IsInstanceOf<ObjectDestroyedSignal>(destroyedSignal, "Should return ObjectDestroyedSignal instance.");
-
- testingTarget.Dispose();
- }
-
- tlog.Debug(tag, $"ObjectRegistryObjectCreatedSignal END (OK)");
- }
- }
-}
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")]