public void CatalogItemAddMapings()
    {
        //Arrange
        BIWCatalogManager.Init();
        BIWTestHelper.CreateTestCatalogLocalSingleObject();
        CatalogItem item = DataStore.i.dataStoreBuilderInWorld.catalogItemDict.GetValues()[0];

        //Act
        biwCreatorController.CreateCatalogItem(item);

        //Assert
        LoadParcelScenesMessage.UnityParcelScene data = scene.sceneData;
        foreach (KeyValuePair <string, string> content in item.contents)
        {
            ContentServerUtils.MappingPair mappingPair = new ContentServerUtils.MappingPair();
            mappingPair.file = content.Key;
            mappingPair.hash = content.Value;
            bool found = false;
            foreach (ContentServerUtils.MappingPair mappingPairToCheck in data.contents)
            {
                if (mappingPairToCheck.file == mappingPair.file)
                {
                    found = true;
                    break;
                }
            }
            Assert.IsTrue(found);
        }
    }
    protected override IEnumerator SetUp()
    {
        yield return(base.SetUp());

        TestHelpers.CreateSceneEntity(scene, ENTITY_ID);

        TestHelpers.CreateAndSetShape(scene, ENTITY_ID, DCL.Models.CLASS_ID.GLTF_SHAPE, JsonConvert.SerializeObject(
                                          new
        {
            src = TestAssetsUtils.GetPath() + "/GLB/Trunk/Trunk.glb"
        }));

        LoadWrapper gltfShape = GLTFShape.GetLoaderForEntity(scene.entities[ENTITY_ID]);

        yield return(new DCL.WaitUntil(() => gltfShape.alreadyLoaded));

        outlinerController = new BIWOutlinerController();
        entityHandler      = new BIWEntityHandler();

        var referencesController = BIWTestHelper.CreateReferencesControllerWithGenericMocks(
            outlinerController,
            entityHandler
            );

        outlinerController.Init(referencesController);
        entityHandler.Init(referencesController);

        entityHandler.EnterEditMode(scene);
        outlinerController.EnterEditMode(scene);

        entity = entityHandler.GetConvertedEntity(scene.entities[ENTITY_ID]);
    }
    protected override IEnumerator SetUp()
    {
        yield return(base.SetUp());

        TestHelpers.CreateSceneEntity(scene, ENTITY_ID);
        biwActionController  = new BIWActionController();
        entityHandler        = new BIWEntityHandler();
        biwFloorHandler      = new BIWFloorHandler();
        biwCreatorController = new BIWCreatorController();

        var referencesController = BIWTestHelper.CreateReferencesControllerWithGenericMocks(
            biwActionController,
            entityHandler,
            biwFloorHandler,
            biwCreatorController
            );

        biwActionController.Init(referencesController);
        entityHandler.Init(referencesController);
        biwFloorHandler.Init(referencesController);
        biwCreatorController.Init(referencesController);

        biwActionController.EnterEditMode(scene);
        entityHandler.EnterEditMode(scene);
        biwFloorHandler.EnterEditMode(scene);
        biwCreatorController.EnterEditMode(scene);
    }
Exemple #4
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 CatalogItemsNfts()
    {
        BIWTestHelper.CreateNFT();

        Assert.AreEqual(DataStore.i.dataStoreBuilderInWorld.catalogItemDict.Count(), 1);
        Assert.AreEqual(DataStore.i.dataStoreBuilderInWorld.catalogItemPackDict.Count(), 1);
        Assert.AreEqual(BIWCatalogManager.GetCatalogItemPacksFilteredByCategories().Count, 1);
    }
Exemple #6
0
    protected override IEnumerator SetUp()
    {
        yield return(base.SetUp());

        scene = (ParcelScene)Environment.i.world.sceneController.CreateTestScene();
        TestHelpers.CreateSceneEntity(scene, ENTITY_ID);
        BIWCatalogManager.Init();
        BIWTestHelper.CreateNFT();
    }
