From: rina6350.you Date: Thu, 20 Jul 2017 05:03:55 +0000 (+0900) Subject: Add Scroller TC for checking ScrollTo operation X-Git-Tag: submit/trunk/20170823.075128~110^2~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ff5b7c44dbf6471fc11ff72a6c45478af20350a1;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git Add Scroller TC for checking ScrollTo operation TASK=TCAPI-2587 Change-Id: I0ab8d7370e760da0aef0c07955171132f46a2451 --- diff --git a/test/ElmSharp.Test/ElmSharp.Test.csproj b/test/ElmSharp.Test/ElmSharp.Test.csproj old mode 100644 new mode 100755 index 05a0d80..9b21715 --- a/test/ElmSharp.Test/ElmSharp.Test.csproj +++ b/test/ElmSharp.Test/ElmSharp.Test.csproj @@ -49,6 +49,7 @@ + @@ -231,4 +232,4 @@ - + \ No newline at end of file diff --git a/test/ElmSharp.Test/TC/ScrollerTest3.cs b/test/ElmSharp.Test/TC/ScrollerTest3.cs new file mode 100755 index 0000000..90d7015 --- /dev/null +++ b/test/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"); + } + } +}