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.
20 namespace ElmSharp.Test
22 class GenListTest6 : TestCaseBase
24 public override string TestName => "GenListTest6";
25 public override string TestDescription => "To test deletion of GenListItem";
26 GenListItem selected = null;
29 public override void Run(Window window)
31 Conformant conformant = new Conformant(window);
33 Box box = new Box(window)
41 conformant.SetContent(box);
44 GenList list = new GenList(window)
53 GenItemClass defaultClass = new GenItemClass("default")
55 GetTextHandler = (obj, part) =>
57 return string.Format("{0} - {1}", (string)obj, part);
59 DeleteHandler = new GenItemClass.DeleteDelegate((obj) =>
61 Console.WriteLine("DeleteHandler was called with... {0}", (string)obj);
64 GenListItem[] items = new GenListItem[100];
65 for (int i = 0; i < 100; i++)
67 items[i] = list.Append(defaultClass, string.Format("{0} Item", i));
70 list.ItemSelected += List_ItemSelected;
71 list.ItemActivated += List_ItemActivated;
72 list.ItemUnselected += List_ItemUnselected;
73 list.ItemPressed += List_ItemPressed;
74 list.ItemRealized += List_ItemRealized;
75 list.ItemReleased += List_ItemReleased;
76 list.ItemUnrealized += List_ItemUnrealized;
77 list.ItemLongPressed += List_ItemLongPressed;
78 list.ItemDoubleClicked += List_ItemDoubleClicked;
80 Button first = new Button(window)
86 first.Clicked += (s, e) =>
95 private void List_ItemSelected(object sender, GenListItemEventArgs e)
98 Console.WriteLine("{0} Item was selected", (string)(e.Item.Data));
100 private void List_ItemDoubleClicked(object sender, GenListItemEventArgs e)
102 Console.WriteLine("{0} Item was double clicked", (string)(e.Item.Data));
105 private void List_ItemLongPressed(object sender, GenListItemEventArgs e)
107 Console.WriteLine("{0} Item was Long pressed", (string)(e.Item.Data));
110 private void List_ItemUnrealized(object sender, GenListItemEventArgs e)
112 Console.WriteLine("!!!! Item was Unrealized!!!");
113 Console.WriteLine("{0} Item was unrealzed", (string)(e.Item.Data));
116 private void List_ItemReleased(object sender, GenListItemEventArgs e)
118 Console.WriteLine("{0} Item was released", (string)(e.Item.Data));
121 private void List_ItemRealized(object sender, GenListItemEventArgs e)
123 Console.WriteLine("{0} Item was Realized", (string)(e.Item.Data));
126 private void List_ItemPressed(object sender, GenListItemEventArgs e)
128 Console.WriteLine("{0} Item was Pressed", (string)(e.Item.Data));
131 private void List_ItemUnselected(object sender, GenListItemEventArgs e)
133 Console.WriteLine("{0} Item was unselected", (string)(e.Item.Data));
136 private void List_ItemActivated(object sender, GenListItemEventArgs e)
138 Console.WriteLine("{0} Item was Activated", (string)(e.Item.Data));