Initial Commit
This commit is contained in:
parent
53eb92e9af
commit
270ab7d11f
15341 changed files with 700234 additions and 0 deletions
|
@ -0,0 +1,42 @@
|
|||
using NUnit.Framework;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class RectMask2DCulling : TestBehaviourBase<UnityEngine.Canvas>
|
||||
{
|
||||
[Test]
|
||||
public void CullFlagNotResetWhenReparented740604()
|
||||
{
|
||||
var noMaskGameObject = new GameObject("noMaskGO");
|
||||
noMaskGameObject.AddComponent<RectTransform>();
|
||||
|
||||
var maskGameObject = new GameObject("MaskGO");
|
||||
var rectMask2D = maskGameObject.AddComponent<RectMask2D>();
|
||||
|
||||
noMaskGameObject.transform.SetParent(m_TestObject.transform);
|
||||
maskGameObject.transform.SetParent(m_TestObject.transform);
|
||||
|
||||
noMaskGameObject.GetComponent<RectTransform>().sizeDelta = new Vector2(800, 800);
|
||||
maskGameObject.GetComponent<RectTransform>().sizeDelta = new Vector2(400, 400);
|
||||
|
||||
var imageGameObject = new GameObject("ImageGO");
|
||||
var image = imageGameObject.AddComponent<Image>();
|
||||
imageGameObject.transform.SetParent(maskGameObject.transform);
|
||||
|
||||
imageGameObject.GetComponent<RectTransform>().sizeDelta = new Vector2(100, 100);
|
||||
|
||||
// Start with image inside RectMask2D area so that it's no culled
|
||||
rectMask2D.PerformClipping();
|
||||
Assert.IsFalse(image.canvasRenderer.cull);
|
||||
|
||||
// Move image outside of RectMask2D so that it is culled
|
||||
imageGameObject.GetComponent<RectTransform>().position = new Vector2(275, 275);
|
||||
rectMask2D.PerformClipping();
|
||||
Assert.IsTrue(image.canvasRenderer.cull);
|
||||
|
||||
// Change parent to noMask so that it's unaffected by RectMask2D and isn't culled
|
||||
imageGameObject.transform.SetParent(noMaskGameObject.transform);
|
||||
rectMask2D.PerformClipping();
|
||||
Assert.IsFalse(image.canvasRenderer.cull);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4402dcee6e9969549bf5b33f11533208
|
||||
timeCreated: 1458135886
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,18 @@
|
|||
using UnityEngine;
|
||||
using NUnit.Framework;
|
||||
|
||||
public class RectTransformPosition
|
||||
{
|
||||
[Test]
|
||||
public void SettingPositionBeforeGameObjectIsActivatedWorks_953409()
|
||||
{
|
||||
var positionToSet = new Vector3(1, 2, 3);
|
||||
var go = new GameObject("RectTransform", typeof(RectTransform));
|
||||
|
||||
go.SetActive(false);
|
||||
go.transform.position = positionToSet;
|
||||
go.SetActive(true);
|
||||
|
||||
Assert.AreEqual(positionToSet, go.transform.position, "Expected RectTransform position to be set but it was not.");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fb660d86885d89a499a31c6ab6f26269
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue