diff options
author | SungHyun Min <shyun.min@samsung.com> | 2017-03-07 19:29:11 +0900 |
---|---|---|
committer | SungHyun Min <shyun.min@samsung.com> | 2017-03-14 18:43:49 +0900 |
commit | 12a9516763b6a535eca259b4c73e91a226ab47e6 (patch) | |
tree | 06ba399f5d7412d3c7f1fd015a13f966bf659f3e /ElmSharp.Test | |
parent | cc62896b904df628956431fe428dcd87de4cba57 (diff) | |
download | elm-sharp-12a9516763b6a535eca259b4c73e91a226ab47e6.tar.gz elm-sharp-12a9516763b6a535eca259b4c73e91a226ab47e6.tar.bz2 elm-sharp-12a9516763b6a535eca259b4c73e91a226ab47e6.zip |
Add MultiButtonEntry
Change-Id: Ifb5ae0a7e34fd9a09642f54307c6ed1d6b93cc05
Signed-off-by: SungHyun Min <shyun.min@samsung.com>
Diffstat (limited to 'ElmSharp.Test')
-rwxr-xr-x | ElmSharp.Test/ElmSharp.Test.csproj | 1 | ||||
-rw-r--r-- | ElmSharp.Test/TC/MultibuttonEntryTest1.cs | 119 |
2 files changed, 120 insertions, 0 deletions
diff --git a/ElmSharp.Test/ElmSharp.Test.csproj b/ElmSharp.Test/ElmSharp.Test.csproj index 74232bd..b71210f 100755 --- a/ElmSharp.Test/ElmSharp.Test.csproj +++ b/ElmSharp.Test/ElmSharp.Test.csproj @@ -43,6 +43,7 @@ <Compile Include="TC\BackgroundTest1.cs" /> <Compile Include="TC\BackgroundTest2.cs" /> <Compile Include="TC\BackgroundTest3.cs" /> + <Compile Include="TC\MultibuttonEntryTest1.cs" /> <Compile Include="TC\DateTimeSelectorTest2.cs" /> <Compile Include="TC\EntryTest2.cs" /> <Compile Include="TC\FlipSelectorTest.cs" /> diff --git a/ElmSharp.Test/TC/MultibuttonEntryTest1.cs b/ElmSharp.Test/TC/MultibuttonEntryTest1.cs new file mode 100644 index 0000000..b27f0d2 --- /dev/null +++ b/ElmSharp.Test/TC/MultibuttonEntryTest1.cs @@ -0,0 +1,119 @@ +/* + * 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 ElmSharp; + +namespace ElmSharp.Test +{ + class MultiButtonEntryTest1 : TestCaseBase + { + public override string TestName => "MultiButtonEntryTest1"; + public override string TestDescription => "To test basic operation of MultiButtonEntry"; + + public override void Run(Window window) + { + Background bg = new Background(window); + bg.Color = Color.White; + bg.Move(0, 0); + bg.Resize(window.ScreenSize.Width, window.ScreenSize.Height); + bg.Show(); + + MultiButtonEntry mbe = new MultiButtonEntry(window) + { + IsEditable = true, + IsExpanded = true, + Text = "To: " + }; + + var test = mbe.Append("test"); + mbe.Prepend("prepend"); + mbe.Append("append"); + mbe.InsertBefore(test, "insertBefore"); + mbe.InsertAfter(test, "insertAfter"); + + mbe.ItemSelected += (s, e) => + { + Console.WriteLine("item selected: " + e.Item.Label); + if (e.Item.Next != null) + Console.WriteLine("next item: " + e.Item.Next); + if (e.Item.Prev != null) + Console.WriteLine("next item: " + e.Item.Prev); + }; + + mbe.ItemClicked += (s, e) => + { + Console.WriteLine("item clicked: " + e.Item.Label); + }; + + mbe.ItemLongPressed += (s, e) => + { + Console.WriteLine("item longpressed: " + e.Item.Label); + }; + + mbe.ItemAdded += (s, e) => + { + Console.WriteLine("item added: " + e.Item.Label); + }; + + mbe.ItemDeleted += (s, e) => + { + Console.WriteLine("item deleted: " + e.Item.Label); + }; + + mbe.AppendFilter((label) => + { + if (label.Contains("a")) + { + Console.WriteLine("appended filter : Item has 'a', It won't be added until 'a' is removed."); + return false; + } + else + { + return true; + } + }); + + mbe.PrependFilter((label) => + { + if (label.Contains("p")) + { + Console.WriteLine("prepended filter : Item has 'p', It won't be added until 'p' is removed."); + return false; + } + else + { + return true; + } + }); + + Label label1 = new Label(window) + { + Text = "MultiButtonEntry Test", + Color = Color.Blue + }; + + label1.Resize(600, 100); + label1.Move(50, 50); + label1.Show(); + + mbe.Resize(600, 600); + mbe.Move(0, 100); + mbe.Show(); + } + } +}
\ No newline at end of file |