<Compile Include="TC\Wearable\IndexTest1.cs" />
<Compile Include="TC\Wearable\IndexTest2.cs" />
<Compile Include="TC\Wearable\ListTest1.cs" />
+ <Compile Include="TC\Wearable\NaviframeTest1.cs" />
+ <Compile Include="TC\Wearable\NaviframeTest2.cs" />
+ <Compile Include="TC\Wearable\NaviframeTest3.cs" />
+ <Compile Include="TC\Wearable\PanelTest1.cs" />
+ <Compile Include="TC\Wearable\PanelTest2.cs" />
+ <Compile Include="TC\Wearable\PanesTest1.cs" />
+ <Compile Include="TC\Wearable\PerformanceTest.cs" />
+ <Compile Include="TC\Wearable\PolygonTest1.cs" />
+ <Compile Include="TC\Wearable\PopupTest1.cs" />
<Compile Include="TC\Wearable\ProgressBarTest1.cs" />
<Compile Include="TC\Wearable\ProgressBarTest2.cs" />
<Compile Include="TC\Wearable\RadioTest1.cs" />
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
-</Project>
+</Project>
\ No newline at end of file
--- /dev/null
+/*
+ * 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;
+
+namespace ElmSharp.Test.Wearable
+{
+ class NaviframeTest1 : WearableTestCase
+ {
+ public override string TestName => "NaviframeTest1";
+ public override string TestDescription => "Naviframe test";
+
+ public override void Run(Window window)
+ {
+ var square = window.GetInnerSquare();
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+
+ Naviframe navi = new Naviframe(window)
+ {
+ PreserveContentOnPop = true,
+ DefaultBackButtonEnabled = true,
+ Geometry = square
+ };
+
+ navi.Popped += (s, e) =>
+ {
+ Console.WriteLine("naviframe was popped : " + e.Content.GetType());
+ };
+
+ Rectangle rect1 = new Rectangle(window)
+ {
+ Color = Color.Red,
+ Geometry = new Rect(square.X, square.Y, square.Width, square.Height)
+ };
+
+ navi.Push(rect1, "First Page");
+
+ Rectangle rect2 = new Rectangle(window)
+ {
+ Color = Color.Blue,
+ Geometry = new Rect(square.X, square.Y, square.Width, square.Height)
+ };
+
+ navi.Push(rect2, "Second Page");
+ navi.Show();
+ conformant.SetContent(navi);
+ }
+ }
+}
--- /dev/null
+/*
+ * 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 System.Linq;
+
+namespace ElmSharp.Test.Wearable
+{
+ public class NaviframeTest2 : WearableTestCase
+ {
+ public override string TestName => "NaviframeTest2";
+ public override string TestDescription => "Naviframe test";
+
+ Naviframe _navi;
+ int _sequence = 0;
+ Rect square;
+
+ public override void Run(Window window)
+ {
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+ square = window.GetInnerSquare();
+
+ 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), "0 Page");
+
+ navi.Show();
+ conformant.SetContent(navi);
+ }
+
+ EvasObject CreatePage(Window parent)
+ {
+ Table table = new Table(parent);
+ table.Geometry = square;
+ table.Show();
+
+ Label label = new Label(parent) {
+ Text = string.Format("<span color=#000000 font_size=15>{0} Page</span>", _sequence++),
+ WeightX = 1,
+ AlignmentX = -1,
+ BackgroundColor = Color.Black,
+ Geometry = new Rect(square.X, square.Y, square.Width, square.Height/9)
+ };
+
+ Button push = new Button(parent) {
+ Text = "<span color=#000000 font_size=15>Push</span>",
+ WeightX = 1,
+ AlignmentX = -1,
+ BackgroundColor = Color.Black,
+ Geometry = new Rect(square.X, square.Y + square.Height/9, square.Width/2, square.Height/9)
+ };
+
+ Button pop = new Button(parent) {
+ Text = "<span color=#000000 font_size=15>pop</span>",
+ WeightX = 1,
+ AlignmentX = -1,
+ BackgroundColor = Color.Black,
+ Geometry = new Rect(square.X + square.Width/2, square.Y + square.Height/9, square.Width/2, square.Height/9)
+ };
+
+ Button insertBeforeTop = new Button(parent) {
+ Text = "<span color=#000000 font_size=15>insertBeforeTop</span>",
+ WeightX = 1,
+ AlignmentX = -1,
+ BackgroundColor = Color.Black,
+ Geometry = new Rect(square.X, square.Y + square.Height / 9*2, square.Width / 2, square.Height / 9)
+ };
+
+ Button insertAfterTop = new Button(parent) {
+ Text = "<span color=#000000 font_size=15>insertAfterTop</span>",
+ WeightX = 1,
+ AlignmentX = -1,
+ BackgroundColor = Color.Black,
+ Geometry = new Rect(square.X + square.Width / 2, square.Y + square.Height / 9*2, square.Width / 2, square.Height / 9)
+ };
+
+ Button removeTop = new Button(parent)
+ {
+ Text = "<span color=#000000 font_size=15>removeTop</span>",
+ WeightX = 1,
+ AlignmentX = -1,
+ BackgroundColor = Color.Black,
+ Geometry = new Rect(square.X, square.Y + square.Height / 9 * 3, square.Width, square.Height / 9)
+ };
+
+ Button barChange = new Button(parent)
+ {
+ Text = "<span color=#000000 font_size=15>TitleBarColor Change</span>",
+ WeightX = 1,
+ AlignmentX = -1,
+ BackgroundColor = Color.Black,
+ Geometry = new Rect(square.X, square.Y + square.Height / 9 * 4, square.Width / 2, square.Height / 9)
+ };
+
+ Button barColorDefault = new Button(parent)
+ {
+ Text = "<span color=#000000 font_size=15>TitleBarColor - Default</span>",
+ WeightX = 1,
+ AlignmentX = -1,
+ BackgroundColor = Color.Black,
+ Geometry = new Rect(square.X + square.Width / 2, square.Y + square.Height / 9 * 4, square.Width / 2, square.Height / 9)
+ };
+
+ label.Show();
+ push.Show();
+ pop.Show();
+ insertBeforeTop.Show();
+ insertAfterTop.Show();
+ removeTop.Show();
+ barChange.Show();
+ barColorDefault.Show();
+
+ push.Clicked += (s, e) =>
+ {
+ _navi.Push(CreatePage(parent), string.Format("{0} Page", _sequence-1));
+ };
+
+ 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);
+ };
+
+ insertBeforeTop.Clicked += (s, e) =>
+ {
+ _navi.InsertBefore(_navi.NavigationStack.LastOrDefault(), CreatePage(parent), string.Format("{0} Page", _sequence - 1));
+ };
+
+ insertAfterTop.Clicked += (s, e) =>
+ {
+ _navi.InsertAfter(_navi.NavigationStack.LastOrDefault(), CreatePage(parent), string.Format("{0} Page", _sequence - 1));
+ };
+ removeTop.Clicked += (s, e) =>
+ {
+ var item = _navi.NavigationStack.LastOrDefault();
+ int nativePointer = (int)(IntPtr)(item.Content);
+ Console.WriteLine("----- Before Call NaviItem.Delete() {0:x} ", nativePointer);
+ item.Delete();
+ Console.WriteLine("----- After Call NaviItem.Delete() {0:x} ", nativePointer);
+ };
+
+ Random rand = new Random(DateTime.Now.Millisecond);
+ barChange.Clicked += (s, e) =>
+ {
+ int currentIndex = _navi.NavigationStack.Count - 1;
+ if (currentIndex >= 0)
+ {
+ _navi.NavigationStack[currentIndex].TitleBarBackgroundColor = Color.FromHex(string.Format("#{0:X8}", rand.Next()));
+ }
+ };
+
+ barColorDefault.Clicked += (s, e) =>
+ {
+ int currentIndex = _navi.NavigationStack.Count - 1;
+ if (currentIndex >= 0)
+ {
+ _navi.NavigationStack[currentIndex].TitleBarBackgroundColor = Color.Default;
+ }
+ };
+
+ table.Pack(label, 0,0,1,1);
+ table.Pack(push, 0,1,1,1);
+ table.Pack(pop, 1,1,1,1);
+ table.Pack(insertBeforeTop, 0, 2, 1, 1);
+ table.Pack(insertAfterTop, 1, 2, 1, 1);
+ table.Pack(removeTop, 0, 3, 1, 1);
+ table.Pack(barChange, 0, 4, 1, 1);
+ table.Pack(barColorDefault, 1, 4, 1, 1);
+
+ return table;
+ }
+ }
+}
--- /dev/null
+/*
+ * 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 System.Linq;
+
+namespace ElmSharp.Test.Wearable
+{
+ public class NaviframeTest3 : WearableTestCase
+ {
+ public override string TestName => "NaviframeTest3";
+ public override string TestDescription => "Naviframe test";
+
+ Naviframe _navi;
+ int _sequence = 0;
+ Rect square;
+
+ public override void Run(Window window)
+ {
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+ square = window.GetInnerSquare();
+
+ 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);
+ };
+
+ NaviItem item = navi.Push(CreatePage(window), "0 Page");
+ item.SetPartContent("title_left_btn", new Button(window) { Text = "LEFT" , Style = "naviframe/title_left"} );
+ item.SetPartContent("title_right_btn", new Button(window) { Text = "RIGHT", Style = "naviframe/title_right" });
+ navi.Show();
+ conformant.SetContent(navi);
+ }
+
+ EvasObject CreatePage(Window parent)
+ {
+ Table table = new Table(parent);
+ table.Geometry = square;
+ table.Show();
+
+ Label label = new Label(parent) {
+ Text = string.Format("<span color=#000000 font_size=15>{0} Page</span>", _sequence++),
+ WeightX = 1,
+ AlignmentX = -1,
+ };
+ Button push = new Button(parent) {
+ Text = "<span color=#000000 font_size=15>Push</span>",
+ WeightX = 1,
+ AlignmentX = -1,
+ BackgroundColor = Color.Black,
+ };
+ Button pop = new Button(parent) {
+ Text = "<span color=#000000 font_size=15>pop</span>",
+ WeightX = 1,
+ AlignmentX = -1,
+ BackgroundColor = Color.Black,
+ };
+ Button insertBeforeTop = new Button(parent) {
+ Text = "<span color=#000000 font_size=15>insertBeforeTop</span>",
+ WeightX = 1,
+ AlignmentX = -1,
+ BackgroundColor = Color.Black,
+ };
+ Button insertAfterTop = new Button(parent) {
+ Text = "<span color=#000000 font_size=15>insertAfterTop</span>",
+ WeightX = 1,
+ AlignmentX = -1,
+ BackgroundColor = Color.Black,
+ };
+
+ Button removeTop = new Button(parent)
+ {
+ Text = "<span color=#000000 font_size=15>removeTop</span>",
+ WeightX = 1,
+ AlignmentX = -1,
+ BackgroundColor = Color.Black,
+ };
+
+ Button barChange = new Button(parent)
+ {
+ Text = "<span color=#000000 font_size=15>TitleBarColor Change</span>",
+ WeightX = 1,
+ AlignmentX = -1,
+ BackgroundColor = Color.Black,
+ };
+
+ Button barColorDefault = new Button(parent)
+ {
+ Text = "<span color=#000000 font_size=15>TitleBarColor - Default</span>",
+ WeightX = 1,
+ AlignmentX = -1,
+ BackgroundColor = Color.Black,
+ };
+
+ label.Show();
+ push.Show();
+ pop.Show();
+ insertBeforeTop.Show();
+ insertAfterTop.Show();
+ removeTop.Show();
+ barChange.Show();
+ barColorDefault.Show();
+
+ push.Clicked += (s, e) =>
+ {
+ _navi.Push(CreatePage(parent), string.Format("{0} Page", _sequence-1));
+ };
+
+ 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);
+ };
+
+ insertBeforeTop.Clicked += (s, e) =>
+ {
+ _navi.InsertBefore(_navi.NavigationStack.LastOrDefault(), CreatePage(parent), string.Format("{0} Page", _sequence - 1));
+ };
+
+ insertAfterTop.Clicked += (s, e) =>
+ {
+ _navi.InsertAfter(_navi.NavigationStack.LastOrDefault(), CreatePage(parent), string.Format("{0} Page", _sequence - 1));
+ };
+ removeTop.Clicked += (s, e) =>
+ {
+ var item = _navi.NavigationStack.LastOrDefault();
+ int nativePointer = (int)(IntPtr)(item.Content);
+ Console.WriteLine("----- Before Call NaviItem.Delete() {0:x} ", nativePointer);
+ item.Delete();
+ Console.WriteLine("----- After Call NaviItem.Delete() {0:x} ", nativePointer);
+ };
+
+ Random rand = new Random(DateTime.Now.Millisecond);
+ barChange.Clicked += (s, e) =>
+ {
+ int currentIndex = _navi.NavigationStack.Count - 1;
+ if (currentIndex >= 0)
+ {
+ _navi.NavigationStack[currentIndex].TitleBarBackgroundColor = Color.FromHex(string.Format("#{0:X8}", rand.Next()));
+ }
+ };
+
+ barColorDefault.Clicked += (s, e) =>
+ {
+ int currentIndex = _navi.NavigationStack.Count - 1;
+ if (currentIndex >= 0)
+ {
+ _navi.NavigationStack[currentIndex].TitleBarBackgroundColor = Color.Default;
+ }
+ };
+
+ table.Pack(label, 0, 0, 1, 1);
+ table.Pack(push, 0, 1, 1, 1);
+ table.Pack(pop, 1, 1, 1, 1);
+ table.Pack(insertBeforeTop, 0, 2, 1, 1);
+ table.Pack(insertAfterTop, 1, 2, 1, 1);
+ table.Pack(removeTop, 0, 3, 1, 1);
+ table.Pack(barChange, 0, 4, 1, 1);
+ table.Pack(barColorDefault, 1, 4, 1, 1);
+
+ return table;
+ }
+ }
+}
--- /dev/null
+/*
+ * 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 ElmSharp.Test.Wearable;
+
+namespace ElmSharp.Test.Wearable
+{
+ public class PanelTest1 : WearableTestCase
+ {
+ public override string TestName => "PanelTest1";
+ public override string TestDescription => "To test basic operation of Panel";
+
+ public override void Run(Window window)
+ {
+ var square = window.GetInnerSquare();
+
+ Label label = new Label(window) {
+ Text = "<span color=#ffffff font_size=26>Panel as NonScrollable</span>",
+ AlignmentX = -1,
+ WeightX = 1,
+ Geometry = new Rect(square.X, square.Y, square.Width, square.Height/6)
+ };
+ label.Show();
+
+ Panel panel = new Panel(window) {
+ Direction = PanelDirection.Left,
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ Geometry = new Rect(square.X, square.Y+ square.Height/6, square.Width, square.Height/5*2)
+ };
+ panel.SetScrollable(false);
+
+ Rectangle redbox = new Rectangle(window) {
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ Color = Color.Red,
+ Geometry = new Rect(square.X, square.Y + square.Height/6, square.Width/2, square.Height/5*2)
+ };
+ redbox.Show();
+ panel.SetContent(redbox);
+ panel.Show();
+ panel.IsOpen = true;
+
+ Button button1 = new Button(window) {
+ Text = "Toggle open",
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ Geometry = new Rect(square.X, square.Y + square.Height/6 + square.Height/5*2+5, square.Width, square.Height/5)
+ };
+ Button button2 = new Button(window) {
+ Text = "Toggle direction",
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ Geometry = new Rect(square.X, square.Y + square.Height/6 + square.Height/5*3+5, square.Width, square.Height/5)
+ };
+ button1.Show();
+ button2.Show();
+
+ button1.Clicked += (s, e) =>
+ {
+ panel.Toggle();
+ };
+ button2.Clicked += (s, e) =>
+ {
+ panel.Direction = (PanelDirection)((int)(panel.Direction + 1) % 4);
+ };
+ panel.Toggled += (s, e) =>
+ {
+ Console.WriteLine("Panel Toggled!");
+ };
+ }
+
+ }
+}
--- /dev/null
+/*
+ * 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;
+
+namespace ElmSharp.Test.Wearable
+{
+ public class PanelTest2 : WearableTestCase
+ {
+ public override string TestName => "PanelTest2";
+ public override string TestDescription => "To test basic operation of Panel";
+
+ public override void Run(Window window)
+ {
+ var square = window.GetInnerSquare();
+
+ Label label = new Label(window)
+ {
+ Text = "<span color=#ffffff font_size=26>Panel as Scrollable</span>",
+ AlignmentX = -1,
+ WeightX = 1,
+ Geometry = new Rect(square.X, square.Y, square.Width, square.Height / 6)
+ };
+ label.Show();
+
+ Panel panel = new Panel(window)
+ {
+ Direction = PanelDirection.Left,
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ Geometry = new Rect(square.X, square.Y + square.Height / 6, square.Width, square.Height / 5 * 2)
+ };
+ panel.SetScrollable(true);
+ panel.SetScrollableArea(1.0);
+
+ Rectangle redbox = new Rectangle(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ Color = Color.Red,
+ Geometry = new Rect(square.X, square.Y + square.Height / 6, square.Width / 2, square.Height / 5 * 2)
+ };
+ redbox.Show();
+ panel.SetContent(redbox);
+ panel.Show();
+ panel.IsOpen = true;
+
+ Button button1 = new Button(window)
+ {
+ Text = "Toggle open",
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ Geometry = new Rect(square.X, square.Y + square.Height / 6 + square.Height / 5 * 2 + 5, square.Width, square.Height / 5)
+ };
+ Button button2 = new Button(window)
+ {
+ Text = "Toggle direction",
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ Geometry = new Rect(square.X, square.Y + square.Height / 6 + square.Height / 5 * 3 + 5, square.Width, square.Height / 5)
+ };
+ button1.Show();
+ button2.Show();
+
+ button1.Clicked += (s, e) =>
+ {
+ panel.Toggle();
+ };
+ button2.Clicked += (s, e) =>
+ {
+ panel.Direction = (PanelDirection)((int)(panel.Direction + 1) % 4);
+ };
+ panel.Toggled += (s, e) =>
+ {
+ Console.WriteLine("Panel Toggled!");
+ };
+ }
+
+ }
+}
--- /dev/null
+/*
+ * 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;
+
+namespace ElmSharp.Test.Wearable
+{
+ public class PanesTest1 : WearableTestCase
+ {
+ public override string TestName => "PanesTest1";
+ public override string TestDescription => "To test basic operation of Panes";
+
+ public override void Run(Window window)
+ {
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+ Box box = new Box(window);
+ conformant.SetContent(box);
+ box.Show();
+
+ Rectangle redBox = new Rectangle(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ Color = Color.Red,
+ };
+ redBox.Show();
+ Rectangle blueBox = new Rectangle(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ Color = Color.Blue,
+ };
+ Rectangle greenBox = new Rectangle(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ Color = Color.Green,
+ };
+ Panes subPanes = new Panes(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ Proportion = 0.3,
+ IsHorizontal = false
+ };
+ subPanes.Show();
+ subPanes.SetPartContent("left", blueBox);
+ subPanes.SetPartContent("right", greenBox);
+ Panes panes = new Panes(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ Proportion = 0.1,
+ IsFixed = true,
+ IsHorizontal = true,
+ };
+ panes.SetPartContent("left", redBox);
+ panes.SetPartContent("right", subPanes);
+ panes.Show();
+ box.PackEnd(panes);
+ }
+
+ }
+}
--- /dev/null
+/*
+ * 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;
+
+namespace ElmSharp.Test.Wearable
+{
+ public class PerformanceTest : WearableTestCase
+ {
+ public override string TestName => "PerformanceTest";
+ public override string TestDescription => "To test Performance of GenList";
+
+ const int TestItemMax = 2000;
+ const double TimeSet = 5.0;
+
+ string[] arrLabel = {
+ "Time Warner Cable(Cable)",
+ "ComCast (Cable)",
+ "Dish (Satellite)",
+ "DirecTV (Satellite)",
+ "Tata Sky (Satellite)",
+ "Nextra Cable(Cable)",
+ "DD Plus (Cable)",
+ "Tikona Cable(Cable)",
+ "True Provider (Cable)",
+ "Vodafone (Satellite)",
+ "Sample Text"
+ };
+
+ GenList list;
+ Box box;
+ Box box2;
+ GenListItem ItemTarget = null;
+ double _enteringSpeed = 0;
+ int _frameCount = 0;
+ int _ecoreCount = 0;
+ double _frameSet = 0;
+ IntPtr _anim = IntPtr.Zero;
+ double FrameFPS = 0;
+ double AnimatorFPS = 0;
+ Rect square;
+
+ public override void Run(Window window)
+ {
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+
+ square = window.GetInnerSquare();
+
+ Naviframe navi = new Naviframe(window)
+ {
+ PreserveContentOnPop = true,
+ DefaultBackButtonEnabled = true,
+ Geometry = square
+ };
+
+ box = new Box(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ Geometry = new Rect(square.X, square.Y, square.Width, square.Height)
+ };
+ box.Show();
+
+ box2 = new Box(box);
+ box2.Geometry = new Rect(square.X, square.Y + square.Height/6, square.Width, square.Height/2);
+ box2.Show();
+ box.PackEnd(box2);
+
+ list = new GenList(window)
+ {
+ Homogeneous = true,
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ Style = "solid/default"
+ };
+ box.PackEnd(list);
+ navi.Push(box, "Performance");
+
+ InitializeListItem();
+
+ list.Changed += List_Changed;
+ list.ScrollAnimationStarted += List_ScrollAnimationStarted;
+ list.ScrollAnimationStopped += List_ScrollAnimationStopped;
+ list.Show();
+
+ navi.Show();
+ conformant.SetContent(navi);
+ }
+
+ private void InitializeListItem()
+ {
+ GenItemClass defaultClass = new GenItemClass("default")
+ {
+ GetTextHandler = (obj, part) =>
+ {
+ return (string)obj;
+ }
+ };
+
+ for (int i = 0; i < TestItemMax; ++i)
+ {
+ if (i == 999)
+ ItemTarget = list.Append(defaultClass, new string(arrLabel[i % 10].ToCharArray()));
+ else
+ list.Append(defaultClass, new string(arrLabel[i % 10].ToCharArray()));
+ }
+ }
+
+ private void List_ScrollAnimationStopped(object sender, EventArgs e)
+ {
+ list.RenderPost -= List_RenderPostFrame;
+ list.ScrollAnimationStarted -= List_ScrollAnimationStarted;
+ list.ScrollAnimationStopped -= List_ScrollAnimationStopped;
+
+ EcoreAnimator.RemoveAnimator(_anim);
+ Elementary.BringInScrollFriction = _frameSet;
+
+ FrameFPS = _frameCount / TimeSet;
+ AnimatorFPS = _ecoreCount / TimeSet;
+
+ Button btn1 = new Button(box2)
+ {
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ Geometry = new Rect(square.X, square.Y, square.Width, square.Height / 3)
+ };
+ btn1.Text = string.Format("Entering Speed : {0:f1} msec", _enteringSpeed);
+ btn1.Show();
+
+ Button btn2 = new Button(box2)
+ {
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ Geometry = new Rect(square.X, square.Y+ square.Height / 3, square.Width, square.Height / 3)
+ };
+ btn2.Text = string.Format("Animator FPS : {0:f1} fps", AnimatorFPS);
+ btn2.Show();
+
+ Button btn3 = new Button(box2)
+ {
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ Geometry = new Rect(square.X, square.Y + square.Height / 3*2, square.Width, square.Height / 3)
+ };
+ btn3.Text = string.Format("Evas FPS : {0:f1} fps", FrameFPS);
+ btn3.Show();
+ }
+
+ private void List_RenderPost(object sender, EventArgs e)
+ {
+ list.RenderPost -= List_RenderPost;
+ _enteringSpeed = (EcoreAnimator.GetCurrentTime() - _enteringSpeed) * 1000;
+
+ _frameSet = Elementary.BringInScrollFriction;
+ Elementary.BringInScrollFriction = TimeSet;
+ list.ScrollTo(ItemTarget, ScrollToPosition.In, true);
+ }
+
+ private void List_ScrollAnimationStarted(object sender, EventArgs e)
+ {
+ _ecoreCount = 0;
+ _anim = EcoreAnimator.AddAnimator(OnEcoreCheck);
+ list.RenderPost += List_RenderPostFrame;
+ }
+
+ private bool OnEcoreCheck()
+ {
+ _ecoreCount++;
+ return true;
+ }
+
+ private void List_RenderPostFrame(object sender, EventArgs e)
+ {
+ _frameCount++;
+ }
+
+ private void List_Changed(object sender, EventArgs e)
+ {
+ _enteringSpeed = EcoreAnimator.GetCurrentTime();
+ list.Changed -= List_Changed;
+ list.RenderPost += List_RenderPost;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * 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;
+
+namespace ElmSharp.Test.Wearable
+{
+ class PolygonTest1 : WearableTestCase
+ {
+ public override string TestName => "PolygonTest1";
+ public override string TestDescription => "To test basic operation of Polygon";
+
+ public override void Run(Window window)
+ {
+ var 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();
+
+ Polygon triangle1 = new Polygon(window);
+ triangle1.Color = Color.Blue;
+ triangle1.AddPoint(square.X, square.Y + square.Height/6);
+ triangle1.AddPoint(square.X, square.Y + square.Height/3);
+ triangle1.AddPoint(square.X + square.Width/2, square.Y + square.Height/5);
+ triangle1.Show();
+
+ Polygon triange2 = new Polygon(window);
+ triange2.AddPoint(square.X + square.Width/2, square.Y + square.Height/5);
+ triange2.AddPoint(new Point{X= square.X + square.Width, Y= square.Y + square.Height/5 });
+ triange2.AddPoint(new Point{X= square.X + square.Width, Y= square.Y + square.Height/3 });
+ triange2.Color = Color.Green;
+ triange2.Show();
+
+ Polygon hexagon = new Polygon(window);
+ hexagon.Color = Color.Pink;
+ hexagon.AddPoint(square.X, square.Y);
+ hexagon.AddPoint(square.X + square.Width, square.Y);
+ hexagon.ClearPoints();
+ for (double a=0; a < 2 * Math.PI; a += Math.PI / 3)
+ {
+ hexagon.AddPoint(
+ square.X + square.Width/2 + (int)(120 * Math.Sin(a)),
+ square.Y + square.Height/2+square.Height/6 + (int)(120 * Math.Cos(a))
+ );
+ }
+ hexagon.Show();
+ }
+
+ }
+}
--- /dev/null
+/*
+ * 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;
+
+namespace ElmSharp.Test.Wearable
+{
+ public class PopupTest1 : WearableTestCase
+ {
+ public override string TestName => "PopupTest1";
+ public override string TestDescription => "To test basic operation of Popup";
+
+ public override void Run(Window window)
+ {
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+ Box box = new Box(window);
+ box.Show();
+ Button btn = new Button(window)
+ {
+ AlignmentX = -1,
+ WeightX = 1,
+ Text = "Open"
+ };
+ btn.Show();
+
+ Popup popup = new Popup(window)
+ {
+ Orientation = PopupOrientation.Bottom,
+ Timeout = 5,
+ };
+
+ popup.Dismissed += (s, e) =>
+ {
+ Console.WriteLine("Popup dismissed");
+ };
+
+ popup.ShowAnimationFinished += (s, e) =>
+ {
+ Console.WriteLine("Popup show animation finished");
+ };
+
+ popup.OutsideClicked += (s, e) =>
+ {
+ Console.WriteLine("Popup outside clicked");
+ };
+
+ popup.TimedOut += (s, e) =>
+ {
+ Console.WriteLine("Popup time out");
+ };
+
+ popup.Append("Label1");
+ popup.Append("Label2");
+ popup.Append("Label3");
+
+ popup.BackButtonPressed += (s, e) =>
+ {
+ Console.WriteLine("!!! BackButtonPressed Event on Popup!!");
+ popup.Hide();
+ };
+
+ btn.Clicked += (s, e) =>
+ {
+ popup.Show();
+ };
+
+ Button close = new Button(popup)
+ {
+ AlignmentX = -1,
+ WeightX = 1,
+ Text = "Close"
+ };
+ popup.SetPartContent("button1", close);
+
+ close.Clicked += (s, e) =>
+ {
+ popup.Hide();
+ };
+
+ box.PackEnd(btn);
+ conformant.SetContent(box);
+ }
+ }
+}