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);
        }
    }
    public void CatalogItemsSceneObject()
    {
        BIWTestHelper.CreateTestCatalogLocalSingleObject();

        Assert.AreEqual(DataStore.i.dataStoreBuilderInWorld.catalogItemDict.Count(), 1);
        Assert.AreEqual(DataStore.i.dataStoreBuilderInWorld.catalogItemPackDict.Count(), 1);
        Assert.AreEqual(BIWCatalogManager.GetCatalogItemPacksFilteredByCategories().Count, 1);
    }
Beispiel #3
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!");
    }
Beispiel #4
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 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));
    }
    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));
        }
    }
    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);
    }