Merge "[ElmSharp] Fix EcoreMainloop crash issue in multi thread" 5.0.0-preview1-00396
authorKangho Hur <kangho.hur@samsung.com>
Thu, 30 Nov 2017 07:51:17 +0000 (07:51 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Thu, 30 Nov 2017 07:51:17 +0000 (07:51 +0000)
12 files changed:
src/ElmSharp.Wearable/ElmSharp.Wearable/CircleSpinner.cs
src/Tizen.Applications.Notification/Interop/Interop.Notification.cs
src/Tizen.Applications.Notification/Tizen.Applications.Notifications/Notification.cs
src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationReplyAction.cs
src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationStyleBinder.cs
src/Tizen.Applications.NotificationEventListener/Interop/Interop.NotificationEventListener.cs
src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsBinder.cs
src/Tizen.NUI/src/public/Animation.cs
test/ElmSharp.Wearable.Test/TC/CircleSpinnerTest1.cs [changed mode: 0755->0644]
test/ElmSharp.Wearable.Test/TC/CircleSpinnerTest2.cs [changed mode: 0755->0644]
test/ElmSharp.Wearable.Test/TC/CircleSpinnerTest3.cs [changed mode: 0755->0644]
test/ElmSharp.Wearable.Test/TC/CircleSpinnerTest4.cs [new file with mode: 0644]

index c0ca700..717ff3e 100644 (file)
@@ -29,7 +29,7 @@ namespace ElmSharp.Wearable
     public class CircleSpinner : Spinner, IRotaryActionWidget
     {
         IntPtr _circleHandle;
-        double _angleRatio = 1.0;
+        double _angleRatio = -1.0;
         CircleSurface _surface;
 
         /// <summary>
@@ -73,16 +73,36 @@ namespace ElmSharp.Wearable
         /// Sets or gets the circle spinner angle per each spinner value.
         /// </summary>
         /// <since_tizen> preview </since_tizen>
+        [Obsolete("Use Step")]
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public double AngleRatio
         {
             get
             {
+                if(_angleRatio <= 0)
+                {
+                    if(Maximum == Minimum)
+                    {
+                        return 0.0;
+                    }
+                    else
+                    {
+                        return 360/(Maximum - Minimum);
+                    }
+                }
+
                 return _angleRatio;
             }
             set
             {
-                _angleRatio = value;
-                Interop.Eext.eext_circle_object_spinner_angle_set(CircleHandle, _angleRatio);
+                if(value > 0)
+                {
+                    if (_angleRatio == value) return;
+
+                    _angleRatio = value;
+
+                    Interop.Eext.eext_circle_object_spinner_angle_set(CircleHandle, _angleRatio);
+                }
             }
         }
 
index 854e1aa..1d5651b 100755 (executable)
@@ -203,14 +203,14 @@ internal static partial class Interop
         [DllImport(Libraries.Notification, EntryPoint = "notification_set_delete_timeout")]
         internal static extern NotificationError SetDeleteTime(NotificationSafeHandle handle, int timeout);
 
-        [DllImport(Libraries.Notification, EntryPoint = "notification_set_extention_data")]
-        internal static extern NotificationError SetExtentionData(NotificationSafeHandle handle, string key, SafeBundleHandle bundleHandle);
+        [DllImport(Libraries.Notification, EntryPoint = "notification_set_extension_data")]
+        internal static extern NotificationError SetExtensionData(NotificationSafeHandle handle, string key, SafeBundleHandle bundleHandle);
 
-        [DllImport(Libraries.Notification, EntryPoint = "notification_get_extention_data")]
-        internal static extern NotificationError GetExtentionData(NotificationSafeHandle handle, string key, out SafeBundleHandle bundleHandle);
+        [DllImport(Libraries.Notification, EntryPoint = "notification_get_extension_data")]
+        internal static extern NotificationError GetExtensionData(NotificationSafeHandle handle, string key, out SafeBundleHandle bundleHandle);
 
         [DllImport(Libraries.Notification, EntryPoint = "notification_get_args")]
-        internal static extern NotificationError GetExtentionBundle(NotificationSafeHandle handle, out IntPtr args, out IntPtr group_args);
+        internal static extern NotificationError GetExtensionBundle(NotificationSafeHandle handle, out IntPtr args, out IntPtr group_args);
 
         [DllImport(Libraries.Notification, EntryPoint = "notification_get_default_button")]
         internal static extern NotificationError GetDefaultButton(NotificationSafeHandle handle, out int index);
index b4ec769..8ac2c21 100755 (executable)
@@ -479,7 +479,7 @@ namespace Tizen.Applications.Notifications
             foreach (string key in GetextraDataDictionary().Keys)
             {
                 Log.Info(LogTag, "Start to bind Notification.ExtenderData to SafeHandle");
-                Interop.Notification.SetExtentionData(Handle, key, extraDataDictionary[key].SafeBundleHandle);
+                Interop.Notification.SetExtensionData(Handle, key, extraDataDictionary[key].SafeBundleHandle);
             }
 
             foreach (Notification.StyleBase style in styleDictionary.Values)
@@ -503,23 +503,23 @@ namespace Tizen.Applications.Notifications
 
         internal Notification Build()
         {
-            IntPtr extention = IntPtr.Zero;
-            IntPtr extentionBundlePtr = IntPtr.Zero;
+            IntPtr extension = IntPtr.Zero;
+            IntPtr extensionBundlePtr = IntPtr.Zero;
 
             NotificationBinder.BindSafeHandle(this);
 
-            Interop.Notification.GetExtentionBundle(Handle, out extention, out extentionBundlePtr);
+            Interop.Notification.GetExtensionBundle(Handle, out extension, out extensionBundlePtr);
 
-            if (extention != IntPtr.Zero)
+            if (extension != IntPtr.Zero)
             {
-                Bundle bundle = new Bundle(new SafeBundleHandle(extention, false));
+                Bundle bundle = new Bundle(new SafeBundleHandle(extension, false));
                 foreach (string key in bundle.Keys)
                 {
                     if (key.StartsWith("_NOTIFICATION_EXTENSION_EVENT_"))
                         continue;
 
                     SafeBundleHandle sbh;
-                    Interop.Notification.GetExtentionData(Handle, key, out sbh);
+                    Interop.Notification.GetExtensionData(Handle, key, out sbh);
                     extraDataDictionary.Add(key, new Bundle(sbh));
                 }
             }
index 42d34ff..38cd443 100755 (executable)
@@ -106,7 +106,7 @@ namespace Tizen.Applications.Notifications
 
                 Bundle bundle = new Bundle();
                 bundle.AddItem(replyKey, ((int)this.ParentIndex).ToString());
-                Interop.Notification.SetExtentionData(notification.Handle, replyKey, bundle.SafeBundleHandle);
+                Interop.Notification.SetExtensionData(notification.Handle, replyKey, bundle.SafeBundleHandle);
 
                 Interop.Notification.SetPlaceHolderLength(notification.Handle, this.ReplyMax);
                 Interop.Notification.SetText(notification.Handle, NotificationText.PlaceHolder, PlaceHolderText, null, -1);
index f84c6f7..d32b721 100755 (executable)
@@ -255,7 +255,7 @@ namespace Tizen.Applications.Notifications
                     try
                     {
                         SafeBundleHandle bundleHandle;
-                        Interop.Notification.GetExtentionData(notification.Handle, replyKey, out bundleHandle);
+                        Interop.Notification.GetExtensionData(notification.Handle, replyKey, out bundleHandle);
                         Bundle bundle = new Bundle(bundleHandle);
                         reply.ParentIndex = (ButtonIndex)int.Parse(bundle.GetItem(replyKey).ToString());
                     }
index 9e36242..85fbc4b 100755 (executable)
@@ -138,7 +138,7 @@ internal static partial class Interop
         [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_property")]
         internal static extern ErrorCode GetProperties(NotificationSafeHandle handle, out int flags);
 
-        [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_extention_data")]
+        [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_extension_data")]
         internal static extern ErrorCode GetExtender(NotificationSafeHandle handle, string key, out SafeBundleHandle value);
 
         [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_clone")]
@@ -148,7 +148,7 @@ internal static partial class Interop
         internal static extern ErrorCode NotificationListFree(IntPtr list);
 
         [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_args")]
-        internal static extern ErrorCode GetExtentionBundle(NotificationSafeHandle handle, out IntPtr args, out IntPtr groupArgs);
+        internal static extern ErrorCode GetExtensionBundle(NotificationSafeHandle handle, out IntPtr args, out IntPtr groupArgs);
 
         [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_hide_timeout")]
         internal static extern ErrorCode GetHideTimeout(NotificationSafeHandle handle, out int timeout);
index d30292e..c70c072 100755 (executable)
@@ -35,7 +35,7 @@ namespace Tizen.Applications.NotificationEventListener
             NotificationLayout layout;
             NotificationType type;
             string text;
-            IntPtr extention = IntPtr.Zero;
+            IntPtr extension = IntPtr.Zero;
             IntPtr dummy = IntPtr.Zero;
             SafeAppControlHandle appcontrol = null;
 
@@ -158,15 +158,15 @@ namespace Tizen.Applications.NotificationEventListener
                 eventargs.IsVisible = false;
             }
 
-            err = Interop.NotificationEventListener.GetExtentionBundle(eventargs.Handle, out extention, out dummy);
+            err = Interop.NotificationEventListener.GetExtensionBundle(eventargs.Handle, out extension, out dummy);
             if (err != Interop.NotificationEventListener.ErrorCode.None)
             {
                 Log.Info(LogTag, "unable to get Extender");
             }
 
-            if (extention != IntPtr.Zero)
+            if (extension != IntPtr.Zero)
             {
-                Bundle bundle = new Bundle(new SafeBundleHandle(extention, false));
+                Bundle bundle = new Bundle(new SafeBundleHandle(extension, false));
                 foreach (string key in bundle.Keys)
                 {
                     if (key.StartsWith("_NOTIFICATION_EXTENSION_EVENT_"))
index 98c0db7..9caa1ee 100755 (executable)
@@ -260,8 +260,8 @@ namespace Tizen.NUI
         }
 
         /// <summary>
-        /// Set: Enables looping for 'count' repeats. A zero is the same as Looping = true; i.e., repeat forever.<br />
-        /// If Play() Stop() or 'count' loops is reached, the loop counter will reset.<br />
+        /// Set: Enables looping for a specified number of repeats. A zero is the same as Looping = true; i.e., repeat forever.<br />
+        /// This property resets the looping value and should not be used with the Looping property.<br />
         /// Setting this parameter does not cause the animation to Play().<br />
         /// Get: Gets the loop count. A zero is the same as Looping = true; i.e., repeat forever.<br />
         /// The loop count is initially 1 for play once.<br />
@@ -1171,4 +1171,4 @@ namespace Tizen.NUI
 
     }
 
-}
\ No newline at end of file
+}
old mode 100755 (executable)
new mode 100644 (file)
index 87c6a0a..d068df4
@@ -21,7 +21,7 @@ namespace ElmSharp.Test.TC
     class CircleSpinnerTest1 : TestCaseBase
     {
         public override string TestName => "CircleSpinnerTest1";
-        public override string TestDescription => "To test basic operation of Circle Spinner";
+        public override string TestDescription => "To test basic operation of Circle Spinner with no AngleRatio";
 
         public override void Run(Window window)
         {
@@ -39,9 +39,8 @@ namespace ElmSharp.Test.TC
                 Text = "Spinner Test",
                 LabelFormat = "%d Value",
                 Style = "circle",
-                AngleRatio = 3.0,
                 Minimum = 0,
-                Maximum = 360,
+                Maximum = 100,
                 Value = 0,
                 Step = 10,
                 Interval = 0.5,
old mode 100755 (executable)
new mode 100644 (file)
index 80c5372..f32d951
@@ -21,7 +21,7 @@ namespace ElmSharp.Test.TC
     class CircleSpinnerTest2 : TestCaseBase
     {
         public override string TestName => "CircleSpinnerTest2";
-        public override string TestDescription => "To test basic operation of Circle Spinner";
+        public override string TestDescription => "To test basic operation of Circle Spinner with Marker";
 
         public override void Run(Window window)
         {
old mode 100755 (executable)
new mode 100644 (file)
index 57843c8..a6a9b31
@@ -21,7 +21,7 @@ namespace ElmSharp.Test.TC
     class CircleSpinnerTest3 : TestCaseBase
     {
         public override string TestName => "CircleSpinnerTest3";
-        public override string TestDescription => "To test basic operation of Circle Spinner";
+        public override string TestDescription => "To test basic operation of Circle Spinner with AngleRatio";
 
         public override void Run(Window window)
         {
@@ -42,9 +42,9 @@ namespace ElmSharp.Test.TC
                 Text = "Spinner Test",
                 LabelFormat = "%d Value",
                 Style = "circle",
-                AngleRatio = 3.0,
+                AngleRatio = 1.0,
                 Minimum = 0,
-                Maximum = 360,
+                Maximum = 100,
                 Value = 0,
                 Step = 10,
                 Interval = 0.5,
diff --git a/test/ElmSharp.Wearable.Test/TC/CircleSpinnerTest4.cs b/test/ElmSharp.Wearable.Test/TC/CircleSpinnerTest4.cs
new file mode 100644 (file)
index 0000000..11df391
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 ElmSharp.Wearable;
+
+namespace ElmSharp.Test.TC
+{
+    class CircleSpinnerTest4 : TestCaseBase
+    {
+        public override string TestName => "CircleSpinnerTest4";
+        public override string TestDescription => "To test advanced operation of Circle Spinner with AngleRatio";
+
+        CircleSpinner spn1;
+        CircleSpinner spn2;
+
+        public override void Run(Window window)
+        {
+            Log.Debug(TestName, "CircleSpinnerTest run");
+
+            Rect square = window.GetInnerSquare();
+
+            Conformant conformant = new Conformant(window);
+            conformant.Show();
+
+            var surface = new CircleSurface(conformant);
+            spn1 = new CircleSpinner(window, surface) {
+                Text = "Spinner Test",
+                LabelFormat = "%d Ratio",
+                Style = "circle",
+                Minimum = 0,
+                Maximum = 100,
+                Value = 0.0,
+                Step = 10,
+                Interval = 0.5,
+                AlignmentX = -1,
+                AlignmentY = 0.5,
+                WeightX = 1,
+                WeightY = 1
+            };
+            spn1.Geometry = new Rect(square.X, square.Y, square.Width, square.Height / 4);
+            spn1.Show();
+
+            spn2 = new CircleSpinner(window, surface) {
+                Text = "Spinner Test",
+                LabelFormat = "%d Value",
+                Style = "circle",
+                MarkerColor = Color.Red,
+                Minimum = 0,
+                Maximum = 100,
+                Value = 0,
+                Interval = 0.5,
+                AlignmentX = -1,
+                AlignmentY = 0.5,
+                WeightX = 1,
+                WeightY = 1
+            };
+            spn2.Geometry = new Rect(square.X, square.Y+ square.Width * 2 / 4, square.Width, square.Height / 4);
+            spn2.Show();
+
+            spn1.Focused += Spn1_Focused;
+            spn2.Focused += Spn2_Focused;
+            spn1.ValueChanged += Spn1_ValueChanged;
+        }
+
+        private void Spn1_ValueChanged(object sender, System.EventArgs e)
+        {
+            spn2.AngleRatio = spn1.Value;
+        }
+
+        private void Spn2_Focused(object sender, System.EventArgs e)
+        {
+            ((IRotaryActionWidget)spn2).Activate();
+        }
+
+        private void Spn1_Focused(object sender, System.EventArgs e)
+        {
+            ((IRotaryActionWidget)spn1).Activate();
+        }
+    }
+}