From caf287ce83b8b62fa11206e6b428a3ae175804c5 Mon Sep 17 00:00:00 2001 From: alexiscatnip Date: Wed, 3 Aug 2022 01:01:15 +0800 Subject: [PATCH] test: deprecate DeleteLocalCacheFiles(). We used to do the files-check-and-copy on the every bootstrap_scene load, which is compatible with this method. We are now only checking the staticAssets integrity once during startup. Thus this method is deprecated and incompatible. --- .../StaticAssetsCopierTests.cs | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Assets/Tests/Raindrop/RaindropIntegrationTests/StaticAssetsCopierTests.cs b/Assets/Tests/Raindrop/RaindropIntegrationTests/StaticAssetsCopierTests.cs index 9adb0ad..20de796 100644 --- a/Assets/Tests/Raindrop/RaindropIntegrationTests/StaticAssetsCopierTests.cs +++ b/Assets/Tests/Raindrop/RaindropIntegrationTests/StaticAssetsCopierTests.cs @@ -1,11 +1,11 @@ -using System.Collections; +using System; +using System.Collections; using System.IO; using Disk; using NUnit.Framework; using OpenMetaverse; using Raindrop.Bootstrap; using UnityEngine; -using UnityEngine.SceneManagement; using UnityEngine.TestTools; namespace Tests.Raindrop.RaindropIntegrationTests @@ -17,19 +17,20 @@ namespace Tests.Raindrop.RaindropIntegrationTests [UnityTest] public IEnumerator StaticAssets_MainSceneOnBoot_AreCopied() { - // 1. delete any files in the local cache folder - DeleteLocalCacheFiles(); - - // 2. start main scene, which includes the startupCopier + // startupCopier will run on App boot-up, but we load scene anyway. RaindropLoader.Load(); //wait for abit... - yield return new WaitForSeconds(10); + yield return new WaitForSeconds(5); - string expectedToExist = Path.Combine(DirectoryHelpers.GetInternalStorageDir(), - "grids.xml"); + string expectedToExist = + Path.Combine( + DirectoryHelpers.GetInternalStorageDir(), + "grids.xml"); - Assert.True(File.Exists(expectedToExist),"file not exist: " + expectedToExist); + Assert.True( + File.Exists(expectedToExist), + "file not exist: " + expectedToExist); // 3. don't forget to unload the scene! RaindropLoader.Unload(); @@ -37,6 +38,8 @@ namespace Tests.Raindrop.RaindropIntegrationTests yield break; } + [Obsolete] + // DO NOT use me! only use if your asset-checking is on-scene-load. public static void DeleteLocalCacheFiles() { System.IO.DirectoryInfo localCacheFolder