コード例 #1
0
        public void TestPointOutsideOfRangeWithNewPath()
        {
            Path    simplePath = new Path();
            Vector2 position   = new Vector2(200, 150);

            simplePath.AddPointLast(new Vector2(200, 100));
            BezierPoint createdPoint = simplePath.AddPointLast(position).Value;

            simplePath.AddPointLast(new Vector2(200, 200));

            editorState.SelectedPoint = createdPoint;
            editorState.SelectedPath  = simplePath;
            editorState.CurrentState  = EditorStateControl.MouseState.Idle;
            editorState.ModifierState = EditorStateControl.KeyModifierState.None;

            container.Stub(x => x.GetPathsEnumerator()).Return(null).WhenCalled(x => x.ReturnValue = new List <Path>()
            {
                simplePath
            }.GetEnumerator());

            Vector2 newPosition = new Vector2(250, 150);

            inputstateControl.UpdateState(newPosition);

            Assert.That(editorState.SelectedPoint, Is.EqualTo(new BezierPoint(newPosition)));
            Assert.That(editorState.CurrentState, Is.EqualTo(EditorStateControl.MouseState.NewPointDragging));

            container.AssertWasCalled(x => x.AddPath(Arg <Path> .Is.Anything), opt => opt.Repeat.Times(2));
            Assert.That(editorState.SelectedPath, Is.Not.EqualTo(simplePath));
        }
コード例 #2
0
        public void TestSetPathContainerNewPath()
        {
            IPathContainer container = MockRepository.GenerateMock <IPathContainer>();

            container.Stub(x => x.Count).Return(0);

            inputstateControl.SetPathsContainer(container);

            Assert.IsNull(editorState.SelectedPoint);
            Assert.IsNotNull(editorState.SelectedPath);
            container.AssertWasCalled(x => x.AddPath(Arg <Path> .Is.Anything));
        }