コード例 #1
0
ファイル: DragEventTests.cs プロジェクト: veboys/UIForia
        public void DragEnter_FiresForReEnteringElement()
        {
            MockApplication testView = MockApplication.Setup <DragHandlerTestThing>();

            testView.Update();
            testView.SetViewportRect(new Rect(0, 0, 1000, 1000));
            DragHandlerTestThing root = (DragHandlerTestThing)testView.RootElement;

            Assert.AreEqual(0, root.dragList.Count);
            root.ignoreExit = true;

            testView.InputSystem.MouseDown(new Vector2(10, 10));
            testView.Update();

            testView.InputSystem.MouseDragMove(new Vector2(30, 30));
            testView.Update();

            testView.InputSystem.MouseDragMove(new Vector2(130, 30));
            testView.Update();

            testView.InputSystem.MouseDragMove(new Vector2(30, 30));
            testView.Update();

            Assert.AreEqual(3, root.dragList.Count);
            Assert.AreEqual(new[] { "enter:child0", "enter:child1", "enter:child0" }, root.dragList.ToArray());
        }
コード例 #2
0
ファイル: DragEventTests.cs プロジェクト: veboys/UIForia
        public void DragExit_FireAgainWhenReenteredElement()
        {
            MockApplication testView = MockApplication.Setup <DragHandlerTestThing>();

            testView.Update();
            testView.SetViewportRect(new Rect(0, 0, 1000, 1000));
            DragHandlerTestThing root = (DragHandlerTestThing)testView.RootElement;

            testView.InputSystem.MouseDown(new Vector2(10, 10));
            testView.Update();

            testView.InputSystem.MouseDragMove(new Vector2(30, 30));
            testView.Update();

            testView.InputSystem.MouseDragMove(new Vector2(130, 30));
            testView.Update();

            testView.InputSystem.MouseDragMove(new Vector2(30, 30));
            testView.Update();

            Assert.AreEqual(5, root.dragList.Count);
            Assert.AreEqual(new[] { "enter:child0", "exit:child0", "enter:child1", "exit:child1", "enter:child0" }, root.dragList.ToArray());
        }