Skip to content

Commit

Permalink
Merge branch 'mrtk3' into new_hand_menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Zee2 authored Dec 28, 2022
2 parents 658de76 + 1405fd9 commit 30959cf
Show file tree
Hide file tree
Showing 88 changed files with 741 additions and 1,028 deletions.
180 changes: 107 additions & 73 deletions Pipelines/Templates/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,90 +1,123 @@
# Copyright (c) Microsoft Corporation.
#Licensed under the MIT License.
# Licensed under the MIT License.

# [Template] Run MRTK tests.

parameters:
- name: UnityVersion
type: string
default: ''

- name: BuildTarget
type: string
values:
- StandaloneWindows64
- WSAPlayer
- Android
default: StandaloneWindows64
- name: PathToProject
type: string

- name: AdditionalArguments
type: string
default: ''
- name: UnityVersion
type: string
default: ""

- name: BuildTarget
type: string
values:
- StandaloneWindows64
- WSAPlayer
- Android
default: StandaloneWindows64

- name: PathToProject
type: string

- name: AdditionalArguments
type: string
default: ""

steps:
# No edit mode tests (yet!)
# - pwsh: |
# Write-Host "======================= EditMode Tests ======================="

# $logFile = Join-Path $(Build.ArtifactStagingDirectory) "editmode-test-run.log"
# New-Item -Path $logFile -ItemType File -Force

# $resultFile = Join-Path $(Build.ArtifactStagingDirectory) "test-results-editmode.xml"
# New-Item -Path $resultFile -ItemType File -Force

# if ("${{ parameters.UnityVersion }}" -eq "Latest") {
# $proc = Start-UnityEditor -Project "${{ parameters.PathToProject }}" -Latest -RunTests -TestPlatform EditMode -BuildTarget ${{ parameters.BuildTarget }} -BatchMode -Quit -PassThru -LogFile $logFile -EditorTestsResultFile $resultFile -AdditionalArguments "${{ parameters.AdditionalArguments }}"
# }
# else {
# $proc = Start-UnityEditor -Project "${{ parameters.PathToProject }}" -Version ${{ parameters.UnityVersion }} -RunTests -TestPlatform PlayMode -BuildTarget ${{ parameters.BuildTarget }} -BatchMode -Quit -PassThru -LogFile $logFile -EditorTestsResultFile ".\test-editmode-default.xml" -AdditionalArguments "${{ parameters.AdditionalArguments }}"
# }

# $ljob = Start-Job -ScriptBlock { param($log) Get-Content "$log" -Wait } -ArgumentList $logFile

# while (-not $proc.HasExited -and $ljob.HasMoreData)
# {
# Receive-Job $ljob
# Start-Sleep -Milliseconds 200
# }
# Stop-Job $ljob
# Remove-Job $ljob
# Stop-Process $proc

