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.
18 using System.Collections.Generic;
21 namespace ElmSharp.Test
23 class GenListTest10 : TestCaseBase
25 public override string TestName => "GenListTest10";
26 public override string TestDescription => "To test InsertBefore operation of GenList with full style";
28 public override void Run(Window window)
30 Conformant conformant = new Conformant(window);
32 Box box = new Box(window)
40 conformant.SetContent(box);
42 GenList list = new GenList(window)
51 GenItemClass defaultClass = new GenItemClass("full")
53 GetContentHandler = (obj, part) =>
55 Console.WriteLine("{0} part create requested", part);
56 var btn = new Button(window)
58 Text = obj.ToString(),
66 GenItemClass headerClass = new GenItemClass("full")
68 GetContentHandler = (obj, part) =>
70 Console.WriteLine("{0} part create requested", part);
71 var btn = new Button(window)
73 Text = obj.ToString(),
79 var label = new Label(window)
81 Text = "GenItem with full style"
85 Box hBox = new Box(window)
100 List<GenListItem> itemList = new List<GenListItem>();
101 GenListItem firstItem = null;
103 for (int i = 0; i < 5; i++)
105 GenListItem now = list.Append(defaultClass, string.Format("{0} Item", i));
108 if (firstItem == null)
114 list.ItemSelected += List_ItemSelected;
117 Button first = new Button(window)
123 Button last = new Button(window)
130 first.Clicked += (s, e) =>
132 firstItem = list.InsertBefore(headerClass, "Header", firstItem);
134 last.Clicked += (s, e) =>
136 list.Append(headerClass, "Footer");
145 private void List_ItemSelected(object sender, GenListItemEventArgs e)
147 Console.WriteLine("{0} Item was selected", (string)(e.Item.Data));