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.
19 using System.Collections.Generic;
21 namespace ElmSharp.Test
23 class GenListTest7 : TestCaseBase
25 public override string TestName => "GenListTest7";
26 public override string TestDescription => "To test basic operation of GenList";
28 public override void Run(Window window)
30 Conformant conformant = new Conformant(window);
32 Box box = new Box(window);
33 conformant.SetContent(box);
36 GenList list = new GenList(window)
45 Button button = new Button(window)
52 GenItemClass defaultClass = new GenItemClass("default")
54 GetTextHandler = (obj, part) =>
56 return string.Format("{0} - {1}",(string)obj, part);
60 GenListItem[] itemArr = new GenListItem[9];
61 for (int i = 0; i < 9; i++)
63 itemArr[i] = list.Append(defaultClass, string.Format("{0} Item", i));
67 button.Clicked += (s, e) =>
70 Console.WriteLine("GenListItem deleted");
71 itemArr[idx++].Delete();
77 list.ItemSelected += List_ItemSelected;
78 list.ItemRealized += List_ItemRealized;
79 list.ItemUnrealized += List_ItemUnrealized;
85 private void List_ItemSelected(object sender, GenListItemEventArgs e)
87 Console.WriteLine("{0} Item was selected", (string)(e.Item.Data));
89 private void List_ItemRealized(object sender, GenListItemEventArgs e)
91 Console.WriteLine("{0} Item was realized", (string)(e.Item.Data));
93 private void List_ItemUnrealized(object sender, GenListItemEventArgs e)
95 Console.WriteLine("{0} Item was unrealized", (string)(e.Item.Data));