public void GetCharacterPartVisibility_ReturnsCorrectVisibilitValue()
        {
            var part = CacheObject.Create <CharacterPartCache>(null);

            part.isVisible = false;
            var treeViewItem = new TreeViewItemBase <CharacterPartCache>(0, 0, "", part);

            Assert.IsFalse(m_Controller.GetCharacterPartVisibility(treeViewItem));
        }
示例#2
0
        public void GetTreeItemDepthValue()
        {
            m_Controller.Activate();
            var boneCache    = CacheObject.Create <BoneCache>(null);
            var treeViewItem = new TreeViewItemBase <BoneCache>(0, 0, "test", boneCache);

            treeViewItem.customData.depth = 5;
            m_Model.GetDepth(Arg.Is <BoneCache>(x => x == boneCache)).Returns(10);
            Assert.AreEqual(10, m_Controller.GetTreeItemDepthValue(treeViewItem));
        }
示例#3
0
        public void SetTreeItemDepthValue()
        {
            m_Controller.Activate();
            var boneCache    = CacheObject.Create <BoneCache>(null);
            var treeViewItem = new TreeViewItemBase <BoneCache>(0, 0, "test", boneCache);

            treeViewItem.customData.depth = 5;
            m_Controller.SetTreeItemDepthValue(treeViewItem, 100);
            m_Model.Received(1).SetDepth(Arg.Any <BoneCache>(), Arg.Any <int>());
            m_Model.Received(1).SetDepth(Arg.Is <BoneCache>(x => x == boneCache), 100);
        }
        public void OnSpriteSelectionChanged_InformsViewOnChange()
        {
            m_Controller.Activate();
            var spriteCache = CacheObject.Create <SpriteCache>(null);

            spriteCache.name = "Test Sprite";
            m_Model.selectedSprite.Returns(spriteCache);
            m_View.ClearReceivedCalls();
            m_Events.selectedSpriteChanged.Invoke(spriteCache);
            m_View.Received(1).OnSpriteSelectionChanged();
            m_View.Received(1).headerText = "Test Sprite";
        }
示例#5
0
        public void GetTreeItemVisibility_GetsValiueFromModel()
        {
            m_Controller.Activate();
            var boneCache    = CacheObject.Create <BoneCache>(null);
            var treeViewItem = new TreeViewItemBase <BoneCache>(0, 0, "test", boneCache);

            treeViewItem.customData.isVisible = false;
            m_Model.GetVisibility(Arg.Is <BoneCache>(x => x == boneCache)).Returns(true);
            Assert.AreEqual(true, m_Controller.GetTreeItemVisibility(treeViewItem));

            treeViewItem.customData.isVisible = true;
            m_Model.GetVisibility(Arg.Is <BoneCache>(x => x == boneCache)).Returns(false);
            Assert.AreEqual(false, m_Controller.GetTreeItemVisibility(treeViewItem));
        }
        public void OnActivate_HaveCorrectSetup()
        {
            var spriteCache = CacheObject.Create <SpriteCache>(null);

            m_Model.selectedSprite.Returns(spriteCache);
            m_Model.previousVisibility.Returns(true);
            m_Model.allVisibility.Returns(true);

            m_Events.skinningModeChanged.Received(1).AddListener(Arg.Any <UnityAction <SkinningMode> >());
            m_Controller.Activate();
            m_Events.selectedSpriteChanged.Received(1).AddListener(Arg.Any <UnityAction <SpriteCache> >());
            m_View.Received(1).Setup();
            m_Model.DidNotReceiveWithAnyArgs().previousVisibility = true;
        }
        public void OnViewSelectionChanged_UpdatesModelOnSelectionChange()
        {
            m_Controller.OnViewCreated();
            var bones = new[]
            {
                CacheObject.Create <BoneCache>(null),
                CacheObject.Create <BoneCache>(null),
            };

            m_View.onSelectionChanged        += Raise.Event <Action <BoneCache[]> >(new[] { bones });
            m_Model.Received(1).selectedBones = Arg.Any <BoneCache[]>();
            BoneCache[] boneResult = m_Model.selectedBones;
            Assert.AreEqual(bones.Length, boneResult.Length);
        }
        public void ShouldEnableAddButton_ReturnsCorrectButtonState()
        {
            var spriteCache = CacheObject.Create <SpriteCache>(null);

            m_Model.selectedSprite.Returns(spriteCache);

            var bones = new[]
            {
                CacheObject.Create <BoneCache>(null),
                CacheObject.Create <BoneCache>(null),
            };

            m_Model.selectedBones.Returns(bones);
            Assert.IsTrue(m_Controller.ShouldEnableAddButton(new BoneCache[0]));
        }
        public void GetSelectedSpriteBoneInfluence_GetsCorrectDataFromModel()
        {
            var spriteCache   = CacheObject.Create <SpriteCache>(null);
            var characterpart = CacheObject.Create <CharacterPartCache>(null);
            var bones         = new[]
            {
                CacheObject.Create <BoneCache>(null),
                CacheObject.Create <BoneCache>(null),
            };

            characterpart.bones = bones;
            m_Model.selectedSprite.Returns(spriteCache);
            m_Model.GetSpriteCharacterPart(Arg.Is(spriteCache)).Returns(characterpart);
            var bonesResult = m_Controller.GetSelectedSpriteBoneInfluence();

            Assert.AreEqual(bones.Length, bonesResult.Length);
            for (int i = 0; i < bones.Length; ++i)
            {
                Assert.AreEqual(bones[i], bonesResult[1]);
            }
        }
        public void GetSelectedBoneForList_RetunsCorrectValue()
        {
            var spriteCache   = CacheObject.Create <SpriteCache>(null);
            var characterpart = CacheObject.Create <CharacterPartCache>(null);
            var bones         = new[]
            {
                CacheObject.Create <BoneCache>(null),
                CacheObject.Create <BoneCache>(null),
            };

            characterpart.bones = bones;
            m_Model.selectedSprite.Returns(spriteCache);
            m_Model.selectedBones.Returns(bones);
            m_Model.GetSpriteCharacterPart(Arg.Is(spriteCache)).Returns(characterpart);
            var bonesResult = m_Controller.GetSelectedBoneForList(bones);

            Assert.AreEqual(bones.Length, bonesResult.Length);
            for (int i = 0; i < bones.Length; ++i)
            {
                Assert.AreEqual(i, bonesResult[i]);
            }
        }
        public void OnRemoveBone_RemovesBoneFromModel()
        {
            m_Controller.OnViewCreated();
            SkeletonCache skeleton = CacheObject.Create <SkeletonCache>(null);

            m_Model.characterSkeleton.Returns(skeleton);

            var spriteCache   = CacheObject.Create <SpriteCache>(null);
            var characterpart = CacheObject.Create <CharacterPartCache>(null);
            var bones         = new[]
            {
                CacheObject.Create <BoneCache>(null),
                CacheObject.Create <BoneCache>(null),
            };

            characterpart.bones = bones;
            m_Model.selectedSprite.Returns(spriteCache);
            m_Model.GetSpriteCharacterPart(Arg.Is(spriteCache)).Returns(characterpart);
            m_Model.selectedBones.Returns(bones);
            m_View.onRemoveBone += Raise.Event <Action>(new object[0]);
            Assert.AreEqual(0, characterpart.bones.Length);
        }
示例#12
0
 public void Setup()
 {
     m_Transform0 = CacheObject.Create <TransformCache>(null);
     m_Transform1 = CacheObject.Create <TransformCache>(null);
     m_Transform2 = CacheObject.Create <TransformCache>(null);
 }