chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "MCPForUnityTests.PlayMode",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"UnityEngine.TestRunner",
|
||||
"UnityEditor.TestRunner"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": true,
|
||||
"precompiledReferences": [
|
||||
"nunit.framework.dll"
|
||||
],
|
||||
"autoReferenced": false,
|
||||
"defineConstraints": [
|
||||
"UNITY_INCLUDE_TESTS"
|
||||
],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ee22713734c3444ea97b26bc4f4009c6
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,86 @@
|
||||
using System.Collections;
|
||||
using NUnit.Framework;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
|
||||
namespace MCPForUnityTests.PlayMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Basic PlayMode tests to verify the MCP test runner handles PlayMode correctly.
|
||||
/// These tests exercise coroutine-based testing which requires Play mode.
|
||||
/// </summary>
|
||||
public class PlayModeBasicTests
|
||||
{
|
||||
[UnityTest]
|
||||
public IEnumerator GameObjectCreation_InPlayMode_Succeeds()
|
||||
{
|
||||
var go = new GameObject("TestObject");
|
||||
Assert.IsNotNull(go);
|
||||
Assert.AreEqual("TestObject", go.name);
|
||||
|
||||
yield return null; // Wait one frame
|
||||
|
||||
Assert.IsTrue(go != null); // Still exists after frame
|
||||
Object.Destroy(go);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator WaitForSeconds_CompletesAfterDelay()
|
||||
{
|
||||
float startTime = Time.time;
|
||||
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
|
||||
float elapsed = Time.time - startTime;
|
||||
Assert.GreaterOrEqual(elapsed, 0.09f, "Should have waited at least 0.09 seconds");
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator MultipleFrames_ProgressCorrectly()
|
||||
{
|
||||
int frameCount = Time.frameCount;
|
||||
|
||||
yield return null;
|
||||
yield return null;
|
||||
yield return null;
|
||||
|
||||
int newFrameCount = Time.frameCount;
|
||||
Assert.Greater(newFrameCount, frameCount, "Frame count should have advanced");
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Component_AddAndRemove_InPlayMode()
|
||||
{
|
||||
var go = new GameObject("ComponentTest");
|
||||
|
||||
yield return null;
|
||||
|
||||
var rb = go.AddComponent<Rigidbody>();
|
||||
Assert.IsNotNull(rb);
|
||||
Assert.IsTrue(go.GetComponent<Rigidbody>() != null);
|
||||
|
||||
yield return null;
|
||||
|
||||
Object.Destroy(rb);
|
||||
|
||||
yield return null;
|
||||
|
||||
Assert.IsTrue(go.GetComponent<Rigidbody>() == null);
|
||||
Object.Destroy(go);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Coroutine_CanYieldMultipleTimes()
|
||||
{
|
||||
int counter = 0;
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
counter++;
|
||||
yield return null;
|
||||
}
|
||||
|
||||
Assert.AreEqual(5, counter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0fdf985950dd444e4977139e67d778a2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user