-
Notifications
You must be signed in to change notification settings - Fork 362
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,156 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!29 &1 | ||
SceneSettings: | ||
m_ObjectHideFlags: 0 | ||
m_PVSData: | ||
m_PVSObjectsArray: [] | ||
m_PVSPortalsArray: [] | ||
m_OcclusionBakeSettings: | ||
smallestOccluder: 5 | ||
smallestHole: 0.25 | ||
backfaceThreshold: 100 | ||
--- !u!104 &2 | ||
RenderSettings: | ||
m_ObjectHideFlags: 0 | ||
serializedVersion: 6 | ||
m_Fog: 0 | ||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} | ||
m_FogMode: 3 | ||
m_FogDensity: 0.01 | ||
m_LinearFogStart: 0 | ||
m_LinearFogEnd: 300 | ||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} | ||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} | ||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} | ||
m_AmbientIntensity: 1 | ||
m_AmbientMode: 0 | ||
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} | ||
m_HaloStrength: 0.5 | ||
m_FlareStrength: 1 | ||
m_FlareFadeSpeed: 3 | ||
m_HaloTexture: {fileID: 0} | ||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} | ||
m_DefaultReflectionMode: 0 | ||
m_DefaultReflectionResolution: 128 | ||
m_ReflectionBounces: 1 | ||
m_ReflectionIntensity: 1 | ||
m_CustomReflection: {fileID: 0} | ||
m_Sun: {fileID: 0} | ||
--- !u!157 &3 | ||
LightmapSettings: | ||
m_ObjectHideFlags: 0 | ||
serializedVersion: 6 | ||
m_GIWorkflowMode: 0 | ||
m_LightmapsMode: 1 | ||
m_GISettings: | ||
serializedVersion: 2 | ||
m_BounceScale: 1 | ||
m_IndirectOutputScale: 1 | ||
m_AlbedoBoost: 1 | ||
m_TemporalCoherenceThreshold: 1 | ||
m_EnvironmentLightingMode: 0 | ||
m_EnableBakedLightmaps: 1 | ||
m_EnableRealtimeLightmaps: 1 | ||
m_LightmapEditorSettings: | ||
serializedVersion: 3 | ||
m_Resolution: 2 | ||
m_BakeResolution: 40 | ||
m_TextureWidth: 1024 | ||
m_TextureHeight: 1024 | ||
m_AOMaxDistance: 1 | ||
m_Padding: 2 | ||
m_CompAOExponent: 0 | ||
m_LightmapParameters: {fileID: 0} | ||
m_TextureCompression: 1 | ||
m_FinalGather: 0 | ||
m_FinalGatherRayCount: 1024 | ||
m_ReflectionCompression: 2 | ||
m_LightingDataAsset: {fileID: 0} | ||
m_RuntimeCPUUsage: 25 | ||
--- !u!196 &4 | ||
NavMeshSettings: | ||
serializedVersion: 2 | ||
m_ObjectHideFlags: 0 | ||
m_BuildSettings: | ||
serializedVersion: 2 | ||
agentRadius: 0.5 | ||
agentHeight: 2 | ||
agentSlope: 45 | ||
agentClimb: 0.4 | ||
ledgeDropHeight: 0 | ||
maxJumpAcrossDistance: 0 | ||
accuratePlacement: 0 | ||
minRegionArea: 2 | ||
cellSize: 0.16666667 | ||
manualCellSize: 0 | ||
m_NavMeshData: {fileID: 0} | ||
--- !u!1 &978433746 | ||
GameObject: | ||
m_ObjectHideFlags: 0 | ||
m_PrefabParentObject: {fileID: 0} | ||
m_PrefabInternal: {fileID: 0} | ||
serializedVersion: 4 | ||
m_Component: | ||
- 4: {fileID: 978433749} | ||
- 114: {fileID: 978433747} | ||
- 114: {fileID: 978433750} | ||
m_Layer: 0 | ||
m_Name: SceneCompositionRoot | ||
m_TagString: Untagged | ||
m_Icon: {fileID: 0} | ||
m_NavMeshLayer: 0 | ||
m_StaticEditorFlags: 0 | ||
m_IsActive: 1 | ||
--- !u!114 &978433747 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_PrefabParentObject: {fileID: 0} | ||
m_PrefabInternal: {fileID: 0} | ||
m_GameObject: {fileID: 978433746} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: 0e516af87ca41694bbaa70c373f993e0, type: 3} | ||
m_Name: | ||
m_EditorClassIdentifier: | ||
_runAll: 1 | ||
_testMethod: | ||
m_PersistentCalls: | ||
m_Calls: | ||
- m_Target: {fileID: 978433750} | ||
m_MethodName: TestGameObjectConcreteSingle | ||
m_Mode: 1 | ||
m_Arguments: | ||
m_ObjectArgument: {fileID: 0} | ||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine | ||
m_IntArgument: 0 | ||
m_FloatArgument: 0 | ||
m_StringArgument: | ||
m_BoolArgument: 0 | ||
m_CallState: 1 | ||
m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine, Version=0.0.0.0, Culture=neutral, | ||
PublicKeyToken=null | ||
--- !u!4 &978433749 | ||
Transform: | ||
m_ObjectHideFlags: 0 | ||
m_PrefabParentObject: {fileID: 0} | ||
m_PrefabInternal: {fileID: 0} | ||
m_GameObject: {fileID: 978433746} | ||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | ||
m_LocalPosition: {x: 0, y: 0, z: 0} | ||
m_LocalScale: {x: 1, y: 1, z: 1} | ||
m_Children: [] | ||
m_Father: {fileID: 0} | ||
m_RootOrder: 0 | ||
--- !u!114 &978433750 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_PrefabParentObject: {fileID: 0} | ||
m_PrefabInternal: {fileID: 0} | ||
m_GameObject: {fileID: 978433746} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: b2a4b96e29add784fad9924f51f7fa9b, type: 3} | ||
m_Name: | ||
m_EditorClassIdentifier: | ||
CubePrefab: {fileID: 181248, guid: 16c31656842de3b429a3232daac6826c, type: 2} |
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,132 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using ModestTree.UnityUnitTester; | ||
using UnityEngine; | ||
|
||
namespace ModestTree.Tests.Zenject.BindGameObject | ||
{ | ||
public class Fixture : MonoTestFixture | ||
{ | ||
public GameObject CubePrefab; | ||
|
||
const string GameObjName = "TestObj"; | ||
|
||
[Test] | ||
public void TestGameObjectSelfSingle1() | ||
{ | ||
Container.Bind<GameObject>().FromGameObject().WithGameObjectName(GameObjName).AsSingle(); | ||
|
||
Container.BindRootResolve<GameObject>(); | ||
|
||
FixtureUtil.AssertNumGameObjects(Container, 1); | ||
FixtureUtil.AssertNumGameObjectsWithName(Container, GameObjName, 1); | ||
} | ||
|
||
[Test] | ||
public void TestGameObjectSelfSingle2() | ||
{ | ||
Container.Bind<GameObject>().FromGameObject().WithGameObjectName(GameObjName).AsSingle(); | ||
Container.Bind<GameObject>().FromGameObject().WithGameObjectName(GameObjName).AsSingle(); | ||
Container.Bind<GameObject>("asdf").FromGameObject().WithGameObjectName(GameObjName).AsSingle(); | ||
|
||
Container.BindRootResolve<GameObject>(); | ||
Container.BindRootResolve<GameObject>("asdf"); | ||
|
||
FixtureUtil.AssertNumGameObjects(Container, 1); | ||
FixtureUtil.AssertNumGameObjectsWithName(Container, GameObjName, 1); | ||
} | ||
|
||
[Test] | ||
[ExpectedException] | ||
[ExpectedValidationException] | ||
public void TestGameObjectSelfSingleConflict() | ||
{ | ||
Container.Bind<GameObject>().FromGameObject().WithGameObjectName(GameObjName).AsSingle(); | ||
Container.Bind<GameObject>().FromGameObject().WithGameObjectName("asdf").AsSingle(); | ||
|
||
Container.BindRootResolve<GameObject>(); | ||
} | ||
|
||
[Test] | ||
public void TestGameObjectSelfTransient() | ||
{ | ||
Container.Bind<GameObject>().FromGameObject().WithGameObjectName(GameObjName).AsTransient(); | ||
Container.Bind<GameObject>().FromGameObject().WithGameObjectName(GameObjName).AsTransient(); | ||
Container.Bind<GameObject>().FromGameObject().WithGameObjectName("asdf").AsTransient(); | ||
Container.BindRootResolve<GameObject>(); | ||
|
||
FixtureUtil.AssertNumGameObjects(Container, 3); | ||
FixtureUtil.AssertNumGameObjectsWithName(Container, GameObjName, 2); | ||
} | ||
|
||
[Test] | ||
public void TestGameObjectConcreteSingle() | ||
{ | ||
Container.Bind<UnityEngine.Object>().To<GameObject>().FromGameObject().WithGameObjectName(GameObjName).AsSingle(); | ||
|
||
Container.BindRootResolve<UnityEngine.Object>(); | ||
|
||
FixtureUtil.AssertNumGameObjects(Container, 1); | ||
FixtureUtil.AssertNumGameObjectsWithName(Container, GameObjName, 1); | ||
} | ||
|
||
[Test] | ||
public void TestPrefabSelfSingle1() | ||
{ | ||
Container.Bind<GameObject>().FromPrefab(CubePrefab) | ||
.WithGameObjectName(GameObjName).AsSingle(); | ||
|
||
FixtureUtil.AssertNumGameObjects(Container, 1); | ||
FixtureUtil.AssertNumGameObjectsWithName(Container, GameObjName, 1); | ||
|
||
FixtureUtil.AddInitMethod(Container, (GameObject gameObject) => | ||
{ | ||
Assert.IsNotNull(gameObject.GetComponent<BoxCollider>()); | ||
}); | ||
} | ||
|
||
[Test] | ||
public void TestPrefabConcreteSingle1() | ||
{ | ||
Container.Bind<UnityEngine.Object>().To<GameObject>() | ||
.FromPrefab(CubePrefab).WithGameObjectName(GameObjName).AsSingle(); | ||
|
||
FixtureUtil.AssertNumGameObjects(Container, 1); | ||
FixtureUtil.AssertNumGameObjectsWithName(Container, GameObjName, 1); | ||
|
||
FixtureUtil.AddInitMethod(Container, (UnityEngine.Object obj) => | ||
{ | ||
Assert.IsNotNull(((GameObject)obj).GetComponent<BoxCollider>()); | ||
}); | ||
} | ||
|
||
[Test] | ||
public void TestPrefabResourceSelfSingle1() | ||
{ | ||
Container.Bind<GameObject>().FromPrefabResource("BindGameObject/Cube").WithGameObjectName(GameObjName).AsSingle(); | ||
|
||
FixtureUtil.AssertNumGameObjects(Container, 1); | ||
FixtureUtil.AssertNumGameObjectsWithName(Container, GameObjName, 1); | ||
|
||
FixtureUtil.AddInitMethod(Container, (GameObject gameObject) => | ||
{ | ||
Assert.IsNotNull(gameObject.GetComponent<BoxCollider>()); | ||
}); | ||
} | ||
|
||
[Test] | ||
public void TestPrefabResourceConcreteSingle1() | ||
{ | ||
Container.Bind<UnityEngine.Object>().To<GameObject>() | ||
.FromPrefabResource("BindGameObject/Cube").WithGameObjectName(GameObjName).AsSingle(); | ||
|
||
FixtureUtil.AssertNumGameObjects(Container, 1); | ||
FixtureUtil.AssertNumGameObjectsWithName(Container, GameObjName, 1); | ||
|
||
FixtureUtil.AddInitMethod(Container, (UnityEngine.Object obj) => | ||
{ | ||
Assert.IsNotNull(((GameObject)obj).GetComponent<BoxCollider>()); | ||
}); | ||
} | ||
} | ||
} |
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.