PO/Library/Artifacts/c4/c4b4d1921d887d1d3a157e74b13...

126 lines
8.8 KiB
Plaintext
Raw Normal View History

2022-01-12 10:06:03 +03:00
<0F>#P2019.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><00>y<EFBFBD>HorizonalLayoutGroupTestskusing System.IO;
using NUnit.Framework;
using UnityEditor;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.TestTools;
namespace LayoutTests
{
public class HorizontalLayoutGroupTests : IPrebuildSetup
{
GameObject m_PrefabRoot;
const string kPrefabPath = "Assets/Resources/HorizontalLayoutGroupPrefab.prefab";
public void Setup()
{
#if UNITY_EDITOR
var rootGO = new GameObject("rootGo");
var canvasGO = new GameObject("Canvas", typeof(Canvas));
canvasGO.transform.SetParent(rootGO.transform);
var groupGO = new GameObject("Group", typeof(RectTransform), typeof(HorizontalLayoutGroup));
groupGO.transform.SetParent(canvasGO.transform);
var horizontalLayoutGroup = groupGO.GetComponent<HorizontalLayoutGroup>();
horizontalLayoutGroup.padding = new RectOffset(2, 4, 3, 5);
horizontalLayoutGroup.spacing = 1;
horizontalLayoutGroup.childForceExpandWidth = false;
horizontalLayoutGroup.childForceExpandHeight = false;
horizontalLayoutGroup.childControlWidth = true;
horizontalLayoutGroup.childControlHeight = true;
var element1GO = new GameObject("Element1", typeof(RectTransform), typeof(LayoutElement));
element1GO.transform.SetParent(groupGO.transform);
var layoutElement1 = element1GO.GetComponent<LayoutElement>();
layoutElement1.minWidth = 5;
layoutElement1.minHeight = 10;
layoutElement1.preferredWidth = 100;
layoutElement1.preferredHeight = 50;
layoutElement1.flexibleWidth = 0;
layoutElement1.flexibleHeight = 0;
var element2GO = new GameObject("Element2", typeof(RectTransform), typeof(LayoutElement));
element2GO.transform.SetParent(groupGO.transform);
var layoutElement2 = element2GO.GetComponent<LayoutElement>();
layoutElement2.minWidth = 10;
layoutElement2.minHeight = 5;
layoutElement2.preferredWidth = -1;
layoutElement2.preferredHeight = -1;
layoutElement2.flexibleWidth = 0;
layoutElement2.flexibleHeight = 0;
var element3GO = new GameObject("Element3", typeof(RectTransform), typeof(LayoutElement));
element3GO.transform.SetParent(groupGO.transform);
var layoutElement3 = element3GO.GetComponent<LayoutElement>();
layoutElement3.minWidth = 25;
layoutElement3.minHeight = 15;
layoutElement3.preferredWidth = 200;
layoutElement3.preferredHeight = 80;
layoutElement3.flexibleWidth = 1;
layoutElement3.flexibleHeight = 1;
if (!Directory.Exists("Assets/Resources/"))
Directory.CreateDirectory("Assets/Resources/");
PrefabUtility.SaveAsPrefabAsset(rootGO, kPrefabPath);
GameObject.DestroyImmediate(rootGO);
#endif
}
[SetUp]
public void TestSetup()
{
m_PrefabRoot = Object.Instantiate(Resources.Load("HorizontalLayoutGroupPrefab")) as GameObject;
}
[TearDown]
public void TearDown()
{
GameObject.DestroyImmediate(m_PrefabRoot);
}
[OneTimeTearDown]
public void OneTimeTearDown()
{
#if UNITY_EDITOR
AssetDatabase.DeleteAsset(kPrefabPath);
#endif
}
[Test]
public void TestCalculateLayoutInputHorizontal()
{
HorizontalLayoutGroup layoutGroup = m_PrefabRoot.GetComponentInChildren<HorizontalLayoutGroup>();
layoutGroup.CalculateLayoutInputHorizontal();
layoutGroup.SetLayoutHorizontal();
layoutGroup.CalculateLayoutInputVertical();
layoutGroup.SetLayoutVertical();
Assert.AreEqual(48, layoutGroup.minWidth);
Assert.AreEqual(318, layoutGroup.preferredWidth);
Assert.AreEqual(1, layoutGroup.flexibleWidth);
}
[Test]
public void TestCalculateLayoutInputVertical()
{
HorizontalLayoutGroup layoutGroup = m_PrefabRoot.GetComponentInChildren<HorizontalLayoutGroup>();
layoutGroup.CalculateLayoutInputHorizontal();
layoutGroup.SetLayoutHorizontal();
layoutGroup.CalculateLayoutInputVertical();
layoutGroup.SetLayoutVertical();
Assert.AreEqual(23, layoutGroup.minHeight);
Assert.AreEqual(88, layoutGroup.preferredHeight);
Assert.AreEqual(1, layoutGroup.flexibleHeight);
Assert.AreEqual(1, layoutGroup.flexibleHeight);
}
}
}
HorizonalLayoutGroupTests