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 TransitTest : TestCaseBase
24 public override string TestName => "TransitTest";
25 public override string TestDescription => "To test basic operation of Transit";
27 Transit CreateTransit()
29 Transit transit = new Transit();
30 transit.Deleted += (s, e) => { Console.WriteLine("Transit Deleted"); };
32 transit.AutoReverse = true;
37 public override void Run(Window window)
39 Button button1 = new Button(window) {
43 button1.Resize(270, 200);
46 Button button2 = new Button(window)
48 Text = "Chain Effect",
50 button2.Move(270, 200);
51 button2.Resize(270, 200);
54 Point begin = new Point();
55 begin.X = begin.Y = 0;
56 Point end = new Point();
58 TranslationEffect translation = new TranslationEffect(begin, end);
59 translation.EffectEnded += (s, e) => { Console.WriteLine("Translation Effect Ended"); };
61 RotationEffect rotation = new RotationEffect(0, 180);
62 rotation.EffectEnded += (s, e) => { Console.WriteLine("Rotation Effect Ended"); };
64 button1.Clicked += (s, e) => {
65 Transit transit1 = CreateTransit();
66 transit1.Objects.Add(button1);
67 transit1.Objects.Add(button2);
68 transit1.AddEffect(translation);
69 transit1.AddEffect(rotation);
73 button2.Clicked += (s, e) => {
74 Transit transit1 = CreateTransit();
75 transit1.Objects.Add(button1);
76 transit1.AddEffect(translation);
77 transit1.AddEffect(rotation);
79 Transit transit2 = CreateTransit();
80 transit2.Objects.Add(button2);
81 transit2.AddEffect(translation);
82 transit2.AddEffect(rotation);
84 transit1.Chains.Add(transit2);