Add Some Test case for Circular Wearable
authorpius.lee <pius.lee@samsung.com>
Mon, 17 Jul 2017 13:29:47 +0000 (22:29 +0900)
committerKangho Hur <kangho.hur@samsung.com>
Wed, 19 Jul 2017 07:45:46 +0000 (16:45 +0900)
Change to TestRunner show TC list by current platform.
Add BackgroundColor Test
Add Background widget Test
Add Box Layout Test
Add Normal Button Test
Add Circular Button Test
Add Check Test
Add Clipper Test
Add Context Popup Test
Add DateTimeSelector - Date format Test

Change-Id: I8a3a230a5e47c4bb9010492d32b7a2222b8448d8

27 files changed:
test/ElmSharp.Test/ElmSharp.Test.csproj [changed mode: 0755->0644]
test/ElmSharp.Test/Log.cs [moved from test/ElmSharp.Test/TC/Log.cs with 100% similarity]
test/ElmSharp.Test/TC/AccessibilityRoleTest.cs
test/ElmSharp.Test/TC/EvasMapTest1.cs [changed mode: 0755->0644]
test/ElmSharp.Test/TC/FloatingButtonTest.cs [changed mode: 0755->0644]
test/ElmSharp.Test/TC/GenListTest10.cs [changed mode: 0755->0644]
test/ElmSharp.Test/TC/GenListTest2.cs [changed mode: 0755->0644]
test/ElmSharp.Test/TC/GenListTest7.cs [changed mode: 0755->0644]
test/ElmSharp.Test/TC/SliderTest1.cs [changed mode: 0755->0644]
test/ElmSharp.Test/TC/SliderTest2.cs [changed mode: 0755->0644]
test/ElmSharp.Test/TC/ToolbarTest2.cs [changed mode: 0755->0644]
test/ElmSharp.Test/TC/ToolbarTest3.cs [changed mode: 0755->0644]
test/ElmSharp.Test/TC/ToolbarTest4.cs [changed mode: 0755->0644]
test/ElmSharp.Test/TC/TransitTest.cs [changed mode: 0755->0644]
test/ElmSharp.Test/TC/Wearable/BackgroundColorTest1.cs [new file with mode: 0644]
test/ElmSharp.Test/TC/Wearable/BackgroundTest1.cs [new file with mode: 0644]
test/ElmSharp.Test/TC/Wearable/BackgroundTest2.cs [new file with mode: 0644]
test/ElmSharp.Test/TC/Wearable/BoxLayoutTest1.cs [new file with mode: 0644]
test/ElmSharp.Test/TC/Wearable/ButtonTest1.cs [new file with mode: 0644]
test/ElmSharp.Test/TC/Wearable/ButtonTest2.cs [new file with mode: 0644]
test/ElmSharp.Test/TC/Wearable/CheckTest1.cs [new file with mode: 0644]
test/ElmSharp.Test/TC/Wearable/CircleTool.cs [new file with mode: 0644]
test/ElmSharp.Test/TC/Wearable/ClipperTest1.cs [new file with mode: 0644]
test/ElmSharp.Test/TC/Wearable/ContextPopupTest1.cs [new file with mode: 0644]
test/ElmSharp.Test/TC/Wearable/DateTimeSelectorTest1.cs [new file with mode: 0644]
test/ElmSharp.Test/TestCaseBase.cs
test/ElmSharp.Test/TestRunner.cs

old mode 100755 (executable)
new mode 100644 (file)
index e03a102..05a0d80
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
   </PropertyGroup>
   <ItemGroup>
+    <Compile Include="Log.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="TC\AccessibilityRelationTest.cs" />
+    <Compile Include="TC\AccessibilityRoleTest.cs" />
     <Compile Include="TC\AccessibilityTest.cs" />
     <Compile Include="TC\BackgroundTest1.cs" />
     <Compile Include="TC\BackgroundTest2.cs" />
     <Compile Include="TC\BackgroundTest3.cs" />
+    <Compile Include="TC\GestureLayerTest1.cs" />
     <Compile Include="TC\ProgressBarTest2.cs" />
