[ElmSharp.Wearable]add Activate() and fix tc
[platform/core/csapi/tizenfx.git] / test / ElmSharp.Wearable.Test / TC / CircleGenListTest3.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 ElmSharp.Wearable;
18
19 namespace ElmSharp.Test.TC
20 {
21     class CircleGenListTest3 : TestCaseBase
22     {
23         public override string TestName => "CircleGenListTest3";
24         public override string TestDescription => "To display a genlist applied a circle UI on a naviframe";
25
26         public override void Run(Window window)
27         {
28             Conformant conformant = new Conformant(window);
29             conformant.Show();
30
31             var naviframe = new Naviframe(conformant);
32
33             conformant.SetContent(naviframe);
34
35             var surface = new CircleSurface(conformant);
36
37             var list = new CircleGenList(naviframe, surface)
38             {
39                 Homogeneous = true,
40                 VerticalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Auto,
41                 IsEnabled = false,
42             };
43             ((IRotaryActionWidget)list).Activate();
44             var item = naviframe.Push(list);
45             item.Style = "empty";
46
47             GenItemClass defaultClass = new GenItemClass("default")
48             {
49                 GetTextHandler = (obj, part) =>
50                 {
51                     return string.Format("{0} - {1}",(string)obj, part);
52                 }
53             };
54
55             for (int i = 0; i < 100; i++)
56             {
57                 list.Append(defaultClass, string.Format("{0} Item", i));
58             }
59             list.ItemSelected += List_ItemSelected; ;
60         }
61
62         private void List_ItemSelected(object sender, GenListItemEventArgs e)
63         {
64             Log.Debug(TestName, "{0} Item was selected", (string)(e.Item.Data));
65         }
66     }
67 }