diff options
author | rina6350.you <rina6350.you@samsung.com> | 2017-07-20 14:03:55 +0900 |
---|---|---|
committer | rina6350.you <rina6350.you@samsung.com> | 2017-07-20 14:06:23 +0900 |
commit | 3a208c8f74f03fc44e1a3ec32dfe090d403bc56f (patch) | |
tree | 90a6e0899fa23c77cb3545af8d68b15e9c94bf70 | |
parent | 4a1a1691cddc63ee8002f68a86ca0ec0b80d2949 (diff) | |
download | elm-sharp-3a208c8f74f03fc44e1a3ec32dfe090d403bc56f.tar.gz elm-sharp-3a208c8f74f03fc44e1a3ec32dfe090d403bc56f.tar.bz2 elm-sharp-3a208c8f74f03fc44e1a3ec32dfe090d403bc56f.zip |
Add Scroller TC for checking ScrollTo operation
TASK=TCAPI-2587
Change-Id: I0ab8d7370e760da0aef0c07955171132f46a2451
-rwxr-xr-x[-rw-r--r--] | ElmSharp.Test/ElmSharp.Test.csproj | 3 | ||||
-rwxr-xr-x | ElmSharp.Test/TC/ScrollerTest3.cs | 122 |
2 files changed, 124 insertions, 1 deletions
diff --git a/ElmSharp.Test/ElmSharp.Test.csproj b/ElmSharp.Test/ElmSharp.Test.csproj index 05a0d80..9b21715 100644..100755 --- a/ElmSharp.Test/ElmSharp.Test.csproj +++ b/ElmSharp.Test/ElmSharp.Test.csproj @@ -49,6 +49,7 @@ <Compile Include="TC\BackgroundTest3.cs" /> <Compile Include="TC\GestureLayerTest1.cs" /> <Compile Include="TC\ProgressBarTest2.cs" /> + <Compile Include="TC\ScrollerTest3.cs" /> <Compile Include="TC\Wearable\CircleTool.cs" /> <Compile Include="TC\TransitTest.cs" /> <Compile Include="TC\EcoreTimerTest1.cs" /> @@ -231,4 +232,4 @@ </FlavorProperties> </VisualStudio> </ProjectExtensions> -</Project> +</Project>
\ No newline at end of file diff --git a/ElmSharp.Test/TC/ScrollerTest3.cs b/ElmSharp.Test/TC/ScrollerTest3.cs new file mode 100755 index 0000000..90d7015 --- /dev/null +++ b/ElmSharp.Test/TC/ScrollerTest3.cs @@ -0,0 +1,122 @@ +/* + * 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 ScrollerTest3 : TestCaseBase + { + public override string TestName => "ScrollerTest3"; + public override string TestDescription => "To test ScrollTo 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(); + Scroller scroller = new Scroller(window) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + ScrollBlock = ScrollBlock.Vertical, + HorizontalPageScrollLimit = 1, + }; + scroller.SetPageSize(1.0, 1.0); + scroller.Show(); + + Box box = new Box(window) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1 + }; + box.Show(); + scroller.SetContent(box); + + for (int i = 0; i < 30; i++) + { + Label addlabel = new Label(window) + { + Text = i + " Label Test", + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + }; + addlabel.Show(); + box.PackEnd(addlabel); + } + + conformant.SetContent(outterBox); + outterBox.PackEnd(scroller); + + Button prev = new Button(window) + { + AlignmentX = -1, + WeightX = 1, + Text = "Prev" + }; + Button next = new Button(window) + { + AlignmentX = -1, + WeightX = 1, + Text = "next" + }; + prev.Clicked += (s, e) => + { + Rect region = new Rect(0, 0, scroller.Geometry.Width, scroller.Geometry.Width); + Console.WriteLine("{0} {1}\n", scroller.Geometry.Width, scroller.Geometry.Width); + scroller.ScrollTo(region, true); + }; + next.Clicked += (s, e) => + { + Rect region = new Rect(0, scroller.Geometry.Height, scroller.Geometry.Width, scroller.Geometry.Height); + Console.WriteLine("{0} {1}\n", scroller.Geometry.Width, scroller.Geometry.Width); + scroller.ScrollTo(region, true); + }; + prev.Show(); + next.Show(); + outterBox.PackEnd(prev); + outterBox.PackEnd(next); + + scroller.DragStart += Scroller_DragStart; + scroller.DragStop += Scroller_DragStop; + } + + private void Scroller_DragStop(object sender, EventArgs e) + { + Console.WriteLine("Drag stop"); + } + + private void Scroller_DragStart(object sender, EventArgs e) + { + Console.WriteLine("Drag start"); + } + } +} |