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 public class GenGridTest1 : TestCaseBase
24 public override string TestName => "GenGridTest1";
25 public override string TestDescription => "To test basic operation of GenGrid";
27 public override void Run(Window window)
29 Conformant conformant = new Conformant(window);
31 GenGrid grid = new GenGrid(window)
39 ItemWidth = window.ScreenSize.Width / 3,
40 ItemHeight = window.ScreenSize.Width / 3,
41 HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible,
42 VerticalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible
45 GenItemClass defaultClass = new GenItemClass("default")
47 GetTextHandler = (obj, part) =>
49 Color item = (Color)obj;
50 return String.Format("#{0:X}{1:X}{2:X}", item.R, item.G, item.B);
52 GetContentHandler = (obj, part) =>
54 Color item = (Color)obj;
55 Console.WriteLine("{0} part create requested", part);
56 if (part == "elm.swallow.icon")
58 var colorbox = new Rectangle(window)
68 var rnd = new Random();
69 for (int i = 0; i < 10; i++)
71 int r = rnd.Next(255);
72 int g = rnd.Next(255);
73 int b = rnd.Next(255);
74 Color color = Color.FromRgb(r, g, b);
75 var griditem = grid.Append(defaultClass, color);
76 griditem.SetTooltipText("AAAAAA");
77 //griditem.TooltipStyle = "transparent";
79 griditem.TooltipContentDelegate = () => { return new Button(window); };
84 conformant.SetContent(grid);
87 private void List_ItemSelected(object sender, GenListItemEventArgs e)
89 Console.WriteLine("{0} Item was selected", (string)(e.Item.Data));