From e6ed1095b750c1caaf59b9e697c408d6e185bccb Mon Sep 17 00:00:00 2001 From: Kangho Hur Date: Mon, 21 Aug 2017 10:41:24 +0900 Subject: [PATCH] sync ElmSharp source code latest - platform/core/csapi/elm-sharp is no longer used. - This patch is from 020305fffb52c4d273d9d8c3c457dc2c88e8a04e Change-Id: I4550ac8c55e056a55d8335aefda91b0ce030ca1c --- src/ElmSharp.Wearable/ElmSharp.Wearable.sln | 17 +- .../ElmSharp.Wearable/MoreOption.cs | 33 ++- .../ElmSharp.Wearable/MoreOptionItem.cs | 18 ++ .../ElmSharp.Wearable/MoreOptionItemEventArgs.cs | 7 + .../ElmSharp.Wearable/MoreOptionList.cs | 63 ++++ .../ElmSharp.Wearable/PointerEventArgs.cs | 16 ++ .../ElmSharp.Wearable/RotarySelector.cs | 41 +++ .../ElmSharp.Wearable/RotarySelectorItem.cs | 87 +++++- .../RotarySelectorItemEventArgs.cs | 20 ++ .../ElmSharp.Wearable/RotarySelectorList.cs | 16 ++ src/ElmSharp/ElmSharp/AnimatorMotionMapper.cs | 119 ++++++++ src/ElmSharp/ElmSharp/Calendar.cs | 2 - src/ElmSharp/ElmSharp/EcoreTimelineAnimator.cs | 70 +++++ src/ElmSharp/ElmSharp/Panes.cs | 5 +- src/ElmSharp/Interop/Interop.Ecore.cs | 37 +++ .../Interop/Interop.Elementary.DateTimePicker.cs | 2 +- .../Interop/Interop.Elementary.ProgressBar.cs | 2 +- test/ElmSharp.Test/ElmSharp.Test.csproj | 317 +++------------------ test/ElmSharp.Test/ElmSharp.Test.project.json | 13 - test/ElmSharp.Test/Properties/AssemblyInfo.cs | 36 --- .../ElmSharp.Test/TC/EcoreTimelineAnimatorTest1.cs | 87 ++++++ test/ElmSharp.Test/TC/GenListTest11.cs | 115 ++++++++ test/ElmSharp.Test/TC/ImageTest1.cs | 12 +- test/ElmSharp.Test/TC/ScrollerTest4.cs | 148 ++++++++++ .../TC/Wearable/EcoreTimelineAnimatorTest1.cs | 87 ++++++ test/ElmSharp.Test/TC/Wearable/ImageTest1.cs | 4 +- test/ElmSharp.Test/tizen-manifest.xml | 18 +- .../ElmSharp.Wearable.Test.csproj | 173 +++-------- .../ElmSharp.Wearable.Test.project.json | 13 - .../Properties/AssemblyInfo.cs | 36 --- 30 files changed, 1076 insertions(+), 538 deletions(-) mode change 100755 => 100644 src/ElmSharp.Wearable/ElmSharp.Wearable.sln create mode 100644 src/ElmSharp/ElmSharp/AnimatorMotionMapper.cs create mode 100644 src/ElmSharp/ElmSharp/EcoreTimelineAnimator.cs delete mode 100755 test/ElmSharp.Test/ElmSharp.Test.project.json delete mode 100644 test/ElmSharp.Test/Properties/AssemblyInfo.cs create mode 100644 test/ElmSharp.Test/TC/EcoreTimelineAnimatorTest1.cs create mode 100755 test/ElmSharp.Test/TC/GenListTest11.cs create mode 100644 test/ElmSharp.Test/TC/ScrollerTest4.cs create mode 100644 test/ElmSharp.Test/TC/Wearable/EcoreTimelineAnimatorTest1.cs mode change 100755 => 100644 test/ElmSharp.Test/TC/Wearable/ImageTest1.cs delete mode 100644 test/ElmSharp.Wearable.Test/ElmSharp.Wearable.Test.project.json delete mode 100644 test/ElmSharp.Wearable.Test/Properties/AssemblyInfo.cs diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable.sln b/src/ElmSharp.Wearable/ElmSharp.Wearable.sln old mode 100755 new mode 100644 index 5079bfe..dbf2ebd --- a/src/ElmSharp.Wearable/ElmSharp.Wearable.sln +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable.sln @@ -1,12 +1,16 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.12 +VisualStudioVersion = 15.0.26730.8 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp.Wearable", "ElmSharp.Wearable.csproj", "{01AE2E3A-C08E-431C-97B3-A18D536FCD52}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp", "..\ElmSharp\ElmSharp.csproj", "{393A27E0-A1FF-4BC7-9B44-2B2803080AC2}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp.Test", "..\..\test\ElmSharp.Test\ElmSharp.Test.csproj", "{7FD75973-F5CE-4D17-81CB-A5905A62D138}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp.Wearable.Test", "..\..\test\ElmSharp.Wearable.Test\ElmSharp.Wearable.Test.csproj", "{DC7126DF-8ED8-448A-B7D8-15C7441B6929}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,8 +25,19 @@ Global {393A27E0-A1FF-4BC7-9B44-2B2803080AC2}.Debug|Any CPU.Build.0 = Debug|Any CPU {393A27E0-A1FF-4BC7-9B44-2B2803080AC2}.Release|Any CPU.ActiveCfg = Release|Any CPU {393A27E0-A1FF-4BC7-9B44-2B2803080AC2}.Release|Any CPU.Build.0 = Release|Any CPU + {7FD75973-F5CE-4D17-81CB-A5905A62D138}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7FD75973-F5CE-4D17-81CB-A5905A62D138}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7FD75973-F5CE-4D17-81CB-A5905A62D138}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7FD75973-F5CE-4D17-81CB-A5905A62D138}.Release|Any CPU.Build.0 = Release|Any CPU + {DC7126DF-8ED8-448A-B7D8-15C7441B6929}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DC7126DF-8ED8-448A-B7D8-15C7441B6929}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DC7126DF-8ED8-448A-B7D8-15C7441B6929}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DC7126DF-8ED8-448A-B7D8-15C7441B6929}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {DCFCB5BF-47F2-4C3E-AB44-B126B259C9AA} + EndGlobalSection EndGlobal diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOption.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOption.cs index 7f75cc1..002a7a6 100644 --- a/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOption.cs +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOption.cs @@ -5,14 +5,32 @@ using System.Linq; namespace ElmSharp.Wearable { + /// + /// The MoreOption is a widget composed of the toggle(cue button) and more option view, and MoreOption can change a visibility through the toggle. + /// Inherits Layout + /// public class MoreOption : Layout { - + /// + /// Sets or gets the list of more option item + /// public IList Items { get; private set; } + /// + /// Selected will be triggered when the user selects an item. + /// public event EventHandler Selected; + /// + /// Clicked will be triggered when the user selects the already selected item again or selects a selector. + /// public event EventHandler Clicked; + /// + /// Opened will be triggered when more option view is shown. + /// public event EventHandler Opened; + /// + /// Closed will be triggered when more option view is hidden. + /// public event EventHandler Closed; SmartEvent _selectedEvent; @@ -20,6 +38,10 @@ namespace ElmSharp.Wearable SmartEvent _openedEvent; SmartEvent _closedEvent; + /// + /// Creates and initializes a new instance of MoreOption class. + /// + /// The parent is a given container which will be attached by MoreOption as a child. It's type. public MoreOption(EvasObject parent) : base(parent) { Items = new MoreOptionList(this); @@ -51,6 +73,9 @@ namespace ElmSharp.Wearable return Interop.Eext.eext_more_option_add(parent); } + /// + /// Sets or gets the direction of more option. + /// public MoreOptionDirection Direction { get @@ -65,6 +90,9 @@ namespace ElmSharp.Wearable } } + /// + /// Sets or gets the visibility of more option view. + /// public bool IsOpened { get @@ -79,6 +107,9 @@ namespace ElmSharp.Wearable } } + /// + /// Enumeration for More Option Direction type. + /// public enum MoreOptionDirection { Top, diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionItem.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionItem.cs index ad5bf58..85ad356 100644 --- a/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionItem.cs +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionItem.cs @@ -4,6 +4,9 @@ using System.Text; namespace ElmSharp.Wearable { + /// + /// The MoreOptionItem is a item of MoreOption widget. + /// public class MoreOptionItem { const string MainTextPartName = "selector,main_text"; @@ -15,6 +18,9 @@ namespace ElmSharp.Wearable Image _icon; IntPtr _handle; + /// + /// Sets or gets the more option item handle. + /// public IntPtr Handle { get @@ -34,11 +40,17 @@ namespace ElmSharp.Wearable } } + /// + /// Set the icon to null + /// public MoreOptionItem() { _icon = null; } + /// + /// Sets or gets the main text of a more option object. + /// public string MainText { set @@ -57,6 +69,9 @@ namespace ElmSharp.Wearable } } + /// + /// Sets or gets the sub text of a more option object. + /// public string SubText { set @@ -75,6 +90,9 @@ namespace ElmSharp.Wearable } } + /// + /// Sets or gets the icon image + /// public Image Icon { set diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionItemEventArgs.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionItemEventArgs.cs index 7bc9723..c1781e4 100644 --- a/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionItemEventArgs.cs +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionItemEventArgs.cs @@ -3,8 +3,15 @@ using System; namespace ElmSharp.Wearable { + /// + /// The MoreOptionItemEventArgs is a event args class for MoreOptionItem. + /// Inherits EventArgs + /// public class MoreOptionItemEventArgs : EventArgs { + /// + /// Sets or gets the more option item + /// public MoreOptionItem Item { get; set; } } } diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionList.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionList.cs index 577bc8e..95510d0 100644 --- a/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionList.cs +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionList.cs @@ -11,10 +11,21 @@ namespace ElmSharp.Wearable List Items { get; set; } + /// + /// Sets or gets the count of Items + /// public int Count => Items.Count; + /// + /// Sets or gets whether it is read only + /// public bool IsReadOnly => false; + /// + /// Sets or gets the item with the index + /// + /// the position of item in items + /// public MoreOptionItem this[int index] { get @@ -28,34 +39,60 @@ namespace ElmSharp.Wearable } } + /// + /// Creates and initializes a new instance of MoreOptionList class. + /// + /// the object of more option public MoreOptionList(MoreOption owner) { Owner = owner; Items = new List(); } + /// + /// Append a new item to a more option. + /// + /// The more option item public void Add(MoreOptionItem item) { item.Handle = Interop.Eext.eext_more_option_item_append(Owner); Items.Add(item); } + /// + /// add a new item to a more option at the first. + /// + /// The more option item public void AddFirst(MoreOptionItem item) { item.Handle = Interop.Eext.eext_more_option_item_prepend(Owner); Items.Insert(0, item); } + /// + /// add a new item to a more option at the last. + /// + /// The more option item public void AddLast(MoreOptionItem item) { Add(item); } + /// + /// Get the index of item + /// + /// The more option item + /// the index of item public int IndexOf(MoreOptionItem item) { return Items.IndexOf(item); } + /// + /// Insert a new item into the more option after more option item with the index. + /// + /// the index of item which is insert after + /// The more option item public void Insert(int index, MoreOptionItem item) { if (Items.Count < index + 1 || index < 0) @@ -66,6 +103,10 @@ namespace ElmSharp.Wearable Items.Insert(index, item); } + /// + /// Delete an item which is the given item index + /// + /// the item index which will be deleted public void RemoveAt(int index) { if (Items.Count < index + 1 || index < 0) @@ -77,6 +118,9 @@ namespace ElmSharp.Wearable Items.RemoveAt(index); } + /// + /// Remove all items from a given more option list object. + /// public void Clear() { Interop.Eext.eext_more_option_items_clear(Owner); @@ -87,16 +131,31 @@ namespace ElmSharp.Wearable Items.Clear(); } + /// + /// Check the item whether is contained + /// + /// The more option item + /// If contain return true, otherwise false public bool Contains(MoreOptionItem item) { return Items.Contains(item); } + /// + /// Copy Items + /// + /// the target array + /// which index the item will copy to public void CopyTo(MoreOptionItem[] array, int arrayIndex) { Items.CopyTo(array, arrayIndex); } + /// + /// Remove a item + /// + /// the item will be removed + /// if remove success return true, otherwise false public bool Remove(MoreOptionItem item) { if (Items.Contains(item)) @@ -108,6 +167,10 @@ namespace ElmSharp.Wearable return false; } + /// + /// Return an enumerator that iterates through IEnumerator + /// + /// public IEnumerator GetEnumerator() { return Items.GetEnumerator(); diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/PointerEventArgs.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/PointerEventArgs.cs index d746824..e0bf3c7 100644 --- a/src/ElmSharp.Wearable/ElmSharp.Wearable/PointerEventArgs.cs +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/PointerEventArgs.cs @@ -1,3 +1,19 @@ +/* + * 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.Collections.Generic; using System.Text; diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelector.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelector.cs index eb0181c..48a2c80 100644 --- a/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelector.cs +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelector.cs @@ -1,3 +1,19 @@ +/* + * 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.Collections.Generic; using System.Linq; @@ -5,6 +21,11 @@ using System.Text; namespace ElmSharp.Wearable { + /// + /// The Rotary Selector is a widget to display a selector and multiple items surrounding the selector. + /// And an item can be selected by rotary event or user item click. + /// Inherits . + /// public class RotarySelector : Layout { const string IconPartName = "selector,icon"; @@ -14,15 +35,29 @@ namespace ElmSharp.Wearable const string ItemSelectedEventName = "item,selected"; const string ItemClickedEventName = "item,clicked"; + /// + /// Selected will be triggered when selected an item. + /// public event EventHandler Selected; + + /// + /// Clicked will be triggered when selecting again the alredy selected item or selecting a selector. + /// public event EventHandler Clicked; SmartEvent _selectedEvent; SmartEvent _clickedEvent; Image _normalBgImage; + /// + /// Gets the rotary selector item list of a rotary selector object. + /// public IList Items { get; private set; } + /// + /// Creates and initializes a new instance of the Rotary Selector class. + /// + /// The parent of new Rotary Selector instance public RotarySelector(EvasObject parent) : base(parent) { Items = new RotarySelectorList(this); @@ -42,6 +77,9 @@ namespace ElmSharp.Wearable }; } + /// + /// Sets or gets the selected item of a rotary selector object. + /// public RotarySelectorItem SelectedItem { get @@ -77,6 +115,9 @@ namespace ElmSharp.Wearable } } + /// + /// Sets or gets the background image of a rotary selector object. + /// public Image BackgroundImage { set => setPart(ref _normalBgImage, BgPartName, State.Normal, value); get => _normalBgImage; } protected override IntPtr CreateHandle(EvasObject parent) diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorItem.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorItem.cs index d6abba8..38e46cb 100644 --- a/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorItem.cs +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorItem.cs @@ -1,9 +1,28 @@ +/* + * 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.Collections.Generic; using System.Text; namespace ElmSharp.Wearable { + /// + /// A instance to the Rotary Selector Item added. And an item can be selected by rotary event or user item click. + /// public class RotarySelectorItem { const string MainTextPartName = "selector,main_text"; @@ -37,6 +56,9 @@ namespace ElmSharp.Wearable IntPtr _handle; + /// + /// Sets or gets the handle of a rotary selector item object. + /// public IntPtr Handle { set @@ -128,28 +150,89 @@ namespace ElmSharp.Wearable } } + /// + /// Sets or gets the main text of a rotary selector item object. + /// public string MainText { set => setPart(ref _mainText, MainTextPartName, value); get => _mainText; } + + /// + /// Sets or gets the sub text of a rotary selector item object. + /// public string SubText { set => setPart(ref _subText, SubTextPartName, value); get => _subText; } + /// + /// Sets or gets the sub text color of a rotary selector item object. + /// public Color MainTextColor { set => setPart(ref _mainTextColor, MainTextPartName, ItemState.Normal, value); get => _mainTextColor; } - public Color SubextColor { set => setPart(ref _subTextColor, SubTextPartName, ItemState.Normal, value); get => _subTextColor; } + /// + /// Sets or gets the sub text color of a rotary selector item object. + /// + public Color SubTextColor { set => setPart(ref _subTextColor, SubTextPartName, ItemState.Normal, value); get => _subTextColor; } + + /// + /// Sets or gets the normal icon image of a rotary selector item object. + /// public Image NormalIconImage { set => setPart(ref _normalIconImage, IconPartName, ItemState.Normal, value); get => _normalIconImage; } + + /// + /// Sets or gets the press icon image of a rotary selector item object. + /// public Image PressedIconImage { set => setPart(ref _pressedIconImage, IconPartName, ItemState.Pressed, value); get => _pressedIconImage; } + + /// + /// Sets or gets the disable icon image of a rotary selector item object. + /// public Image DisabledIconImage { set => setPart(ref _disabledIconImage, IconPartName, ItemState.Disabled, value); get => _disabledIconImage; } - public Image SelectedIconImage { set => setPart(ref _selectedIconImage, IconPartName, ItemState.Selected, value); get => _selectedIconImage; } + /// + /// Sets or gets the selected icon image of a rotary selector item object. + /// + public Image SelectedIconImage { set => setPart(ref _selectedIconImage, IconPartName, ItemState.Selected, value); get => _selectedIconImage; } + /// + /// Sets or gets the normal background image of a rotary selector item object. + /// public Image NormalBackgroundImage { set => setPart(ref _normalBgImage, BgPartName, ItemState.Normal, value); get => _normalBgImage; } + + /// + /// Sets or gets the pressed background image of a rotary selector item object. + /// public Image PressedBackgroundImage { set => setPart(ref _pressedBgImage, BgPartName, ItemState.Pressed, value); get => _pressedBgImage; } + + /// + /// Sets or gets the disabled background image of a rotary selector item object. + /// public Image DisabledBackgroundImage { set => setPart(ref _disabledBgImage, BgPartName, ItemState.Disabled, value); get => _disabledBgImage; } + + /// + /// Sets or gets the selected background image of a rotary selector item object. + /// public Image SelectedBackgroundImage { set => setPart(ref _selectedBgImage, BgPartName, ItemState.Selected, value); get => _selectedBgImage; } + /// + /// Sets or gets the normal background color of a rotary selector item object. + /// public Color NormalBackgroundColor { set => setPart(ref _normalBgColor, BgPartName, ItemState.Normal, value); get => _normalBgColor; } + + /// + /// Sets or gets the pressed background color of a rotary selector item object. + /// public Color PressedBackgroundColor { set => setPart(ref _pressedBgColor, BgPartName, ItemState.Pressed, value); get => _pressedBgColor; } + + /// + /// Sets or gets the disabled background color of a rotary selector item object. + /// public Color DisabledBackgroundColor { set => setPart(ref _disabledBgColor, BgPartName, ItemState.Disabled, value); get => _disabledBgColor; } + + /// + /// Sets or gets the selected background color of a rotary selector item object. + /// public Color SelectedBackgroundColor { set => setPart(ref _selectedBgColor, BgPartName, ItemState.Selected, value); get => _selectedBgColor; } + /// + /// Sets or gets the selector icon image of a rotary selector item object. + /// public Image SelectorIconImage { set => setPart(ref _selectorIconImage, SelectorIconPartName, ItemState.Normal, value); get => _selectorIconImage; } internal enum ItemState diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorItemEventArgs.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorItemEventArgs.cs index 401be2f..b6494d1 100644 --- a/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorItemEventArgs.cs +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorItemEventArgs.cs @@ -1,9 +1,29 @@ +/* + * 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.Collections.Generic; using System.Text; namespace ElmSharp.Wearable { + /// + /// and events of RotarySelector contain RotarySelectorItemEventArgs as a parameter. + /// Inherits . + /// public class RotarySelectorItemEventArgs : EventArgs { public RotarySelectorItem Item { get; set; } diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorList.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorList.cs index 2f73984..39866b8 100644 --- a/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorList.cs +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorList.cs @@ -1,3 +1,19 @@ +/* + * 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.Collections; using System.Collections.Generic; diff --git a/src/ElmSharp/ElmSharp/AnimatorMotionMapper.cs b/src/ElmSharp/ElmSharp/AnimatorMotionMapper.cs new file mode 100644 index 0000000..defc7af --- /dev/null +++ b/src/ElmSharp/ElmSharp/AnimatorMotionMapper.cs @@ -0,0 +1,119 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ElmSharp +{ + public interface AnimatorMotionMapper + { + double Caculate(double position); + } + + public class LinearMotionMapper : AnimatorMotionMapper + { + public double Caculate(double position) + { + return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Linear, 0, 0); + } + } + + public class AccelerateMotionMapper : AnimatorMotionMapper + { + public double Caculate(double position) + { + return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Accelerate, 0, 0); + } + } + + public class DecelerateMotionMapper : AnimatorMotionMapper + { + public double Caculate(double position) + { + return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Decelerate, 0, 0); + } + } + + public class SinusoidalMotionMapper : AnimatorMotionMapper + { + public double Caculate(double position) + { + return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Sinusoidal, 0, 0); + } + } + + public class AccelerateFactorMotionMapper : AnimatorMotionMapper + { + public double PowerFactor { get; set; } = 0; + + public double Caculate(double position) + { + return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.AccelerateFactor, PowerFactor, 0); + } + } + + public class DecelerateFactorMotionMapper : AnimatorMotionMapper + { + public double PowerFactor { get; set; } = 0; + + public double Caculate(double position) + { + return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.DecelerateFactor, PowerFactor, 0); + } + } + + public class SinusoidalFactorMotionMapper : AnimatorMotionMapper + { + public double PowerFactor { get; set; } = 0; + + public double Caculate(double position) + { + return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.SinusoidalFactor, PowerFactor, 0); + } + } + + public class DivisorInterpolatedMotionMapper : AnimatorMotionMapper + { + public double Divisor { get; set; } = 0; + public double Power { get; set; } = 0; + + public double Caculate(double position) + { + return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.DivisorInterp, Divisor, Power); + } + } + + public class BounceMotionMapper : AnimatorMotionMapper + { + public int Bounces { get; set; } = 0; + public double DecayFactor { get; set; } = 0; + public double Caculate(double position) + { + return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Bounce, DecayFactor, Bounces); + } + } + + public class SpringMotionMapper : AnimatorMotionMapper + { + public int Wobbles { get; set; } = 0; + public double DecayFactor { get; set; } = 0; + + public double Caculate(double position) + { + return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Bounce, DecayFactor, Wobbles); + } + } + + public class CubicBezierMotionMapper : AnimatorMotionMapper + { + public double X1 { get; set; } = 0; + public double Y1 { get; set; } = 0; + public double X2 { get; set; } = 0; + public double Y2 { get; set; } = 0; + + public double Caculate(double position) + { + double[] values = { X1, Y1, X2, Y2 }; + return Interop.Ecore.ecore_animator_pos_map_n(position, Interop.Ecore.PositionMap.Bounce, values.Length, values); + } + } +} diff --git a/src/ElmSharp/ElmSharp/Calendar.cs b/src/ElmSharp/ElmSharp/Calendar.cs index ef87281..01a6c76 100755 --- a/src/ElmSharp/ElmSharp/Calendar.cs +++ b/src/ElmSharp/ElmSharp/Calendar.cs @@ -387,8 +387,6 @@ namespace ElmSharp /// /// Gets or sets date format the string that will be used to display month and year. - /// By default it uses strftime with "%B %Y" format string. - /// It should allocate the memory that will be used by the string, that will be freed by the widget after usage.A pointer to the string and a pointer to the time struct will be provided. /// public DateFormatDelegate DateFormat { diff --git a/src/ElmSharp/ElmSharp/EcoreTimelineAnimator.cs b/src/ElmSharp/ElmSharp/EcoreTimelineAnimator.cs new file mode 100644 index 0000000..8bc0a39 --- /dev/null +++ b/src/ElmSharp/ElmSharp/EcoreTimelineAnimator.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ElmSharp +{ + public class EcoreTimelineAnimator + { + double _runtime; + IntPtr _animator; + Action _timelineCallback; + Interop.Ecore.EcoreTimelineCallback _nativeCallback; + double _position; + + public event EventHandler Finished; + + + public EcoreTimelineAnimator(double runtime, Action timelineCallback) + { + _runtime = runtime; + _nativeCallback = NativeCallback; + _timelineCallback = timelineCallback; + _position = 0; + } + + public bool IsRunning { get; private set; } + public double Position => _position; + + public void Start() + { + IsRunning = true; + _animator = Interop.Ecore.ecore_animator_timeline_add(_runtime, _nativeCallback, IntPtr.Zero); + } + + public void Stop() + { + IsRunning = false; + _animator = IntPtr.Zero; + } + + public void Freeze() + { + Interop.Ecore.ecore_animator_freeze(_animator); + } + + public void Thaw() + { + Interop.Ecore.ecore_animator_thaw(_animator); + } + + protected void OnTimeline() + { + _timelineCallback(); + } + + bool NativeCallback(IntPtr data, double pos) + { + _position = pos; + if (!IsRunning) return false; + OnTimeline(); + if (pos == 1.0) + { + IsRunning = false; + _animator = IntPtr.Zero; + Finished?.Invoke(this, EventArgs.Empty); + } + return true; + } + } +} diff --git a/src/ElmSharp/ElmSharp/Panes.cs b/src/ElmSharp/ElmSharp/Panes.cs index d99b5b6..4871d68 100755 --- a/src/ElmSharp/ElmSharp/Panes.cs +++ b/src/ElmSharp/ElmSharp/Panes.cs @@ -94,8 +94,9 @@ namespace ElmSharp /// Sets or gets the orientation of a given Panes widget. /// /// - /// Uses this function to change how your panes are to be disposed: vertically or horizontally. - /// By default it's displayed horizontally. + /// Use this function to change how your panes is to be disposed: vertically or horizontally. + /// Horizontal panes have "top" and "bottom" contents, vertical panes have "left" and "right" contents. + /// By default panes is in a vertical mode. /// public bool IsHorizontal { diff --git a/src/ElmSharp/Interop/Interop.Ecore.cs b/src/ElmSharp/Interop/Interop.Ecore.cs index 99b9ee1..10e72d3 100644 --- a/src/ElmSharp/Interop/Interop.Ecore.cs +++ b/src/ElmSharp/Interop/Interop.Ecore.cs @@ -21,9 +21,25 @@ internal static partial class Interop { internal static partial class Ecore { + internal enum PositionMap + { + Linear, + Accelerate, + Decelerate, + Sinusoidal, + AccelerateFactor, + DecelerateFactor, + SinusoidalFactor, + DivisorInterp, + Bounce, + Spring, + CubicBezier + } + internal delegate void EcoreCallback(IntPtr data); internal delegate bool EcoreTaskCallback(IntPtr data); internal delegate void EcoreEventCallback(IntPtr data, int type, IntPtr evt); + internal delegate bool EcoreTimelineCallback(IntPtr data, double pos); [DllImport(Libraries.Ecore)] internal static extern int ecore_init(); @@ -72,5 +88,26 @@ internal static partial class Interop [DllImport(Libraries.Ecore)] internal static extern IntPtr ecore_event_handler_del(IntPtr handler); + + [DllImport(Libraries.Ecore)] + internal static extern IntPtr ecore_animator_timeline_add(double runtime, EcoreTimelineCallback func, IntPtr data); + + [DllImport(Libraries.Ecore)] + internal static extern void ecore_animator_freeze(IntPtr animator); + + [DllImport(Libraries.Ecore)] + internal static extern void ecore_animator_thaw(IntPtr animator); + + [DllImport(Libraries.Ecore)] + internal static extern void ecore_animator_frametime_set(double frametime); + + [DllImport(Libraries.Ecore)] + internal static extern void ecore_animator_frametime_get(); + + [DllImport(Libraries.Ecore)] + internal static extern double ecore_animator_pos_map(double pos, PositionMap map, double v1, double v2); + + [DllImport(Libraries.Ecore)] + internal static extern double ecore_animator_pos_map_n(double pos, PositionMap map, int v_size, double[] v); } } diff --git a/src/ElmSharp/Interop/Interop.Elementary.DateTimePicker.cs b/src/ElmSharp/Interop/Interop.Elementary.DateTimePicker.cs index e65b9ef..a8bf333 100644 --- a/src/ElmSharp/Interop/Interop.Elementary.DateTimePicker.cs +++ b/src/ElmSharp/Interop/Interop.Elementary.DateTimePicker.cs @@ -33,7 +33,7 @@ internal static partial class Interop [DllImport(Libraries.Elementary)] internal static extern bool elm_datetime_format_set(IntPtr obj, string format); - [DllImport(Libraries.Elementary)] + [DllImport(Libraries.Elementary, EntryPoint = "elm_datetime_format_get")] internal static extern IntPtr _elm_datetime_format_get(IntPtr obj); internal static string elm_datetime_format_get(IntPtr obj) diff --git a/src/ElmSharp/Interop/Interop.Elementary.ProgressBar.cs b/src/ElmSharp/Interop/Interop.Elementary.ProgressBar.cs index 259b53f..4e35680 100644 --- a/src/ElmSharp/Interop/Interop.Elementary.ProgressBar.cs +++ b/src/ElmSharp/Interop/Interop.Elementary.ProgressBar.cs @@ -66,7 +66,7 @@ internal static partial class Interop [DllImport(Libraries.Elementary)] internal static extern void elm_progressbar_unit_format_set(IntPtr obj, string format); - [DllImport(Libraries.Elementary)] + [DllImport(Libraries.Elementary, EntryPoint = "elm_progressbar_unit_format_get")] internal static extern IntPtr _elm_progressbar_unit_format_get(IntPtr obj); internal static string elm_progressbar_unit_format_get(IntPtr obj) diff --git a/test/ElmSharp.Test/ElmSharp.Test.csproj b/test/ElmSharp.Test/ElmSharp.Test.csproj index 7de2ba7..580f5c5 100644 --- a/test/ElmSharp.Test/ElmSharp.Test.csproj +++ b/test/ElmSharp.Test/ElmSharp.Test.csproj @@ -1,296 +1,53 @@ - - + + + + + + $(MSBuildExtensionsPath)\Tizen\VisualStudio\ + + + + + + - Debug - AnyCPU - {2F98DAC9-6F16-457B-AED7-D43CAC379341};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - {E901BB06-632D-489E-86AC-66AD2EF85BCC} Exe - Properties - ElmSharp.Test - ElmSharp.Test - 512 + netcoreapp1.1 + + - .NETCoreApp - v1.0 - .NETCoreApp,Version=v1.0 - false - true - $(NoWarn);1701;1702 + true + $(PackageTargetFallback);portable-net45+wp80+win81+wpa81 + - true - full - true - bin\Debug\ - DEBUG;TRACE - prompt - 4 - true + portable - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - true + None + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - + + - - False - ..\ElmSharp\bin\Debug\netstandard1.3\ElmSharp.dll - + - - + + + - - - --> - - - - <_TargetFrameworkDirectories>$(MSBuildThisFileDirectory) - <_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory) - true - - - - - - - - - - - - + \ No newline at end of file diff --git a/test/ElmSharp.Test/ElmSharp.Test.project.json b/test/ElmSharp.Test/ElmSharp.Test.project.json deleted file mode 100755 index 4bd5e6c..0000000 --- a/test/ElmSharp.Test/ElmSharp.Test.project.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "dependencies": { - "Microsoft.NETCore.App": "1.0.0", - "Tizen.Applications.Common": "1.5.8", - "Tizen.Applications.UI": "1.5.8" - }, - "frameworks": { - "netcoreapp1.0": {} - }, - "runtimes": { - "win": {} - } -} \ No newline at end of file diff --git a/test/ElmSharp.Test/Properties/AssemblyInfo.cs b/test/ElmSharp.Test/Properties/AssemblyInfo.cs deleted file mode 100644 index fa3b23e..0000000 --- a/test/ElmSharp.Test/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ElmSharp.Test")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("ElmSharp.Test")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("2e1a161a-baa9-40ef-a8b4-082ce7c813b8")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/test/ElmSharp.Test/TC/EcoreTimelineAnimatorTest1.cs b/test/ElmSharp.Test/TC/EcoreTimelineAnimatorTest1.cs new file mode 100644 index 0000000..e112cbb --- /dev/null +++ b/test/ElmSharp.Test/TC/EcoreTimelineAnimatorTest1.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.Text; +using ElmSharp; + +namespace ElmSharp.Test +{ + class EcoreTimelineAnimatorTest1 : TestCaseBase + + { + public override string TestName => "Timeline Animator Test1"; + + public override string TestDescription => "Ecore Timeline Animator Test1"; + + EcoreTimelineAnimator timelineAnimator; + + int X1, Y1, X2, Y2; + + Tuple[] mappers = + { + new Tuple("Linear", new LinearMotionMapper()), + new Tuple("Accelerate", new AccelerateMotionMapper()), + new Tuple("Decelerate", new DecelerateMotionMapper()), + new Tuple("Sinusoida", new SinusoidalMotionMapper()), + new Tuple("Bounce", new BounceMotionMapper{ Bounces = 3, DecayFactor = 1.8 }), + new Tuple("Spring", new SpringMotionMapper{ Wobbles = 3, DecayFactor = 1.8 }), + new Tuple("AccelerateFactor", new AccelerateFactorMotionMapper{ PowerFactor = 1.5 }), + new Tuple("DecelerateFactor", new DecelerateFactorMotionMapper{ PowerFactor = 1.5 }), + new Tuple("SinusoidaFactor", new SinusoidalFactorMotionMapper{ PowerFactor = 1.5 }), + new Tuple("DivisorInterpolate", new DivisorInterpolatedMotionMapper{ Divisor = 1.0, Power = 2.0 }), + new Tuple("CubicBezier", new CubicBezierMotionMapper{ X1 = 0, X2 = 1, Y1 = 0, Y2 = 1}) + }; + + int map_index = 0; + + Rectangle square; + + public override void Run(Window window) + { + Rect rect = new Rect(0, 0, window.ScreenSize.Width, window.ScreenSize.Height); + + X1 = rect.X; + Y1 = rect.Y; + X2 = rect.X + rect.Width - rect.Width / 10; + Y2 = rect.Y; + + square = new Rectangle(window) + { + Geometry = new Rect(X1, Y1, rect.Width / 10, rect.Height / 6), + Color = Color.Red + }; + square.Show(); + + Button btn = new Button(window) + { + Geometry = new Rect(rect.X, rect.Y + rect.Height - rect.Height / 4, rect.Width, rect.Height / 4), + Text = mappers[map_index].Item1 + }; + btn.Show(); + + timelineAnimator = new EcoreTimelineAnimator(1.0, OnTimeline); + + btn.Clicked += Btn_Clicked; + timelineAnimator.Finished += (s, e) => + { + map_index = (map_index + 1) % mappers.Length; + btn.IsEnabled = true; + }; + } + + private void Btn_Clicked(object sender, EventArgs e) + { + timelineAnimator.Start(); + ((Button)sender).IsEnabled = false; + Log.Debug(mappers[map_index].Item1); + } + + void OnTimeline() + { + double o = mappers[map_index].Item2.Caculate(timelineAnimator.Position); + int x = (int)((X2 * o) + (X1 * (1.0 - o))); + int y = (int)((Y2 * o) + (Y1 * (1.0 - o))); + + square.Move(x, y); + } + } +} diff --git a/test/ElmSharp.Test/TC/GenListTest11.cs b/test/ElmSharp.Test/TC/GenListTest11.cs new file mode 100755 index 0000000..731a9fc --- /dev/null +++ b/test/ElmSharp.Test/TC/GenListTest11.cs @@ -0,0 +1,115 @@ +/* + * 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 +{ + class GenListTest11 : TestCaseBase + { + public override string TestName => "GenListTest11"; + public override string TestDescription => "To test InsertSorted operation of GenList"; + + public int myCompare(object t1, object t2) + { + int c1 = Convert.ToInt32((string)t1); + int c2 = Convert.ToInt32((string)t2); + + return c1 - c2; + } + + public override void Run(Window window) + { + Conformant conformant = new Conformant(window); + conformant.Show(); + Box box = new Box(window) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + }; + box.Show(); + conformant.SetContent(box); + + GenList list = new GenList(window) + { + Homogeneous = true, + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1 + }; + + GenItemClass defaultClass = new GenItemClass("default") + { + GetTextHandler = (obj, part) => + { + return string.Format("{0} - {1}", (string)obj, part); + } + }; + + List items = new List(); + int idx = 20; + for (int t = 1; t < 10; t++) + { + items.Add(list.InsertSorted(defaultClass, idx.ToString(), myCompare, GenListItemType.Normal, null)); + idx--; + } + list.Show(); + list.ItemSelected += List_ItemSelected; + + box.PackEnd(list); + Button first = new Button(window) + { + Text = "Check first and last item", + AlignmentX = -1, + WeightX = 1, + }; + + Button Add = new Button(window) + { + Text = "Add", + AlignmentX = -1, + WeightX = 1, + }; + Add.Clicked += (s, e) => + { + items.Add(list.InsertSorted(defaultClass, idx.ToString(), myCompare, GenListItemType.Normal, null)); + idx--; + }; + + first.Clicked += (s, e) => + { + Console.WriteLine("Last Item's Data : " + list.LastItem.Data); + Console.WriteLine("First date of Items " + items[0].Data); + Console.WriteLine("Result for comparinson " + (bool)(list.LastItem == list.LastItem)); + }; + + first.Show(); + Add.Show(); + box.PackEnd(first); + box.PackEnd(Add); + } + + private void List_ItemSelected(object sender, GenListItemEventArgs e) + { + Console.WriteLine("{0} Item was selected", (string)(e.Item.Data)); + } + } +} diff --git a/test/ElmSharp.Test/TC/ImageTest1.cs b/test/ElmSharp.Test/TC/ImageTest1.cs index 0a6793d..d013a4c 100644 --- a/test/ElmSharp.Test/TC/ImageTest1.cs +++ b/test/ElmSharp.Test/TC/ImageTest1.cs @@ -169,16 +169,24 @@ namespace ElmSharp.Test Console.WriteLine("Image has been clicked. (IsFixedAspect = {0}", image.IsFixedAspect); image.IsFixedAspect = image.IsFixedAspect == true ? false : true; }; + image.LoadingCompleted += (s, e) => + { + Console.WriteLine("Image has been loaded successfully."); + }; + image.LoadingFailed += (s, e) => + { + Console.WriteLine("Image loading has been failed."); + }; btnFile1.Clicked += (s, e) => LoadFile("TED/large/a.jpg"); btnFile2.Clicked += (s, e) => LoadFile("TED/large/b.jpg"); btnUri1.Clicked += (s, e) => LoadUri("http://pe.tedcdn.com/images/ted/2e306b9655267cee35e45688ace775590b820510_615x461.jpg"); - btnStream1.Clicked += (s, e) => LoadStream(new FileStream(Path.Combine(TestRunner.ResourceDir, "TED/large/c.jpg"), FileMode.Open)); + btnStream1.Clicked += (s, e) => LoadStream(new FileStream(Path.Combine(TestRunner.ResourceDir, "TED/large/c.jpg"), FileMode.Open, FileAccess.Read)); btnFileAsync1.Clicked += (s, e) => LoadFileAsync("TED/large/d.jpg"); btnFileAsync2.Clicked += (s, e) => LoadFileAsync("TED/large/e.jpg"); btnUriAsync1.Clicked += (s, e) => LoadUriAsync("http://pe.tedcdn.com/images/ted/2e306b9655267cee35e45688ace775590b820510_615x461.jpg"); - btnStreamAsync1.Clicked += (s, e) => LoadStreamAsync(new FileStream(Path.Combine(TestRunner.ResourceDir, "TED/large/f.jpg"), FileMode.Open)); + btnStreamAsync1.Clicked += (s, e) => LoadStreamAsync(new FileStream(Path.Combine(TestRunner.ResourceDir, "TED/large/f.jpg"), FileMode.Open, FileAccess.Read)); box.PackEnd(buttonBox1); box.PackEnd(buttonBox2); box.PackEnd(lbInfo); diff --git a/test/ElmSharp.Test/TC/ScrollerTest4.cs b/test/ElmSharp.Test/TC/ScrollerTest4.cs new file mode 100644 index 0000000..235594c --- /dev/null +++ b/test/ElmSharp.Test/TC/ScrollerTest4.cs @@ -0,0 +1,148 @@ +/* + * 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 +{ + public class ScrollerTest4 : TestCaseBase + { + public override string TestName => "ScrollerTest4"; + public override string TestDescription => "To test basic operation of Scroller"; + + public override void Run(Window window) + { + //Conformant conformant = new Conformant(window); + //conformant.Show(); + Box outterBox = new Box(window) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + IsHorizontal = false, + }; + outterBox.Show(); + + var button = new Button(window) + { + Text = "Button1", + Color = Color.White, + }; + button.Show(); + button.Resize(200, 100); + button.Move(300, 100); + + var button2 = new Button(window) + { + Text = "Button2", + Color = Color.White, + }; + button2.Show(); + button2.Resize(200, 100); + button2.Move(300, 300); + + var button3 = new Button(window) + { + Text = "Button3", + Color = Color.White, + }; + button3.Show(); + button3.Resize(200, 100); + button3.Move(300, 500); + + Scroller scroller = new Scroller(window); + scroller.Show(); + scroller.Resize(200, 400); + scroller.Move(100, 600); + + Box box = new Box(window) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1 + }; + box.Show(); + scroller.SetContent(box); + + var rnd = new Random(); + for (int i = 0; i < 20; i++) + { + int r = rnd.Next(255); + int g = rnd.Next(255); + int b = rnd.Next(255); + Color color = Color.FromRgb(r, g, b); + var colorBox1 = new Label(window) + { + Text = "Label" + i.ToString(), + BackgroundColor = color, + MinimumHeight = 40, + }; + colorBox1.Show(); + box.PackEnd(colorBox1); + } + + Scroller scroller2 = new Scroller(window); + scroller2.Show(); + scroller2.Resize(200, 400); + scroller2.Move(700, 600); + + Box box2 = new Box(window) + { + MinimumWidth = 400, + MinimumHeight = 200, + }; + box2.BackgroundColor = Color.White; + box2.Show(); + scroller2.SetContent(box2); + + rnd = new Random(); + for (int i = 0; i < 20; i++) + { + int r = rnd.Next(255); + int g = rnd.Next(255); + int b = rnd.Next(255); + Color color = Color.FromRgb(r, g, b); + var colorBox2 = new Label(scroller2) + { + BackgroundColor = color, + MinimumHeight = 40, + Text = "GOGOGO" + }; + colorBox2.Show(); + box2.PackEnd(colorBox2); + } + + //conformant.SetContent(outterBox); + //outterBox.PackEnd(button); + //outterBox.PackEnd(button2); + //outterBox.PackEnd(button3); + //outterBox.PackEnd(scroller); + //outterBox.PackEnd(scroller2); + + //outterBox.SetLayoutCallback(() => + //{ + // scroller.Move(100, 800); + // button.Move(300, 100); + // button2.Move(300, 300); + // button3.Move(300, 500); + // scroller2.Move(700, 800); + //}); + } + } +} \ No newline at end of file diff --git a/test/ElmSharp.Test/TC/Wearable/EcoreTimelineAnimatorTest1.cs b/test/ElmSharp.Test/TC/Wearable/EcoreTimelineAnimatorTest1.cs new file mode 100644 index 0000000..16e023f --- /dev/null +++ b/test/ElmSharp.Test/TC/Wearable/EcoreTimelineAnimatorTest1.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.Text; +using ElmSharp; + +namespace ElmSharp.Test.Wearable +{ + class EcoreTimelineAnimatorTest1 : WearableTestCase + + { + public override string TestName => "Timeline Animator Test1"; + + public override string TestDescription => "Ecore Timeline Animator Test1"; + + EcoreTimelineAnimator timelineAnimator; + + int X1, Y1, X2, Y2; + + Tuple[] mappers = + { + new Tuple("Linear", new LinearMotionMapper()), + new Tuple("Accelerate", new AccelerateMotionMapper()), + new Tuple("Decelerate", new DecelerateMotionMapper()), + new Tuple("Sinusoida", new SinusoidalMotionMapper()), + new Tuple("Bounce", new BounceMotionMapper{ Bounces = 3, DecayFactor = 1.8 }), + new Tuple("Spring", new SpringMotionMapper{ Wobbles = 3, DecayFactor = 1.8 }), + new Tuple("AccelerateFactor", new AccelerateFactorMotionMapper{ PowerFactor = 1.5 }), + new Tuple("DecelerateFactor", new DecelerateFactorMotionMapper{ PowerFactor = 1.5 }), + new Tuple("SinusoidaFactor", new SinusoidalFactorMotionMapper{ PowerFactor = 1.5 }), + new Tuple("DivisorInterpolate", new DivisorInterpolatedMotionMapper{ Divisor = 1.0, Power = 2.0 }), + new Tuple("CubicBezier", new CubicBezierMotionMapper{ X1 = 0, X2 = 1, Y1 = 0, Y2 = 1}) + }; + + int map_index = 0; + + Rectangle square; + + public override void Run(Window window) + { + Rect rect = window.GetInnerSquare(); + + X1 = rect.X; + Y1 = rect.Y; + X2 = rect.X + rect.Width - rect.Width / 10; + Y2 = rect.Y; + + square = new Rectangle(window) + { + Geometry = new Rect(X1, Y1, rect.Width / 10, rect.Height / 6), + Color = Color.Red + }; + square.Show(); + + Button btn = new Button(window) + { + Geometry = new Rect(rect.X, rect.Y + rect.Height - rect.Height / 4, rect.Width, rect.Height / 4), + Text = mappers[map_index].Item1 + }; + btn.Show(); + + timelineAnimator = new EcoreTimelineAnimator(1.0, OnTimeline); + + btn.Clicked += Btn_Clicked; + timelineAnimator.Finished += (s, e) => + { + map_index = (map_index + 1) % mappers.Length; + btn.IsEnabled = true; + }; + } + + private void Btn_Clicked(object sender, EventArgs e) + { + timelineAnimator.Start(); + ((Button)sender).IsEnabled = false; + Log.Debug(mappers[map_index].Item1); + } + + void OnTimeline() + { + double o = mappers[map_index].Item2.Caculate(timelineAnimator.Position); + int x = (int)((X2 * o) + (X1 * (1.0 - o))); + int y = (int)((Y2 * o) + (Y1 * (1.0 - o))); + + square.Move(x, y); + } + } +} diff --git a/test/ElmSharp.Test/TC/Wearable/ImageTest1.cs b/test/ElmSharp.Test/TC/Wearable/ImageTest1.cs old mode 100755 new mode 100644 index b7c7c5a..ddb003f --- a/test/ElmSharp.Test/TC/Wearable/ImageTest1.cs +++ b/test/ElmSharp.Test/TC/Wearable/ImageTest1.cs @@ -77,12 +77,12 @@ namespace ElmSharp.Test.Wearable btns[0].Clicked += (s, e) => LoadFile("TED/large/a.jpg"); btns[1].Clicked += (s, e) => LoadFile("TED/large/b.jpg"); btns[2].Clicked += (s, e) => LoadUri("http://pe.tedcdn.com/images/ted/2e306b9655267cee35e45688ace775590b820510_615x461.jpg"); - btns[3].Clicked += (s, e) => LoadStream(new FileStream(Path.Combine(TestRunner.ResourceDir, "TED/large/c.jpg"), FileMode.Open)); + btns[3].Clicked += (s, e) => LoadStream(new FileStream(Path.Combine(TestRunner.ResourceDir, "TED/large/c.jpg"), FileMode.Open, FileAccess.Read)); btns[4].Clicked += (s, e) => LoadFileAsync("TED/large/d.jpg"); btns[5].Clicked += (s, e) => LoadFileAsync("TED/large/e.jpg"); btns[6].Clicked += (s, e) => LoadUriAsync("http://pe.tedcdn.com/images/ted/2e306b9655267cee35e45688ace775590b820510_615x461.jpg"); - btns[7].Clicked += (s, e) => LoadStreamAsync(new FileStream(Path.Combine(TestRunner.ResourceDir, "TED/large/f.jpg"), FileMode.Open)); + btns[7].Clicked += (s, e) => LoadStreamAsync(new FileStream(Path.Combine(TestRunner.ResourceDir, "TED/large/f.jpg"), FileMode.Open, FileAccess.Read)); } void LoadFile(string file) diff --git a/test/ElmSharp.Test/tizen-manifest.xml b/test/ElmSharp.Test/tizen-manifest.xml index 5067a8f..d2eacea 100644 --- a/test/ElmSharp.Test/tizen-manifest.xml +++ b/test/ElmSharp.Test/tizen-manifest.xml @@ -1,13 +1,9 @@ - - - - ElmSharp.Test.png - - + + + + ElmSharp.Test.png + + + diff --git a/test/ElmSharp.Wearable.Test/ElmSharp.Wearable.Test.csproj b/test/ElmSharp.Wearable.Test/ElmSharp.Wearable.Test.csproj index 419f133..7686cc4 100644 --- a/test/ElmSharp.Wearable.Test/ElmSharp.Wearable.Test.csproj +++ b/test/ElmSharp.Wearable.Test/ElmSharp.Wearable.Test.csproj @@ -1,151 +1,54 @@ - - + + + + + + $(MSBuildExtensionsPath)\Tizen\VisualStudio\ + + + + + + - Debug - AnyCPU - {2F98DAC9-6F16-457B-AED7-D43CAC379341};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - {C6E111B7-21E2-4CD6-93BF-2CD5ED255749} Exe - Properties - ElmSharp.Wearable.Test - ElmSharp.Wearable.Test - 512 + netcoreapp1.1 + + - .NETCoreApp - v1.0 - .NETCoreApp,Version=v1.0 - false - true - $(NoWarn);1701;1702 + true + $(PackageTargetFallback);portable-net45+wp80+win81+wpa81 + - true - full - true - bin\Debug\ - DEBUG;TRACE - prompt - 4 - true + portable - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - true + None + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - {9a1c45ac-93e3-4b09-b896-769df60cf1b2} - ElmSharp.Wearable - - - {d00c29dd-4b2e-41c0-a323-bad1a74c69bf} - ElmSharp - + + - - + + + - - - --> - - - - <_TargetFrameworkDirectories>$(MSBuildThisFileDirectory) - <_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory) - true - - - - - - - - - - - - \ No newline at end of file + diff --git a/test/ElmSharp.Wearable.Test/ElmSharp.Wearable.Test.project.json b/test/ElmSharp.Wearable.Test/ElmSharp.Wearable.Test.project.json deleted file mode 100644 index 4bd5e6c..0000000 --- a/test/ElmSharp.Wearable.Test/ElmSharp.Wearable.Test.project.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "dependencies": { - "Microsoft.NETCore.App": "1.0.0", - "Tizen.Applications.Common": "1.5.8", - "Tizen.Applications.UI": "1.5.8" - }, - "frameworks": { - "netcoreapp1.0": {} - }, - "runtimes": { - "win": {} - } -} \ No newline at end of file diff --git a/test/ElmSharp.Wearable.Test/Properties/AssemblyInfo.cs b/test/ElmSharp.Wearable.Test/Properties/AssemblyInfo.cs deleted file mode 100644 index c419e2d..0000000 --- a/test/ElmSharp.Wearable.Test/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ElmSharp.Wearable.Test")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("ElmSharp.Wearable.Test")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("2e1a161a-baa9-40ef-a8b4-082ce7c813b8")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -- 2.7.4