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 FloatingButtonTest : TestCaseBase
24 public override string TestName => "FloatingButtonTest";
25 public override string TestDescription => "To test FloatingButton";
27 Button _RedButton = null;
28 Button _GreenButton = null;
30 public Button CreateButton(Window window, string text)
32 return new Button(window)
40 public override void Run(Window window)
42 Conformant conformant = new Conformant(window);
44 Box box = new Box(window)
52 conformant.SetContent(box);
54 FloatingButton floatingButton = new FloatingButton(window)
56 Mode = FloatingButtonMode.All,
62 floatingButton.Show();
63 floatingButton.Resize(700, 700);
64 floatingButton.Move(0, 400);
66 Box backGround = new Box(window)
75 Button button1 = CreateButton(window, "Mode change to LeftRightOnly");
76 button1.Clicked += (s, e) => {
77 if (floatingButton.Mode == FloatingButtonMode.All)
79 floatingButton.Mode = FloatingButtonMode.LeftRightOnly;
80 button1.Text = "Mode change to All";
84 floatingButton.Mode = FloatingButtonMode.All;
85 button1.Text = "Mode change to LeftRightOnly";
90 Button button2 = CreateButton(window, "MovementBlock Set");
91 button2.Clicked += (s, e) => {
92 floatingButton.MovementBlock = !floatingButton.MovementBlock;
93 if (floatingButton.MovementBlock) button2.Text = "MovementBlock Unset";
94 else button2.Text = "MovementBlock Set";
98 Button button3 = CreateButton(window, "RedButton Set");
99 button3.Clicked += (s, e) => {
100 if (_RedButton == null)
102 _RedButton = CreateButton(window, "RedButton");
103 _RedButton.BackgroundColor = Color.Red;
104 floatingButton.SetPartContent("button1", _RedButton, true);
105 button3.Text = "RedButton Unset";
109 _RedButton.Unrealize();
111 floatingButton.SetPartContent("button1", _RedButton, true);
112 button3.Text = "RedButton Set";
117 Button button4 = CreateButton(window, "GreenButton Set");
118 button4.Clicked += (s, e) => {
119 if (_GreenButton == null)
121 _GreenButton = CreateButton(window, "GreenButton");
122 _GreenButton.BackgroundColor = Color.Green;
123 floatingButton.SetPartContent("button2", _GreenButton, true);
124 button4.Text = "GreenButton Unset";
128 _GreenButton.Unrealize();
130 floatingButton.SetPartContent("button2", _GreenButton, true);
131 button4.Text = "GreenButton Unset";
136 box.PackEnd(backGround);
137 box.PackEnd(button1);
138 box.PackEnd(button2);
139 box.PackEnd(button3);
140 box.PackEnd(button4);