コード例 #1
0
        public void AssetBundleLoadPathsCorrectForGetLoadInfo(string internalId, bool isLocal, bool useUnityWebRequestForLocalBundles)
        {
            if (internalId.StartsWith("jar") && Application.platform != RuntimePlatform.Android)
            {
                Assert.Ignore($"Skipping test {TestContext.CurrentContext.Test.Name} due jar based tests are only for running on Android Platform.");
            }

            var loc = new ResourceLocationBase("dummy", internalId, "dummy", typeof(Object));

            loc.Data = new AssetBundleRequestOptions {
                UseUnityWebRequestForLocalBundles = useUnityWebRequestForLocalBundles
            };
            ProviderOperation <Object> op = new ProviderOperation <Object>();

            op.Init(m_Addressables.ResourceManager, null, loc, new AsyncOperationHandle <IList <AsyncOperationHandle> >());
            ProvideHandle h = new ProvideHandle(m_Addressables.ResourceManager, op);

            AssetBundleResource.GetLoadInfo(h, out AssetBundleResource.LoadType loadType, out string path);
            var expectedLoadType = isLocal ? useUnityWebRequestForLocalBundles ? AssetBundleResource.LoadType.Web : AssetBundleResource.LoadType.Local : AssetBundleResource.LoadType.Web;

            Assert.AreEqual(expectedLoadType, loadType, "Incorrect load type found for internalId " + internalId);
            var expectedPath = internalId;

            if (isLocal && useUnityWebRequestForLocalBundles)
            {
                expectedPath = internalId.StartsWith("jar") ? internalId : "file:///" + Path.GetFullPath(internalId);
            }
            Assert.AreEqual(expectedPath, path);
        }
コード例 #2
0
        public void AssetDatabaseProvider_LoadAssetAtPath_WhenNotInAssetDatabase_DoesNotThrow()
        {
            var loc = new ResourceLocationBase("name", "id", "providerId", typeof(object));
            ProviderOperation <Object> op = new ProviderOperation <Object>();

            op.Init(m_ResourceManager, null, loc, new AsyncOperationHandle <IList <AsyncOperationHandle> >());
            ProvideHandle handle = new ProvideHandle(m_ResourceManager, op);

            Assert.DoesNotThrow(() => AssetDatabaseProvider.LoadAssetAtPath("doesnotexist", handle));
        }
コード例 #3
0
        public void BundledCatalog_WhenRequestingRemoteCatalog_CanLoadCatalogFromBundle_ReturnsExpectedResult(string internalId, bool result)
        {
            var loc = new ResourceLocationBase(internalId, internalId, typeof(ContentCatalogProvider).FullName, typeof(IResourceLocator));
            ProviderOperation <Object> op = new ProviderOperation <Object>();

            op.Init(m_Addressables.ResourceManager, null, loc, new AsyncOperationHandle <IList <AsyncOperationHandle> >());
            ProvideHandle handle = new ProvideHandle(m_Addressables.ResourceManager, op);

            bool loadCatalogFromLocalBundle = new ContentCatalogProvider.InternalOp().CanLoadCatalogFromBundle(internalId, handle.Location);

            Assert.AreEqual(result, loadCatalogFromLocalBundle);
        }
コード例 #4
0
        public void BundledCatalog_WhenRequestingLocalCatalog_CanLoadCatalogFromBundle_ReturnsTrue()
        {
            string internalId             = Path.Combine(Addressables.RuntimePath, m_RuntimeCatalogFilename);
            var    loc                    = new ResourceLocationBase(internalId, internalId, typeof(ContentCatalogProvider).FullName, typeof(IResourceLocator));
            ProviderOperation <Object> op = new ProviderOperation <Object>();

            op.Init(m_Addressables.ResourceManager, null, loc, new AsyncOperationHandle <IList <AsyncOperationHandle> >());
            ProvideHandle handle = new ProvideHandle(m_Addressables.ResourceManager, op);

            bool loadCatalogFromLocalBundle = new ContentCatalogProvider.InternalOp().CanLoadCatalogFromBundle(internalId, handle.Location);

            Assert.IsTrue(loadCatalogFromLocalBundle);
        }