+    <Compile Include="TC\Wearable\CircleTool.cs" />
     <Compile Include="TC\TransitTest.cs" />
     <Compile Include="TC\EcoreTimerTest1.cs" />
     <Compile Include="TC\EntryTest3.cs" />
@@ -53,7 +57,6 @@
     <Compile Include="TC\GenListTest10.cs" />
     <Compile Include="TC\ImageTest4.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\ToolbarTest2.cs" />
     <Compile Include="TC\ToolbarTest3.cs" />
     <Compile Include="TC\ToolbarTest4.cs" />
+    <Compile Include="TC\Wearable\BackgroundColorTest1.cs" />
+    <Compile Include="TC\Wearable\BackgroundTest1.cs" />
+    <Compile Include="TC\Wearable\BackgroundTest2.cs" />
+    <Compile Include="TC\Wearable\BoxLayoutTest1.cs" />
+    <Compile Include="TC\Wearable\ButtonTest1.cs" />
+    <Compile Include="TC\Wearable\ButtonTest2.cs" />
+    <Compile Include="TC\Wearable\CheckTest1.cs" />
+    <Compile Include="TC\Wearable\ClipperTest1.cs" />
+    <Compile Include="TC\Wearable\ContextPopupTest1.cs" />
+    <Compile Include="TC\Wearable\DateTimeSelectorTest1.cs" />
     <Compile Include="TC\WindowInternalTest.cs" />
     <Compile Include="TestCaseBase.cs" />
     <Compile Include="TestRunner.cs" />
     <Content Include="tizen-manifest.xml" />
   </ItemGroup>
   <ItemGroup>
-    <ProjectReference Include="..\ElmSharp\ElmSharp.csproj">
-      <Project>{7a268128-a10d-478a-b813-19fd6264003c}</Project>
-      <Name>ElmSharp</Name>
-    </ProjectReference>
+    <Reference Include="ElmSharp, Version=1.2.0.0, Culture=neutral, PublicKeyToken=3836ec6cd2c91e8b, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\ElmSharp\bin\Debug\netstandard1.3\ElmSharp.dll</HintPath>
+    </Reference>
   </ItemGroup>
+  <ItemGroup />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
        Other similar extension points exist, see Microsoft.Common.targets.
       </FlavorProperties>
     </VisualStudio>
   </ProjectExtensions>
-</Project>
\ No newline at end of file
+</Project>
index aeccbb6..216ee3d 100644 (file)
@@ -42,7 +42,7 @@ namespace ElmSharp.Test
 
             Label alertLabel = new Label(win)
             {
-                Text = "Alert";
+                Text = "Alert"
             };
 
             Label Animation = new Label(win)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/test/ElmSharp.Test/TC/Wearable/BackgroundColorTest1.cs b/test/ElmSharp.Test/TC/Wearable/BackgroundColorTest1.cs
