Beispiel #1
0
        public void GetHoveredWidget_LocationInside_ReturnsWidget()
        {
            var b = UserInteractionHandler.GetHoveredWidget(_widgetTree,
                                                            new Vector2(332, 43)) is Maybe <IWidget> .Some;

            Assert.That(b, Is.True);
        }
Beispiel #2
0
 public void BeforeEach()
 {
     _widgetTree = new Widget(new RectangleF(0, 0, 540, 260));
     _device     = new Mock <IDevice>();
     _intRun     = new Mock <InteractionUpdater>();
     _handler    = new UserInteractionHandler(_device.Object, _intRun.Object);
 }
Beispiel #3
0
        public void GetHoveredWidget_HoverChildInWidget_ReturnsChild()
        {
            var child = new Widget(new RectangleF(0, 0, 50, 60));

            _widgetTree.AddChild(child);
            var hovered = UserInteractionHandler.GetHoveredWidget(_widgetTree, new Vector2(32, 8));
            var b       = hovered.TryGetValue(out var value);

            Assert.That(b, Is.True);
            Assert.That(value, Is.EqualTo(child));
        }
Beispiel #4
0
        internal WTree(IWidget widgetRoot, IDevice device)
        {
            _userInteractionHandler = new UserInteractionHandler(device, new InteractionUpdater());
            Root = widgetRoot;
            TreeVisitor.ApplyPropsOnTree(Root);

            TreeVisitor.ResetApplicationDoneFlags(Root);
            Log.Information(
                "Created new WTreeManager with root starting at ({X},{Y}) for ({W},{H}) of space",
                Root.Space.X, Root.Space.Y, Root.Space.Width, Root.Space.Height
                );
        }
Beispiel #5
0
        private void InitUserInteractionHandler()
        {
            Func <Configuration> reloadConfiguration = () => {
                if (this.isDisposed)
                {
                    return(null);
                }

                this.config = Configuration.Read(ProtectorPlugin.ConfigFilePath);

                this.protectionManager.Config = this.Config;

                return(this.config);
            };

            this.userInteractionHandler = new UserInteractionHandler(
                this.Trace, this.PluginInfo, this.Config, this.ServerMetadataHandler,
                this.WorldMetadataHandler.Metadata, this.ProtectionManager, this.PluginCooperationHandler, reloadConfiguration
                );
        }
Beispiel #6
0
        public void GetHoveredWidget_NotInside_ReturnsNone()
        {
            var b = UserInteractionHandler.GetHoveredWidget(_widgetTree, new Vector2(332, 678)) is Maybe <IWidget> .Some;

            Assert.That(b, Is.False);
        }