public void ShouldPersistState()
        {
            var subSceneA       = EntityHierarchyNodeId.FromSubScene(1);
            var subSceneB       = EntityHierarchyNodeId.FromSubScene(2);
            var unknownSubScene = EntityHierarchyNodeId.FromSubScene(3);

            EntityHierarchyState.OnFoldingStateChanged(subSceneA, true);
            EntityHierarchyState.OnFoldingStateChanged(subSceneB, false);

            Assert.That(EntityHierarchyState.GetFoldingState(subSceneA), Is.True);
            Assert.That(EntityHierarchyState.GetFoldingState(subSceneB), Is.False);
            Assert.That(EntityHierarchyState.GetFoldingState(unknownSubScene), Is.Null);
        }
Example #2
0
        public void ShouldPersistState()
        {
            var state = new EntityHierarchyFoldingState(Guid.NewGuid().ToString("N"));

            var subSceneA       = EntityHierarchyNodeId.FromSubScene(1);
            var subSceneB       = EntityHierarchyNodeId.FromSubScene(2);
            var unknownSubScene = EntityHierarchyNodeId.FromSubScene(3);

            state.OnFoldingStateChanged(subSceneA, true);
            state.OnFoldingStateChanged(subSceneB, false);

            Assert.That(state.GetFoldingState(subSceneA), Is.True);
            Assert.That(state.GetFoldingState(subSceneB), Is.False);
            Assert.That(state.GetFoldingState(unknownSubScene), Is.Null);
        }
        public void ShouldIgnoreEverythingExceptSceneAndSubScenes()
        {
            EntityHierarchyState.OnFoldingStateChanged(EntityHierarchyNodeId.Root, true);
            EntityHierarchyState.OnFoldingStateChanged(EntityHierarchyNodeId.FromEntity(new Entity {
                Index = 1, Version = 1
            }), true);
            EntityHierarchyState.OnFoldingStateChanged(EntityHierarchyNodeId.FromScene(1), true);
            EntityHierarchyState.OnFoldingStateChanged(EntityHierarchyNodeId.FromSubScene(1), false);

            Assert.That(EntityHierarchyState.GetFoldingState(EntityHierarchyNodeId.Root), Is.Null);
            Assert.That(EntityHierarchyState.GetFoldingState(EntityHierarchyNodeId.FromEntity(new Entity {
                Index = 1, Version = 1
            })), Is.Null);
            Assert.That(EntityHierarchyState.GetFoldingState(EntityHierarchyNodeId.FromScene(1)), Is.True);
            Assert.That(EntityHierarchyState.GetFoldingState(EntityHierarchyNodeId.FromSubScene(1)), Is.False);
        }
        // Creates the basic hierarchy for a single scene with a single subscene.
        static (TestHierarchy.TestNode root, TestHierarchy.TestNode subScene, int nextSceneId, int nextEntityId) CreateBaseHierarchyForSubscene()
        {
            var entityId = 0;
            var sceneId  = 0;

            var rootNode = TestHierarchy.CreateRoot();

            rootNode.AddChildren(
                new EntityHierarchyNodeId(NodeKind.Entity, entityId++, 0),                                  // World Time Entity
                new EntityHierarchyNodeId(NodeKind.Entity, entityId++, 0),                                  // SubScene Entity
                new EntityHierarchyNodeId(NodeKind.Entity, entityId++, 0));                                 // SceneSection Entity

            var subSceneNode =
                rootNode.AddChild(EntityHierarchyNodeId.FromScene(sceneId++))                  // Main Scene
                .AddChild(EntityHierarchyNodeId.FromSubScene(sceneId++));                      // SubScene

            return(rootNode, subSceneNode, sceneId, entityId);
        }
Example #5
0
        public void ShouldIgnoreEverythingExceptSceneAndSubScenes()
        {
            var state = new EntityHierarchyFoldingState(Guid.NewGuid().ToString("N"));

            state.OnFoldingStateChanged(EntityHierarchyNodeId.Root, true);
            state.OnFoldingStateChanged(EntityHierarchyNodeId.FromEntity(new Entity {
                Index = 1, Version = 1
            }), true);
            state.OnFoldingStateChanged(EntityHierarchyNodeId.FromScene(1), true);
            state.OnFoldingStateChanged(EntityHierarchyNodeId.FromSubScene(1), false);

            Assert.That(state.GetFoldingState(EntityHierarchyNodeId.Root), Is.Null);
            Assert.That(state.GetFoldingState(EntityHierarchyNodeId.FromEntity(new Entity {
                Index = 1, Version = 1
            })), Is.Null);
            Assert.That(state.GetFoldingState(EntityHierarchyNodeId.FromScene(1)), Is.True);
            Assert.That(state.GetFoldingState(EntityHierarchyNodeId.FromSubScene(1)), Is.False);
        }