new file mode 100644 (file)
index 0000000..00c1d77
--- /dev/null
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ElmSharp.Test.TC
+{
+    class BackgroundColorTest : WearableTestCase
+    {
+        public override string TestName => "BackgroundColorTest1";
+        public override string TestDescription => "To test basic operation of Widget's background Color";
+
+        Color[] _colors = new Color[] {
+            Color.Red,
+            new Color(125,200,255, 150),
+            new Color(125, 200, 255, 10),
+            Color.Default
+        };
+
+        public override void Run(Window window)
+        {
+            Rect square = window.GetInnerSquare();
+
+            Button colorButton = new Button(window);
+            colorButton.Geometry = square;
+            Log.Debug(colorButton.Geometry.ToString());
+            colorButton.Text = colorButton.BackgroundColor.ToString();
+            colorButton.Show();
+
+            int colorIndex = 0;
+            colorButton.Clicked += (s, e) =>
+            {
+                colorButton.BackgroundColor = _colors[colorIndex++];
+                colorButton.Text = colorButton.BackgroundColor.ToString();
+                if (colorIndex == _colors.Length) colorIndex = 0;
+            };
+        }
+    }
+}
diff --git a/test/ElmSharp.Test/TC/Wearable/BackgroundTest1.cs b/test/ElmSharp.Test/TC/Wearable/BackgroundTest1.cs
new file mode 100644 (file)
index 0000000..0f5f56c
--- /dev/null
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ElmSharp.Test.TC
+{
+    class BackgroundTest1 : WearableTestCase
+
+    {
+        public override string TestName => "BackgroundTest1";
+        public override string TestDescription => "To test basic operation of Background";
+
+        public override void Run(Window window)
+        {
+            Rect square = window.GetInnerSquare();
+
+            Background bg1 = new Background(window)
+            {
+                Color = Color.Orange,
+                Geometry = new Rect(square.X, square.Y, square.Width / 2, square.Height / 2)
+            };
+
+            Background bg2 = new Background(window)
+            {
+                Color = new Color(60, 128, 255, 100),
+                Geometry = new Rect(square.X, square.Y + square.Height / 2, square.Width / 2, square.Height / 2)
+            };
+
+            Background bg3 = new Background(window)
+            {
+                File = "/home/owner/apps_rw/ElmSharpTest/res/picture.png",
+                BackgroundOption = BackgroundOptions.Center,
+                BackgroundColor = Color.Gray,
+                Geometry = new Rect(square.X + square.Width/2, square.Y, square.Width / 2, square.Height)
+            };
+
+            bg3.SetFileLoadSize(square.Width/2, square.Height);
+
+            bg1.Show();
+            bg2.Show();
+            bg3.Show();
+        }
+    }
+}
diff --git a/test/ElmSharp.Test/TC/Wearable/BackgroundTest2.cs b/test/ElmSharp.Test/TC/Wearable/BackgroundTest2.cs
new file mode 100644 (file)
index 0000000..069e5b0
--- /dev/null
@@ -0,0 +1,91 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ElmSharp.Test.TC
+{
+    class BackgroundTest2 : WearableTestCase
+    {
+        public override string TestName => "BackgroundTest2";
+        public override string TestDescription => "To test basic operation of Background";
+
+        public override void Run(Window window)
+        {
+            Rect square = window.GetInnerSquare();
+
+            Conformant conformant = new Conformant(window);
+            conformant.Show();
+
+            Box box = new Box(window)
+            {
+                Geometry = square
+            };
+            box.Show();
+            Background bg = new Background(window)
+            {
+                AlignmentY = -1,
+                AlignmentX = -1,
+                WeightX = 1,
+                WeightY = 1,
+            };
+            bg.Show();
+            box.PackEnd(bg);
+            Slider red = new Slider(window)
+            {
+                Minimum = 0,
+                Maximum = 255,
+                Text = "Red",
+                AlignmentX = -1,
+                WeightX = 1
+            };
+            Slider green = new Slider(window)
+            {
+                Minimum = 0,
+                Maximum = 255,
+                Text = "Green",
+                AlignmentX = -1,
+                WeightX = 1
+            };
+            Slider blue = new Slider(window)
+            {
+                Minimum = 0,
+                Maximum = 255,
+                Text = "Blue",
+                AlignmentX = -1,
+                WeightX = 1
+            };
+            Slider alpha = new Slider(window)
+            {
+                Minimum = 0,
+                Maximum = 255,
+                Text = "Alpha",
+                AlignmentX = -1,
+                WeightX = 1
+            };
+            red.Show();
+            green.Show();
+            blue.Show();
+            alpha.Show();
+            box.PackEnd(red);
+            box.PackEnd(green);
+            box.PackEnd(blue);
+            box.PackEnd(alpha);
+            red.Value = 255;
+            green.Value = 255;
+            blue.Value = 255;
+            alpha.Value = 255;
+
+            bg.Color = new Color(255, 255, 255, 255);
+
+            EventHandler handler = (s, e) =>
+            {
+                bg.Color = new Color((int)red.Value, (int)green.Value, (int)blue.Value, (int)alpha.Value);
+            };
+
+            red.ValueChanged += handler;
+            green.ValueChanged += handler;
+            blue.ValueChanged += handler;
+            alpha.ValueChanged += handler;
+        }
+    }
+}
diff --git a/test/ElmSharp.Test/TC/Wearable/BoxLayoutTest1.cs b/test/ElmSharp.Test/TC/Wearable/BoxLayoutTest1.cs
new file mode 100644 (file)
index 0000000..3f4ddba
--- /dev/null
@@ -0,0 +1,104 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace ElmSharp.Test.TC
+{
+    // under construct
+    class BoxLayoutTest1 : WearableTestCase
+    {
+        public override string TestName => "BoxLayoutTest1";
+        public override string TestDescription => "Box Layout callback test";
+
+        Naviframe _navi;
+        int _sequence = 0;
+        Rect _square;
+
+        public override void Run(Window window)
+        {
+            _square = window.GetInnerSquare();
+
+            Conformant conformant = new Conformant(window);
+            conformant.Show();
+
+            Naviframe navi = new Naviframe(window)
+            {
+                PreserveContentOnPop = true,
+                DefaultBackButtonEnabled = true
+            };
+            _navi = navi;
+
+            navi.Popped += (s, e) =>
+            {
+                Console.WriteLine("----- Naviframe was popped {0:x} ", (int)(IntPtr)e.Content);
+            };
+
+            navi.Push(CreatePage(window));
+            navi.Show();
+            //navi.Geometry = _square;
+            conformant.SetContent(navi);
+        }
+
+        EvasObject CreatePage(Window parent)
+        {
+            Box box = new Box(parent);
+            box.Show();
+            box.BackgroundColor = Color.Gray;
+
+            Label label = new Label(parent)
+            {
+                Text = string.Format("{0} Page", _sequence++),
+                WeightX = 1,
+                AlignmentX = -1,
+            };
+            Button push = new Button(parent)
+            {
+                Text = "Push",
+                WeightX = 1,
+                AlignmentX = -1,
+            };
+            Button pop = new Button(parent)
+            {
+                Text = "pop",
+                WeightX = 1,
+                AlignmentX = -1,
+            };
+
+            label.Show();
+            push.Show();
+            pop.Show();
+
+            push.Clicked += (s, e) =>
+            {
+                _navi.Push(CreatePage(parent));
+            };
+
+            pop.Clicked += (s, e) =>
+            {
+                var item = _navi.NavigationStack.LastOrDefault();
+                int nativePointer = (int)(IntPtr)(item.Content);
+                Console.WriteLine("----- Before Call _navi.Pop() {0:x} ", nativePointer);
+                _navi.Pop();
+                Console.WriteLine("----- After Call _navi.Pop() {0:x} ", nativePointer);
+            };
+
+            push.Resize(_square.Width, _square.Height / 6);
+            pop.Resize(_square.Width, _square.Height / 6);
+            label.Resize(_square.Width, _square.Height / 6);
+            box.SetLayoutCallback(() =>
+            {
+                Console.WriteLine("Layout callback with : {0}", _square);
+                var rect = box.Geometry;
+                label.Move(_square.X, rect.Y);
+                push.Move(_square.X, rect.Y + _square.Height / 6 + 5);
+                pop.Move(_square.X, rect.Y + _square.Height / 3 + 10);
+            });
+
+            box.PackEnd(label);
+            box.PackEnd(push);
+            box.PackEnd(pop);
+            return box;
+        }
+    }
+}
diff --git a/test/ElmSharp.Test/TC/Wearable/ButtonTest1.cs b/test/ElmSharp.Test/TC/Wearable/ButtonTest1.cs
new file mode 100644 (file)
index 0000000..a7f589f
--- /dev/null
@@ -0,0 +1,83 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ElmSharp.Test.TC
+{
+    class ButtonTest1 : WearableTestCase
+    {
+        public override string TestName => "ButtonTest1";
+        public override string TestDescription => "To test basic operation of Button";
+
+        void SetButtonEventHandler(Button button)
+        {
+            button.Clicked += (s, e) =>
+            {
+                Log.Debug($"{button.Text} Clicked! : {button.BackgroundColor}");
+                Log.Debug($"{button.Text} Clicked! : {button.ClassName}");
+                Log.Debug($"{button.Text} Clicked! : {button.ClassName.ToLower()}");
+                Log.Debug($"{button.Text} Clicked! : {button.ClassName.ToLower().Replace("elm_", "")}");
+                Log.Debug($"{button.Text} Clicked! : {button.ClassName.ToLower().Replace("elm_", "") + "/" + "bg"}");
+            };
+
+            button.Pressed += (s, e) =>
+            {
+                Log.Debug("{button.Text} Pressed!");
+            };
+
+            button.Released += (s, e) =>
+            {
+                Log.Debug("{button.Text} Released!");
+            };
+
+            button.Repeated += (s, e) =>
+            {
+                Log.Debug("{button.Text} Repeated!");
+            };
+
+            button.Show();
+        }
+
+        public override void Run(Window window)
+        {
+            Rect square = window.GetInnerSquare();
+            Log.Debug(square.ToString());
+
+            Button button1 = new Button(window)
+            {
+                Text = "Button 1",
+            };
+            button1.SetPartColor("bg", Color.Red);
+            SetButtonEventHandler(button1);
+            button1.Resize(square.Width, square.Height/4);
+            button1.Move(square.X, square.Y);
+
+            Button button2 = new Button(window)
+            {
+                Text = "Button 2",
+                BackgroundColor = Color.Red,
+            };
+            SetButtonEventHandler(button2);
+            button2.Resize(square.Width, square.Height / 4);
+            button2.Move(square.X, square.Y + square.Height / 4);
+
+            Button button3 = new Button(window)
+            {
+                Text = "Button 3",
+                BackgroundColor = new Color(125, 200, 255, 150)
+            };
+            SetButtonEventHandler(button3);
+            button3.Resize(square.Width, square.Height / 4);
+            button3.Move(square.X, square.Y + square.Height / 2);
+
+            Button button4 = new Button(window)
+            {
+                Text = "Button 4",
+                BackgroundColor = new Color(125, 200, 255, 10)
+            };
+            SetButtonEventHandler(button4);
+            button4.Resize(square.Width, square.Height / 4);
+            button4.Move(square.X, square.Y + square.Height * 3 / 4);
+        }
+    }
+}
diff --git a/test/ElmSharp.Test/TC/Wearable/ButtonTest2.cs b/test/ElmSharp.Test/TC/Wearable/ButtonTest2.cs
new file mode 100644 (file)
index 0000000..dda65ae
--- /dev/null
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ElmSharp.Test.TC
+{
+    class ButtonTest2 : WearableTestCase
+    {
+        public override string TestName => "ButtonTest2";
+        public override string TestDescription => "To Test Wearable Circular Buttons";
+
+        public override void Run(Window window)
+        {
+            Background bg = new Background(window);
+            bg.Color = Color.Black;
+            bg.Show();
+
+            Button btn_bottom = new Button(window)
+            {
+                Style = "bottom",
+                Text = "Down",
+                Geometry = new Rect((window.ScreenSize.Width - 360) / 2, (window.ScreenSize.Height - 100), 360, 100)
+            };
+            btn_bottom.Show();
+
+            Button btn_left = new Button(window)
+            {
+                Style = "popup/circle/left",
+                Text = "Left",
+                Geometry = new Rect(0, 0, 64, 360)
+            };
+            btn_left.Show();
+
+            Button btn_right = new Button(window)
+            {
+                Style = "popup/circle/right",
+                Text = "Right",
+                Geometry = new Rect(window.ScreenSize.Width - 64, 0, 64, 360)
+            };
+            btn_right.Show();
+        }
+    }
+}
diff --git a/test/ElmSharp.Test/TC/Wearable/CheckTest1.cs b/test/ElmSharp.Test/TC/Wearable/CheckTest1.cs
new file mode 100644 (file)
index 0000000..3232e7f
--- /dev/null
@@ -0,0 +1,60 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ElmSharp.Test.TC
+{
+    class CheckTest1 : WearableTestCase
+    {
+        public override string TestName => "CheckTest1";
+        public override string TestDescription => "To test basic operation of Check";
+
+        public override void Run(Window window)
+        {
+            Rect square = window.GetInnerSquare();
+
+            Background bg = new Background(window);
+            bg.Color = Color.White;
+            bg.Geometry = square;
+            bg.Show();
+
+            Check check = new Check(window)
+            {
+                Text = "This is Check",
+                Style = "default",
+            };
+
+            Label label1 = new Label(window)
+            {
+                Text = string.Format("IsChecked ={0}, Style={1}", check.IsChecked, check.Style),
+            };
+
+            Label label2 = new Label(window);
+
+            Label label3 = new Label(window);
+
+            check.StateChanged += (object sender, CheckStateChangedEventArgs e) =>
+            {
+                check.Style = check.Style == "default" ? "on&off" : "default";
+                label1.Text = string.Format("IsChecked ={0}, Style={1}", check.IsChecked, check.Style);
+                label2.Text = string.Format("OldState={0}", e.OldState);
+                label3.Text = string.Format("NewState={0}", e.NewState);
+            };
+
+            Rect quater = square;
+            quater.Height /= 4;
+
+            label1.Geometry = new Rect(quater.X, quater.Y, quater.Width, quater.Height);
+            label1.Show();
+
+            label2.Geometry = new Rect(quater.X, quater.Y + quater.Height, quater.Width, quater.Height);
+            label2.Show();
+
+            label3.Geometry = new Rect(quater.X, quater.Y + quater.Height * 2, quater.Width, quater.Height);
+            label3.Show();
+
+            check.Geometry = new Rect(quater.X, quater.Y + quater.Height * 3, quater.Width, quater.Height);
+            check.Show();
+        }
+    }
+}
diff --git a/test/ElmSharp.Test/TC/Wearable/CircleTool.cs b/test/ElmSharp.Test/TC/Wearable/CircleTool.cs
new file mode 100644 (file)
index 0000000..e884e1d
--- /dev/null
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ElmSharp.Test.TC
+{
+    public static class CircleTool
+    {
+        static Rect _inSquare;
+        public static Rect GetInnerSquare(this Window window)
+        {
+            Size screenSize = window.ScreenSize;
+            int min = Math.Min(screenSize.Height, screenSize.Width);
+            int width = (int)(min * Math.Cos(Math.PI / 4));
+            int x = screenSize.Width / 2 - width / 2;
+            int y = screenSize.Height / 2 - width / 2;
+
+            return _inSquare == default(Rect) ? (_inSquare = new Rect(x, y, width, width)) : _inSquare;
+        }
+    }
+}
diff --git a/test/ElmSharp.Test/TC/Wearable/ClipperTest1.cs b/test/ElmSharp.Test/TC/Wearable/ClipperTest1.cs
new file mode 100644 (file)
index 0000000..d83e9d8
--- /dev/null
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ElmSharp.Test.TC
+{
+    class ClipperTest1 : WearableTestCase
+    {
+        public override string TestName => "ClipperTest1";
+        public override string TestDescription => "ClipperTest1 test";
+
+        public override void Run(Window window)
+        {
+            Rect square = window.GetInnerSquare();
+
+            Conformant conformant = new Conformant(window);
+            conformant.Show();
+
+            Naviframe navi = new Naviframe(window)
+            {
+                PreserveContentOnPop = true,
+                DefaultBackButtonEnabled = true
+            };
+
+            Scroller scroller = new Scroller(window)
+            {
+                AlignmentX = -1,
+                AlignmentY = -1,
+                WeightX = 1,
+                WeightY = 1,
+                ScrollBlock = ScrollBlock.None,
+            };
+            scroller.Show();
+            Box container = new Box(window);
+            scroller.SetContent(container);
+
+            var rect1 = new Rectangle(window)
+            {
+                AlignmentX = -1,
+                WeightX = 1,
+                Color = Color.Blue,
+                MinimumHeight = square.Height / 3
+            };
+            rect1.Show();
+
+            var clipper = new Rectangle(window);
+            clipper.Color = new Color(200, 200, 200, 200);
+            clipper.Geometry = rect1.Geometry;
+            rect1.Moved += (s, e) =>
+            {
+                clipper.Geometry = ((Rectangle)s).Geometry;
+            };
+            rect1.SetClip(clipper);
+            clipper.Show();
+            container.PackEnd(rect1);
+
+            Color[] colors = { Color.Red, Color.Olive, Color.Green, Color.Gray, Color.Lime, Color.Maroon };
+            for (int i = 0; i < 6; i++)
+            {
+                var rect = new Rectangle(window)
+                {
+                    AlignmentX = -1,
+                    WeightX = 1,
+                    Color = colors[i],
+                    MinimumHeight = square.Height / 3
+                };
+                rect.Show();
+                container.PackEnd(rect);
+            }
+
+            navi.Push(scroller, "Scroll Page");
+            navi.Show();
+            conformant.SetContent(navi);
+        }
+    }
+}
diff --git a/test/ElmSharp.Test/TC/Wearable/ContextPopupTest1.cs b/test/ElmSharp.Test/TC/Wearable/ContextPopupTest1.cs
new file mode 100644 (file)
index 0000000..449877b
--- /dev/null
@@ -0,0 +1,65 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ElmSharp.Test.TC
+{
+    class ContextPopupTest1 : WearableTestCase
+    {
+        public override string TestName => "ContextPopupTest1";
+        public override string TestDescription => "To test basic operation of ContextPopup";
+        private int _count = 0;
+        public override void Run(Window window)
+        {
+            Rect square = window.GetInnerSquare();
+
+            Background bg = new Background(window);
+            bg.Color = Color.White;
+            bg.Move(0, 0);
+            bg.Resize(window.ScreenSize.Width, window.ScreenSize.Height);
+            bg.Show();
+
+            ContextPopup ctxPopup = new ContextPopup(bg)
+            {
+                IsHorizontal = false,
+                AutoHide = false,
+            };
+
+            for (int i = 0; i < 5; i++)
+            {
+                ctxPopup.Append(string.Format("{0} item", _count++));
+            }
+
+            ctxPopup.Dismissed += (e, o) => {
+                Console.WriteLine("Dismissed");
+            };
+            ctxPopup.Geometry = new Rect(square.X, square.Y, square.Width / 4, square.Height);
+            ctxPopup.Show();
+
+            bool ctxPopupVisible = true;
+            string dismissCaption = "Dismiss ContextPopup!";
+            string showCaption = "Show ContextPopup!";
+
+            Button button = new Button(window)
+            {
+                Text = dismissCaption
+            };
+            button.Clicked += (E, o) =>
+            {
+                if (ctxPopupVisible)
+                {
+                    ctxPopup.Dismiss();
+                }
+                else
+                {
+                    ctxPopup.Show();
+                }
+                ctxPopupVisible = !ctxPopupVisible;
+                button.Text = ctxPopupVisible ? dismissCaption : showCaption;
+            };
+
+            button.Geometry = new Rect(square.X + square.Width/2, square.Y, square.Width / 2, square.Height);
+            button.Show();
+        }
+    }
+}
diff --git a/test/ElmSharp.Test/TC/Wearable/DateTimeSelectorTest1.cs b/test/ElmSharp.Test/TC/Wearable/DateTimeSelectorTest1.cs
new file mode 100644 (file)
index 0000000..6fc80e6
--- /dev/null
@@ -0,0 +1,66 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ElmSharp.Test.TC
+{
+    class DateTimeSelectorTest1 : WearableTestCase
+    {
+        public override string TestName => "DateTimeSelectorTest1";
+        public override string TestDescription => "To test basic operation of DateTimeSelector";
+
+        public override void Run(Window window)
+        {
+            Conformant conformant = new Conformant(window);
+            conformant.Show();
+
+            Background bg = new Background(window);
+            bg.Color = Color.Black;
+            bg.Show();
+            conformant.SetContent(bg);
+
+            DateTimeSelector dateTime = new DateTimeSelector(window)
+            {
+                MinimumDateTime = new DateTime(2015, 1, 1),
+                MaximumDateTime = DateTime.Now,
+                DateTime = DateTime.Now
+            };
+
+            dateTime.Geometry = new Rect(0, 0, window.ScreenSize.Width, window.ScreenSize.Height);
+            dateTime.Show();
+
+            dateTime.DateTimeChanged += (object sender, DateChangedEventArgs e) =>
+            {
+                Log.Debug($"Old DateTime={e.OldDate}");
+                Log.Debug($"New DateTime={e.NewDate}");
+                Log.Debug($"Current DateTime={dateTime.DateTime}");
+            };
+
+            Button btn_left = new Button(window)
+            {
+                Style = "popup/circle/left",
+                Text = "Left",
+                Geometry = new Rect(0, 0, 64, 360)
+            };
+            btn_left.Show();
+
+            Button btn_right = new Button(window)
+            {
+                Style = "popup/circle/right",
+                Text = "Right",
+                Geometry = new Rect(window.ScreenSize.Width - 64, 0, 64, 360)
+            };
+            btn_right.Show();
+
+            btn_left.Clicked += (s, e) =>
+            {
+                dateTime.DateTime -= new TimeSpan(1, 0, 0, 0, 0);
+            };
+
+            btn_right.Clicked += (s, e) =>
+            {
+                dateTime.DateTime += new TimeSpan(1, 0, 0, 0, 0);
+            };
+        }
+    }
+}
index 5803eaa..04987dc 100644 (file)
  */
 
 using System;
