[label] add slide speed property & TC
authordarkleem <cdark.lim@samsung.com>
Fri, 21 Apr 2017 06:47:21 +0000 (15:47 +0900)
committerdarkleem <cdark.lim@samsung.com>
Wed, 10 May 2017 07:38:01 +0000 (16:38 +0900)
Change-Id: I37ffe75d47e7261ffe8acfdc2ef99d86d562b8c9
Signed-off-by: darkleem <cdark.lim@samsung.com>
src/ElmSharp/ElmSharp/Label.cs
src/ElmSharp/Interop/Interop.Elementary.Label.cs
test/ElmSharp.Test/ElmSharp.Test.csproj
test/ElmSharp.Test/TC/LabelTest5.cs [new file with mode: 0644]

index 58a816e..77fa79b 100755 (executable)
@@ -105,6 +105,26 @@ namespace ElmSharp
         }
 
         /// <summary>
+        /// Sets or gets the slide Speed of the label.
+        /// </summary>
+        /// <remarks>
+        /// The speed of the slide animation in px per seconds.
+        /// If you set the duration of the slide using elm_label_slide_duration_set() you cannot get the correct speed using this function until the label is actually rendered and resized.
+        /// </remarks>
+        /// <seealso cref="SlideDuration"/>
+        public double SlideSpeed
+        {
+            get
+            {
+                return Interop.Elementary.elm_label_slide_speed_get(RealHandle);
+            }
+            set
+            {
+                Interop.Elementary.elm_label_slide_speed_set(RealHandle, value);
+            }
+        }
+
+        /// <summary>
         /// Sets or gets the ellipsis behavior of the label.
         /// </summary>
         public bool IsEllipsis
index ea073fe..aa4c716 100644 (file)
@@ -37,6 +37,12 @@ internal static partial class Interop
         internal static extern double elm_label_slide_duration_get(IntPtr obj);
 
         [DllImport(Libraries.Elementary)]
+        internal static extern void elm_label_slide_speed_set(IntPtr obj, double speed);
+
+        [DllImport(Libraries.Elementary)]
+        internal static extern double elm_label_slide_speed_get(IntPtr obj);
+
+        [DllImport(Libraries.Elementary)]
         internal static extern void elm_label_slide_go(IntPtr obj);
 
         [DllImport(Libraries.Elementary)]
index ed2ba74..1e0e3c7 100755 (executable)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -48,6 +48,7 @@
     <Compile Include="TC\GenListTest10.cs" />
     <Compile Include="TC\LabelTest4.cs" />
     <Compile Include="TC\Log.cs" />
+    <Compile Include="TC\LabelTest5.cs" />
     <Compile Include="TC\MultibuttonEntryTest1.cs" />
     <Compile Include="TC\DateTimeSelectorTest2.cs" />
     <Compile Include="TC\EntryTest2.cs" />
   <ProjectExtensions>
     <VisualStudio>
       <FlavorProperties GUID="{2F98DAC9-6F16-457B-AED7-D43CAC379341}" Configuration="Debug|Any CPU">
-        <ProjectCorporateFlavorCfg />
+        <ProjectCommonFlavorCfg />
       </FlavorProperties>
       <FlavorProperties GUID="{2F98DAC9-6F16-457B-AED7-D43CAC379341}" Configuration="Release|Any CPU">
-        <ProjectCorporateFlavorCfg />
+        <ProjectCommonFlavorCfg />
       </FlavorProperties>
     </VisualStudio>
   </ProjectExtensions>
diff --git a/test/ElmSharp.Test/TC/LabelTest5.cs b/test/ElmSharp.Test/TC/LabelTest5.cs
new file mode 100644 (file)
index 0000000..46294e4
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * 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 System;
+using ElmSharp;
+using System.Collections.Generic;
+
+namespace ElmSharp.Test
+{
+    public class LabelTest5 : TestCaseBase
+    {
+        public override string TestName => "LabelTest5";
+        public override string TestDescription => "To test Slide Animation Speed of Label";
+
+        public override void Run(Window window)
+        {
+            Background bg = new Background(window)
+            {
+                AlignmentX = -1,
+                AlignmentY = -1,
+                WeightX = 1,
+                WeightY = 1,
+                Color = Color.White
+            };
+            bg.Show();
+            window.AddResizeObject(bg);
+
+            Conformant conformant = new Conformant(window);
+            conformant.Show();
+            Box box = new Box(window)
+            {
+                AlignmentX = -1,
+                AlignmentY = -1,
+                WeightX = 1,
+                WeightY = 1
+            };
+            conformant.SetContent(box);
+            box.Show();
+
+            Label label1 = new Label(window)
+            {
+                Text = "Test Slide Animaiton",
+                Color = Color.Black,
+                Style = "slide_long",
+                SlideSpeed = 100,
+                SlideMode = LabelSlideMode.Always,
+                AlignmentX = -1,
+                AlignmentY = -1,
+                WeightX = 1,
+                WeightY = 1
+            };
+            label1.Show();
+            label1.PlaySlide();
+
+            Button btnCurrentSpeed = new Button(window)
+            {
+                Text = "Current Speed : 100",
+                AlignmentX = -1,
+                AlignmentY = -1,
+                WeightX = 1,
+            };
+
+            Button btnSpeedUp = new Button(window)
+            {
+                Text = "Speed + 10",
+                AlignmentX = -1,
+                AlignmentY = -1,
+                WeightX = 1,
+            };
+            btnSpeedUp.Clicked += (s, e) =>
+            {
+                label1.SlideSpeed += 10;
+                btnCurrentSpeed.Text = string.Format("Current Speed : {0}", label1.SlideSpeed);
+                label1.PlaySlide();
+            };
+            Button btnSpeedDown = new Button(window)
+            {
+                Text = "Speed - 10",
+                AlignmentX = -1,
+                AlignmentY = -1,
+                WeightX = 1,
+            };
+            btnSpeedDown.Clicked += (s, e) =>
+            {
+                label1.SlideSpeed -= 10;
+                btnCurrentSpeed.Text = string.Format("Current Speed : {0}", label1.SlideSpeed);
+                label1.PlaySlide();
+            };
+
+            box.PackEnd(label1);
+            box.PackEnd(btnCurrentSpeed);
+            box.PackEnd(btnSpeedUp);
+            box.PackEnd(btnSpeedDown);
+            btnCurrentSpeed.Show();
+            btnSpeedUp.Show();
+            btnSpeedDown.Show();
+        }
+    }
+}