public void ResourcesEntry_AddsCorrectTreeViewItem_ForSubobjects()
        {
            using (new HideResourceFoldersScope())
            {
                //Setup
                string assetPath = "SubFolder/Cube.prefab";
                int    builtInPackagesResourcesCount = ResourcesTestUtility.GetResourcesEntryCount(Settings, true);
                CreatePrefabInResourcesSubFolder(assetPath);
                AddressableAssetEntryTreeView treeView = new AddressableAssetEntryTreeView(
                    new TreeViewState(),
                    new MultiColumnHeaderState(new MultiColumnHeaderState.Column[1]),
                    new AddressableAssetsSettingsGroupEditor(new AddressableAssetsWindow()));

                //Test
                AddressableAssetEntry  entry        = Settings.FindAssetEntry("Resources");
                AssetEntryTreeViewItem treeViewItem = new AssetEntryTreeViewItem(entry, 0);
                treeView.RecurseEntryChildren(entry, treeViewItem, 0);

                //Assert
                Assert.AreEqual(1 + builtInPackagesResourcesCount, treeViewItem.children.Count);
                Assert.AreEqual(assetPath.Replace(".prefab", ""), treeViewItem.children[0].displayName);

                //Cleanup
                AssetDatabase.DeleteAsset("Assets/Resources/");
            }
        }
Beispiel #2
0
        public void AddressableAssetWindow_RemoveGroup_GroupGetsRemovedCorrectly()
        {
            var group = Settings.CreateGroup("RemoveMeGroup", false, false, true, new List <AddressableAssetGroupSchema>());
            AddressableAssetEntryTreeView treeView = new AddressableAssetEntryTreeView(Settings);

            treeView.RemoveGroupImpl(new List <AssetEntryTreeViewItem>()
            {
                new AssetEntryTreeViewItem(group, 1)
            }, true);
            Assert.IsNull(Settings.FindGroup("RemoveMeGroup"));
        }
Beispiel #3
0
        public void AddressableAssetWindow_RemoveMissingReferences_RemovesAllNullReferences()
        {
            Settings.groups.Add(null);
            Settings.groups.Add(null);

            AddressableAssetEntryTreeView treeView = new AddressableAssetEntryTreeView(Settings);

            treeView.RemoveMissingReferencesImpl();
            foreach (var group in Settings.groups)
            {
                Assert.IsNotNull(group);
            }
        }
Beispiel #4
0
        public void AddressableAssetWindow_RemovedEntries_AreNoLongerPresent()
        {
            var entry = Settings.CreateOrMoveEntry(m_AssetGUID, Settings.DefaultGroup);

            AddressableAssetEntryTreeView treeView = new AddressableAssetEntryTreeView(Settings);

            treeView.RemoveEntryImpl(new List <AssetEntryTreeViewItem>()
            {
                new AssetEntryTreeViewItem(entry, 1)
            }, true);

            Assert.IsNull(Settings.FindAssetEntry(m_AssetGUID));
        }
Beispiel #5
0
        public void AddressableAssetWindow_SetDefaultGroup_SetsTheSpecifiedGroupToDefault()
        {
            var savedDefaultGroup = Settings.DefaultGroup;
            var newDefaultGroup   = Settings.CreateGroup("NewDefaultGroup", false, false, true, new List <AddressableAssetGroupSchema>());
            AddressableAssetEntryTreeView treeView = new AddressableAssetEntryTreeView(Settings);

            treeView.SetGroupAsDefault(new List <AssetEntryTreeViewItem>()
            {
                new AssetEntryTreeViewItem(newDefaultGroup, 1)
            });

            Assert.AreEqual(newDefaultGroup, Settings.DefaultGroup);

            Settings.DefaultGroup = savedDefaultGroup;
            Settings.RemoveGroup(newDefaultGroup);
        }
Beispiel #6
0
        public void AddressableAssetWindow_SimplifyAddress_ReturnsFileNameOnly()
        {
            string assetPath = AssetDatabase.GUIDToAssetPath(m_AssetGUID);
            var    entry     = Settings.CreateOrMoveEntry(m_AssetGUID, Settings.DefaultGroup);

            Assert.AreEqual(assetPath, entry.address);

            AddressableAssetEntryTreeView treeView = new AddressableAssetEntryTreeView(Settings);

            treeView.SimplifyAddressesImpl(new List <AssetEntryTreeViewItem>()
            {
                new AssetEntryTreeViewItem(entry, 1)
            });

            Assert.AreEqual(Path.GetFileNameWithoutExtension(assetPath), entry.address);
        }
        AddressableAssetEntryTreeView CreateExpandedTree()
        {
            var tree = new AddressableAssetEntryTreeView(m_Settings);

            tree.Reload();
            var count = tree.GetRows().Count;

            tree.ExpandAll();
            while (count != tree.GetRows().Count)
            {
                tree.Reload();
                count = tree.GetRows().Count;
                tree.ExpandAll();
            }

            return(tree);
        }
        public void CopyAddressesToClipboard_Simple()
        {
            List <AssetEntryTreeViewItem> nodesToSelect = new List <AssetEntryTreeViewItem>();

            AddressableAssetEntry entry1 = new AddressableAssetEntry("0001", "address1", null, false);

            nodesToSelect.Add(new AssetEntryTreeViewItem(entry1, 0));

            //Save users previous clipboard so it doesn't get eaten during test
            string previousClipboard = GUIUtility.systemCopyBuffer;

            AddressableAssetEntryTreeView.CopyAddressesToClipboard(nodesToSelect);

            string result = GUIUtility.systemCopyBuffer;

            GUIUtility.systemCopyBuffer = previousClipboard;

            Assert.AreEqual("address1", result, "Entry's address was incorrectly copied.");
        }