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 ImageTest2 : TestCaseBase
24 public override string TestName => "ImageTest2";
25 public override string TestDescription => "To test basic operation of Image";
30 public override void Run(Window window)
32 Conformant conformant = new Conformant(window);
34 Box box = new Box(window);
35 conformant.SetContent(box);
38 Box buttonBox1 = new Box(window) {
45 Button btnFile1 = new Button(window) {
54 Button btnFile2 = new Button(window) {
63 Button btnFile3 = new Button(window) {
72 Button btnFile4 = new Button(window) {
81 buttonBox1.PackEnd(btnFile1);
82 buttonBox1.PackEnd(btnFile2);
83 buttonBox1.PackEnd(btnFile3);
84 buttonBox1.PackEnd(btnFile4);
86 lbInfo = new Label(window) {
94 image = new Image(window) {
102 image.Load(Path.Combine(TestRunner.ResourceDir, "picture.png"));
103 image.Clicked += (s, e) =>
105 Console.WriteLine("Image has been clicked. (IsFixedAspect = {0}", image.IsFixedAspect);
106 image.IsFixedAspect = image.IsFixedAspect == true ? false : true;
109 btnFile1.Clicked += (s, e) => { image.BackgroundColor = Color.Blue; UpdateLabelText(image.BackgroundColor.ToString()); };
110 btnFile2.Clicked += (s, e) => { image.BackgroundColor = Color.Default; UpdateLabelText(image.BackgroundColor.ToString()); };
111 btnFile3.Clicked += (s, e) => { image.IsFixedAspect = image.IsFixedAspect == true ? false : true; };
112 btnFile4.Clicked += (s, e) => { image.Orientation = image.Orientation == ImageOrientation.None ? ImageOrientation.Rotate270 : ImageOrientation.None; };
114 box.PackEnd(buttonBox1);
119 void UpdateLabelText(string text)
121 lbInfo.Text = "<span color=#ffffff font_size=20> BackgroundColor => " + text + "</span>";