Ejemplo n.º 1
0
        public IEnumerator LoadLibraryAsync_LoadFailed_LibraryLoadedReturnsFalse()
        {
            mtlLibrary.ContentLoader = FakeContentLoaderFactory.CreateFakeFailLoader <string>();

            LogAssert.Expect(LogType.Error, new Regex(@"\w*This is a simulated fail\w*"));

            Task task = LoadLibrary();

            yield return(AsyncTest.WaitForTask(task));

            bool loaded = mtlLibrary.LibraryLoaded(libraryName);

            Assert.IsFalse(loaded, "The import should have aborted but apparently, the library is shown as imported");
        }
Ejemplo n.º 2
0
        public IEnumerator FetchTextureAsync_WebRequestFailed_ReturnsNull()
        {
            TextureConstructor textureConstructor = new TextureConstructor(loadPath);

            textureConstructor.TextureLoader = FakeContentLoaderFactory.CreateFakeFailLoader <Texture2D>();

            LogAssert.Expect(LogType.Error, new Regex(@"\w*This is a simulated fail\w*"));

            Task <Texture2D> task = textureConstructor.FetchTextureAsync();

            yield return(AsyncTest.WaitForTask(task));

            Texture2D res = task.Result;

            Assert.Null(res);
        }
Ejemplo n.º 3
0
        public IEnumerator ImportAsync_WebRequestFailed_ReturnNull()
        {
            ObjImporter     objImporter    = new ObjImporter();
            IServiceManager serviceManager = A.Fake <IServiceManager>();

            objImporter.Initialize(serviceManager);
            objImporter.ContentLoader = FakeContentLoaderFactory.CreateFakeFailLoader <string>();

            LogAssert.Expect(LogType.Error, new Regex(@"\w*Error fetching obj. No object imported\w*"));

            Task <GameObject> task = objImporter.ImportAsync("http://test.org/test.obj");

            yield return(AsyncTest.WaitForTask(task));

            GameObject res = task.Result;

            Assert.Null(res);
        }
Ejemplo n.º 4
0
        public IEnumerator ImportAsync_ObjFetchSuccessMtlFetchFail_CreateObjectWithDefaultMat()
        {
            ObjImporter objImporter = SetUpObjImporter(cubeObj, "");

            objImporter.MtlLibrary.ContentLoader = FakeContentLoaderFactory.CreateFakeFailLoader <string>();

            LogAssert.Expect(LogType.Error, new Regex(@"\w*This is a simulated fail\w*"));
            LogAssert.Expect(LogType.Error, new Regex(@"\w*Could not load .mtl file\w*"));

            Task <GameObject> task = objImporter.ImportAsync("http://test.org/test.obj");

            yield return(AsyncTest.WaitForTask(task));

            GameObject res = task.Result;

            Assert.NotNull(res);
            Assert.AreEqual(1, res.transform.childCount);
            MeshRenderer mr = res.transform.GetChild(0).GetComponent <MeshRenderer>();

            Assert.AreEqual("New Material", mr.sharedMaterial.name);
        }