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); }
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)); }
private static PSResourceProviderOperation ToPSResourceProviderOperation(ProviderOperation operation, string provider, string resource = null) { PSResourceProviderOperation psOperation = new PSResourceProviderOperation(); psOperation.Operation = operation.Name; psOperation.OperationName = operation.DisplayName; psOperation.Description = operation.Description; psOperation.ProviderNamespace = provider; psOperation.ResourceName = resource ?? string.Empty; return(psOperation); }
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); }
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); }
public void ProviderOperation_PercentComplete_DoesNotDecreaseAfterPercentCallbackIsSet() { var providerOp = new ProviderOperation <GameObject>(); providerOp.m_DepOp = new AsyncOperationHandle <IList <AsyncOperationHandle> >(); providerOp.m_DepOp.m_InternalOp = new ProviderOperation <IList <AsyncOperationHandle> >(); providerOp.m_DepOp.m_InternalOp.Result = new List <AsyncOperationHandle>(); providerOp.m_DepOp.m_InternalOp.Result.Add(new ManualPercentCompleteOperation(1.0f).Handle); Assert.AreEqual(0.5f, providerOp.PercentComplete); providerOp.SetProgressCallback(() => 0.5f); Assert.AreEqual(0.75f, providerOp.PercentComplete); }
private static bool IsUserOperation(ProviderOperation operation) { return(operation.Origin == null || operation.Origin.Contains("user")); }
private static bool IsUserOperation(ProviderOperation operation) { return(operation.Origin == null || operation.Origin.IndexOf("user", StringComparison.OrdinalIgnoreCase) > -1); }