forked from needle-mirror/com.unity.xr.management
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## [3.2.12] - 2020-06-05 * Fix testing definitions to allows us to remove tests as separate packages. ## [3.2.11] - 2020-06-04 * Documentation updates for clarity and correctness. * Block use of deprecated APIs on 2020.2 and later.
- Loading branch information
Unity Technologies
committed
Jun 5, 2020
1 parent
6e669fe
commit 266ba12
Showing
75 changed files
with
2,039 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
using System.Collections.Generic; | ||
using NUnit.Framework; | ||
using UnityEditor.Build; | ||
using UnityEngine; | ||
using UnityEngine.Rendering; | ||
using UnityEngine.XR.Management; | ||
using UnityEngine.XR.Management.Tests; | ||
using Object = UnityEngine.Object; | ||
|
||
#if UNITY_EDITOR_WIN || UNITY_EDITOR_OSX | ||
|
||
namespace UnityEditor.XR.Management.Tests.BuildTests | ||
{ | ||
#if UNITY_EDITOR_WIN | ||
[TestFixture(GraphicsDeviceType.Direct3D11, false, new [] { GraphicsDeviceType.Direct3D11})] | ||
[TestFixture(GraphicsDeviceType.Direct3D11, false, new [] { GraphicsDeviceType.Direct3D12, GraphicsDeviceType.Direct3D11})] | ||
[TestFixture(GraphicsDeviceType.Direct3D11, true, new [] { GraphicsDeviceType.Direct3D12, GraphicsDeviceType.Vulkan})] | ||
[TestFixture(GraphicsDeviceType.Direct3D11, false, new [] { GraphicsDeviceType.Null, GraphicsDeviceType.Vulkan})] | ||
[TestFixture(GraphicsDeviceType.Direct3D11, false, new [] { GraphicsDeviceType.Vulkan, GraphicsDeviceType.Null})] | ||
#elif UNITY_EDITOR_OSX | ||
[TestFixture(GraphicsDeviceType.Metal, false, new [] { GraphicsDeviceType.Metal})] | ||
[TestFixture(GraphicsDeviceType.Metal, false, new [] { GraphicsDeviceType.Direct3D12, GraphicsDeviceType.Metal})] | ||
[TestFixture(GraphicsDeviceType.Metal, true, new [] { GraphicsDeviceType.OpenGLES3, GraphicsDeviceType.Vulkan})] | ||
[TestFixture(GraphicsDeviceType.Metal, false, new [] { GraphicsDeviceType.Null, GraphicsDeviceType.Vulkan})] | ||
[TestFixture(GraphicsDeviceType.Metal, false, new [] { GraphicsDeviceType.Vulkan, GraphicsDeviceType.Null})] | ||
#endif | ||
class GraphicsAPICompatibilityTests | ||
{ | ||
XRManagerSettings m_Manager; | ||
List<XRLoader> m_Loaders = new List<XRLoader>(); | ||
|
||
private GraphicsDeviceType m_PlayerSettingsDeviceType; | ||
private GraphicsDeviceType[] m_LoadersSupporteDeviceTypes; | ||
bool m_BuildFails; | ||
|
||
public GraphicsAPICompatibilityTests(GraphicsDeviceType playerSettingsDeviceType, bool fails, GraphicsDeviceType[] loaders) | ||
{ | ||
m_BuildFails = fails; | ||
m_PlayerSettingsDeviceType = playerSettingsDeviceType; | ||
m_LoadersSupporteDeviceTypes = loaders; | ||
} | ||
|
||
[SetUp] | ||
public void SetupPlayerSettings() | ||
{ | ||
#if UNITY_EDITOR_WIN | ||
PlayerSettings.SetGraphicsAPIs(BuildTarget.StandaloneWindows64, new[] { m_PlayerSettingsDeviceType }); | ||
#elif UNITY_EDITOR_OSX | ||
PlayerSettings.SetGraphicsAPIs(BuildTarget.StandaloneOSX, new[] { m_PlayerSettingsDeviceType }); | ||
#endif | ||
m_Manager = ScriptableObject.CreateInstance<XRManagerSettings>(); | ||
m_Manager.automaticLoading = false; | ||
|
||
m_Loaders = new List<XRLoader>(); | ||
|
||
for (int i = 0; i < m_LoadersSupporteDeviceTypes.Length; i++) | ||
{ | ||
DummyLoader dl = ScriptableObject.CreateInstance(typeof(DummyLoader)) as DummyLoader; | ||
dl.id = i; | ||
dl.supportedDeviceType = m_LoadersSupporteDeviceTypes[i]; | ||
m_Loaders.Add(dl); | ||
m_Manager.loaders.Add(dl); | ||
} | ||
} | ||
|
||
[TearDown] | ||
public void TeadDown() | ||
{ | ||
Object.DestroyImmediate(m_Manager); | ||
m_Manager = null; | ||
|
||
} | ||
|
||
[Test] | ||
public void CheckGraphicsAPICompatibilityOnBuild() | ||
{ | ||
try | ||
{ | ||
XRGeneralBuildProcessor.VerifyGraphicsAPICompatibility(m_Manager, m_PlayerSettingsDeviceType); | ||
} | ||
catch (BuildFailedException) | ||
{ | ||
Assert.True(m_BuildFails); | ||
return; | ||
} | ||
|
||
Assert.False(m_BuildFails); | ||
} | ||
} | ||
} | ||
#endif //UNITY_EDITOR_WIN || UNITY_EDITOR_OSX |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using NUnit.Framework; | ||
|
||
using System; | ||
using System.IO; | ||
|
||
using UnityEngine; | ||
using UnityEngine.XR.Management; | ||
|
||
using Unity.XR.TestTooling; | ||
|
||
namespace UnityEditor.XR.Management.Tests | ||
{ | ||
|
||
class XRGeneralSettingsTests : ManagementTestSetup | ||
{ | ||
protected override bool TestManagerUpgradePath => true; | ||
BuildTargetGroup previousBuildTargetSelection { get; set; } | ||
|
||
[SetUp] | ||
public override void SetupTest() | ||
{ | ||
|
||
base.SetupTest(); | ||
|
||
previousBuildTargetSelection = EditorUserBuildSettings.selectedBuildTargetGroup; | ||
EditorUserBuildSettings.selectedBuildTargetGroup = BuildTargetGroup.Standalone; | ||
} | ||
|
||
[TearDown] | ||
public override void TearDownTest() | ||
{ | ||
EditorUserBuildSettings.selectedBuildTargetGroup = previousBuildTargetSelection; | ||
base.TearDownTest(); | ||
} | ||
|
||
|
||
[Test] | ||
public void UpdateGeneralSettings_ToPerBuildTargetSettings() | ||
{ | ||
bool success = XRGeneralSettingsUpgrade.UpgradeSettingsToPerBuildTarget(testPathToSettings); | ||
Assert.IsTrue(success); | ||
|
||
XRGeneralSettingsPerBuildTarget pbtgs = null; | ||
|
||
pbtgs = AssetDatabase.LoadAssetAtPath(testPathToSettings, typeof(XRGeneralSettingsPerBuildTarget)) as XRGeneralSettingsPerBuildTarget; | ||
Assert.IsNotNull(pbtgs); | ||
|
||
var settings = pbtgs.SettingsForBuildTarget(EditorUserBuildSettings.selectedBuildTargetGroup); | ||
Assert.IsNotNull(settings); | ||
Assert.IsNotNull(settings.Manager); | ||
Assert.AreEqual(testManager, settings.Manager); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.