diff options
author | Kangho Hur <kangho.hur@samsung.com> | 2017-02-10 18:17:51 +0900 |
---|---|---|
committer | Kangho Hur <kangho.hur@samsung.com> | 2017-02-10 18:18:50 +0900 |
commit | 9cf19f7c821f1e09cf9dbfec18218146e7fd576d (patch) | |
tree | 7274f8588f134c8dfe2843fe6848cd6f4e8b6c5e /ElmSharp.Test | |
parent | d9778bcb94fe87c5c197e1051ca9891c6256f1a7 (diff) | |
download | elm-sharp-9cf19f7c821f1e09cf9dbfec18218146e7fd576d.tar.gz elm-sharp-9cf19f7c821f1e09cf9dbfec18218146e7fd576d.tar.bz2 elm-sharp-9cf19f7c821f1e09cf9dbfec18218146e7fd576d.zip |
Add DateTimeSelectorTC2 and NaviframeTest3
Change-Id: I69489891f9330e02f0c17695c1576899247bc7f9
Diffstat (limited to 'ElmSharp.Test')
-rw-r--r-- | ElmSharp.Test/ElmSharp.Test.csproj | 2 | ||||
-rw-r--r-- | ElmSharp.Test/TC/DateTimeSelectorTest2.cs | 75 | ||||
-rw-r--r-- | ElmSharp.Test/TC/NaviframeTest3.cs | 178 |
3 files changed, 255 insertions, 0 deletions
diff --git a/ElmSharp.Test/ElmSharp.Test.csproj b/ElmSharp.Test/ElmSharp.Test.csproj index f5600af..78f3556 100644 --- a/ElmSharp.Test/ElmSharp.Test.csproj +++ b/ElmSharp.Test/ElmSharp.Test.csproj @@ -43,8 +43,10 @@ <Compile Include="TC\BackgroundTest1.cs" /> <Compile Include="TC\BackgroundTest2.cs" /> <Compile Include="TC\BackgroundTest3.cs" /> + <Compile Include="TC\DateTimeSelectorTest2.cs" /> <Compile Include="TC\EntryTest2.cs" /> <Compile Include="TC\GenListTest9.cs" /> + <Compile Include="TC\NaviframeTest3.cs" /> <Compile Include="TC\ScreenInformationTest.cs" /> <Compile Include="TC\BoxLayoutTest1.cs" /> <Compile Include="TC\BoxTest1.cs" /> diff --git a/ElmSharp.Test/TC/DateTimeSelectorTest2.cs b/ElmSharp.Test/TC/DateTimeSelectorTest2.cs new file mode 100644 index 0000000..aec7470 --- /dev/null +++ b/ElmSharp.Test/TC/DateTimeSelectorTest2.cs @@ -0,0 +1,75 @@ +/* + * 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 DateTimeSelectorTest2 : TestCaseBase + { + public override string TestName => "DateTimeSelectorTest2"; + public override string TestDescription => "To test basic operation of DateTimeSelector"; + + 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(); + + DateTimeSelector dateTime = new DateTimeSelector(window) + { + DateTime = DateTime.Today, + Style = "time_layout", + Format = "%I:%M %p" + }; + + Label label1 = new Label(window); + + Label label2 = new Label(window); + + Label label3 = new Label(window) { + Text = string.Format("Current DateTime={0}", dateTime.DateTime), + }; + + dateTime.DateTimeChanged += (object sender, DateChangedEventArgs e) => + { + label1.Text = string.Format("Old DateTime={0}", e.OldDate); + label2.Text = string.Format("New DateTime={0}", e.NewDate); + label3.Text = string.Format("Current DateTime={0}", dateTime.DateTime); + }; + + dateTime.Resize(600, 600); + dateTime.Move(0, 300); + dateTime.Show(); + + label1.Resize(600, 100); + label1.Move(0, 0); + label1.Show(); + + label2.Resize(600, 100); + label2.Move(0, 100); + label2.Show(); + + label3.Resize(600, 100); + label3.Move(0, 200); + label3.Show(); + } + } +} diff --git a/ElmSharp.Test/TC/NaviframeTest3.cs b/ElmSharp.Test/TC/NaviframeTest3.cs new file mode 100644 index 0000000..6c35376 --- /dev/null +++ b/ElmSharp.Test/TC/NaviframeTest3.cs @@ -0,0 +1,178 @@ +/* + * 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 +{ + public class NaviframeTest3 : TestCaseBase + { + public override string TestName => "NaviframeTest3"; + public override string TestDescription => "Naviframe test"; + + Naviframe _navi; + int _sequence = 0; + + public override void Run(Window window) + { + Conformant conformant = new Conformant(window); + conformant.Show(); + + Naviframe navi = new Naviframe(window) + { + PreserveContentOnPop = true, + DefaultBackButtonEnabled = true + }; + _navi = navi; + + navi.Popped += (s, e) => + { + Console.WriteLine("----- Naviframe was popped {0:x} ", (int)(IntPtr)e.Content); + }; + + 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) + { + Box box = new Box(parent); + box.Show(); + + Label label = new Label(parent) { + Text = string.Format("{0} Page", _sequence++), + WeightX = 1, + AlignmentX = -1, + }; + Button push = new Button(parent) { + Text = "Push", + WeightX = 1, + AlignmentX = -1, + }; + Button pop = new Button(parent) { + Text = "pop", + WeightX = 1, + AlignmentX = -1, + }; + Button insertBeforeTop = new Button(parent) { + Text = "insertBeforeTop", + WeightX = 1, + AlignmentX = -1, + }; + Button insertAfterTop = new Button(parent) { + Text = "insertAfterTop", + WeightX = 1, + AlignmentX = -1, + }; + + Button removeTop = new Button(parent) + { + Text = "removeTop", + WeightX = 1, + AlignmentX = -1, + }; + + Button barChange = new Button(parent) + { + Text = "TitleBarColor Change", + WeightX = 1, + AlignmentX = -1, + }; + + Button barColorDefault = new Button(parent) + { + Text = "TitleBarColor - Default", + WeightX = 1, + AlignmentX = -1, + }; + + 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; + } + }; + + box.PackEnd(label); + box.PackEnd(push); + box.PackEnd(pop); + box.PackEnd(insertBeforeTop); + box.PackEnd(insertAfterTop); + box.PackEnd(removeTop); + box.PackEnd(barChange); + box.PackEnd(barColorDefault); + + return box; + } + } +} |