Skip to content

Commit 2a5ceeb

Browse files
committed
convert tabs to spaces
1 parent a44c4c6 commit 2a5ceeb

File tree

1 file changed

+83
-81
lines changed

1 file changed

+83
-81
lines changed

Assets/FbxExporters/Editor/UnitTests/DefaultSelectionTest.cs

Lines changed: 83 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ namespace FbxExporters.UnitTests
1616
public class DefaultSelectionTest : ExporterTestBase
1717
{
1818
protected GameObject m_root;
19-
protected bool m_centerObjectsSetting;
19+
protected bool m_centerObjectsSetting;
2020

21-
[SetUp]
22-
public void Init()
23-
{
24-
m_centerObjectsSetting = FbxExporters.EditorTools.ExportSettings.instance.centerObjects;
25-
}
21+
[SetUp]
22+
public void Init ()
23+
{
24+
m_centerObjectsSetting = FbxExporters.EditorTools.ExportSettings.instance.centerObjects;
25+
}
2626

2727
[TearDown]
2828
public override void Term ()
@@ -31,8 +31,8 @@ public override void Term ()
3131
if (m_root) {
3232
UnityEngine.Object.DestroyImmediate (m_root);
3333
}
34-
// restore original setting
35-
FbxExporters.EditorTools.ExportSettings.instance.centerObjects = m_centerObjectsSetting;
34+
// restore original setting
35+
FbxExporters.EditorTools.ExportSettings.instance.centerObjects = m_centerObjectsSetting;
3636
}
3737

3838
[Test]
@@ -53,65 +53,65 @@ public void TestDefaultSelection ()
5353
// - if there are multiple root GameObjects, export
5454
// the global transform of root GameObjects, and local transform
5555
// of descendants.
56-
// if Center Objects is checked in the preferences,
57-
// then export the translations so they are centered
58-
// around the center of the union of the bounding boxes.
56+
// if Center Objects is checked in the preferences,
57+
// then export the translations so they are centered
58+
// around the center of the union of the bounding boxes.
5959

6060
m_root = CreateHierarchy ();
6161
Assert.IsNotNull (m_root);
6262

6363
// test Export Root
6464
// Expected result: everything gets exported
6565
// Expected transform: root is zeroed out, all other transforms unchanged
66-
var exportedRoot = ExportSelection (new Object[]{m_root});
67-
CompareHierarchies(m_root, exportedRoot, true, false);
66+
var exportedRoot = ExportSelection (new Object[]{ m_root });
67+
CompareHierarchies (m_root, exportedRoot, true, false);
6868
CompareGlobalTransform (exportedRoot.transform);
6969

7070
// test Export Parent1, Child1
7171
// Expected result: Parent1, Child1, Child2
7272
// Expected transform: Parent1 zeroed out, all other transforms unchanged
73-
var parent1 = m_root.transform.Find("Parent1");
73+
var parent1 = m_root.transform.Find ("Parent1");
7474
var child1 = parent1.Find ("Child1");
75-
exportedRoot = ExportSelection (new Object[]{parent1.gameObject, child1.gameObject});
76-
CompareHierarchies(parent1.gameObject, exportedRoot, true, false);
75+
exportedRoot = ExportSelection (new Object[]{ parent1.gameObject, child1.gameObject });
76+
CompareHierarchies (parent1.gameObject, exportedRoot, true, false);
7777
CompareGlobalTransform (exportedRoot.transform);
7878

7979
// test Export Child2
8080
// Expected result: Child2
8181
// Expected transform: Child2 zeroed out
82-
var child2 = parent1.Find("Child2").gameObject;
83-
exportedRoot = ExportSelection (new Object[]{child2});
84-
CompareHierarchies(child2, exportedRoot, true, false);
82+
var child2 = parent1.Find ("Child2").gameObject;
83+
exportedRoot = ExportSelection (new Object[]{ child2 });
84+
CompareHierarchies (child2, exportedRoot, true, false);
8585
CompareGlobalTransform (exportedRoot.transform);
8686

8787
// test Export Child2, Parent2
8888
// Expected result: Parent2, Child3, Child2
8989
// Expected transform: Child2 and Parent2 maintain global transform
90-
var parent2 = m_root.transform.Find("Parent2");
91-
var exportSet = new Object[]{child2, parent2};
92-
// for passing to FindCenter()
93-
var goExportSet = new GameObject[]{ child2.gameObject, parent2.gameObject };
90+
var parent2 = m_root.transform.Find ("Parent2");
91+
var exportSet = new Object[]{ child2, parent2 };
92+
// for passing to FindCenter()
93+
var goExportSet = new GameObject[]{ child2.gameObject, parent2.gameObject };
9494

