Esempio n. 1
0
        public IEnumerator QueuePreviewImageLoadTask()
        {
            EditorUpdateManager.ResetImageLoading();
            const string PKG_PATH = "Packages/com.unity.streaming-image-sequence/Tests/Data/png/A_00000.png";
            string       fullPath = Path.GetFullPath(PKG_PATH);

            Assert.IsTrue(File.Exists(fullPath));

            //Loading preview type would also load the full type
            const int IMAGE_TYPE = C.IMAGE_TYPE_PREVIEW;

            AssertReadStatus(fullPath, IMAGE_TYPE, C.READ_STATUS_UNAVAILABLE, "Texture is already available ?");

            const int WIDTH  = 256;
            const int HEIGHT = 128;

            ImageLoader.RequestLoadPreviewImage(fullPath, WIDTH, HEIGHT);
            yield return(new WaitForSeconds(LOAD_TIMEOUT));

            ImageData r = AssertReadStatus(fullPath, IMAGE_TYPE, C.READ_STATUS_SUCCESS, "Loading texture is not successful.");

            Assert.AreEqual(WIDTH, r.Width);
            Assert.AreEqual(HEIGHT, r.Height);

            ResetAndAssert(fullPath, IMAGE_TYPE);
        }
        public IEnumerator QueueFullImageLoadTask()
        {
            EditorUpdateManager.ResetImageLoading();
            const string PKG_PATH = "Packages/com.unity.streaming-image-sequence/Tests/Data/png/A_00000.png";
            string       fullPath = Path.GetFullPath(PKG_PATH);

            Assert.IsTrue(File.Exists(fullPath));

            const int IMAGE_TYPE = StreamingImageSequenceConstants.IMAGE_TYPE_FULL;

            ImageLoader.GetImageDataInto(fullPath, IMAGE_TYPE, out ImageData readResult);
            Assert.AreEqual(StreamingImageSequenceConstants.READ_STATUS_UNAVAILABLE, readResult.ReadStatus,
                            "Texture is already or currently being loaded"
                            );

            ImageLoader.RequestLoadFullImage(fullPath);
            yield return(new WaitForSeconds(LOAD_TIMEOUT));

            ImageLoader.GetImageDataInto(fullPath, IMAGE_TYPE, out readResult);
            Assert.AreEqual(StreamingImageSequenceConstants.READ_STATUS_SUCCESS, readResult.ReadStatus,
                            "Loading texture is not successful."
                            );

            AssertUnloaded(fullPath, IMAGE_TYPE);
            ResetAndAssert(fullPath, IMAGE_TYPE);
        }
Esempio n. 3
0
        public IEnumerator LoadUnavailableImages()
        {
            EditorUpdateManager.ResetImageLoading();
            const string PKG_PATH = "ThisImageDoesNotExist.png";
            string       fullPath = Path.GetFullPath(PKG_PATH);

            Assert.IsFalse(File.Exists(fullPath));

            ImageLoader.RequestLoadFullImage(fullPath);
            yield return(new WaitForSeconds(LOAD_TIMEOUT));

            ImageLoader.RequestLoadPreviewImage(fullPath, /*width= */ 256, /* height= */ 128);
            yield return(new WaitForSeconds(LOAD_TIMEOUT));

            AssertReadStatus(fullPath, C.IMAGE_TYPE_FULL, C.READ_STATUS_FAIL, "Unavailable texture was loaded.");
            AssertReadStatus(fullPath, C.IMAGE_TYPE_PREVIEW, C.READ_STATUS_UNAVAILABLE,
                             "The preview was loaded even though the full version failed.");

            ResetAndAssert(fullPath, C.IMAGE_TYPE_PREVIEW);
            ResetAndAssert(fullPath, C.IMAGE_TYPE_FULL);
        }
Esempio n. 4
0
        public IEnumerator QueueFullImageLoadTask()
        {
            EditorUpdateManager.ResetImageLoading();
            const string PKG_PATH = "Packages/com.unity.streaming-image-sequence/Tests/Data/png/A_00000.png";
            string       fullPath = Path.GetFullPath(PKG_PATH);

            Assert.IsTrue(File.Exists(fullPath));

            const int IMAGE_TYPE = C.IMAGE_TYPE_FULL;

            AssertReadStatus(fullPath, IMAGE_TYPE, C.READ_STATUS_UNAVAILABLE, "Texture is already available ?");

            ImageLoader.RequestLoadFullImage(fullPath);
            yield return(new WaitForSeconds(LOAD_TIMEOUT));

            AssertReadStatus(fullPath, IMAGE_TYPE, C.READ_STATUS_SUCCESS, "Loading texture is not successful.");


            AssertUnloaded(fullPath, IMAGE_TYPE);
            ResetAndAssert(fullPath, IMAGE_TYPE);
        }
 private static void Reset()
 {
     EditorUpdateManager.ResetImageLoading();
     PreviewTextureFactory.Reset();
 }