# Write-Output '====================================================='
# Write-Output ' PlayMode Tests Finished '
# Write-Output '====================================================='
# displayName: 'Run EditMode tests'
- pwsh: |
Write-Host "======================= EditMode Tests ======================="
$logFile = Join-Path $(Build.ArtifactStagingDirectory) "editmode-test-run.log"
New-Item -Path $logFile -ItemType File -Force
$resultFile = Join-Path $(Build.ArtifactStagingDirectory) "test-results-editmode.xml"
New-Item -Path $resultFile -ItemType File -Force
try {
if ("${{ parameters.UnityVersion }}" -eq "Latest") {
$proc = Start-UnityEditor -Project "${{ parameters.PathToProject }}" -Latest -RunTests -TestPlatform EditMode -BuildTarget ${{ parameters.BuildTarget }} -BatchMode -PassThru -LogFile $logFile -EditorTestsResultFile $resultFile -AdditionalArguments "${{ parameters.AdditionalArguments }}"
}
else {
$proc = Start-UnityEditor -Project "${{ parameters.PathToProject }}" -Version ${{ parameters.UnityVersion }} -RunTests -TestPlatform EditMode -BuildTarget ${{ parameters.BuildTarget }} -BatchMode -PassThru -LogFile $logFile -EditorTestsResultFile $resultFile -AdditionalArguments "${{ parameters.AdditionalArguments }}"
}
$ljob = Start-Job -ScriptBlock { param($log) Get-Content "$log" -Wait } -ArgumentList $logFile
while (-not $proc.HasExited -and $ljob.HasMoreData)
{
Receive-Job $ljob
Start-Sleep -Milliseconds 200
}
Stop-Job $ljob
Remove-Job $ljob
Stop-Process $proc
}
finally {
Write-Output '====================================================='
Write-Output ' EditMode Tests Finished '
Write-Output '====================================================='
if (Test-Path $logFile) {
Write-Output '====================================================='
Write-Output ' Begin EditMode Tests Logs '
Write-Output '====================================================='
Get-Content $logFile
Write-Output '====================================================='
Write-Output ' End EditMode Tests Logs '
Write-Output '====================================================='
}
else {
Write-Output 'EditMode Tests log missing!'
}
if (Test-Path $resultFile) {
Write-Output '====================================================='
Write-Output ' Begin EditMode Tests Results '
Write-Output '====================================================='
Get-Content $resultFile
Write-Output '====================================================='
Write-Output ' End EditMode Tests Results '
Write-Output '====================================================='
}
else {
Write-Output 'EditMode Tests results missing!'
}
Write-Output "Exit code: $($proc.ExitCode)"
}
displayName: Run EditMode tests
- pwsh: |
Write-Host "======================= PlayMode Tests ======================="
$logFile = Join-Path $(Build.ArtifactStagingDirectory) "playmode-test-run.log"
New-Item -Path $logFile -ItemType File -Force
$resultFile = Join-Path $(Build.ArtifactStagingDirectory) "test-results-playmode.xml"
New-Item -Path $resultFile -ItemType File -Force
$setupMethod = "Microsoft.MixedReality.Toolkit.Examples.Build.BuildApp.EnsureTMPro"
try {
if ("${{ parameters.UnityVersion }}" -eq "Latest") {
$proc = Start-UnityEditor -Project "${{ parameters.PathToProject }}" -Latest -ExecuteMethod $setupMethod -RunTests -TestPlatform PlayMode -BuildTarget ${{ parameters.BuildTarget }} -BatchMode -PassThru -LogFile $logFile -EditorTestsResultFile $resultFile -AdditionalArguments "${{ parameters.AdditionalArguments }}"
}
else {
$proc = Start-UnityEditor -Project "${{ parameters.PathToProject }}" -Version ${{ parameters.UnityVersion }} -ExecuteMethod $setupMethod -RunTests -TestPlatform PlayMode -BuildTarget ${{ parameters.BuildTarget }} -BatchMode -PassThru -LogFile $logFile -EditorTestsResultFile $resultFile -AdditionalArguments "${{ parameters.AdditionalArguments }}"
}
if ("${{ parameters.UnityVersion }}" -eq "Latest") {
$proc = Start-UnityEditor -Project "${{ parameters.PathToProject }}" -Latest -ExecuteMethod $setupMethod -RunTests -TestPlatform PlayMode -BuildTarget ${{ parameters.BuildTarget }} -BatchMode -PassThru -LogFile $logFile -EditorTestsResultFile $resultFile -AdditionalArguments "${{ parameters.AdditionalArguments }}"
}
else {
$proc = Start-UnityEditor -Project "${{ parameters.PathToProject }}" -Version ${{ parameters.UnityVersion }} -ExecuteMethod $setupMethod -RunTests -TestPlatform PlayMode -BuildTarget ${{ parameters.BuildTarget }} -BatchMode -PassThru -LogFile $logFile -EditorTestsResultFile $resultFile -AdditionalArguments "${{ parameters.AdditionalArguments }}"
}
$ljob = Start-Job -ScriptBlock { param($log) Get-Content "$log" -Wait } -ArgumentList $logFile
while (-not $proc.HasExited -and $ljob.HasMoreData)
{
Receive-Job $ljob
Start-Sleep -Milliseconds 200
}
Stop-Job $ljob
Remove-Job $ljob
Stop-Process $proc
$ljob = Start-Job -ScriptBlock { param($log) Get-Content "$log" -Wait } -ArgumentList $logFile
while (-not $proc.HasExited -and $ljob.HasMoreData)
{
Receive-Job $ljob
Start-Sleep -Milliseconds 200
}
Stop-Job $ljob
Remove-Job $ljob
Stop-Process $proc
}
finally {
Write-Output '====================================================='
Expand All @@ -105,6 +138,7 @@ steps:
else {
Write-Output 'PlayMode Tests log missing!'
}
if (Test-Path $resultFile) {
Write-Output '====================================================='
Write-Output ' Begin PlayMode Tests Results '
Expand All @@ -119,16 +153,16 @@ steps:
else {
Write-Output 'PlayMode Tests results missing!'
}
Write-Output "Exit code: $($proc.ExitCode)"
}
displayName: 'Run PlayMode tests'
Write-Output "Exit code: $($proc.ExitCode)"
}
displayName: Run PlayMode tests
- task: PublishTestResults@2
displayName: 'Publish Test Results'
displayName: Publish Test Results
inputs:
testResultsFormat: NUnit
testResultsFiles: 'test*.xml'
testResultsFiles: "test*.xml"
searchFolder: $(Build.ArtifactStagingDirectory)
failTaskOnFailedTests: true
continueOnError: false
8 changes: 4 additions & 4 deletions com.microsoft.mrtk.core/Editor/AboutMRTK.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private static void Init()
window = GetWindow<AboutMRTK>();
window.titleContent = WindowTitle;