95-
// test without centering objects
96-
FbxExporters.EditorTools.ExportSettings.instance.centerObjects = false;
95+
// test without centering objects
96+
FbxExporters.EditorTools.ExportSettings.instance.centerObjects = false;
9797

98-
exportedRoot = ExportSelection (exportSet);
98+
exportedRoot = ExportSelection (exportSet);
9999
List<GameObject> children = new List<GameObject> ();
100100
foreach (Transform child in exportedRoot.transform) {
101101
children.Add (child.gameObject);
102102
}
103-
CompareHierarchies(new GameObject[]{child2, parent2.gameObject}, children.ToArray());
103+
CompareHierarchies (new GameObject[]{ child2, parent2.gameObject }, children.ToArray ());
104104

105-
// test with centered objects
106-
FbxExporters.EditorTools.ExportSettings.instance.centerObjects = true;
107-
var newCenter = FbxExporters.Editor.ModelExporter.FindCenter (goExportSet);
105+
// test with centered objects
106+
FbxExporters.EditorTools.ExportSettings.instance.centerObjects = true;
107+
var newCenter = FbxExporters.Editor.ModelExporter.FindCenter (goExportSet);
108108

109-
exportedRoot = ExportSelection (exportSet);
110-
children = new List<GameObject> ();
111-
foreach (Transform child in exportedRoot.transform) {
112-
children.Add (child.gameObject);
113-
}
114-
CompareHierarchies(new GameObject[]{child2, parent2.gameObject}, children.ToArray(), newCenter);
109+
exportedRoot = ExportSelection (exportSet);
110+
children = new List<GameObject> ();
111+
foreach (Transform child in exportedRoot.transform) {
112+
children.Add (child.gameObject);
113+
}
114+
CompareHierarchies (new GameObject[]{ child2, parent2.gameObject }, children.ToArray (), newCenter);
115115
}
116116

