Seans add windows mr submodule (#127)

Refactoring CrossPlatform project to use a WinMR submodule to run across WinMR.
This commit is contained in:
Sean Stolberg 2019-07-24 16:10:45 -07:00 коммит произвёл GitHub Enterprise
Родитель 0f27a3b7c9
Коммит dbd2585e02
36 изменённых файлов: 229 добавлений и 198 удалений

4
.gitmodules поставляемый Normal file
Просмотреть файл

@ -0,0 +1,4 @@
[submodule "FunctionalTests/VR/CrossPlatform/Assets/WindowsMR"]
path = FunctionalTests/VR/CrossPlatform/Assets/WindowsMR
url = git@github.cds.internal.unity3d.com:unity/xr.xrautomatedtests.windowsmr.emulation.git
branch = trunk

Просмотреть файл

@ -143,6 +143,11 @@ public class Build
{
return new OptionSet()
{
{
"simulationmode=",
"Enable Simulation modes for Windows MR in Editor. Values: \r\n\"HoloLens\"\r\n\"WindowsMR\"\r\n\"Remoting\"",
simMode => PlatformSettings.SimulationMode = simMode
},
{
"enabledxrtarget=",
"XR target to enable in player settings. Values: \r\n\"Oculus\"\r\n\"OpenVR\"\r\n\"cardboard\"\r\n\"daydream\"\r\n\"MockHMD\"",

Просмотреть файл

@ -1,116 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using UnityEditor;
using UnityEngine;
namespace HoloToolkit.Unity
{
public class CertificatePasswordWindow : EditorWindow
{
private static readonly GUILayoutOption LabelWidth = GUILayout.Width(110f);
private static readonly GUILayoutOption ButtonWidth = GUILayout.Width(110f);
private string path;
private string password;
private GUIContent message;
private GUIStyle messageStyle;
private string focus;
public static void Show(string path)
{
CertificatePasswordWindow[] array = (CertificatePasswordWindow[])Resources.FindObjectsOfTypeAll(typeof(CertificatePasswordWindow));
CertificatePasswordWindow certificatePasswordWindow = (array.Length <= 0) ? CreateInstance<CertificatePasswordWindow>() : array[0];
path = path.Replace("\\", "/");
certificatePasswordWindow.path = path.Substring(path.LastIndexOf("Assets/", StringComparison.Ordinal));
certificatePasswordWindow.password = string.Empty;
certificatePasswordWindow.message = GUIContent.none;
certificatePasswordWindow.messageStyle = new GUIStyle(GUI.skin.label);
certificatePasswordWindow.messageStyle.fontStyle = FontStyle.Italic;
certificatePasswordWindow.focus = "password";
if (array.Length > 0)
{
certificatePasswordWindow.Focus();
}
else
{
certificatePasswordWindow.titleContent = new GUIContent("Enter Windows Store Certificate Password");
certificatePasswordWindow.position = new Rect(100f, 100f, 350f, 90f);
certificatePasswordWindow.minSize = new Vector2(certificatePasswordWindow.position.width, certificatePasswordWindow.position.height);
certificatePasswordWindow.maxSize = certificatePasswordWindow.minSize;
certificatePasswordWindow.ShowUtility();
}
}
public void OnGUI()
{
Event current = Event.current;
bool flag = false;
bool flag2 = false;
if (current.type == EventType.KeyDown)
{
flag = (current.keyCode == KeyCode.Escape);
flag2 = (current.keyCode == KeyCode.Return || current.keyCode == KeyCode.KeypadEnter);
}
using (new EditorGUILayout.HorizontalScope())
{
GUILayout.Space(10f);
using (new EditorGUILayout.VerticalScope())
{
GUILayout.FlexibleSpace();
using (new EditorGUILayout.HorizontalScope())
{
GUILayout.Label(new GUIContent("Password|Certificate password."), LabelWidth);
GUI.SetNextControlName("password");
password = GUILayout.PasswordField(password, '●');
}
GUILayout.Space(10f);
using (new EditorGUILayout.HorizontalScope())
{
GUILayout.Label(message, messageStyle);
GUILayout.FlexibleSpace();
if (GUILayout.Button(new GUIContent("Ok"), ButtonWidth) || flag2)
{
message = GUIContent.none;
try
{
if (PlayerSettings.WSA.SetCertificate(path, password))
{
flag = true;
}
else
{
message = new GUIContent("Invalid password.");
}
}
catch (UnityException ex)
{
Debug.LogError(ex.Message);
}
}
}
GUILayout.FlexibleSpace();
}
GUILayout.Space(10f);
}
if (flag)
{
Close();
}
else if (focus != null)
{
EditorGUI.FocusTextInControl(focus);
focus = null;
}
}
}
}

Просмотреть файл

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 0ff5d5ee9ce34c18a0df4ea5495be19b
timeCreated: 1497159260

Просмотреть файл

@ -30,14 +30,7 @@ public static class PlatformSettings
settingsAsset.StereoRenderingMode = GetXrStereoRenderingPathMapping(StereoRenderingPath);
settingsAsset.MtRendering = MtRendering;
settingsAsset.GraphicsJobs = GraphicsJobs;
if (SimulationMode != string.Empty || SimulationMode != null)
{
settingsAsset.SimulationMode = SimulationMode;
}
else
{
settingsAsset.SimulationMode = "None";
}
settingsAsset.SimulationMode = SimulationMode;
AssetDatabase.CreateAsset(settingsAsset, "Assets/Resources/settings.asset");
AssetDatabase.SaveAssets();

Просмотреть файл

@ -1,3 +1,18 @@
{
"name": "Scripts"
}
{
"name": "Scripts",
"references": [
"UnityEngine.SpatialTracking"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [
"nunit.framework.dll"
],
"autoReferenced": false,
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
],
"versionDefines": []
}

Просмотреть файл

@ -1,22 +1,8 @@
using System.Collections;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.TestTools;
[UnityPlatform(include = new[]
{
RuntimePlatform.WindowsEditor,
RuntimePlatform.WindowsPlayer,
RuntimePlatform.Android,
RuntimePlatform.IPhonePlayer,
RuntimePlatform.OSXEditor,
RuntimePlatform.OSXPlayer,
RuntimePlatform.Lumin,
RuntimePlatform.WSAPlayerARM,
RuntimePlatform.WSAPlayerX64,
RuntimePlatform.WSAPlayerX86
})]
public class XrFunctionalTestBase
public abstract class XrFunctionalTestBase
{
protected XrFunctionalTestHelpers XrFunctionalTestHelpers;
protected CurrentSettings Settings;
@ -51,12 +37,20 @@ public class XrFunctionalTestBase
return Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer;
}
protected void AssertNotUsingEmulation()
{
if (Settings.SimulationMode != string.Empty)
{
Assert.Ignore("This test cannot run in emulation mode. Skipping.");
}
}
protected IEnumerator SkipFrame(int frames)
{
Debug.Log(string.Format("Skipping {0} frames.", frames));
for (int f = 0; f < frames; f++)
{
yield return null;
Debug.Log("Skip Frame");
}
}

Просмотреть файл

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: f9edfed0a5032fa4fa5582cddc5b4c80
guid: aee10e5e454db1846ba07f75b7913ee4
folderAsset: yes
DefaultImporter:
externalObjects: {}

Просмотреть файл

@ -0,0 +1,3 @@
DeviceGuid : d612553d-06b1-49ca-8938-e39ef80eb16f
DeviceIdInstancePath: USB\VID_045E&PID_0659&MI_04\C&2766B56&0&0004
DisableDevice : True

Просмотреть файл

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 33be64706808cf9408816e1a5d36386c
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>

Просмотреть файл

@ -0,0 +1,94 @@
fileFormatVersion: 2
guid: 00e42fe72d7134741bcfcda4d7b3c47a
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 1
Exclude Editor: 0
Exclude Linux64: 1
Exclude Lumin: 1
Exclude OSXUniversal: 1
Exclude Win: 1
Exclude Win64: 1
Exclude WindowsStoreApps: 1
- first:
Android: Android
second:
enabled: 0
settings:
CPU: ARMv7
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
CPU: x86_64
DefaultValueInitialized: true
OS: Windows
- first:
Facebook: Win
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Win
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
DontProcess: false
PlaceholderPath:
SDK: AnySDK
ScriptingBackend: AnyScriptingBackend
userData:
assetBundleName:
assetBundleVariant:

Просмотреть файл

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: dd70b9f301ec6b242a7d289bd42b01d7
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 8657eeb69915b97409bf621820c0bf54
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Просмотреть файл

@ -38,21 +38,22 @@ public class CameraTests : XrFunctionalTestBase
[UnityTest]
public IEnumerator VerifyRefreshRate()
{
AssertNotUsingEmulation();
yield return SkipFrame(DefaultFrameSkipCount);
var refreshRate = XRDevice.refreshRate;
if (IsMobilePlatform())
{
Assert.GreaterOrEqual(refreshRate, 60, "Refresh rate returned to lower than expected");
} else
{
Assert.GreaterOrEqual(refreshRate, 89, "Refresh rate returned to lower than expected");
}
#if PLATFORM_IOS || PLATFORM_ANDROID || (UNITY_METRO && UNITY_EDITOR)
Assert.GreaterOrEqual(refreshRate, 60, "Refresh rate returned to lower than expected");
#else
Assert.GreaterOrEqual(refreshRate, 89, "Refresh rate returned to lower than expected");
#endif
}
[UnityTest]
public IEnumerator VerifyAdjustRenderViewportScale()
{
AssertNotUsingEmulation();
yield return SkipFrame(DefaultFrameSkipCount);
var tolerance = .005;
@ -147,20 +148,18 @@ public class CameraTests : XrFunctionalTestBase
try
{
if (IsMobilePlatform())
{
var cam = XrFunctionalTestHelpers.Camera;
var width = cam.GetComponent<Camera>().scaledPixelWidth;
var height = cam.GetComponent<Camera>().scaledPixelHeight;
#if PLATFORM_IOS || PLATFORM_ANDROID
var cam = XrFunctionalTestHelpers.Camera;
var width = cam.GetComponent<Camera>().scaledPixelWidth;
var height = cam.GetComponent<Camera>().scaledPixelHeight;
mobileTexture = new Texture2D(width, height, TextureFormat.RGBA32, false);
mobileTexture = ScreenCapture.CaptureScreenshotAsTexture(ScreenCapture.StereoScreenCaptureMode.BothEyes);
}
else
{
fileName = Application.temporaryCachePath + "/ScreenShotTest.jpg";
ScreenCapture.CaptureScreenshot(fileName, ScreenCapture.StereoScreenCaptureMode.BothEyes);
}
mobileTexture = new Texture2D(width, height, TextureFormat.RGBA32, false);
mobileTexture = ScreenCapture.CaptureScreenshotAsTexture(ScreenCapture.StereoScreenCaptureMode.BothEyes);
#else
fileName = Application.temporaryCachePath + "/ScreenShotTest.jpg";
ScreenCapture.CaptureScreenshot(fileName, ScreenCapture.StereoScreenCaptureMode.BothEyes);
#endif
}
catch (Exception e)
{
@ -168,25 +167,21 @@ public class CameraTests : XrFunctionalTestBase
Assert.Fail("Failed to get capture! : " + e);
}
if (IsMobilePlatform())
{
yield return SkipFrame(5);
yield return SkipFrame(5);
if (IsMobilePlatform())
{
Assert.IsNotNull(mobileTexture, "Texture data is empty for mobile");
}
else
{
var tex = new Texture2D(2, 2);
#if PLATFORM_IOS || PLATFORM_ANDROID
var texData = File.ReadAllBytes(fileName);
Debug.Log("Screen Shot Success!" + Environment.NewLine + "File Name = " + fileName);
tex.LoadImage(texData);
Assert.IsNotNull(mobileTexture, "Texture data is empty for mobile");
#else
var tex = new Texture2D(2, 2);
Assert.IsNotNull(tex, "Texture Data is empty");
}
}
var texData = File.ReadAllBytes(fileName);
Debug.Log("Screen Shot Success!" + Environment.NewLine + "File Name = " + fileName);
tex.LoadImage(texData);
Assert.IsNotNull(tex, "Texture Data is empty");
#endif
}
}

Просмотреть файл

@ -1,10 +1,10 @@
using NUnit.Framework;
#if !UNITY_ANDROID
using NUnit.Framework;
using System.Collections;
using UnityEngine;
using UnityEngine.TestTools;
[UnityPlatform(exclude = new [] {RuntimePlatform.Android})]
public class DllNativePluginTests : XrFunctionalTestBase
{
private bool sceneObjectsLoaded;
@ -104,3 +104,4 @@ public class DllNativePluginTests : XrFunctionalTestBase
return filter && textsize;
}
}
#endif

Просмотреть файл

@ -53,10 +53,7 @@ public class RenderingChecks : XrFunctionalTestBase
go.GetComponent<ParticleSystemRenderer>().material = Resources.Load<Material>("Materials/Particle");
Assert.IsNotNull(go.GetComponent<ParticleSystemRenderer>().material);
particles.Play();
// 100 frames ~= 1 or 2 seconds
for (int i = 0; i < 100; i++)
yield return SkipFrame(DefaultFrameSkipCount);
yield return SkipFrame(100);
}
// TODO We need to refactor this so that we have a clear arrange/act/assert

Просмотреть файл

@ -1,10 +1,12 @@
{
"name": "Unity.CrossPlatformXRAutomation",
"name": "Unity.CrossPlatform.XRAutomation",
"references": [
"UnityEngine.SpatialTracking",
"UnityEngine.TestRunner",
"UnityEditor.TestRunner",
"Scripts"
"Scripts",
"Unity.XR.WindowsMR",
"Unity.WindowsMRAutomation"
],
"includePlatforms": [],
"excludePlatforms": [

Просмотреть файл

@ -1,21 +1,26 @@
using System.Collections;
using System.Text;
using UnityEngine;
using NUnit.Framework;
using NUnit.Framework.Internal.Commands;
using UnityEngine.TestTools;
using UnityEngine.XR;
public class XrApiTests : XrFunctionalTestBase
{
[UnityPlatform(include = new[] { RuntimePlatform.Android, RuntimePlatform.IPhonePlayer })]
#if PLATFORM_IOS || PLATFORM_ANDROID
[Test]
public void VerifyApplication_IsMobilePlatform()
{
Assert.IsTrue(Application.isMobilePlatform, "SDK returned as a non mobile platform ");
}
#endif
[Test]
public void VerifyXrDevice_IsPresent()
{
AssertNotUsingEmulation();
Assert.IsTrue(XRDevice.isPresent, "XR Device is not present");
}
@ -23,9 +28,21 @@ public class XrApiTests : XrFunctionalTestBase
[Test]
public void VerifyXRDevice_userPresence_isPresent()
{
if (Settings.EnabledXrTarget != "MockHMD")
var expUserPresenceState = UserPresenceState.Present;
var mockHmd = "MockHMD";
if (Settings.EnabledXrTarget == mockHmd || Application.isEditor)
{
string reasonString;
if (Settings.EnabledXrTarget == mockHmd)
reasonString = string.Format("EnabledXrTarget == {0}", mockHmd);
else
reasonString = string.Format("Test is running in the Editor");
Assert.Ignore("{0}: UserPresenceState.Present will always be false. Ignoring", reasonString);
}
else
{
var expUserPresenceState = UserPresenceState.Present;
Assert.AreEqual(XRDevice.userPresence, expUserPresenceState, string.Format("Not mobile platform. Expected XRDevice.userPresence to be {0}, but is {1}.", expUserPresenceState, XRDevice.userPresence));
}
}
@ -33,6 +50,7 @@ public class XrApiTests : XrFunctionalTestBase
[Test]
public void VerifyXrSettings_IsDeviceActive()
{
AssertNotUsingEmulation();
Assert.IsTrue(XRSettings.isDeviceActive, "XR Device is not active");
}
@ -48,6 +66,7 @@ public class XrApiTests : XrFunctionalTestBase
[Test]
public void VerifyXrModelNotEmpty()
{
AssertNotUsingEmulation();
Assert.IsNotEmpty(XRDevice.model, "Model is empty");
}
@ -61,6 +80,7 @@ public class XrApiTests : XrFunctionalTestBase
[Test]
public void VerifyRefreshRateGreaterThan0()
{
AssertNotUsingEmulation();
Assert.AreNotEqual(XRDevice.refreshRate, 0, "Refresh is 0; should be greater than 0.");
}

@ -0,0 +1 @@
Subproject commit fcac6d2f5ce2ce5a98b54d783cdc825236553b1a

Просмотреть файл

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 6b5ad15a2698d7247aa881d0611d25a6
guid: 3b6041d2195c5824991a8ec07669aace
folderAsset: yes
DefaultImporter:
externalObjects: {}

Просмотреть файл

@ -5,7 +5,7 @@
"com.unity.ide.visualstudio": "1.0.7",
"com.unity.ide.vscode": "1.0.6",
"com.unity.package-manager-ui": "2.2.0",
"com.unity.test-framework": "1.0.14",
"com.unity.test-framework": "1.0.18",
"com.unity.xr.legacyinputhelpers": "2.0.2",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
@ -39,6 +39,5 @@
"com.unity.modules.wind": "1.0.0",
"com.unity.modules.xr": "1.0.0"
},
"registry": "https://staging-packages.unity.com",
"disableProjectUpdate": true
"registry": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"
}