2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 namespace ElmSharp.Test
22 public class ScrollerTest3 : TestCaseBase
24 public override string TestName => "ScrollerTest3";
25 public override string TestDescription => "To test ScrollTo operation of Scroller";
27 public override void Run(Window window)
29 Conformant conformant = new Conformant(window);
31 Box outterBox = new Box(window)
40 Scroller scroller = new Scroller(window)
46 ScrollBlock = ScrollBlock.Vertical,
47 HorizontalPageScrollLimit = 1,
49 scroller.SetPageSize(1.0, 1.0);
52 Box box = new Box(window)
60 scroller.SetContent(box);
62 for (int i = 0; i < 30; i++)
64 Label addlabel = new Label(window)
66 Text = i + " Label Test",
73 box.PackEnd(addlabel);
76 conformant.SetContent(outterBox);
77 outterBox.PackEnd(scroller);
79 Button prev = new Button(window)
85 Button next = new Button(window)
91 prev.Clicked += (s, e) =>
93 Rect region = new Rect(0, 0, scroller.Geometry.Width, scroller.Geometry.Width);
94 Console.WriteLine("{0} {1}\n", scroller.Geometry.Width, scroller.Geometry.Width);
95 scroller.ScrollTo(region, true);
97 next.Clicked += (s, e) =>
99 Rect region = new Rect(0, scroller.Geometry.Height, scroller.Geometry.Width, scroller.Geometry.Height);
100 Console.WriteLine("{0} {1}\n", scroller.Geometry.Width, scroller.Geometry.Width);
101 scroller.ScrollTo(region, true);
105 outterBox.PackEnd(prev);
106 outterBox.PackEnd(next);
108 scroller.DragStart += Scroller_DragStart;
109 scroller.DragStop += Scroller_DragStop;
112 private void Scroller_DragStop(object sender, EventArgs e)
114 Console.WriteLine("Drag stop");
117 private void Scroller_DragStart(object sender, EventArgs e)
119 Console.WriteLine("Drag start");