Resolve WES-187 "Unit tests justsign and spellingbee"
This commit is contained in:
committed by
Dries Van Schuylenbergh
parent
1e09f09dae
commit
53fc361af4
@@ -586,7 +586,8 @@ public class HangmanController : AbstractMinigameController
|
||||
/// </summary>
|
||||
/// <param name="accuracy">The accuracy of the passed sign</param>
|
||||
/// <param name="predictedSign">The name of the passed sign</param>
|
||||
protected override void ProcessMostProbableSign(float distance, string predictedSign)
|
||||
|
||||
public override void ProcessMostProbableSign(float distance, string predictedSign)
|
||||
{
|
||||
// Grab the threshold for the most probable letter
|
||||
Learnable letter = fingerSpelling.learnables.Find((l) => l.name == predictedSign);
|
||||
@@ -744,10 +745,6 @@ public class HangmanController : AbstractMinigameController
|
||||
{
|
||||
return usedLettersText.text;
|
||||
}
|
||||
public void ProcessSignForTests(float accuracy, string sign)
|
||||
{
|
||||
ProcessMostProbableSign(accuracy, sign);
|
||||
}
|
||||
public float getCurrentTime()
|
||||
{
|
||||
return currentTime;
|
||||
|
||||
@@ -215,7 +215,7 @@ public class HangmanPlaymodeTests
|
||||
// Wrong letter, but this one will be rejected
|
||||
while (hangmanController.getCurrentMode() != multiplayerConfirmInput)
|
||||
{
|
||||
hangmanController.ProcessSignForTests(1, "Q");
|
||||
hangmanController.ProcessMostProbableSign(0.0001f, "Q");
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
}
|
||||
|
||||
@@ -265,17 +265,17 @@ public class HangmanPlaymodeTests
|
||||
{
|
||||
hangmanController.SinglePlayer();
|
||||
|
||||
hangmanController.ProcessSignForTests(0.001f, "A");
|
||||
hangmanController.ProcessMostProbableSign(0.001f, "A");
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
// The sign for A has been held for 0.2f seconds...
|
||||
Assert.IsTrue(hangmanController.getCurrentTime() >= 0.2f && hangmanController.getCurrentTime() <= 0.3f);
|
||||
|
||||
hangmanController.ProcessSignForTests(0.001f, "B");
|
||||
hangmanController.ProcessMostProbableSign(0.001f, "B");
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
// The sign changed so the time needs to be at 0.2f again
|
||||
Assert.IsTrue(hangmanController.getCurrentTime() >= 0.2f && hangmanController.getCurrentTime() <= 0.3f);
|
||||
|
||||
hangmanController.ProcessSignForTests(1000, "B");
|
||||
hangmanController.ProcessMostProbableSign(1000, "B");
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
// The sign changed is way above the threshold, time is no longer tracked and is reset
|
||||
Assert.IsTrue(hangmanController.getCurrentTime() == 0.0);
|
||||
@@ -285,13 +285,13 @@ public class HangmanPlaymodeTests
|
||||
float threshold = C.thresholdDistance;
|
||||
for (float i = 2 * threshold; i > threshold; i -= threshold / 6)
|
||||
{
|
||||
hangmanController.ProcessSignForTests(i, "C");
|
||||
hangmanController.ProcessMostProbableSign(i, "C");
|
||||
yield return new WaitForSeconds(0.01f);
|
||||
Assert.IsTrue(hangmanController.getCurrentTime() == 0.0);
|
||||
}
|
||||
|
||||
// Check that the time rises above zero when you dip just below the threshold
|
||||
hangmanController.ProcessSignForTests(threshold - 0.01f, "C");
|
||||
hangmanController.ProcessMostProbableSign(threshold - 0.01f, "C");
|
||||
yield return new WaitForSeconds(0.01f);
|
||||
Assert.IsTrue(hangmanController.getCurrentTime() > 0.0);
|
||||
|
||||
@@ -360,7 +360,7 @@ public class HangmanPlaymodeTests
|
||||
while (hangmanController.getCurrentMode() != multiplayerConfirmInput)
|
||||
{
|
||||
// Choose the letter by giving it a very small distance
|
||||
hangmanController.ProcessSignForTests(0.001f, letter);
|
||||
hangmanController.ProcessMostProbableSign(0.001f, letter);
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
}
|
||||
|
||||
@@ -377,7 +377,7 @@ public class HangmanPlaymodeTests
|
||||
while (!hangmanController.getUsedLetters().Contains(letter))
|
||||
{
|
||||
// Choose the letter by giving it a very small distance
|
||||
hangmanController.ProcessSignForTests(0.001f, letter);
|
||||
hangmanController.ProcessMostProbableSign(0.001f, letter);
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user