Browse Source

Merge pull request #387 from FungusGames/update-test-tools

Updated test tools to fix compiler warnings
master
Chris Gregan 9 years ago
parent
commit
b7fac1bc80
  1. 3
      Assets/UnityTestTools/Assertions/Editor/AssertionComponentEditor.cs
  2. 4
      Assets/UnityTestTools/Common/Settings/IntegrationTestsRunnerSettings.asset.meta
  3. 2
      Assets/UnityTestTools/IntegrationTestsFramework/Libs.meta
  4. 2
      Assets/UnityTestTools/IntegrationTestsFramework/Libs/Mono.Cecil.Mdb.dll.meta
  5. 6
      Assets/UnityTestTools/IntegrationTestsFramework/Libs/Mono.Cecil.dll.meta
  6. 3
      Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Batch.cs
  7. 2
      Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/EditorReferencesUtil.cs.meta
  8. 8
      Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/IntegrationTestsRunnerWindow.cs
  9. 5
      Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerConfiguration.cs
  10. 5
      Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerSettingsWindow.cs
  11. 5
      Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/TestComponentEditor.cs
  12. 7
      Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/ResultDTO.cs
  13. 5
      Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestComponent.cs
  14. 7
      Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestRunner.cs

3
Assets/UnityTestTools/Assertions/Editor/AssertionComponentEditor.cs

@ -4,6 +4,7 @@ using System.Linq;
using System.Reflection;
using UnityEditor;
using UnityEngine;
using UnityEditor.SceneManagement;
namespace UnityTest
{
@ -81,6 +82,8 @@ namespace UnityTest
DrawCompareToType(script.Action as ComparerBase);
}
}
if(GUI.changed)
EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
}
private void DrawOptionsForAfterPeriodOfTime(AssertionComponent script)

4
Assets/UnityTestTools/Common/Settings/IntegrationTestsRunnerSettings.asset.meta

@ -1,6 +1,6 @@
fileFormatVersion: 2
guid: ad7c6353939274fc8a5e756095b99a64
timeCreated: 1450715835
guid: ec24e4a07acd24ffaa1cd1df7fa11d54
timeCreated: 1455275624
licenseType: Free
NativeFormatImporter:
userData:

2
Assets/UnityTestTools/IntegrationTestsFramework/Libs.meta

@ -2,7 +2,7 @@ fileFormatVersion: 2
guid: e22ba039de7077c4aa95758ef723b803
folderAsset: yes
timeCreated: 1445282049
licenseType: Store
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:

2
Assets/UnityTestTools/IntegrationTestsFramework/Libs/Mono.Cecil.Mdb.dll.meta

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 713231d47408a06408a45470c967bae8
timeCreated: 1441797177
licenseType: Store
licenseType: Pro
PluginImporter:
serializedVersion: 1
iconMap: {}

6
Assets/UnityTestTools/IntegrationTestsFramework/Libs/Mono.Cecil.dll.meta

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 28fc22990733f8f4ea1137f15e363609
timeCreated: 1441797177
licenseType: Store
licenseType: Pro
PluginImporter:
serializedVersion: 1
iconMap: {}
@ -15,6 +15,10 @@ PluginImporter:
enabled: 1
settings:
DefaultValueInitialized: true
WindowsStoreApps:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

3
Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Batch.cs

@ -6,6 +6,7 @@ using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
using UnityTest.IntegrationTests;
using UnityEditor.SceneManagement;
namespace UnityTest
{
@ -89,7 +90,7 @@ namespace UnityTest
return;
}
EditorBuildSettings.scenes = (testScenes.Concat(otherBuildScenes).ToList()).Select(s => new EditorBuildSettingsScene(s, true)).ToArray();
EditorApplication.OpenScene(testScenes.First());
EditorSceneManager.OpenScene(testScenes.First());
GuiHelper.SetConsoleErrorPause(false);
var config = new PlatformRunnerConfiguration