-using ElmSharp;
 
 namespace ElmSharp.Test
 {
+    [Flags]
+    public enum TargetProfile
+    {
+        Mobile = 1,
+        Tv = 2,
+        Wearable = 4
+    }
     public abstract class TestCaseBase
     {
         public abstract string TestName { get; }
         public abstract string TestDescription { get; }
+        public virtual TargetProfile TargetProfile => TargetProfile.Mobile | TargetProfile.Tv;
         public abstract void Run(Window window);
     }
+
+    public abstract class WearableTestCase : TestCaseBase
+    {
+        public override TargetProfile TargetProfile => TargetProfile.Wearable;
+    }
 }
index 3ee156b..315cb0b 100644 (file)
@@ -31,6 +31,8 @@ namespace ElmSharp.Test
 
         public static string ResourceDir { get; private set; }
 
+        public string Profile { get; set; }
+
         public TestRunner()
         {
             s_terminated = false;
@@ -157,25 +159,26 @@ namespace ElmSharp.Test
             {
                 GetTextHandler = (data, part) =>
                 {
-                    return string.Format("{0}",(string)data);
+                    TestCaseBase tc = data as TestCaseBase;
+                    return tc == null ? "" : tc.TestName;
                 }
             };
 
-            foreach (var tc in testCases)
+            foreach (var tc in testCases.Where<TestCaseBase>((tc) => tc.TargetProfile.HasFlag(GetTargetProfile())))
+            {
+                list.Append(defaultClass, tc);
+            }
+
+            if (Profile == "wearable")
             {
-                list.Append(defaultClass, tc.TestName);
+                list.Prepend(defaultClass, null);
+                list.Append(defaultClass, null);
             }
 
             list.ItemSelected += (s, e) =>
             {
-                foreach (var tc in testCases)
-                {
-                    if (tc.TestName == (string)(e.Item.Data))
-                    {
-                        StartTCFromList(tc);
-                        break;
-                    }
-                }
+                TestCaseBase tc = e.Item.Data as TestCaseBase;
+                StartTCFromList(tc);
             };
             list.Show();
 
@@ -194,15 +197,31 @@ namespace ElmSharp.Test
             tc.Run(window);
         }
 
+        private TargetProfile GetTargetProfile()
+        {
+            switch (Profile)
+            {
+                case "wearable" :
+                    return TargetProfile.Wearable;
+                case "mobile" :
+                    return TargetProfile.Mobile;
+                case "tv":
+                    return TargetProfile.Tv;
+            }
+            return TargetProfile.Mobile;
+        }
+
         static void Main(string[] args)
         {
             Elementary.Initialize();
             Elementary.ThemeOverlay();
 
-            Console.WriteLine("ELM_PROFILE : {0}", Elementary.GetProfile());
+            var profile = Elementary.GetProfile();
+            Console.WriteLine("ELM_PROFILE : {0}", profile);
             Console.WriteLine("ELM_SCALE : {0}", Elementary.GetScale());
 
             TestRunner testRunner = new TestRunner();
+            testRunner.Profile = profile;
             testRunner.Run(args);
 
             // if running with appfw is failed, below line will be executed.