1 using System.Diagnostics;
4 * Copyright (c) 2016 Samsung Electronics Co. Ltd All Rights Reserved
6 * Licensed under the Apache License, Version 2.0 (the License);
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an AS IS BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 namespace ElmSharp.Test
21 class EventTest1 : TestCaseBase
23 public override string TestName => "EventTest1";
24 public override string TestDescription => "event propagation test";
27 GestureLayer _gParentLayer, _parentLayer, childLayer, chLayer;
29 public override void Run(Window window)
31 Conformant conformant = new Conformant(window);
33 gParent = new Box(window)
35 BackgroundColor = Color.Yellow,
37 PropagateEvents = false,
39 conformant.SetContent(gParent);
41 Box parent = new Box(gParent)
47 BackgroundColor = Color.Green,
49 PropagateEvents = false,
51 Box child = new Box(parent)
57 BackgroundColor = Color.Blue,
59 PropagateEvents = false,
62 Check ch = new Check(child)
68 BackgroundColor = Color.Silver,
70 PropagateEvents = false,
73 gParent.PackEnd(parent);
74 parent.PackEnd(child);
82 _gParentLayer = new GestureLayer(gParent);
83 _gParentLayer.Attach(gParent);
84 _gParentLayer.SetTapCallback(GestureLayer.GestureType.Tap, GestureLayer.GestureState.End, (info) =>
86 Debug.WriteLine($"@@@ Grand Parent Tap : {gParent.PassEvents}, {gParent.PropagateEvents}, {gParent.RepeatEvents}");
88 _parentLayer = new GestureLayer(parent);
89 _parentLayer.Attach(parent);
90 _parentLayer.SetTapCallback(GestureLayer.GestureType.Tap, GestureLayer.GestureState.End, (info) =>
92 Debug.WriteLine($"@@@ Parent Tap : {parent.PassEvents}, {parent.PropagateEvents}, {parent.RepeatEvents}");
94 childLayer = new GestureLayer(child);
95 childLayer.Attach(child);
96 childLayer.SetTapCallback(GestureLayer.GestureType.Tap, GestureLayer.GestureState.End, (info) =>
98 Debug.WriteLine($"@@@ Child Tap : {child.PassEvents}, {child.PropagateEvents}, {child.RepeatEvents}");
101 chLayer = new GestureLayer(ch);
103 chLayer.SetTapCallback(GestureLayer.GestureType.Tap, GestureLayer.GestureState.End, (info) =>
105 Debug.WriteLine($"@@@ Check1 Tap : {ch.PassEvents}, {ch.PropagateEvents}, {ch.RepeatEvents}");
108 EvasObjectEvent eventGrand = new EvasObjectEvent(gParent, EvasObjectCallbackType.MouseDown);
109 eventGrand.On += (s, e) =>
111 Debug.WriteLine($"@@@ Grand Parent down : {gParent.PassEvents}, {gParent.PropagateEvents}, {gParent.RepeatEvents}");
113 EvasObjectEvent evnetParent = new EvasObjectEvent(parent, EvasObjectCallbackType.MouseDown);
114 evnetParent.On += (s, e) =>
116 Debug.WriteLine($"@@@ Parent down : {parent.PassEvents}, {parent.PropagateEvents}, {parent.RepeatEvents}");
118 EvasObjectEvent eventChild = new EvasObjectEvent(child, EvasObjectCallbackType.MouseDown);
119 eventChild.On += (s, e) =>
121 Debug.WriteLine($"@@@ Child down : {child.PassEvents}, {child.PropagateEvents}, {child.RepeatEvents}");
123 EvasObjectEvent eventCh = new EvasObjectEvent(ch, ch.RealHandle, EvasObjectCallbackType.MouseDown);
124 eventCh.On += (s, e) =>
126 Debug.WriteLine($"@@@ Check down : {ch.PassEvents}, {ch.PropagateEvents}, {ch.RepeatEvents}");