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 ToolbarTest4 : TestCaseBase
25 public override string TestName => "ToolbarTest4";
26 public override string TestDescription => "To test basic operation of Toolbar";
28 public override void Run(Window window)
30 Conformant conformant = new Conformant(window);
32 Box outterBox = new Box(window)
39 BackgroundColor = Color.Aqua,
43 Toolbar toolbar = new Toolbar(window)
47 ShrinkMode = ToolbarShrinkMode.Scroll,
48 IconLookupOrder = ToolbarIconLookupOrder.ThemeFreedesktop,
51 outterBox.PackEnd(toolbar);
53 toolbar.Append("FirstItem", "home");
54 toolbar.Append("LastItem", "home");
55 ToolbarItem result = toolbar.InsertAfter(toolbar.FirstItem, "Result", "");
57 Button bt1 = new Button(window)
59 Text = "Change IconSize",
62 bt1.Clicked += (s, e) =>
64 if (toolbar.IconSize < 50)
65 toolbar.IconSize = 100;
67 toolbar.IconSize = 32;
68 result.Text = string.Format("IconSize{0}", toolbar.IconSize.ToString());
71 outterBox.PackEnd(bt1);
73 Button bt2 = new Button(window)
75 Text = "Find FirstItem",
78 bt2.Clicked += (s, e) =>
80 ToolbarItem item1 = toolbar.FirstItem;
81 ToolbarItem item2 = toolbar.FindItemByLabel("FirstItem");
82 if (item1 == null || item2 == null || item1 != item2)
88 outterBox.PackEnd(bt2);
90 Button bt3 = new Button(window)
92 Text = "Find LastItem",
95 bt3.Clicked += (s, e) =>
97 ToolbarItem item1 = toolbar.LastItem;
98 ToolbarItem item2 = toolbar.FindItemByLabel("LastItem");
99 if (item1 == null || item2 == null || item1 != item2)
100 result.Text = "FAIL";
102 result.Text = "PASS";
105 outterBox.PackEnd(bt3);
107 Button bt4 = new Button(window)
109 Text = "Get ItemsCount",
112 bt4.Clicked += (s, e) =>
114 result.Text = toolbar.ItemsCount.ToString();
117 outterBox.PackEnd(bt4);
119 Button bt5 = new Button(window)
121 Text = "Change IconLookupOrder",
124 bt5.Clicked += (s, e) =>
126 toolbar.IconLookupOrder = (ToolbarIconLookupOrder)(((int)toolbar.IconLookupOrder + 1) % 4);
127 result.Text = toolbar.IconLookupOrder.ToString();
130 outterBox.PackEnd(bt5);
132 conformant.SetContent(outterBox);