412e1e05c3ef52db0f6dcb2db855df876f1ce1cc
[platform/core/csapi/tizenfx.git] / test / ElmSharp.Wearable.Test / TC / CircleScrollerTest3.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 using System;
18 using ElmSharp.Wearable;
19
20 namespace ElmSharp.Test.TC
21 {
22     public class CircleScrollerTest3 : TestCaseBase
23     {
24         public override string TestName => "CircleScrollerTest3";
25         public override string TestDescription => "To test basic operation of CircleScroller";
26
27         public override void Run(Window window)
28         {
29             Conformant conformant = new Conformant(window);
30             conformant.Show();
31
32             Naviframe naviframe = new Naviframe(conformant);
33
34             CircleScroller circleScroller = new CircleScroller(naviframe)
35             {
36                 AlignmentX = -1,
37                 AlignmentY = -1,
38                 WeightX = 1,
39                 WeightY = 1,
40                 VerticalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible,
41                 HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Auto,
42                 HorizontalScrollBarColor = new Color(255, 0, 0, 50),
43                 HorizontalScrollBackgroundColor = Color.Orange,
44                 HorizontalScrollBarLineWidth = 15,
45                 HorizontalScrollBackgroundLineWidth = 15,
46             };
47             circleScroller.Show();
48             naviframe.Push(circleScroller);
49             naviframe.Show();
50             conformant.SetContent(naviframe);
51
52             Box box = new Box(window)
53             {
54                 AlignmentX = -1,
55                 AlignmentY = -1,
56                 WeightX = 1,
57                 WeightY = 1,
58                 IsHorizontal = true,
59             };
60             box.Show();
61             circleScroller.SetContent(box);
62
63             var rnd = new Random();
64             for (int i = 0; i < 10; i++)
65             {
66                 int r = rnd.Next(255);
67                 int g = rnd.Next(255);
68                 int b = rnd.Next(255);
69                 Color color = Color.FromRgb(r, g, b);
70                 Rectangle colorBox = new Rectangle(window)
71                 {
72                     AlignmentX = -1,
73                     AlignmentY = -1,
74                     WeightX = 1,
75                     WeightY = 1,
76                     Color = color,
77                     MinimumWidth = window.ScreenSize.Width,
78                 };
79                 colorBox.Show();
80                 box.PackEnd(colorBox);
81             }
82             circleScroller.Scrolled += (s, e) => Log.Debug(TestName, "Horizental Circle Scroll Scrolled");
83         }
84     }
85 }