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 ToolbarTest2 : TestCaseBase
25 Dictionary<ToolbarItem, int> _itemTable = new Dictionary<ToolbarItem, int>();
26 Dictionary<int, ToolbarItem> _reverseItemTable = new Dictionary<int, ToolbarItem>();
27 public override string TestName => "ToolbarTest2";
28 public override string TestDescription => "To test basic operation of Toolbar";
29 public override void Run(Window window)
31 Conformant conformant = new Conformant(window);
33 Box outerBox = new Box(window)
40 BackgroundColor = Color.Aqua,
44 Toolbar toolbar = new Toolbar(window)
50 outerBox.PackEnd(toolbar);
52 List<ToolbarItem> items = new List<ToolbarItem>();
53 items.Add(toolbar.Append(string.Format("{0} home", items.Count), "home"));
55 Button bt = new Button(window)
57 Text = "Add ToolbarItem",
60 bt.Clicked += (s, e) =>
62 items.Add(toolbar.Append(string.Format("{0} home", items.Count), "home"));
65 Button removebt = new Button(window)
67 Text = "Remove first ToolbarItem",
70 removebt.Clicked += (s, e) =>
72 foreach (var cur in items)
83 outerBox.PackEnd(removebt);
84 conformant.SetContent(outerBox);