Пример #1
0
        public void TestRotationHandleShownOnHover()
        {
            SelectionBoxRotationHandle rotationHandle = null;

            AddStep("retrieve rotation handle", () => rotationHandle = this.ChildrenOfType <SelectionBoxRotationHandle>().First());

            AddAssert("handle hidden", () => rotationHandle.Alpha == 0);
            AddStep("hover over handle", () => InputManager.MoveMouseTo(rotationHandle));
            AddUntilStep("rotation handle shown", () => rotationHandle.Alpha == 1);

            AddStep("move mouse away", () => InputManager.MoveMouseTo(selectionBox));
            AddUntilStep("handle hidden", () => rotationHandle.Alpha == 0);
        }
Пример #2
0
        public void TestRotationHandleShownOnHoveringClosestScaleHandler()
        {
            SelectionBoxRotationHandle rotationHandle = null;

            AddStep("retrieve rotation handle", () => rotationHandle = this.ChildrenOfType <SelectionBoxRotationHandle>().First());

            AddAssert("rotation handle hidden", () => rotationHandle.Alpha == 0);
            AddStep("hover over closest scale handle", () =>
            {
                InputManager.MoveMouseTo(this.ChildrenOfType <SelectionBoxScaleHandle>().Single(s => s.Anchor == rotationHandle.Anchor));
            });
            AddUntilStep("rotation handle shown", () => rotationHandle.Alpha == 1);

            AddStep("move mouse away", () => InputManager.MoveMouseTo(selectionBox));
            AddUntilStep("handle hidden", () => rotationHandle.Alpha == 0);
        }
Пример #3
0
        public void TestRotatingUnsnappedSliderDoesNotSnap()
        {
            SelectionBoxRotationHandle handle = null;

            assertSliderSnapped(false);

            AddStep("select slider", () => EditorBeatmap.SelectedHitObjects.Add(slider));
            AddStep("move mouse to rotate handle", () =>
            {
                handle = this.ChildrenOfType <SelectionBoxRotationHandle>().First();
                InputManager.MoveMouseTo(handle.ScreenSpaceDrawQuad.Centre);
            });
            AddStep("scale slider", () =>
            {
                InputManager.PressButton(MouseButton.Left);
                InputManager.MoveMouseTo(handle.ScreenSpaceDrawQuad.Centre + new Vector2(0, 20));
                InputManager.ReleaseButton(MouseButton.Left);
            });
            assertSliderSnapped(false);
        }
Пример #4
0
        public void TestHoldingScaleHandleHidesCorrespondingRotationHandle()
        {
            SelectionBoxRotationHandle rotationHandle = null;

            AddStep("retrieve rotation handle", () => rotationHandle = this.ChildrenOfType <SelectionBoxRotationHandle>().First());

            AddAssert("rotation handle hidden", () => rotationHandle.Alpha == 0);
            AddStep("hover over closest scale handle", () =>
            {
                InputManager.MoveMouseTo(this.ChildrenOfType <SelectionBoxScaleHandle>().Single(s => s.Anchor == rotationHandle.Anchor));
            });
            AddUntilStep("rotation handle shown", () => rotationHandle.Alpha == 1);
            AddStep("hold scale handle", () => InputManager.PressButton(MouseButton.Left));
            AddUntilStep("rotation handle hidden", () => rotationHandle.Alpha == 0);

            int i;
            ScheduledDelegate mouseMove = null;

            AddStep("start dragging", () =>
            {
                i = 0;

                mouseMove = Scheduler.AddDelayed(() =>
                {
                    InputManager.MoveMouseTo(selectionBox.ScreenSpaceDrawQuad.TopLeft + Vector2.One * (5 * ++i));
                }, 100, true);
            });
            AddAssert("rotation handle still hidden", () => rotationHandle.Alpha == 0);

            AddStep("end dragging", () => mouseMove.Cancel());
            AddAssert("rotation handle still hidden", () => rotationHandle.Alpha == 0);
            AddStep("unhold left", () => InputManager.ReleaseButton(MouseButton.Left));
            AddUntilStep("rotation handle shown", () => rotationHandle.Alpha == 1);
            AddStep("move mouse away", () => InputManager.MoveMouseTo(selectionBox, new Vector2(20)));
            AddUntilStep("rotation handle hidden", () => rotationHandle.Alpha == 0);
        }