PO/Library/Artifacts/14/1431b0c71cd65fe293b9988a92b...

146 lines
8.9 KiB
Plaintext
Raw Normal View History

2022-01-12 10:06:03 +03:00
<0F>#h2019.4.19f1<00><><EFBFBD><EFBFBD> <00><>f<EFBFBD><66>!<21>5<>9<EFBFBD>4Q<0E><>B<00>7<00><><EFBFBD><EFBFBD><EFBFBD><00><00><00><><00> E<00> <00><00>#<00>.<00>,<00>5a<00> <00><00>#<00>.<00>,<00><00><00>r<00> <00><00># <00>.<00>,
<00>H<00><><00><><EFBFBD><EFBFBD><EFBFBD> <01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD> @<00><00><00> Q<00>j<00><00><00>J<00><><EFBFBD><EFBFBD><00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD><00><00><00><00><00>j<00><><EFBFBD><EFBFBD><EFBFBD><00>\<00><00><><EFBFBD><EFBFBD><EFBFBD><00>H<00>r<00><><EFBFBD><EFBFBD><00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00>H<00>w<00><><EFBFBD><EFBFBD><00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00>H<00><><00><><EFBFBD><EFBFBD><00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00>y<00>
<00> <00><00>#!<00>.<00>,"<00><00><><00><><EFBFBD><EFBFBD>#@1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>$<00><00><00>%.<00>j<00>&<00><00><><00><><EFBFBD><EFBFBD>'<00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>(<00><00><00><00>)<00>j<00><><EFBFBD><EFBFBD><EFBFBD>*<00>H<00><><00><><EFBFBD><EFBFBD><EFBFBD>+<00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>,@<00><00><00>-Q<00>j<00>.y<00>
<00> /<00><00>#0<00>.<00>,1<00> <00><>2@<00><00><> 3@<00><00>#4<00>.<00>,5<00>H<00><><00><><EFBFBD><EFBFBD>6<01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>7@<00><00><00>8Q<00>j<00>9H<00><><00><><EFBFBD><EFBFBD>:<01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>;@<00><00><00><Q<00>j<00>=H<00><><00><><EFBFBD><EFBFBD>><01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>?@<00><00><00>@Q<00>j<00>AMonoImporterPPtr<EditorExtension>m_FileIDm_PathIDPPtr<PrefabInstance>m_ExternalObjectsSourceAssetIdentifiertypeassemblynamem_UsedFileIDsm_DefaultReferencesexecutionOrdericonm_UserDatam_AssetBundleNamem_AssetBundleVariants<00><><EFBFBD>G<EFBFBD><47>܏Z56<35>:!@i<>J*<00><00>7<00><><EFBFBD><EFBFBD><EFBFBD><00><00><00><><00>E<00> <00><00><00>.<00><00>(a<00> <00><00><00>.<00><00><00><00>r<00> <00><00> <00>.<00>
<00>H<00><><00><><EFBFBD><EFBFBD><EFBFBD> <01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD> @<00><00><00> Q<00>j<00>H<00><><00><><EFBFBD><EFBFBD><EFBFBD><01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00><00><00>=<00><><EFBFBD><EFBFBD><01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD><01><00><00><00><00>j<00><><EFBFBD><EFBFBD><EFBFBD><01>H<00><><00><><EFBFBD><EFBFBD><EFBFBD><01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00>y<00>
<00> <00><00><00>.<00><00>y<00>Q <00><00><00>.<00> <00><00><00>X!H<00>i<00><><EFBFBD><EFBFBD>"<10>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>#@<00><00><00>$Q<00>j<00>%H<00>u<00><><EFBFBD><EFBFBD>&<10>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>'@<00><00><00>(Q<00>j<00>)PPtr<EditorExtension>m_FileIDm_PathIDPPtr<PrefabInstance>m_DefaultReferencesm_Iconm_ExecutionOrderm_ClassNamem_Namespace\<00>y<EFBFBD>`<00>y<EFBFBD>
ImageTests<00>using UnityEngine;
using UnityEngine.TestTools;
using NUnit.Framework;
using System.Collections;
using UnityEngine.UI;
using System.Reflection;
public class ImageTests
{
private const int Width = 32;
private const int Height = 32;
GameObject m_CanvasGO;
TestableImage m_Image;
private Texture2D m_defaultTexture;
private bool m_dirtyLayout;
private bool m_dirtyMaterial;
[SetUp]
public void SetUp()
{
m_CanvasGO = new GameObject("Canvas", typeof(Canvas));
GameObject imageObject = new GameObject("Image", typeof(TestableImage));
imageObject.transform.SetParent(m_CanvasGO.transform);
m_Image = imageObject.GetComponent<TestableImage>();
m_Image.RegisterDirtyLayoutCallback(() => m_dirtyLayout = true);
m_Image.RegisterDirtyMaterialCallback(() => m_dirtyMaterial = true);
m_defaultTexture = new Texture2D(Width, Height);
Color[] colors = new Color[Width * Height];
for (int i = 0; i < Width * Height; i++)
colors[i] = Color.magenta;
m_defaultTexture.Apply();
}
[Test]
public void TightMeshSpritePopulatedVertexHelperProperly()
{
Texture2D texture = new Texture2D(64, 64);
m_Image.sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0, 0));
m_Image.type = Image.Type.Simple;
m_Image.useSpriteMesh = true;
VertexHelper vh = new VertexHelper();
m_Image.GenerateImageData(vh);
Assert.AreEqual(vh.currentVertCount, m_Image.sprite.vertices.Length);
Assert.AreEqual(vh.currentIndexCount, m_Image.sprite.triangles.Length);
}
[UnityTest]
public IEnumerator CanvasCustomRefPixPerUnitToggleWillUpdateImageMesh()
{
var canvas = m_CanvasGO.GetComponent<Canvas>();
var canvasScaler = m_CanvasGO.AddComponent<CanvasScaler>();
canvasScaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
m_Image.transform.SetParent(m_CanvasGO.transform);
m_Image.type = Image.Type.Sliced;
var texture = new Texture2D(120, 120);
m_Image.sprite = Sprite.Create(texture, new Rect(0, 0, 120, 120), new Vector2(0.5f, 0.5f), 100, 1, SpriteMeshType.Tight, new Vector4(30, 30, 30, 30), true);
m_Image.fillCenter = true;
canvasScaler.referencePixelsPerUnit = 200;
yield return null; // skip frame to update canvas properly
//setup done
canvas.enabled = false;
yield return null;
canvas.enabled = true;
m_Image.isOnPopulateMeshCalled = false;
yield return null;
Assert.IsTrue(m_Image.isOnPopulateMeshCalled);
}
[UnityTest]
public IEnumerator Sprite_Layout()
{
m_Image.sprite = Sprite.Create(m_defaultTexture, new Rect(0, 0, Width, Height), Vector2.zero);
yield return null;
m_Image.isGeometryUpdated = false;
m_dirtyLayout = false;
var Texture = new Texture2D(Width * 2, Height * 2);
m_Image.sprite = Sprite.Create(Texture, new Rect(0, 0, Width, Height), Vector2.zero);
yield return new WaitUntil(() => m_Image.isGeometryUpdated);
// validate that layout change rebuil is not called
Assert.IsFalse(m_dirtyLayout);
m_Image.isGeometryUpdated = false;
m_dirtyLayout = false;
m_Image.sprite = Sprite.Create(Texture, new Rect(0, 0, Width / 2, Height / 2), Vector2.zero);
yield return new WaitUntil(() => m_Image.isGeometryUpdated);
// validate that layout change rebuil is called
Assert.IsTrue(m_dirtyLayout);
}
[UnityTest]
public IEnumerator Sprite_Material()
{
m_Image.sprite = Sprite.Create(m_defaultTexture, new Rect(0, 0, Width, Height), Vector2.zero);
yield return null;
m_Image.isGeometryUpdated = false;
m_dirtyMaterial = false;
m_Image.sprite = Sprite.Create(m_defaultTexture, new Rect(0, 0, Width / 2, Height / 2), Vector2.zero);
yield return new WaitUntil(() => m_Image.isGeometryUpdated);
// validate that material change rebuild is not called
Assert.IsFalse(m_dirtyMaterial);
m_Image.isGeometryUpdated = false;
m_dirtyMaterial = false;
var Texture = new Texture2D(Width * 2, Height * 2);
m_Image.sprite = Sprite.Create(Texture, new Rect(0, 0, Width / 2, Height / 2), Vector2.zero);
yield return new WaitUntil(() => m_Image.isGeometryUpdated);
// validate that layout change rebuil is called
Assert.IsTrue(m_dirtyMaterial);
}
[TearDown]
public void TearDown()
{
GameObject.DestroyImmediate(m_CanvasGO);
GameObject.DestroyImmediate(m_defaultTexture);
}
}
ImageTests