Exemple #7
0
    protected override IEnumerator SetUp()
    {
        yield return(base.SetUp());

        var referencesController = BIWTestHelper.CreateReferencesControllerWithGenericMocks(InitialSceneReferences.i);

        gizmosController = new BIWGizmosController();
        gizmosController.Init(referencesController);
        gizmosController.EnterEditMode(scene);
    }
    protected override IEnumerator SetUp()
    {
        yield return(base.SetUp());

        entityHandler = new BIWEntityHandler();
        entityHandler.Init(BIWTestHelper.CreateMockUpReferenceController());

        TestHelpers.CreateSceneEntity(scene, ENTITY_ID);
        entityHandler.EnterEditMode(scene);
        entity = entityHandler.GetAllEntitiesFromCurrentScene().FirstOrDefault();
    }
Exemple #9
0
    public void FilterBySmartItemNoResult()
    {
        // Arrange
        BIWTestHelper.CreateTestCatalogLocalSingleObject();

        // Act
        biwSearchBarController.ChangeSmartItemFilter();

        // Assert
        Assert.AreEqual(0, biwSearchBarController.filterObjects.Count, "The number of filter objects does not match!");
    }
    protected override IEnumerator SetUp()
    {
        yield return(base.SetUp());

        gameObject = new GameObject();

        builderInWorldBridge = InitialSceneReferences.i.builderInWorldBridge;
        biwSaveController    = new BIWSaveController();
        biwSaveController.Init(BIWTestHelper.CreateReferencesControllerWithGenericMocks(InitialSceneReferences.i));
        biwSaveController.EnterEditMode(scene);
    }
    public void TestSmartItemComponentKernelUpdate()
    {
        //Arrange
        BIWEntity entity = BIWTestHelper.CreateSmartItemEntity(entityHandler, scene, null);

        //Act
        biwBridge.UpdateSmartItemComponent(entity, scene);

        //Assert
        CheckMessageReceived();
    }
Exemple #12
0
    public void FilterBySmartItem()
    {
        // Arrange
        BIWTestHelper.CreateTestSmartItemCatalogLocalSingleObject();

        // Act
        biwSearchBarController.ChangeSmartItemFilter();

        //TODO: SmartItems implement again the test after kernel implement smart items
        // Assert
        //Assert.AreEqual(1, biwSearchBarController.filterObjects.Count, "The number of filter objects does not match!");
    }
    protected override IEnumerator SetUp()
    {
        yield return(base.SetUp());

        entityHandler = new BIWEntityHandler();
        entityHandler.Init(BIWTestHelper.CreateMockUpReferenceController());
        entityHandler.EnterEditMode(scene);

        dummyGameObject = new GameObject();
        biwBridge       = Utils.GetOrCreateComponent <BuilderInWorldBridge>(dummyGameObject);

        WebInterface.OnMessageFromEngine += MessageReceived;
    }
Exemple #14
0
    public void FilterByCategory()
    {
        // Arrange
        string nameToFilter = "decorations";

        BIWTestHelper.CreateTestCatalogLocalSingleObject();

        // Act
        biwSearchBarController.FilterAssets(nameToFilter);

        // Assert
        Assert.AreEqual(1, biwSearchBarController.filterObjects.Count, "The number of filter objects does not match!");
    }
    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;
            }
        }
    }
    public void BuilderInWorldToggleFavorite()
    {
        BIWTestHelper.CreateTestCatalogLocalSingleObject();

        CatalogItem item = DataStore.i.dataStoreBuilderInWorld.catalogItemDict.GetValues()[0];

        FavoritesController favoritesController = new FavoritesController(new GameObject("_FavoritesController").AddComponent <CatalogGroupListView>());

        favoritesController.ToggleFavoriteState(item, null);
        Assert.IsTrue(item.IsFavorite());

        favoritesController.ToggleFavoriteState(item, null);
        Assert.IsFalse(item.IsFavorite());
    }
    public void LoadingGameObjectCreation()
    {
        //Arrange
        BIWCatalogManager.Init();
        BIWTestHelper.CreateTestCatalogLocalSingleObject();
        CatalogItem item = DataStore.i.dataStoreBuilderInWorld.catalogItemDict.GetValues()[0];

        //Act
        biwCreatorController.CreateCatalogItem(item);

        //Assert
        BIWEntity entity = entityHandler.GetAllEntitiesFromCurrentScene().FirstOrDefault();

        Assert.IsTrue(biwCreatorController.ExistsLoadingGameObjectForEntity(entity.rootEntity.entityId));
    }
    protected override IEnumerator SetUp()
    {
        yield return(base.SetUp());

        biwCreatorController = new BIWCreatorController();
        entityHandler        = new BIWEntityHandler();
        var referencesController = BIWTestHelper.CreateReferencesControllerWithGenericMocks(
            entityHandler,
            biwCreatorController
            );

        biwCreatorController.Init(referencesController);
        entityHandler.Init(referencesController);

        entityHandler.EnterEditMode(scene);
        biwCreatorController.EnterEditMode(scene);
    }
    public void CreateItem()
    {
        //Arrange
        BIWCatalogManager.Init();
        BIWTestHelper.CreateTestCatalogLocalSingleObject();
        CatalogItem item = DataStore.i.dataStoreBuilderInWorld.catalogItemDict.GetValues()[0];

        //Act
        biwCreatorController.CreateCatalogItem(item);

        //Assert
        foreach (BIWEntity entity in entityHandler.GetAllEntitiesFromCurrentScene())
        {
            Assert.IsTrue(entity.GetCatalogItemAssociated().id == item.id);
            Assert.AreEqual(Vector3.zero, entity.GetEulerRotation());
        }
    }
    public void ErrorGameObjectDestruction()
    {
        //Arrange
        BIWCatalogManager.Init();
        BIWTestHelper.CreateTestCatalogLocalSingleObject();
        CatalogItem item = DataStore.i.dataStoreBuilderInWorld.catalogItemDict.GetValues()[0];

        biwCreatorController.CreateCatalogItem(item);
        BIWEntity entity = entityHandler.GetAllEntitiesFromCurrentScene().FirstOrDefault();

        biwCreatorController.CreateErrorOnEntity(entity);

        //Act
        biwCreatorController.DeleteErrorOnEntity(entity);

        //Assert
        Assert.IsFalse(biwCreatorController.IsAnyErrorOnEntities());
    }
    public void BuilderInWorldQuickBar()
    {
        BIWTestHelper.CreateTestCatalogLocalSingleObject();
        CatalogItem item = DataStore.i.dataStoreBuilderInWorld.catalogItemDict.GetValues()[0];

        CatalogItemAdapter adapter = BIWTestHelper.CreateCatalogItemAdapter(gameObjectToUse);

        adapter.SetContent(item);

        CatalogAssetGroupAdapter groupAdapter = new GameObject("_CatalogAssetGroupAdapter").AddComponent <CatalogAssetGroupAdapter>();

        groupAdapter.SubscribeToEvents(adapter);

        CatalogGroupListView catalogGroupListView = new GameObject("_CatalogGroupListView").AddComponent <CatalogGroupListView>();

        catalogGroupListView.SubscribeToEvents(groupAdapter);
        catalogGroupListView.generalCanvas = Utils.GetOrCreateComponent <Canvas>(gameObjectToUse);
        SceneCatalogView sceneCatalogView = SceneCatalogView.Create();

        sceneCatalogView.catalogGroupListView = catalogGroupListView;
        SceneCatalogController sceneCatalogController = new SceneCatalogController();

        QuickBarView quickBarView = QuickBarView.Create();

        QuickBarController quickBarController = new QuickBarController();

        sceneCatalogController.Initialize(sceneCatalogView, quickBarController);
        quickBarController.Initialize(quickBarView, sceneCatalogController);
        int slots = quickBarController.GetSlotsCount();

        quickBarView.shortcutsImgs = new QuickBarSlot[slots];

        for (int i = 0; i < slots; i++)
        {
            quickBarController.SetIndexToDrop(i);
            adapter.AdapterStartDragging(null);
            quickBarController.SetQuickBarShortcut(item, i, new Texture2D(10, 10));
            Assert.AreEqual(item, quickBarController.QuickBarObjectSelected(i));
        }
    }
Exemple #22
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 CreateLastItem()
    {
        //Arrange
        BIWCatalogManager.Init();
        BIWTestHelper.CreateTestCatalogLocalSingleObject();
        CatalogItem item = DataStore.i.dataStoreBuilderInWorld.catalogItemDict.GetValues()[0];

        //Act
        biwCreatorController.CreateCatalogItem(item);
        biwCreatorController.CreateLastCatalogItem();

        //Assert
        int cont = 0;

        foreach (BIWEntity entity in entityHandler.GetAllEntitiesFromCurrentScene())
        {
            if (entity.GetCatalogItemAssociated().id == item.id)
            {
                cont++;
            }
        }
        Assert.AreEqual(cont, 2);
    }
    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);
    }