33using NUnit . Framework ;
44using Unity . EditorCoroutines . Editor ;
55using Unity . FilmInternalUtilities ;
6+ using Unity . FilmInternalUtilities . Editor ;
67using UnityEngine ;
78using UnityEngine . Playables ;
89using Unity . StreamingImageSequence . Editor ;
@@ -32,6 +33,7 @@ public IEnumerator CreatePlayableAsset() {
3233
3334//----------------------------------------------------------------------------------------------------------------------
3435 [ UnityTest ]
36+ [ UnityPlatform ( RuntimePlatform . OSXEditor , RuntimePlatform . WindowsEditor ) ]
3537 public IEnumerator UpdateRenderCachePNGInStreamingAssets ( ) {
3638 PlayableDirector director = EditorUtilityTest . NewSceneWithDirector ( ) ;
3739 TimelineClip clip = EditorUtilityTest . CreateTestRenderCacheTimelineClip ( director ) ;
@@ -58,25 +60,21 @@ public IEnumerator UpdateRenderCachePNGInStreamingAssets() {
5860 //Update RenderCache
5961 EditorCoroutineUtility . StartCoroutineOwnerless (
6062 RenderCachePlayableAssetInspector . UpdateRenderCacheCoroutine ( director , renderCachePlayableAsset )
61- ) ;
63+ ) ;
64+
65+ Assert . IsTrue ( Directory . Exists ( OUTPUT_FOLDER ) ) ;
6266
6367 //A hack to wait until the coroutine is finished
64- const float TIMEOUT_SEC = 3.0f ;
65- Assert . IsTrue ( Directory . Exists ( OUTPUT_FOLDER ) ) ;
66- float prevTime = Time . realtimeSinceStartup ;
67- while ( Time . realtimeSinceStartup - prevTime < TIMEOUT_SEC ) {
68- yield return null ;
69- }
68+ const int TIMEOUT_FRAMES = 60 * 3 ;
69+ yield return YieldEditorUtility . WaitForFramesAndIncrementUndo ( TIMEOUT_FRAMES ) ;
70+
7071
7172 string imageFilePath = renderCachePlayableAsset . GetImageFilePath ( 0 ) ;
7273 Assert . IsTrue ( File . Exists ( imageFilePath ) ) ;
7374 ImageLoader . RequestLoadFullImage ( imageFilePath ) ;
7475
7576 //Another hack to wait until the load is finished
76- prevTime = Time . realtimeSinceStartup ;
77- while ( Time . realtimeSinceStartup - prevTime < TIMEOUT_SEC ) {
78- yield return null ;
79- }
77+ yield return YieldEditorUtility . WaitForFramesAndIncrementUndo ( TIMEOUT_FRAMES ) ;
8078
8179 ImageLoader . GetImageDataInto ( imageFilePath , StreamingImageSequenceConstants . IMAGE_TYPE_FULL , out ImageData imageData ) ;
8280 Assert . AreEqual ( StreamingImageSequenceConstants . READ_STATUS_SUCCESS , imageData . ReadStatus ) ;
0 commit comments