コード例 #1
0
        public void TestSetMainSceneInBuild()
        {
            var emptyScene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene);

            LoadingScreenGenerator.SetMainSceneInBuild(emptyScene.path);

            var scenesWithOurPath = Array.FindAll(EditorBuildSettings.scenes, (scene) => scene.path == emptyScene.path);

            Assert.AreEqual(scenesWithOurPath.Length, 1,
                            "The scene should be present in Build Settings once and only once");

            Assert.IsTrue(scenesWithOurPath[0].enabled,
                          "The scene should be enabled");

            foreach (var scene in EditorBuildSettings.scenes)
            {
                if (scene.path == emptyScene.path)
                {
                    continue;
                }

                Assert.IsFalse(scene.enabled,
                               "All other scenes should be disabled");
            }
        }
コード例 #2
0
        public void TestAddLoadingScreenScript()
        {
            var loadingScreenGameObject = new GameObject(TestGameObjectName);

            LoadingScreenGenerator.AddScript(loadingScreenGameObject);
            Assert.IsNotNull(loadingScreenGameObject.GetComponent <LoadingScreenScript>(),
                             "A script should be attached to the loading screen object.");
        }
コード例 #3
0
        public void TestSetMainSceneInBuild()
        {
            var scene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene);

            LoadingScreenGenerator.SetMainSceneInBuild(scene.path);

            Assert.AreEqual(EditorBuildSettings.scenes.Length, 1,
                            "There should be only one scene in Build Settings.");

            Assert.AreEqual(EditorBuildSettings.scenes[0].path, scene.path,
                            "The new scene built should be identical to the one in Build Settings.");
        }
コード例 #4
0
        public void TestAddLoadingScreenImage()
        {
            const string testImage = "example.png";

            // Create an empty test file by immediately closing the FileStream returned by File.Create().
            using (File.Create(testImage));

            var loadingScreenGameObject = new GameObject(TestGameObjectName);

            LoadingScreenGenerator.AddImageToScene(loadingScreenGameObject, testImage);

            Assert.IsNotNull(loadingScreenGameObject.GetComponent <Canvas>(),
                             "A canvas component should have been added to the loading screen game object.");
            Assert.IsNotNull(loadingScreenGameObject.GetComponent <Image>(),
                             "An image component should have been added to the loading screen game object.");
        }
コード例 #5
0
 public void TestFindReplayButtonSprite()
 {
     Assert.IsNotNull(LoadingScreenGenerator.FindReplayButtonSprite());
 }
コード例 #6
0
 public void TestPopulateScene()
 {
     LoadingScreenGenerator.PopulateScene(null, "https://www.validAssetBundleUrl.com");
     Assert.IsNotNull(Object.FindObjectOfType <LoadingScreen.LoadingScreen>(),
                      "A LoadingScreen component should be present in the populated scene");
 }