void Update() { if (UpdateCount == 0) { IntegrationTest.Assert(_mouse_over.MouseOver == false); } else if (UpdateCount == 1) { Vector3 middle_of_screen = new Vector3(Screen.width * 0.5f, Screen.height * 0.5f, 0.0f); UnityBridge.Instance.OverrideMousePosition(true, middle_of_screen); } else if (UpdateCount == 2) { IntegrationTest.Assert(_mouse_over.MouserOverPreviousFrame == false); IntegrationTest.Assert(_mouse_over.MouseOver == true); } else if (UpdateCount == 3) { Vector3 left_of_screen = new Vector3(Screen.width * 0.25f, Screen.height * 0.5f, 0.0f); UnityBridge.Instance.OverrideMousePosition(true, left_of_screen); } else if (UpdateCount == 4) { IntegrationTest.Assert(_mouse_over.MouserOverPreviousFrame == true); IntegrationTest.Assert(_mouse_over.MouseOver == false); Destroy(_card); IntegrationTest.Pass(gameObject); } UpdateCount++; }
protected override IEnumerator Run() { GameObject jauntPlayer = GameObject.Find("JauntPlayer"); GameObject jauntPlayerPrefab = PrefabUtility.GetPrefabParent(jauntPlayer) as GameObject; jauntPlayerPrefab = Instantiate(jauntPlayerPrefab); yield return(null); bool success = TestUtilities.CompareObjectToPrefab(jauntPlayer, jauntPlayerPrefab); IntegrationTest.Assert(success, "JauntPlayer instance does not match prefab"); GameObject jauntAutoplay = GameObject.Find("JauntAutoplay"); GameObject jauntAutoplayPrefab = PrefabUtility.GetPrefabParent(jauntAutoplay) as GameObject; jauntAutoplayPrefab = Instantiate(jauntAutoplayPrefab); yield return(null); success = TestUtilities.CompareObjectToPrefab(jauntAutoplay, jauntAutoplayPrefab); IntegrationTest.Assert(success, "JauntAutoplay instance does not match prefab"); Destroy(jauntPlayerPrefab); Destroy(jauntAutoplayPrefab); //These newly instantiated objects roll over to the next test if not cleaned up yield return(null); }
protected override IEnumerator Run() { //Check that the JauntPlayer object only has the JauntPlayer script and the Transform component GameObject jauntPlayerObj = GameObject.Find("JauntPlayer"); IntegrationTest.Assert(jauntPlayerObj != null); JauntPlayer jauntPlayer = jauntPlayerObj.GetComponent(typeof(JauntPlayer)) as JauntPlayer; IntegrationTest.Assert(jauntPlayer != null, "Jaunt Player is null!"); Destroy(jauntPlayerObj.GetComponent(typeof(JauntPlayer))); yield return(null); int numComponents = jauntPlayerObj.GetComponents(typeof(Component)).Length; IntegrationTest.Assert(numComponents == 1, "Number of JauntPlayer components is " + numComponents + ", should be 1"); //Only the transform component should be left //Check that the AutoPlayer object only has the AutoPlayer script and the Transform component GameObject jauntAutoplayObj = GameObject.Find("JauntAutoplay"); IntegrationTest.Assert(jauntAutoplayObj != null); JauntAutoplay jauntAutoplay = jauntAutoplayObj.GetComponent(typeof(JauntAutoplay)) as JauntAutoplay; IntegrationTest.Assert(jauntAutoplay != null, "JauntAutoplay is null!"); Destroy(jauntAutoplayObj.GetComponent(typeof(JauntAutoplay))); yield return(null); numComponents = jauntPlayerObj.GetComponents(typeof(Component)).Length; IntegrationTest.Assert(numComponents == 1, "Number of JauntAutoplay components is " + numComponents + ", should be 1"); yield return(null); }
void OnBlockEnd(Block block) { IntegrationTest.Assert(started); IntegrationTest.Assert(commandExecuted); IntegrationTest.Pass(); }
private IEnumerator Start() { IScanner scanner = new Scanner(); tweaker = new Tweaker(); TweakerOptions options = TweakerOptions.GetDefaultWithAdditionalFlags(TweakerOptionFlags.IncludeTests); tweaker.Init(options, scanner); AutoTweakable.Manager = tweaker.Tweakables; new TestClass(disposeTweakable: false); ITweakable tweakable = tweaker.Tweakables.GetTweakable(new SearchOptions("TestClass.AutoInt#")); IntegrationTest.Assert(tweakable != null); uint counter = 0u; while (tweaker.Tweakables.GetTweakable(new SearchOptions("TestClass.AutoInt#")) != null) { GC.Collect(); counter++; if (counter > 1000) { IntegrationTest.Fail("Failed to finalize AutoTweakable after " + counter + " frames."); yield break; } yield return(null); } IntegrationTest.Pass(); }
void Start() { CoroutineQueue queue = new CoroutineQueue(); IntegrationTest.Assert(queue.Empty == true); IntegrationTest.Pass(gameObject); }
void Start() { MatchInfo match = new MatchInfo(); match.PlayerGoesFirst = true; match.PlayerDeckCards = new string[2] { "simplecard", "simplecard" }; match.EnemyDeckCards = new string[1] { "simplecard" }; match.PlayerStartingHandCards = new string[1] { "simplecard" }; match.EnemyStartingHandCards = new string[2] { "simplecard", "simplecard" }; GameManager.Instance.StartMatch(match); IntegrationTest.Assert(GameManager.Instance.PlayerHand != null); IntegrationTest.Assert(GameManager.Instance.PlayerDeck != null); IntegrationTest.Assert(GameManager.Instance.EnemyDeck != null); IntegrationTest.Assert(GameManager.Instance.EnemyHand != null); IntegrationTest.Assert(GameManager.Instance.Settings != null); IntegrationTest.Assert(GameManager.Instance.PlayerDeck.Cards.Count == 1); IntegrationTest.Assert(GameManager.Instance.EnemyDeck.Cards.Count == 1); IntegrationTest.Assert(GameManager.Instance.PlayerHand.Cards.Count == 1); IntegrationTest.Assert(GameManager.Instance.EnemyHand.Cards.Count == 2); }
void Update() { if (UpdateCount == 0) { IntegrationTest.Assert(_outline.WantedColor.a <= 0.0f); } else if (UpdateCount == 1) { _outline.Request(this, Color.red); } else if (UpdateCount == 2) { IntegrationTest.Assert(_outline.WantedColor == Color.red); _outline.Request(_outline, Color.black); } else if (UpdateCount == 3) { IntegrationTest.Assert(_outline.WantedColor == Color.red); _outline.Revoke(this); } else if (UpdateCount == 4) { IntegrationTest.Assert(_outline.WantedColor == Color.black); Destroy(_card); IntegrationTest.Pass(gameObject); } UpdateCount++; }
void Update() { if (UpdateCount == 0) { IntegrationTest.Assert(GameManager.Instance.PlayerDeck.Cards.Count == 2); GameManager.Instance.StartPlayerTurn(); } else if (UpdateCount == 1) { IntegrationTest.Assert(GameManager.Instance.PlayerDeck.Cards.Count == 1); GameManager.Instance.StartPlayerTurn(); } else if (UpdateCount == 2) { IntegrationTest.Assert(GameManager.Instance.PlayerDeck.Cards.Count == 1); GameManager.Instance.CleanUpMatch(); } else if (UpdateTime >= 1.5f) { IntegrationTest.Pass(gameObject); } UpdateTime += Time.deltaTime; UpdateCount++; }
void Update() { IntegrationTest.Assert(card.GetComponent <HasPhysicalCard>().PhysicalCardGO != null); IntegrationTest.Assert(card.GetComponent <HasOutline>().OutlineGO != null); Destroy(card); IntegrationTest.Pass(gameObject); }
private IEnumerator TestEmojiInText(Text textComponent, string emojiString) { chatInputField.text = emojiString; yield return(null); IntegrationTest.Assert(textComponent.preferredWidth > 0f, "Failed for emojiString: " + emojiString); }
void OnCommandExecute(Block block, Command command, int commandIndex, int maxCommandIndex) { IntegrationTest.Assert(commandIndex == 0); IntegrationTest.Assert(maxCommandIndex == 1); IntegrationTest.Assert(command.GetType() == typeof(Wait)); commandExecuted = true; }
private IEnumerator TestFaderObjectRemoval() { yield return(new WaitForFixedUpdate()); IntegrationTest.Assert(GameObject.Find("Fade") == null, "Fader game object should be removed at the end of fading"); IntegrationTest.Pass(); }
protected override IEnumerator runTest() { BundleMount bundleMount = loadAndMount("DependencyBundlesTest/main.unity3d", null, isDependency: false); BundleMount bundleMount2 = loadAndMount("DependencyBundlesTest/dep1.unity3d", new HashSet <BundleMount> { bundleMount }, isDependency: true); BundleMount bundleMount3 = loadAndMount("DependencyBundlesTest/dep2.unity3d", new HashSet <BundleMount> { bundleMount2, bundleMount }, isDependency: true); bundleMount.IsPinned = true; IntegrationTest.Assert(bundleMount.IsPinned, "DependencyBundlesTest/main.unity3d"); IntegrationTest.Assert(bundleMount2.IsPinned, "DependencyBundlesTest/dep1.unity3d"); IntegrationTest.Assert(bundleMount3.IsPinned, "DependencyBundlesTest/dep2.unity3d"); bundleMount.IsPinned = false; IntegrationTest.Assert(!bundleMount.IsPinned, "DependencyBundlesTest/main.unity3d"); IntegrationTest.Assert(bundleMount2.IsPinned, "DependencyBundlesTest/dep1.unity3d"); IntegrationTest.Assert(bundleMount3.IsPinned, "DependencyBundlesTest/dep2.unity3d"); bundleMount3.IsPinned = true; IntegrationTest.Assert(!bundleMount.IsPinned, "DependencyBundlesTest/main.unity3d"); IntegrationTest.Assert(bundleMount2.IsPinned, "DependencyBundlesTest/dep1.unity3d"); IntegrationTest.Assert(bundleMount3.IsPinned, "DependencyBundlesTest/dep2.unity3d"); bundleMount.Unload(unloadAllLoadedObjects: true); bundleMount2.Unload(unloadAllLoadedObjects: true); bundleMount3.Unload(unloadAllLoadedObjects: true); yield break; }
protected override IEnumerator runTest() { string payload = string.Format("{0}embeddedasseta.txt?dl=bundle:mock-create-bundle&b=embedded_asset_test&x=.txt", "assets/rootassets/"); ContentManifest.AssetEntry entry = ContentManifest.AssetEntry.Parse(payload); BundleManager bundleManager = new BundleManager(null); DeviceManager deviceManager = new DeviceManager(); deviceManager.Mount(new BundleDevice(deviceManager, bundleManager)); AssetRequest <TextAsset> request = deviceManager.LoadAsync <TextAsset>(entry.DeviceList, ref entry); if (request == null) { IntegrationTest.Fail("request == null"); } else if (bundleManager.IsMounted(entry.BundleKey)) { IntegrationTest.Fail("Bundle will not be mounted untill after the AssetBundle is created internally."); } else { yield return(request); IntegrationTest.Assert(bundleManager.IsMounted(entry.BundleKey)); IntegrationTest.Assert(request.Asset != null); bundleManager.UnmountBundle(entry.BundleKey, unloadAllLoadedObjects: false); } bundleManager.UnmountAllBundles(); }
protected override IEnumerator runTest() { string payload = "test/test_cube?dl=www-bundle&x=txt"; ContentManifest.AssetEntry entry = ContentManifest.AssetEntry.Parse(payload); DeviceManager deviceManager = new DeviceManager(); GcsAccessTokenService gcsAccessTokenService = new GcsAccessTokenService(ConfigHelper.GetEnvironmentProperty <string>("GcsServiceAccountName"), new GcsP12AssetFileLoader(ConfigHelper.GetEnvironmentProperty <string>("GcsServiceAccountFile"))); CPipeManifestService cpipeManifestService = new CPipeManifestService("https://storage.googleapis.com/ad37ed76-3a24-91ba-def6-2ff16973c49d.disney.io/", "__mapping_cpremix_dev.json", gcsAccessTokenService); deviceManager.Mount(new WwwBundleDevice(deviceManager, gcsAccessTokenService, cpipeManifestService)); AssetRequest <AssetBundle> request = deviceManager.LoadAsync <AssetBundle>(entry.DeviceList, ref entry); IntegrationTestEx.FailIf(request == null); IntegrationTestEx.FailIf(request.Finished); IntegrationTestEx.FailIf(request.Cancelled); yield return(request); IntegrationTest.Assert(request.Finished); IntegrationTest.Assert(!request.Cancelled); IntegrationTest.Assert(request.Asset != null); IntegrationTest.Assert(request.Asset.GetAllAssetNames().Length == 1); string[] assetNames = request.Asset.GetAllAssetNames(); IntegrationTest.Assert(assetNames.Contains("assets/bundleassets/test/test_cube.prefab")); request.Asset.Unload(unloadAllLoadedObjects: false); }
protected override IEnumerator runTest() { string key = "embedded_asset_test"; TextAsset bundleTxt = Resources.Load <TextAsset>(key + ".unity3d"); AssetBundle bundle = AssetBundle.LoadFromMemory(bundleTxt.bytes); BundleManager manager = Content.BundleManager; BundleMount mount = manager.MountBundle(key, bundle); AsyncAssetBundleRequest <TextAsset> assetRequest = mount.LoadAsync <TextAsset>("embeddedasseta", "embeddedasseta.txt"); manager.UnmountBundle(key, unloadAllLoadedObjects: false); if (manager.IsMounted(key)) { IntegrationTest.Fail("Bundle should not be considered mounted while waiting to unmount."); } if (!manager.IsUnmounting(key)) { IntegrationTest.Fail("Bundle should be in the process of unmounting."); } yield return(assetRequest); if (assetRequest.Asset == null) { IntegrationTest.Fail("Failed to load asset"); } yield return(null); IntegrationTest.Assert(!manager.IsMounted(key)); IntegrationTest.Assert(!manager.IsUnmounting(key)); }
protected override IEnumerator runTest() { TextAsset textAsset = Content.LoadImmediate <TextAsset>("small_text"); TextAsset textAsset2 = Content.LoadImmediate <TextAsset>("small_text"); IntegrationTest.Assert(textAsset == textAsset2); yield break; }
protected override IEnumerator runTest() { TextAsset textAsset = Content.LoadImmediate <TextAsset>("small_text"); IntegrationTest.Assert(textAsset != null); IntegrationTest.Assert(textAsset.text.StartsWith("hello world")); yield break; }
protected override IEnumerator runTest() { TextAsset textAsset = Content.LoadImmediate <TextAsset>("embeddedasseta"); IntegrationTest.Assert(textAsset != null); IntegrationTest.Assert(textAsset.text.StartsWith("embeddedasseta")); yield break; }
// Use this for initialization void Start() { CoroutineQueue queue = new CoroutineQueue(); queue.Add(SimpleCoroutines.ExitImmidiately()); IntegrationTest.Assert(queue.Empty == false); IntegrationTest.Pass(gameObject); }
void Awake() { GameObject card = CardsGameObjects.OnlyDetachHandle(); card.AddComponent <CanBeDetached>(); IntegrationTest.Assert(card.GetComponent <CanBeDetached>().Detached == false); Destroy(card); IntegrationTest.Pass(gameObject); }
// Update is called once per frame void Run() { GameObject controlsObj = GameObject.Find("Jaunt2DControls"); IntegrationTest.Assert(controlsObj != null, "Jaunt2DControls object does not exist!"); GameObject controlsPrefab = PrefabUtility.GetPrefabParent(controlsObj) as GameObject; IntegrationTest.Assert(controlsPrefab != null, "Jaunt2CControls prefab cannot be found!"); }
// Update is called once per frame void Update() { IntegrationTest.Assert(_hand.Cards.Count == 2); IntegrationTest.Assert(_deck.Cards.Count == 1); _hand.CleanUp(); _deck.CleanUp(); IntegrationTest.Pass(gameObject); }
// Use this for initialization void Start() { Fader.Fade(FadeDirection.In, () => { var alpha = GUI.color.a; IntegrationTest.Assert(GUI.depth == Fader.drawDepth, "GUI Depth should be set"); IntegrationTest.Assert(alpha == (int)FadeDirection.In, "Alpha of the GUI color should be equal to FadeDirection.In at the end of the fade"); StartCoroutine(TestFaderObjectRemoval()); }); }
void Update() { if (UpdateCount == 1) { IntegrationTest.Assert(_card.transform.rotation == Quaternion.Euler(90, 0, 0)); Destroy(_card); IntegrationTest.Pass(gameObject); } UpdateCount++; }
public void assertHook(string hookName) { IntegrationTest.Assert( this.Story.CurrentGroup.Style.Get <string>(HarloweStyleSettings.Hook) == hookName, string.Format("The current group isn't defined as a Harlowe-hook named'{0}'.", hookName) ); IntegrationTest.Assert( this.Story.Output.Reverse <StoryOutput>().Any(output => output.GetAppliedStyle().Get <string>(HarloweStyleSettings.Hook) == hookName), string.Format("The Harlowe-hook '{0}' wasn't applied to any output, despite being in scope.", hookName) ); }
protected override IEnumerator runTest() { string payload = "small_text?dl=asset:res&x=txt"; ContentManifest.AssetEntry entry = ContentManifest.AssetEntry.Parse(payload); TextAsset textAsset = ResourceLoader <TextAsset> .Load(ref entry); IntegrationTest.Assert(textAsset != null); IntegrationTest.Assert(textAsset.text.StartsWith("hello world")); yield break; }
void Update() { IntegrationTest.Assert(_deck.Cards.Count == 2); IntegrationTest.Assert(_deck.Cards[0].GetComponent <SimpleCard>() != null); IntegrationTest.Assert(_deck.Cards[1].GetComponent <OtherSimpleCard>() != null); _deck.CleanUp(); Destroy(_deck.gameObject); IntegrationTest.Pass(gameObject); }
void Awake() { Deck deck = Deck.CreateDeck(true); IntegrationTest.Assert(deck != null); IntegrationTest.Assert(deck.PlayerOwned == true); Destroy(deck.gameObject); IntegrationTest.Pass(gameObject); }