if (MixedRealityInspectorUtility.IsMixedRealityToolkitLogoAssetPresent())
if (InspectorUIUtility.IsMixedRealityToolkitLogoAssetPresent())
{
window.minSize = WindowSizeWithLogo;
window.maxSize = WindowSizeWithLogo;
Expand Down Expand Up @@ -78,18 +78,18 @@ private void OnGUI()
using (new EditorGUILayout.VerticalScope())
{
EditorGUILayout.Space(2);
if (!MixedRealityInspectorUtility.RenderMixedRealityToolkitLogo())
if (!InspectorUIUtility.RenderMixedRealityToolkitLogo())
{
// Only add additional space if the text fallback is used in RenderMixedRealityToolkitLogo().
EditorGUILayout.Space(3);
}
EditorGUILayout.LabelField("Copyright (c) Microsoft Corporation. Licensed under the MIT License.", MixedRealityStylesUtility.LicenseStyle);
EditorGUILayout.LabelField("Copyright (c) Microsoft Corporation. Licensed under the MIT License.", MRTKEditorStyles.LicenseStyle);
EditorGUILayout.Space(12);

if (packageListRequest != null && packageListRequest.IsCompleted == false)
{
EditorGUILayout.Space(30);
EditorGUILayout.LabelField("Loading package information...", MixedRealityStylesUtility.LicenseStyle);
EditorGUILayout.LabelField("Loading package information...", MRTKEditorStyles.LicenseStyle);
}
else
{
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Microsoft.MixedReality.Toolkit.Editor
/// as the configurations assigned to each subsystem.
/// </summary>
[CustomEditor(typeof(MRTKProfile))]
public class MRTKProfileInspector : UnityEditor.Editor
public class MRTKProfileEditor : UnityEditor.Editor
{
/// <summary>
/// A container class, intended to wrap all information about a subsystem
Expand Down Expand Up @@ -290,13 +290,13 @@ private void DrawSubsystemList()
{
using (new EditorGUILayout.VerticalScope(Styles.SubsystemSelectionPanel, GUILayout.Width(Styles.SubsystemListWidth), GUILayout.ExpandWidth(true)))
{
EditorGUILayout.LabelField("Available MRTK Subsystems", MixedRealityStylesUtility.BoldLargeTitleStyle);
EditorGUILayout.LabelField("Available MRTK Subsystems", MRTKEditorStyles.BoldLargeTitleStyle);

foreach (KeyValuePair<string, List<SubsystemItem>> pair in allSubsystemTypes)
{
using (new EditorGUILayout.VerticalScope(Styles.SubsystemListStyle, GUILayout.ExpandHeight(true)))
{
EditorGUILayout.LabelField(pair.Key, MixedRealityStylesUtility.BoldLargeTitleStyle);
EditorGUILayout.LabelField(pair.Key, MRTKEditorStyles.BoldLargeTitleStyle);

foreach (SubsystemItem subsystemItem in pair.Value)
{
Expand Down Expand Up @@ -330,7 +330,7 @@ private void DrawSubsystemInspector()
{
using (new EditorGUILayout.VerticalScope(Styles.SubsystemDetailsPanel))
{
EditorGUILayout.LabelField("Subsystem Details", MixedRealityStylesUtility.BoldLargeTitleStyle);
EditorGUILayout.LabelField("Subsystem Details", MRTKEditorStyles.BoldLargeTitleStyle);

if (selectedItem == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Microsoft.MixedReality.Toolkit.Editor
{
[CustomEditor(typeof(StatefulInteractable), true)]
[CanEditMultipleObjects]
public class StatefulInteractableInspector : BaseInteractableEditor
public class StatefulInteractableEditor : BaseInteractableEditor
{
private SerializedProperty IsToggled;
private SerializedProperty IsToggledStateActive;
Expand Down
Loading

0 comments on commit 30959cf

Please sign in to comment.