2
Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/EditorReferencesUtil.cs.meta

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: aad501c968b324cf3a8d1c52eb09ca04
timeCreated: 1437322927
licenseType: Store
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []

8
Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/IntegrationTestsRunnerWindow.cs

@ -6,6 +6,7 @@ using System.Text.RegularExpressions;
using UnityEditor;
using UnityEngine;
using UnityTest.IntegrationTestRunner;
using UnityEngine.SceneManagement;
namespace UnityTest
{
@ -83,10 +84,11 @@ namespace UnityTest
private static void BackgroundSceneChangeWatch()
{
if (!s_Instance) return;
if (s_Instance.m_CurrectSceneName != null && s_Instance.m_CurrectSceneName == EditorApplication.currentScene) return;
var currentScene = SceneManager.GetActiveScene().path;
if (s_Instance.m_CurrectSceneName != null && s_Instance.m_CurrectSceneName == currentScene) return;
if (EditorApplication.isPlayingOrWillChangePlaymode) return;
TestComponent.DestroyAllDynamicTests();
s_Instance.m_CurrectSceneName = EditorApplication.currentScene;
s_Instance.m_CurrectSceneName = currentScene;
s_Instance.m_ResultList.Clear();
s_Instance.RebuildTestList();
}
@ -239,7 +241,7 @@ namespace UnityTest
if (!EditorApplication.isPlayingOrWillChangePlaymode)
{
var dynamicTestsOnScene = TestComponent.FindAllDynamicTestsOnScene();
var dynamicTestTypes = TestComponent.GetTypesWithHelpAttribute(EditorApplication.currentScene);
var dynamicTestTypes = TestComponent.GetTypesWithHelpAttribute(SceneManager.GetActiveScene().path);
foreach (var dynamicTestType in dynamicTestTypes)
{

5
Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerConfiguration.cs

@ -6,6 +6,7 @@ using System.Net;
using System.Net.Sockets;
using UnityEditor;
using UnityEngine;
using UnityEngine.SceneManagement;
[Serializable]
public class PlatformRunnerConfiguration
@ -14,7 +15,7 @@ public class PlatformRunnerConfiguration
public List<string> testScenes;
public BuildTarget buildTarget;
public bool runInEditor;
public string projectName = EditorApplication.currentScene;
public string projectName = SceneManager.GetActiveScene().path;
public string resultsDir = null;
public bool sendResultsOverNetwork;
@ -24,7 +25,7 @@ public class PlatformRunnerConfiguration
public PlatformRunnerConfiguration(BuildTarget buildTarget)
{
this.buildTarget = buildTarget;
projectName = EditorApplication.currentScene;
projectName = SceneManager.GetActiveScene().path;
}
public PlatformRunnerConfiguration()

5
Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerSettingsWindow.cs

@ -6,6 +6,7 @@ using System.Net;
using UnityEditor;
using UnityEngine;
using Object = UnityEngine.Object;
using UnityEngine.SceneManagement;
namespace UnityTest.IntegrationTests
{
@ -47,7 +48,7 @@ namespace UnityTest.IntegrationTests
position.Set(position.xMin, position.yMin, 200, position.height);
m_AllScenesInProject = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.unity", SearchOption.AllDirectories).ToList();
m_AllScenesInProject.Sort();
var currentScene = (Directory.GetCurrentDirectory() + EditorApplication.currentScene).Replace("\\", "").Replace("/", "");
var currentScene = (Directory.GetCurrentDirectory() + SceneManager.GetActiveScene().path).Replace("\\", "").Replace("/", "");
var currentScenePath = m_AllScenesInProject.Where(s => s.Replace("\\", "").Replace("/", "") == currentScene);
m_SelectedScenes.AddRange(currentScenePath);
@ -264,7 +265,7 @@ namespace UnityTest.IntegrationTests
buildTarget = m_BuildTarget,
buildScenes = m_OtherScenesToBuild,
testScenes = m_IntegrationTestScenes,
projectName = m_IntegrationTestScenes.Count > 1 ? "IntegrationTests" : Path.GetFileNameWithoutExtension(EditorApplication.currentScene),
projectName = m_IntegrationTestScenes.Count > 1 ? "IntegrationTests" : Path.GetFileNameWithoutExtension(SceneManager.GetActiveScene().path),
resultsDir = m_Settings.resultsPath,
sendResultsOverNetwork = m_Settings.sendResultsOverNetwork,
ipList = m_Interfaces.Skip(1).ToList(),

5
Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/TestComponentEditor.cs

@ -4,6 +4,7 @@ using System.Linq;
using UnityEditor;
using UnityEngine;
using Object = UnityEngine.Object;
using UnityEditor.SceneManagement;
namespace UnityTest
{
@ -101,8 +102,8 @@ namespace UnityTest
if (!component.dynamic)
serializedObject.ApplyModifiedProperties();
if(GUI.changed)
EditorApplication.MarkSceneDirty();
if (GUI.changed)
EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
}
private string[] GetListOfIgnoredPlatforms(string[] enumList, int flags)

7
Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/ResultDTO.cs

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace UnityTest
{
@ -18,9 +19,9 @@ namespace UnityTest
private ResultDTO(MessageType messageType)
{
this.messageType = messageType;
levelCount = Application.levelCount;
loadedLevel = Application.loadedLevel;
loadedLevelName = Application.loadedLevelName;
levelCount = UnityEngine.SceneManagement.SceneManager.sceneCount;
loadedLevel = UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex;
loadedLevelName = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;
}
public enum MessageType : byte

5
Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestComponent.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEngine;
using UnityEngine.SceneManagement;
#if UNITY_EDITOR
using UnityEditor;
@ -308,9 +309,9 @@ namespace UnityTest
public static bool AnyDynamicTestForCurrentScene()
{
#if UNITY_EDITOR
return TestComponent.GetTypesWithHelpAttribute(EditorApplication.currentScene).Any();
return TestComponent.GetTypesWithHelpAttribute(SceneManager.GetActiveScene().name).Any();
#else
return TestComponent.GetTypesWithHelpAttribute(Application.loadedLevelName).Any();
return TestComponent.GetTypesWithHelpAttribute(SceneManager.GetActiveScene().name).Any();
#endif
}

7
Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestRunner.cs

@ -8,6 +8,7 @@ using System.Reflection;
using UnityEngine;
using UnityTest.IntegrationTestRunner;
using System.IO;
using UnityEngine.SceneManagement;
namespace UnityTest
{
@ -74,7 +75,7 @@ namespace UnityTest
}
TestComponent.DestroyAllDynamicTests();
var dynamicTestTypes = TestComponent.GetTypesWithHelpAttribute(Application.loadedLevelName);
var dynamicTestTypes = TestComponent.GetTypesWithHelpAttribute(SceneManager.GetActiveScene().name);
foreach (var dynamicTestType in dynamicTestTypes)
TestComponent.CreateDynamicTest(dynamicTestType);
@ -309,7 +310,7 @@ namespace UnityTest
string testScene = m_Configurator.GetIntegrationTestScenes (TestSceneNumber);
if (testScene != null)
Application.LoadLevel(Path.GetFileNameWithoutExtension(testScene));
SceneManager.LoadScene(Path.GetFileNameWithoutExtension(testScene));
else
{
TestRunnerCallback.AllScenesFinished();
@ -363,7 +364,7 @@ namespace UnityTest
currentTest = null;
if (!testResult.IsSuccess
&& testResult.Executed
&& !testResult.IsIgnored) k_ResultRenderer.AddResults(Application.loadedLevelName, testResult);
&& !testResult.IsIgnored) k_ResultRenderer.AddResults(SceneManager.GetActiveScene().name, testResult);
}
#region Test Runner Helpers

Loading…
Cancel
Save