Skip to content

Commit c428524

Browse files
added test cases for disabled proximity effect / default configuration test / custom runtime configured test
1 parent 6b822e8 commit c428524

File tree

1 file changed

+12
-23
lines changed

1 file changed

+12
-23
lines changed

Assets/MixedRealityToolkit.Tests/PlayModeTests/Experimental/BoundsControlTests.cs

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -335,21 +335,15 @@ public IEnumerator DisableObject()
335335

336336
/// <summary>
337337
/// Tests proximity scaling on handles of bounds control
338-
/// Verifies default behavior of handles with effect enabled / disabled as well as constum scaling / distance configurations
338+
/// Verifies default behavior of handles with effect enabled / disabled as well as custom runtime configured scaling / distance values
339339
/// </summary>
340-
/// <returns></returns>
341340
[UnityTest]
342341
public IEnumerator ScaleHandlesOnProximity()
343342
{
344343
var bbox = InstantiateSceneAndDefaultBbox();
345-
346344
yield return VerifyInitialBoundsCorrect(bbox);
347-
// ProximityEffect proximityEffect = bbox.gameObject.AddComponent<ProximityEffect>();
348-
349-
// 1. test no proximity scaling active per default
350-
//yield return PlayModeTestUtilities.WaitForEnterKey();
351-
//yield return PlayModeTestUtilities.WaitForEnterKey();
352345

346+
//--- 1. test no proximity scaling active per default
353347
ScaleHandlesConfiguration scaleHandleConfig = bbox.ScaleHandlesConfiguration;
354348
Vector3 defaultHandleSize = Vector3.one * scaleHandleConfig.HandleSize;
355349

@@ -376,22 +370,10 @@ public IEnumerator ScaleHandlesOnProximity()
376370
// we're in poximity scaling range - check if proximity scaling wasn't applied
377371
Assert.AreEqual(proximityScaledVisual.localScale, defaultHandleSize, "Handle was scaled even though proximity effect wasn't active");
378372

379-
//yield return hand.SetGesture(ArticulatedHandPose.GestureId.Pinch);
380-
381-
//// Verify that scale works before deactivating
382-
//yield return hand.MoveTo(new Vector3(0.542f, 0.192f, 1.245f));
383-
//Vector3 afterTransformScale = bbox.transform.localScale;
384-
//Assert.AreNotEqual(initialScale, afterTransformScale);
385-
//Assert.AreApproximatelyEqual(afterTransformScale.x, 0.58f, 0.09f);
386-
387-
//yield return hand.MoveTo(frontRightCornerPos);
388-
389373
//// reset hand
390-
//yield return hand.SetGesture(ArticulatedHandPose.GestureId.Open);
391374
yield return hand.MoveTo(initialHandPosition);
392375

393-
394-
/// enable proximity scaling and test defaults
376+
//--- 2. enable proximity scaling and test defaults
395377
ProximityEffectConfiguration proximityConfig = bbox.HandleProximityEffectConfiguration;
396378
proximityConfig.ProximityEffectActive = true;
397379
proximityConfig.CloseGrowRate = 1.0f;
@@ -401,7 +383,10 @@ public IEnumerator ScaleHandlesOnProximity()
401383
yield return null; // wait so rig gameobjects get recreated
402384
yield return TestCurrentProximityConfiguration(bbox, hand);
403385

404-
/// now test custom configuration is applied during runtime
386+
// reset hand
387+
yield return hand.MoveTo(initialHandPosition);
388+
389+
//--- 3. now test custom configuration is applied during runtime
405390
proximityConfig.CloseScale = 4.0f;
406391
proximityConfig.MediumScale = 3.0f;
407392
proximityConfig.FarScale = 2.0f;
@@ -412,10 +397,14 @@ public IEnumerator ScaleHandlesOnProximity()
412397
bbox.CreateRig();
413398
yield return null; // wait so rig gameobjects get recreated
414399
yield return TestCurrentProximityConfiguration(bbox, hand);
415-
416400
}
417401

418402

403+
/// <summary>
404+
/// This tests far, medium and close proximity scaling on scale handles by moving the test hand in the corresponding distance ranges
405+
/// </summary>
406+
/// <param name="bbox">Bounds Control to test on</param>
407+
/// <param name="hand">Test hand to use for testing proximity to handle</param>
419408
private IEnumerator TestCurrentProximityConfiguration(BoundsControl bbox, TestHand hand)
420409
{
421410
// get config and scaling handle

0 commit comments

Comments
 (0)