117117
/// <summary>
@@ -121,10 +121,11 @@ public void TestDefaultSelection ()
121121
/// </summary>
122122
/// <param name="actual">Actual.</param>
123123
/// <param name="expected">Expected.</param>
124-
/// <param name="center">New center for expected transform, if present.</param>
125-
private void CompareGlobalTransform(Transform actual, Transform expected=null, Vector3 center=default(Vector3)){
124+
/// <param name="center">New center for expected transform, if present.</param>
125+
private void CompareGlobalTransform (Transform actual, Transform expected = null, Vector3 center = default(Vector3))
126+
{
126127
var actualMatrix = ConstructTRSMatrix (actual);
127-
var expectedMatrix = expected == null? new FbxAMatrix() : ConstructTRSMatrix (expected, false, center);
128+
var expectedMatrix = expected == null ? new FbxAMatrix () : ConstructTRSMatrix (expected, false, center);
128129
Assert.AreEqual (expectedMatrix, actualMatrix);
129130
}
130131

@@ -134,23 +135,23 @@ private void CompareGlobalTransform(Transform actual, Transform expected=null, V
134135
/// <returns>The TRS matrix.</returns>
135136
/// <param name="t">Transform.</param>
136137
/// <param name="local">If set to <c>true</c> use local transform.</param>
137-
/// <param name="center">New center for global transform.</param>
138-
private FbxAMatrix ConstructTRSMatrix(Transform t, bool local=true, Vector3 center=default(Vector3))
138+
/// <param name="center">New center for global transform.</param>
139+
private FbxAMatrix ConstructTRSMatrix (Transform t, bool local = true, Vector3 center = default(Vector3))
139140
{
140-
var translation = local? t.localPosition : FbxExporters.Editor.ModelExporter.GetRecenteredTranslation (t, center);
141-
var rotation = local? t.localEulerAngles : t.eulerAngles;
142-
var scale = local? t.localScale : t.lossyScale;
141+
var translation = local ? t.localPosition : FbxExporters.Editor.ModelExporter.GetRecenteredTranslation (t, center);
142+
var rotation = local ? t.localEulerAngles : t.eulerAngles;
143+
var scale = local ? t.localScale : t.lossyScale;
143144
return new FbxAMatrix (
144145
new FbxVector4 (translation.x, translation.y, translation.z),
145146
new FbxVector4 (rotation.x, rotation.y, rotation.z),
146147
new FbxVector4 (scale.x, scale.y, scale.z)
147148
);
148149
}
149150

150-
/// <summary>
151-
/// Creates test hierarchy.
152-
/// </summary>
153-
/// <returns>The hierarchy root.</returns>
151+
/// <summary>
152+
/// Creates test hierarchy.
153+
/// </summary>
154+
/// <returns>The hierarchy root.</returns>
154155
private GameObject CreateHierarchy ()
155156
{
156157
// Create the following hierarchy:
@@ -188,40 +189,41 @@ private GameObject CreateHierarchy ()
188189
return root;
189190
}
190191

191-
/// <summary>
192-
/// Sets the transform.
193-
/// </summary>
194-
/// <param name="t">Transform.</param>
195-
/// <param name="pos">Position.</param>
196-
/// <param name="rot">Rotation.</param>
197-
/// <param name="scale">Scale.</param>
198-
private void SetTransform(Transform t, Vector3 pos, Vector3 rot, Vector3 scale){
192+
/// <summary>
193+
/// Sets the transform.
194+
/// </summary>
195+
/// <param name="t">Transform.</param>
196+
/// <param name="pos">Position.</param>
197+
/// <param name="rot">Rotation.</param>
198+
/// <param name="scale">Scale.</param>
199+
private void SetTransform (Transform t, Vector3 pos, Vector3 rot, Vector3 scale)
200+
{
199201
t.localPosition = pos;
200202
t.localEulerAngles = rot;
201203
t.localScale = scale;
202204
}
203205

204-
/// <summary>
205-
/// Creates a GameObject.
206-
/// </summary>
207-
/// <returns>The created GameObject.</returns>
208-
/// <param name="name">Name.</param>
209-
/// <param name="parent">Parent.</param>
210-
private GameObject CreateGameObject(string name, Transform parent = null)
206+
/// <summary>
207+
/// Creates a GameObject.
208+
/// </summary>
209+
/// <returns>The created GameObject.</returns>
210+
/// <param name="name">Name.</param>
211+
/// <param name="parent">Parent.</param>
212+
private GameObject CreateGameObject (string name, Transform parent = null)
211213
{
212214
var go = new GameObject (name);
213215
go.transform.SetParent (parent);
214216
return go;
215-
}
217+
}
216218

217-
/// <summary>
218-
/// Compares the hierarchies.
219-
/// </summary>
220-
/// <param name="expectedHierarchy">Expected hierarchy.</param>
221-
/// <param name="actualHierarchy">Actual hierarchy.</param>
222-
/// <param name="ignoreName">If set to <c>true</c> ignore name.</param>
223-
/// <param name="compareTransform">If set to <c>true</c> compare transform.</param>
224-
private void CompareHierarchies(
219+
/// <summary>
220+
/// Compares the hierarchies.
221+
/// </summary>
222+
/// <param name="expectedHierarchy">Expected hierarchy.</param>
223+
/// <param name="actualHierarchy">Actual hierarchy.</param>
224+
/// <param name="ignoreName">If set to <c>true</c> ignore name.</param>
225+
/// <param name="compareTransform">If set to <c>true</c> compare transform.</param>
226+
private void CompareHierarchies (
225227
GameObject expectedHierarchy, GameObject actualHierarchy,
226228
bool ignoreName = false, bool compareTransform = true)
227229
{
@@ -245,21 +247,21 @@ private void CompareHierarchies(
245247
}
246248
}
247249

248-
/// <summary>
249-
/// Compares the hierarchies.
250-
/// </summary>
251-
/// <param name="expectedHierarchy">Expected hierarchy.</param>
252-
/// <param name="actualHierarchy">Actual hierarchy.</param>
253-
/// <param name="center">New center for global transforms.</param>
254-
private void CompareHierarchies(GameObject[] expectedHierarchy, GameObject[] actualHierarchy, Vector3 center=default(Vector3))
250+
/// <summary>
251+
/// Compares the hierarchies.
252+
/// </summary>
253+
/// <param name="expectedHierarchy">Expected hierarchy.</param>
254+
/// <param name="actualHierarchy">Actual hierarchy.</param>
255+
/// <param name="center">New center for global transforms.</param>
256+
private void CompareHierarchies (GameObject[] expectedHierarchy, GameObject[] actualHierarchy, Vector3 center = default(Vector3))
255257
{
256258
Assert.AreEqual (expectedHierarchy.Length, actualHierarchy.Length);
257259

258260
System.Array.Sort (expectedHierarchy, delegate (GameObject x, GameObject y) {
259-
return x.name.CompareTo(y.name);
261+
return x.name.CompareTo (y.name);
260262
});
261263
System.Array.Sort (actualHierarchy, delegate (GameObject x, GameObject y) {
262-
return x.name.CompareTo(y.name);
264+
return x.name.CompareTo (y.name);
263265
});
264266

265267
for (int i = 0; i < expectedHierarchy.Length; i++) {

0 commit comments

Comments
 (0)