From 2be1be0e6153b715363c6bea398489501577453c Mon Sep 17 00:00:00 2001 From: Koji Hasegawa Date: Sat, 13 Apr 2024 17:12:07 +0900 Subject: [PATCH 1/7] Mod canvas scaler in test scenes --- Tests/TestScenes/Buttons.unity | 61 ++++++++++++-------------- Tests/TestScenes/OutGameTutorial.unity | 2 +- 2 files changed, 30 insertions(+), 33 deletions(-) diff --git a/Tests/TestScenes/Buttons.unity b/Tests/TestScenes/Buttons.unity index 77487b4..0a9a1f5 100644 --- a/Tests/TestScenes/Buttons.unity +++ b/Tests/TestScenes/Buttons.unity @@ -13,7 +13,7 @@ OcclusionCullingSettings: --- !u!104 &2 RenderSettings: m_ObjectHideFlags: 0 - serializedVersion: 9 + serializedVersion: 10 m_Fog: 0 m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} m_FogMode: 3 @@ -38,13 +38,12 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.44657874, g: 0.49641275, b: 0.5748172, a: 1} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: m_ObjectHideFlags: 0 serializedVersion: 12 - m_GIWorkflowMode: 1 m_GISettings: serializedVersion: 2 m_BounceScale: 1 @@ -67,9 +66,6 @@ LightmapSettings: m_LightmapParameters: {fileID: 0} m_LightmapsBakeMode: 1 m_TextureCompression: 1 - m_FinalGather: 0 - m_FinalGatherFiltering: 1 - m_FinalGatherRayCount: 256 m_ReflectionCompression: 2 m_MixedBakeMode: 2 m_BakeBackend: 1 @@ -104,7 +100,7 @@ NavMeshSettings: serializedVersion: 2 m_ObjectHideFlags: 0 m_BuildSettings: - serializedVersion: 2 + serializedVersion: 3 agentTypeID: 0 agentRadius: 0.5 agentHeight: 2 @@ -117,7 +113,7 @@ NavMeshSettings: cellSize: 0.16666667 manualTileSize: 0 tileSize: 256 - accuratePlacement: 0 + buildHeightMesh: 0 maxJobWorkers: 0 preserveTilesOutsideBounds: 0 debug: @@ -154,7 +150,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1297532255} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -243,9 +238,17 @@ Camera: m_projectionMatrixMode: 1 m_GateFitMode: 2 m_FOVAxisMode: 0 + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_FocalLength: 50 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 m_SensorSize: {x: 36, y: 24} m_LensShift: {x: 0, y: 0} - m_FocalLength: 50 m_NormalizedViewPortRect: serializedVersion: 2 x: 0 @@ -279,13 +282,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 277263158} + serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 1, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &339569349 GameObject: @@ -317,6 +320,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} m_Name: m_EditorClassIdentifier: + m_SendPointerHoverToParent: 1 m_HorizontalAxis: Horizontal m_VerticalAxis: Vertical m_SubmitButton: Submit @@ -346,13 +350,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 339569349} + serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &430915672 GameObject: @@ -387,7 +391,6 @@ RectTransform: m_Children: - {fileID: 1286947376} m_Father: {fileID: 503407137} - m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -524,7 +527,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} m_Name: m_EditorClassIdentifier: - m_UiScaleMode: 0 + m_UiScaleMode: 1 m_ReferencePixelsPerUnit: 100 m_ScaleFactor: 1 m_ReferenceResolution: {x: 800, y: 600} @@ -552,7 +555,9 @@ Canvas: m_OverrideSorting: 0 m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 m_AdditionalShaderChannelsFlag: 0 + m_UpdateRectTransformForStandalone: 0 m_SortingLayerID: 0 m_SortingOrder: 0 m_TargetDisplay: 0 @@ -577,7 +582,6 @@ RectTransform: - {fileID: 430915673} - {fileID: 1214569670} m_Father: {fileID: 0} - m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -617,7 +621,6 @@ RectTransform: m_Children: - {fileID: 1690339411} m_Father: {fileID: 503407137} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -737,7 +740,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1085114497} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -817,7 +819,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1168193430} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -900,7 +901,6 @@ RectTransform: m_Children: - {fileID: 593735989} m_Father: {fileID: 503407137} - m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -1037,7 +1037,6 @@ RectTransform: m_Children: - {fileID: 726488270} m_Father: {fileID: 503407137} - m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -1174,7 +1173,6 @@ RectTransform: m_Children: - {fileID: 1236238312} m_Father: {fileID: 503407137} - m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -1308,7 +1306,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1214569670} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -1388,7 +1385,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 430915673} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -1471,7 +1467,6 @@ RectTransform: m_Children: - {fileID: 25642853} m_Father: {fileID: 503407137} - m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -1605,7 +1600,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1862254217} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -1688,7 +1682,6 @@ RectTransform: m_Children: - {fileID: 1929521106} m_Father: {fileID: 503407137} - m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -1822,7 +1815,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 533192098} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -1896,9 +1888,8 @@ Light: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1741233949} m_Enabled: 1 - serializedVersion: 10 + serializedVersion: 11 m_Type: 1 - m_Shape: 0 m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} m_Intensity: 1 m_Range: 10 @@ -1957,13 +1948,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1741233949} + serializedVersion: 2 m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} m_LocalPosition: {x: 0, y: 3, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} --- !u!1 &1862254216 GameObject: @@ -1999,7 +1990,6 @@ RectTransform: m_Children: - {fileID: 1584693788} m_Father: {fileID: 503407137} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -2133,7 +2123,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1598507194} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -2182,3 +2171,11 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1929521105} m_CullTransparentMesh: 1 +--- !u!1660057539 &9223372036854775807 +SceneRoots: + m_ObjectHideFlags: 0 + m_Roots: + - {fileID: 277263161} + - {fileID: 1741233951} + - {fileID: 503407137} + - {fileID: 339569352} diff --git a/Tests/TestScenes/OutGameTutorial.unity b/Tests/TestScenes/OutGameTutorial.unity index c0daeed..9429ffe 100644 --- a/Tests/TestScenes/OutGameTutorial.unity +++ b/Tests/TestScenes/OutGameTutorial.unity @@ -552,7 +552,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} m_Name: m_EditorClassIdentifier: - m_UiScaleMode: 0 + m_UiScaleMode: 1 m_ReferencePixelsPerUnit: 100 m_ScaleFactor: 1 m_ReferenceResolution: {x: 800, y: 600} From ea93eefcc801fafbe98359201978edad49979f85 Mon Sep 17 00:00:00 2001 From: Koji Hasegawa Date: Sat, 13 Apr 2024 17:18:16 +0900 Subject: [PATCH 2/7] Remove unuse agent settings in test --- .../StubImmediatelyErrorAgentForTests.asset | 15 --------------- .../StubImmediatelyErrorAgentForTests.asset.meta | 8 -------- 2 files changed, 23 deletions(-) delete mode 100644 Tests/TestAssets/StubImmediatelyErrorAgentForTests.asset delete mode 100644 Tests/TestAssets/StubImmediatelyErrorAgentForTests.asset.meta diff --git a/Tests/TestAssets/StubImmediatelyErrorAgentForTests.asset b/Tests/TestAssets/StubImmediatelyErrorAgentForTests.asset deleted file mode 100644 index 26b1bef..0000000 --- a/Tests/TestAssets/StubImmediatelyErrorAgentForTests.asset +++ /dev/null @@ -1,15 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: bc82cbd7e5b6404da291e090ed1f4eba, type: 3} - m_Name: StubImmediatelyErrorAgentForTests - m_EditorClassIdentifier: - description: diff --git a/Tests/TestAssets/StubImmediatelyErrorAgentForTests.asset.meta b/Tests/TestAssets/StubImmediatelyErrorAgentForTests.asset.meta deleted file mode 100644 index 7ebefe6..0000000 --- a/Tests/TestAssets/StubImmediatelyErrorAgentForTests.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 3f7edebaf584441eea0d62bb4e001beb -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: From fe27d9559b43b0b3900380d7b68a1d53ddfa1343 Mon Sep 17 00:00:00 2001 From: Koji Hasegawa Date: Sat, 13 Apr 2024 17:40:58 +0900 Subject: [PATCH 3/7] Refactor tests Reason: diff occur after running tests below: ``` - m_Name: DoNothingAgentForTests + m_Name: Observer ``` --- Tests/Runtime/AgentDispatcherTest.cs | 18 +++++++++--------- Tests/TestAssets/DoNothingAgentForTests.asset | 16 ---------------- .../DoNothingAgentForTests.asset.meta | 8 -------- 3 files changed, 9 insertions(+), 33 deletions(-) delete mode 100644 Tests/TestAssets/DoNothingAgentForTests.asset delete mode 100644 Tests/TestAssets/DoNothingAgentForTests.asset.meta diff --git a/Tests/Runtime/AgentDispatcherTest.cs b/Tests/Runtime/AgentDispatcherTest.cs index 88071b1..77b3445 100644 --- a/Tests/Runtime/AgentDispatcherTest.cs +++ b/Tests/Runtime/AgentDispatcherTest.cs @@ -8,7 +8,6 @@ using DeNA.Anjin.Settings; using DeNA.Anjin.Utilities; using NUnit.Framework; -using UnityEditor; using UnityEditor.SceneManagement; using UnityEngine; using UnityEngine.SceneManagement; @@ -41,11 +40,9 @@ private static AutopilotSettings CreateAutopilotSettings() return testSettings; } - private const string TestAgentPath = "Packages/com.dena.anjin/Tests/TestAssets/DoNothingAgentForTests.asset"; - - private static DoNothingAgent LoadTestAgent(string name = nameof(DoNothingAgent)) + private static DoNothingAgent CreateDoNothingAgent(string name = nameof(DoNothingAgent)) { - var doNothingAgent = AssetDatabase.LoadAssetAtPath(TestAgentPath); + var doNothingAgent = ScriptableObject.CreateInstance(); doNothingAgent.name = name; return doNothingAgent; } @@ -65,7 +62,10 @@ public void DispatchByScene_DispatchAgentBySceneAgentMaps() const string ActualAgentName = nameof(DoNothingAgent); var settings = CreateAutopilotSettings(); - settings.sceneAgentMaps.Add(new SceneAgentMap { scenePath = TestScenePath, agent = LoadTestAgent() }); + settings.sceneAgentMaps.Add(new SceneAgentMap + { + scenePath = TestScenePath, agent = CreateDoNothingAgent() + }); var logger = new ConsoleLogger(Debug.unityLogger.logHandler); var randomFactory = new RandomFactory(0); @@ -82,7 +82,7 @@ public void DispatchByScene_DispatchFallbackAgent() const string ActualAgentName = "Fallback"; var settings = CreateAutopilotSettings(); - settings.fallbackAgent = LoadTestAgent(ActualAgentName); + settings.fallbackAgent = CreateDoNothingAgent(ActualAgentName); var logger = new ConsoleLogger(Debug.unityLogger.logHandler); var randomFactory = new RandomFactory(0); @@ -111,8 +111,8 @@ public void DispatchByScene_DispatchObserverAgent() const string ActualAgentName = "Observer"; var settings = CreateAutopilotSettings(); - settings.fallbackAgent = LoadTestAgent(); - settings.observerAgent = LoadTestAgent(ActualAgentName); + settings.fallbackAgent = CreateDoNothingAgent(); + settings.observerAgent = CreateDoNothingAgent(ActualAgentName); var logger = new ConsoleLogger(Debug.unityLogger.logHandler); var randomFactory = new RandomFactory(0); diff --git a/Tests/TestAssets/DoNothingAgentForTests.asset b/Tests/TestAssets/DoNothingAgentForTests.asset deleted file mode 100644 index 52bdab6..0000000 --- a/Tests/TestAssets/DoNothingAgentForTests.asset +++ /dev/null @@ -1,16 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 10ad27a6631a40909bf3a0615a1c7dc5, type: 3} - m_Name: DoNothingAgentForTests - m_EditorClassIdentifier: - description: "1\u79D2\u3067\u505C\u6B62\u3057\u307E\u3059" - lifespanSec: 1 diff --git a/Tests/TestAssets/DoNothingAgentForTests.asset.meta b/Tests/TestAssets/DoNothingAgentForTests.asset.meta deleted file mode 100644 index c2839b4..0000000 --- a/Tests/TestAssets/DoNothingAgentForTests.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 6baa725d137a54b42923932c3d5a1ea0 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: From d110cd931b3cf945b89cf839520612022dc0bb64 Mon Sep 17 00:00:00 2001 From: Koji Hasegawa Date: Sat, 13 Apr 2024 18:16:11 +0900 Subject: [PATCH 4/7] Ignore argument tests when running on window mode --- Tests/Runtime/ArgumentCapture/ArgumentTest.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tests/Runtime/ArgumentCapture/ArgumentTest.cs b/Tests/Runtime/ArgumentCapture/ArgumentTest.cs index 692443e..489a61c 100644 --- a/Tests/Runtime/ArgumentCapture/ArgumentTest.cs +++ b/Tests/Runtime/ArgumentCapture/ArgumentTest.cs @@ -2,6 +2,7 @@ // This software is released under the MIT License. using NUnit.Framework; +using TestHelper.Attributes; using UnityEngine.TestTools.Utils; namespace DeNA.Anjin.ArgumentCapture @@ -12,7 +13,7 @@ namespace DeNA.Anjin.ArgumentCapture /// This is actually a test of ArgumentCapture. /// [TestFixture] - [Category("IgnoreGUI")] + [IgnoreWindowMode("Need command line arguments")] public class ArgumentTest { [Test] From 4136c045bd08f5836d15d457bff046232fb7487a Mon Sep 17 00:00:00 2001 From: Koji Hasegawa Date: Sat, 13 Apr 2024 19:15:34 +0900 Subject: [PATCH 5/7] Rename tests --- Tests/Editor/UI/Settings/AutopilotSettingsEditorTest.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Tests/Editor/UI/Settings/AutopilotSettingsEditorTest.cs b/Tests/Editor/UI/Settings/AutopilotSettingsEditorTest.cs index b8de762..37aa10c 100644 --- a/Tests/Editor/UI/Settings/AutopilotSettingsEditorTest.cs +++ b/Tests/Editor/UI/Settings/AutopilotSettingsEditorTest.cs @@ -48,7 +48,7 @@ public IEnumerator UnityTearDown() } [UnityTest] - public IEnumerator Launch_RunAutopilotOnPlayMode() + public IEnumerator Launch_OnEditMode_RunAutopilotOnPlayMode() { var testSettings = AssetDatabase.LoadAssetAtPath( "Packages/com.dena.anjin/Tests/TestAssets/AutopilotSettingsForTests.asset"); @@ -59,15 +59,15 @@ public IEnumerator Launch_RunAutopilotOnPlayMode() yield return new WaitForDomainReload(); // Wait for domain reloading by switching play mode state = AutopilotState.Instance; // Reacquire because lost in domain reloading + Assert.That(state.launchFrom, Is.EqualTo(LaunchType.EditorEditMode)); Assert.That(state.IsRunning, Is.True, "AutopilotState is running"); var autopilot = Object.FindObjectOfType(); - Assert.That((bool)autopilot, Is.True, "Autopilot object is alive"); + Assert.That((bool)autopilot.gameObject, Is.True, "Autopilot object is alive"); } [UnityTest] - public IEnumerator Launch_RunAutopilot_CallMethodWithInitializeOnLaunchAutopilotAttribute() - // Note: This test about InitializeOnLaunchAutopilotAttribute + public IEnumerator Launch_CallMethodWithInitializeOnLaunchAutopilotAttribute() { FakeInitializeOnLaunchAutopilot.Reset(); From 719acb84cf14e7af35f8ce23525eafbf0f57ce3c Mon Sep 17 00:00:00 2001 From: Koji Hasegawa Date: Sat, 13 Apr 2024 20:26:54 +0900 Subject: [PATCH 6/7] Exclude failing tests on Unity 2019 Linux editor Tests failed with the following LogAssert output: ``` MonoScript is registered as both Editor and Runtime script! ``` --- Tests/Runtime/LauncherTest.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Tests/Runtime/LauncherTest.cs b/Tests/Runtime/LauncherTest.cs index 2c9a053..cc86b3c 100644 --- a/Tests/Runtime/LauncherTest.cs +++ b/Tests/Runtime/LauncherTest.cs @@ -12,7 +12,7 @@ namespace DeNA.Anjin { - [UnityPlatform(RuntimePlatform.OSXEditor, RuntimePlatform.WindowsEditor, RuntimePlatform.LinuxEditor)] + [UnityPlatform(RuntimePlatform.OSXEditor, RuntimePlatform.WindowsEditor)] // Fail on Unity 2019 Linux editor [SuppressMessage("ApiDesign", "RS0030")] public class LauncherTest { @@ -66,7 +66,8 @@ public async Task Stop_TerminateAutopilotAndKeepPlayMode() var state = AutopilotState.Instance; editor.Launch(state); await Task.Delay(2000); - await editor.Stop(); // Note: If Autopilot stops for life before Stop, a NullReference exception is raised here. + await editor.Stop(); + // Note: If Autopilot stops for life before Stop, a NullReference exception is raised here. Assert.That(state.IsRunning, Is.False, "AutopilotState is terminated"); Assert.That(EditorApplication.isPlaying, Is.True, "Keep play mode"); From 50b42f83add06dba19b104e818e9f16ccef94dbf Mon Sep 17 00:00:00 2001 From: Koji Hasegawa Date: Sat, 13 Apr 2024 22:02:31 +0900 Subject: [PATCH 7/7] Fix failing tests on Unity 2021+ Linux editor After inserting `Assume.That` for investigation, the test no longer fails... --- Tests/Editor/UI/Settings/AutopilotSettingsEditorTest.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Tests/Editor/UI/Settings/AutopilotSettingsEditorTest.cs b/Tests/Editor/UI/Settings/AutopilotSettingsEditorTest.cs index 37aa10c..7946d59 100644 --- a/Tests/Editor/UI/Settings/AutopilotSettingsEditorTest.cs +++ b/Tests/Editor/UI/Settings/AutopilotSettingsEditorTest.cs @@ -57,6 +57,7 @@ public IEnumerator Launch_OnEditMode_RunAutopilotOnPlayMode() editor.Launch(state); // Note: Can not call editor.OnInspectorGUI() and GUILayout.Button() yield return new WaitForDomainReload(); // Wait for domain reloading by switching play mode + Assume.That(EditorApplication.isPlaying, Is.True, "Switched to play mode"); state = AutopilotState.Instance; // Reacquire because lost in domain reloading Assert.That(state.launchFrom, Is.EqualTo(LaunchType.EditorEditMode));