-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using NUnit.Framework; | ||
using UnityEditor; | ||
|
||
namespace UniCommonTestRunner | ||
{ | ||
public partial class UniCommonTestRunner | ||
{ | ||
/// <summary> | ||
/// 加速度センサーが無効になっているかどうかテストします | ||
/// </summary> | ||
[Test] | ||
public void CheckAccelerometerFrequency() | ||
{ | ||
Assert.IsTrue( PlayerSettings.accelerometerFrequency == 0 ); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using NUnit.Framework; | ||
using System.Linq; | ||
using System.Text; | ||
using UnityEditor; | ||
|
||
namespace UniCommonTestRunner | ||
{ | ||
public partial class UniCommonTestRunner | ||
{ | ||
/// <summary> | ||
/// Android 用のプラグインのプラットフォームが適切に設定されているかどうかテストします | ||
/// </summary> | ||
[Test] | ||
public void CheckAndroidPlugin() | ||
{ | ||
var list = AssetDatabase | ||
.GetAllAssetPaths() | ||
.Where( c => c.Contains( "Plugins" ) ) | ||
.Where( c => c.Contains( "Android" ) ) | ||
.Select( c => AssetImporter.GetAtPath( c ) ) | ||
.OfType<PluginImporter>() | ||
.Where( c => c != null ) | ||
.Where( c => c.GetCompatibleWithPlatform( BuildTarget.iOS ) ) | ||
.Select( c => AssetDatabase.GetAssetPath( c ) ) | ||
; | ||
|
||
if ( !list.Any() ) return; | ||
|
||
var sb = new StringBuilder(); | ||
|
||
foreach ( var n in list ) | ||
{ | ||
sb.AppendLine( n ); | ||
} | ||
|
||
Assert.Fail( sb.ToString() ); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using NUnit.Framework; | ||
using System.Linq; | ||
using System.Text; | ||
using UnityEditor; | ||
using UnityEditor.Animations; | ||
|
||
namespace UniCommonTestRunner | ||
{ | ||
public partial class UniCommonTestRunner | ||
{ | ||
/// <summary> | ||
/// Animator Controller のステートが null になっていないかどうかテストします | ||
/// </summary> | ||
[Test] | ||
public void CheckAnimatorControllerState() | ||
{ | ||
var list = AssetDatabase | ||
.FindAssets( "t:AnimatorController" ) | ||
.Select( AssetDatabase.GUIDToAssetPath ) | ||
.Select( c => AssetDatabase.LoadAssetAtPath<AnimatorController>( c ) ) | ||
.Where( c => c != null ) | ||
.Where( c => HasNullMotion( c ) ) | ||
.Select( c => AssetDatabase.GetAssetPath( c ) ) | ||
; | ||
|
||
if ( !list.Any() ) return; | ||
|
||
var sb = new StringBuilder(); | ||
|
||
foreach ( var n in list ) | ||
{ | ||
sb.AppendLine( n ); | ||
} | ||
|
||
Assert.Fail( sb.ToString() ); | ||
} | ||
|
||
private bool HasNullMotion( AnimatorController controller ) | ||
{ | ||
foreach ( var layer in controller.layers ) | ||
{ | ||
if ( layer.stateMachine.states.Any( c => c.state.motion == null ) ) | ||
{ | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using NUnit.Framework; | ||
using UniCommonTestRunner.Internal; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace UniCommonTestRunner | ||
{ | ||
/// <summary> | ||
/// Audio Listener が存在しないかどうかテストします | ||
/// </summary> | ||
public partial class UniCommonTestRunner | ||
{ | ||
[MenuItem( UCTRConst.MENU_ITEM_ROOT + "Check Audio Listener Exist" )] | ||
private static void CheckAudioListenerExistFromMenu() | ||
{ | ||
UCTRUtils.CheckGameObjectsInCurrentScene( "CheckAudioListenerExist", DoCheckAudioListenerExist ); | ||
} | ||
|
||
[Test] | ||
public void CheckAudioListenerExist() | ||
{ | ||
UCTRUtils.CheckGameObjectsAll( DoCheckAudioListenerExist ); | ||
} | ||
|
||
private static bool DoCheckAudioListenerExist( GameObject go ) | ||
{ | ||
return go.GetComponent<AudioListener>(); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using NUnit.Framework; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using UnityEditor.SceneManagement; | ||
using UnityEngine; | ||
|
||
namespace UniCommonTestRunner | ||
{ | ||
public partial class UniCommonTestRunner | ||
{ | ||
/// <summary> | ||
/// Audio Listener が複数存在しないかどうかテストします | ||
/// </summary> | ||
[Test] | ||
public void CheckAudioListenerMultiple() | ||
{ | ||
var settings = UCTRUtils.GetSettings(); | ||
|
||
Assert.IsNotNull( settings, "`UCTRSettings.asset` could not be found." ); | ||
|
||
if ( settings == null ) return; | ||
|
||
var result = new List<string>(); | ||
|
||
foreach ( var n in settings.GetScenePathList() ) | ||
{ | ||
var scene = EditorSceneManager.OpenScene( n ); | ||
var count = Resources | ||
.FindObjectsOfTypeAll<GameObject>() | ||
.Where( c => c.scene.isLoaded ) | ||
.Where( c => c.hideFlags == HideFlags.None ) | ||
.Count( c => c.GetComponent<AudioListener>() != null ) | ||
; | ||
|
||
if ( count <= 1 ) continue; | ||
|
||
result.Add( n ); | ||
} | ||
|
||
if ( result.Count <= 0 ) return; | ||
|
||
var sb = new StringBuilder(); | ||
|
||
foreach ( var n in result ) | ||
{ | ||
sb.AppendLine( n ); | ||
} | ||
|
||
Assert.Fail( sb.ToString() ); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using NUnit.Framework; | ||
using UniCommonTestRunner.Internal; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace UniCommonTestRunner | ||
{ | ||
/// <summary> | ||
/// 2D のカメラのパタメータが正しく設定されているかどうかテストします | ||
/// </summary> | ||
public partial class UniCommonTestRunner | ||
{ | ||
[MenuItem( UCTRConst.MENU_ITEM_ROOT + "Check Camera 2D" )] | ||
private static void CheckCamera2DFromMenu() | ||
{ | ||
UCTRUtils.CheckGameObjectsInCurrentScene( "CheckCamera2D", DoCheckCamera2D ); | ||
} | ||
|
||
[Test] | ||
public void CheckCamera2D() | ||
{ | ||
UCTRUtils.CheckGameObjectsAll( DoCheckCamera2D ); | ||
} | ||
|
||
private static bool DoCheckCamera2D( GameObject go ) | ||
{ | ||
var camera = go.GetComponent<Camera>(); | ||
if ( camera == null ) return false; | ||
if ( camera.clearFlags != CameraClearFlags.Color ) return true; | ||
if ( !camera.orthographic ) return true; | ||
if ( camera.orthographicSize != 5 ) return true; | ||
if ( camera.useOcclusionCulling ) return true; | ||
return false; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.