示例#1
0
        public void Should_TriggerLayerAdded()
        {
            var layer     = new LineLayer();
            var triggered = false;
            var map       = new Map("id");
            var eventArgs = new MapJsEventArgs {
                Type = "layeradded"
            };

            layer.OnLayerAdded += args => triggered = args.Map == map && args.Type == eventArgs.Type;
            layer.DispatchEvent(map, eventArgs);
            Assert.True(triggered);
        }
示例#2
0
        public void Should_TriggerDblClick()
        {
            var layer     = new LineLayer();
            var triggered = false;
            var map       = new Map("id");
            var eventArgs = CreateEventArgsForMouseEvent("dblclick");

            layer.OnDblClick += args => {
                triggered = args.Map == map &&
                            args.LayerId == eventArgs.LayerId &&
                            args.Pixel == eventArgs.Pixel &&
                            args.Position == eventArgs.Position

                            && args.Type == eventArgs.Type;
            };
            layer.DispatchEvent(map, eventArgs);
            Assert.True(triggered);
        }
示例#3
0
        public void Should_TriggerTouchStart()
        {
            var layer     = new LineLayer();
            var triggered = false;
            var map       = new Map("id");
            var eventArgs = CreateEventArgsForTouchEvent("touchstart");

            layer.OnTouchStart += args => {
                triggered = args.Map == map &&
                            args.LayerId == eventArgs.LayerId &&
                            args.Pixel == eventArgs.Pixel &&
                            args.Position == eventArgs.Position

                            && args.Pixels == eventArgs.Pixels &&
                            args.Positions == eventArgs.Positions &&
                            args.Type == eventArgs.Type;
            };
            layer.DispatchEvent(map, eventArgs);
            Assert.True(triggered);
        }