Merge "[Telephony] Sample App implementation."
[platform/core/csapi/tizenfx.git] / test / ElmSharp.Test / TC / ClipperTest1.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;
19
20 namespace ElmSharp.Test
21 {
22     public class ClipperTest1 : TestCaseBase
23     {
24         public override string TestName => "ClipperTest1";
25         public override string TestDescription => "ClipperTest1 test";
26
27         public override void Run(Window window)
28         {
29             Conformant conformant = new Conformant(window);
30             conformant.Show();
31
32             Naviframe navi = new Naviframe(window)
33             {
34                 PreserveContentOnPop = true,
35                 DefaultBackButtonEnabled = true
36             };
37
38             Scroller scroller = new Scroller(window)
39             {
40                 AlignmentX = -1,
41                 AlignmentY = -1,
42                 WeightX = 1,
43                 WeightY = 1,
44                 ScrollBlock = ScrollBlock.None,
45             };
46             scroller.Show();
47             Box container = new Box(window);
48             scroller.SetContent(container);
49
50             var rect1 = new Rectangle(window)
51             {
52                 AlignmentX = -1,
53                 WeightX = 1,
54                 Color = Color.Blue,
55                 MinimumHeight = 500
56             };
57             rect1.Show();
58
59             var clipper = new Rectangle(window);
60             clipper.Color = new ElmSharp.Color(200, 200, 200, 200);
61             clipper.Geometry = rect1.Geometry;
62             rect1.Moved += (s, e) =>
63             {
64                 clipper.Geometry = ((Rectangle)s).Geometry;
65             };
66             rect1.SetClip(clipper);
67             clipper.Show();
68             container.PackEnd(rect1);
69
70             Color[] colors = { Color.Red, Color.Olive, Color.Green, Color.Gray, Color.Lime, Color.Maroon };
71             for (int i = 0; i < 6; i++)
72             {
73                 var rect = new Rectangle(window)
74                 {
75                     AlignmentX = -1,
76                     WeightX = 1,
77                     Color = colors[i],
78                     MinimumHeight = 500
79                 };
80                 rect.Show();
81                 container.PackEnd(rect);
82             }
83
84             navi.Push(scroller, "Scroll Page");
85             navi.Show();
86             conformant.SetContent(navi);
87         }
88     }
89 }