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 public class ToolbarTest3 : TestCaseBase
25 Dictionary<ToolbarItem, int> _itemTable = new Dictionary<ToolbarItem, int>();
26 Dictionary<int, ToolbarItem> _reverseItemTable = new Dictionary<int, ToolbarItem>();
27 public override string TestName => "ToolbarTest3";
28 public override string TestDescription => "To test basic operation of Toolbar for changing bg color";
29 public override void Run(Window window)
31 Conformant conformant = new Conformant(window);
33 Box outterBox = new Box(window)
40 BackgroundColor = Color.Aqua,
44 Toolbar toolbar = new Toolbar(window)
50 var rnd = new Random();
51 toolbar.BackgroundColor = Color.FromRgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
53 outterBox.PackEnd(toolbar);
55 toolbar.Selected += (s, e) =>
57 e.Item.DeletePartColor("bg");
60 Label lb = new Label(window)
62 Text = "Please, click an item for delete part color",
65 outterBox.PackEnd(lb);
67 for (int i = 0; i < 5; i++)
69 ToolbarItem item = toolbar.Append(string.Format("{0} home", i), "home");
70 Color bgColor = Color.FromRgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
71 item.SetPartColor("bg", bgColor);
73 item.Clicked += (s, e) =>
75 lb.Text = (s as ToolbarItem).Text+" clicked";
80 conformant.SetContent(outterBox);