Пример #1
0
    public void ChangeFloor()
    {
        //Arrange
        BIWCatalogManager.Init();

        BIWTestHelper.CreateTestCatalogLocalMultipleFloorObjects();

        CatalogItem oldFloor = DataStore.i.dataStoreBuilderInWorld.catalogItemDict.GetValues()[0];
        CatalogItem newFloor = DataStore.i.dataStoreBuilderInWorld.catalogItemDict.GetValues()[1];

        biwCreatorController.EnterEditMode(scene);
        biwFloorHandler.EnterEditMode(scene);

        //Act
        biwFloorHandler.CreateFloor(oldFloor);
        biwFloorHandler.ChangeFloor(newFloor);

        //Assert
        foreach (BIWEntity entity in entityHandler.GetAllEntitiesFromCurrentScene())
        {
            if (entity.isFloor)
            {
                Assert.AreEqual(entity.GetCatalogItemAssociated().id, newFloor.id);
                Assert.AreEqual(biwFloorHandler.FindCurrentFloorCatalogItem().id, newFloor.id);
                break;
            }
        }
    }
    public void UndoRedoChangeFloorAction()
    {
        BIWCatalogManager.Init();

        BIWTestHelper.CreateTestCatalogLocalMultipleFloorObjects();

        CatalogItem       oldFloor        = DataStore.i.dataStoreBuilderInWorld.catalogItemDict.GetValues()[0];
        CatalogItem       newFloor        = DataStore.i.dataStoreBuilderInWorld.catalogItemDict.GetValues()[1];
        BIWCompleteAction buildModeAction = new BIWCompleteAction();

        biwCreatorController.EnterEditMode(scene);
        biwFloorHandler.EnterEditMode(scene);

        biwFloorHandler.CreateFloor(oldFloor);
        biwFloorHandler.ChangeFloor(newFloor);

        buildModeAction.CreateChangeFloorAction(oldFloor, newFloor);
        biwActionController.AddAction(buildModeAction);

        foreach (BIWEntity entity in entityHandler.GetAllEntitiesFromCurrentScene())
        {
            if (entity.isFloor)
            {
                Assert.AreEqual(entity.GetCatalogItemAssociated().id, newFloor.id);
                break;
            }
        }

        biwActionController.TryToUndoAction();

        foreach (BIWEntity entity in entityHandler.GetAllEntitiesFromCurrentScene())
        {
            if (entity.isFloor)
            {
                Assert.AreEqual(entity.GetCatalogItemAssociated().id, oldFloor.id);

                break;
            }
        }

        biwActionController.TryToRedoAction();

        foreach (BIWEntity entity in entityHandler.GetAllEntitiesFromCurrentScene())
        {
            if (entity.isFloor)
            {
                Assert.AreEqual(entity.GetCatalogItemAssociated().id, newFloor.id);
                break;
            }
        }
    }
Пример #3
0
    public void CreateFloor()
    {
        //Arrange
        BIWCatalogManager.Init();
        BIWTestHelper.CreateTestCatalogLocalMultipleFloorObjects();
        CatalogItem floorItem = DataStore.i.dataStoreBuilderInWorld.catalogItemDict.GetValues()[0];

        biwCreatorController.EnterEditMode(scene);
        biwFloorHandler.EnterEditMode(scene);

        //Act
        biwFloorHandler.CreateFloor(floorItem);

        //Assert
        foreach (BIWEntity entity in entityHandler.GetAllEntitiesFromCurrentScene())
        {
            if (entity.isFloor)
            {
                Assert.IsTrue(biwFloorHandler.ExistsFloorPlaceHolderForEntity(entity.rootEntity.entityId));
                Assert.AreEqual(entity.GetCatalogItemAssociated().id, floorItem.id);
                break;
            }
        }

        foreach (BIWEntity entity in entityHandler.GetAllEntitiesFromCurrentScene())
        {
            if (entity.isFloor)
            {
                if (!entity.rootEntity.TryGetSharedComponent(CLASS_ID.GLTF_SHAPE, out ISharedComponent component))
                {
                    Assert.Fail("Floor doesn't contains a GLTFShape!");
                }

                entity.rootEntity.OnShapeUpdated?.Invoke(entity.rootEntity);
                Assert.IsFalse(biwFloorHandler.ExistsFloorPlaceHolderForEntity(entity.rootEntity.entityId));
                break;
            }
        }
    }
    public void BuilderInWorldSearch()
    {
        string nameToFilter = "Sandy";

        BIWTestHelper.CreateTestCatalogLocalMultipleFloorObjects();

        CatalogItem catalogItemToFilter = null;

        foreach (CatalogItem catalogItem in DataStore.i.dataStoreBuilderInWorld.catalogItemDict.GetValues())
        {
            if (catalogItem.name.Contains(nameToFilter))
            {
                catalogItemToFilter = catalogItem;
                return;
            }
        }

        SceneCatalogController sceneCatalogController           = new SceneCatalogController();
        List <Dictionary <string, List <CatalogItem> > > result = sceneCatalogController.biwSearchBarController.FilterAssets(nameToFilter);

        CatalogItem filteredItem = result[0].Values.ToList()[0][0];

        Assert.AreEqual(filteredItem, catalogItemToFilter);
    }