}
/// <summary>
- /// Gets the type of the key frame.
+ /// Gets the type of the key frame.<br/>
+ /// An empty key frame will return PropertyType.None, wheras an initialised<br/>
+ /// key frame object will return the type of it's first element.
/// </summary>
/// <returns>The key frame property type</returns>
/// <since_tizen> 3 </since_tizen>
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
+ /// <summary>
+ /// Get the number of added key frame.
+ /// </summary>
+ /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public uint GetKeyFrameCount()
+ {
+ uint ret = Interop.KeyFrames.GetKeyFrameCount(SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ /// <summary>
+ /// Get the progress and value from specific key frame.<br/>
+ /// If index is greater or equal than total key frame count, progress and value is not changed.
+ /// </summary>
+ /// <param name="index">The index of keyframe.</param>
+ /// <param name="progress">A progress value between 0.0 and 1.0.</param>
+ /// <param name="value">A value.</param>
+ /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void GetKeyFrame(uint index, out float progress, PropertyValue value)
+ {
+ Interop.KeyFrames.GetKeyFrame(SwigCPtr, index, out progress, PropertyValue.getCPtr(value));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Set the value to specific key frame.<br/>
+ /// If index is greater or equal than total key frame count or value's PropertyType is not matched, Nothing happened.
+ /// </summary>
+ /// <param name="index">The index of keyframe.</param>
+ /// <param name="value">A value.</param>
+ /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetKeyFrameValue(uint index, PropertyValue value)
+ {
+ Interop.KeyFrames.SetKeyFrameValue(SwigCPtr, index, PropertyValue.getCPtr(value));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
/// This will not be public opened.
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("public/Animation/KeyFrames")]
+ public class InternalKeyFramesTests
+ {
+ private 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("Test GetKeyFrameCount. Check whether it return the right value.")]
+ [Property("SPEC", "Tizen.NUI.KeyFrames.GetKeyFrameCount M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Eunki Hong, eunkiki.hong@samsung.com")]
+ public void GetKeyFrameCount_CHECK_RETURN_VALUE()
+ {
+ /* TEST CODE */
+ var keyFrames = new KeyFrames();
+ Assert.AreEqual(0u, keyFrames.GetKeyFrameCount(), "The number of keyframes must be matched.");
+ keyFrames.Add(0.0f, new Position(0.1f, 0.2f, 0.3f));
+ Assert.AreEqual(1u, keyFrames.GetKeyFrameCount(), "The number of keyframes must be matched.");
+ keyFrames.Add(0.5f, new Position(0.9f, 0.8f, 0.7f));
+ Assert.AreEqual(2u, keyFrames.GetKeyFrameCount(), "The number of keyframes must be matched.");
+ keyFrames.Add(1.0f, new Position(1.0f, 1.0f, 1.0f));
+ Assert.AreEqual(3u, keyFrames.GetKeyFrameCount(), "The number of keyframes must be matched.");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test GetKeyFrame. Check whether it return the right value.")]
+ [Property("SPEC", "Tizen.NUI.KeyFrames.GetKeyFrame M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Eunki Hong, eunkiki.hong@samsung.com")]
+ public void GetKeyFrame_GET_VALUE()
+ {
+ /* TEST CODE */
+ var keyFrames = new KeyFrames();
+ float returnProgress = -1.0f;
+ PropertyValue returnValue = new PropertyValue();
+ float returnValueFloat = -1.0f;
+
+ keyFrames.GetKeyFrame(2u, out returnProgress, returnValue);
+ Assert.AreEqual(false, returnValue.Get(out returnValueFloat), "The value of keyframes must not be float.");
+ Assert.AreEqual(-1.0f, returnProgress, "The value of keyframes must be changed.");
+
+ keyFrames.Add(0.0f, 2.0f);
+ keyFrames.Add(0.5f, 4.0f);
+ keyFrames.Add(1.0f, 7.0f);
+
+ keyFrames.GetKeyFrame(0u, out returnProgress, returnValue);
+ Assert.AreEqual(true, returnValue.Get(out returnValueFloat), "The value of keyframes must be float.");
+ Assert.AreEqual(0.0f, returnProgress, "The value of keyframes must be matched.");
+ Assert.AreEqual(2.0f, returnValueFloat, "The value of keyframes must be matched.");
+
+ keyFrames.GetKeyFrame(1u, out returnProgress, returnValue);
+ Assert.AreEqual(true, returnValue.Get(out returnValueFloat), "The value of keyframes must be float.");
+ Assert.AreEqual(0.5f, returnProgress, "The value of keyframes must be matched.");
+ Assert.AreEqual(4.0f, returnValueFloat, "The value of keyframes must be matched.");
+
+ keyFrames.GetKeyFrame(2u, out returnProgress, returnValue);
+ Assert.AreEqual(true, returnValue.Get(out returnValueFloat), "The value of keyframes must be float.");
+ Assert.AreEqual(1.0f, returnProgress, "The value of keyframes must be matched.");
+ Assert.AreEqual(7.0f, returnValueFloat, "The value of keyframes must be matched.");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test SetKeyFrameValue. Check whether it setup the right value.")]
+ [Property("SPEC", "Tizen.NUI.KeyFrames.SetKeyFrameValue M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Eunki Hong, eunkiki.hong@samsung.com")]
+ public void SetKeyFrameValue_SET_VALUE()
+ {
+ /* TEST CODE */
+ var keyFrames = new KeyFrames();
+ float returnProgress = -1.0f;
+ PropertyValue returnValue = new PropertyValue();
+ float returnValueFloat = -1.0f;
+
+ keyFrames.SetKeyFrameValue(1u, new PropertyValue(3.0f));
+
+ keyFrames.Add(0.0f, 2.0f);
+ keyFrames.Add(0.5f, 4.0f);
+ keyFrames.Add(1.0f, 7.0f);
+
+ keyFrames.GetKeyFrame(1u, out returnProgress, returnValue);
+ Assert.AreEqual(true, returnValue.Get(out returnValueFloat), "The value of keyframes must be float.");
+ Assert.AreEqual(0.5f, returnProgress, "The value of keyframes must be matched.");
+ Assert.AreEqual(4.0f, returnValueFloat, "The value of keyframes must be matched.");
+
+ keyFrames.SetKeyFrameValue(1u, new PropertyValue(1.0f));
+
+ keyFrames.GetKeyFrame(1u, out returnProgress, returnValue);
+ Assert.AreEqual(true, returnValue.Get(out returnValueFloat), "The value of keyframes must be float.");
+ Assert.AreEqual(0.5f, returnProgress, "The value of keyframes must be matched.");
+ Assert.AreEqual(1.0f, returnValueFloat, "The value of keyframes must be matched.");
+ }
+ }
+}