Resolve WES-187 "Unit tests justsign and spellingbee"

This commit is contained in:
Helena Van Breugel
2023-05-14 11:58:09 +00:00
committed by Dries Van Schuylenbergh
parent 1e09f09dae
commit 53fc361af4
11 changed files with 655 additions and 80 deletions

View File

@@ -351,12 +351,12 @@ public partial class SpellingBeeController : AbstractMinigameController
/// </summary>
/// <param name="sign"></param>
/// <returns></returns>
private float GetTresholdPercentage(string sign)
public float GetThreshold(string sign)
{
Learnable letter = fingerspelling.learnables.Find(l => l.name == sign);
return letter.thresholdDistance;
}
/// <summary>
/// Function to get the current letter that needs to be signed
/// </summary>
@@ -369,6 +369,7 @@ public partial class SpellingBeeController : AbstractMinigameController
}
return null;
}
/// <summary>
/// Function to confirm your prediction and check if it is correct.
/// </summary>
@@ -388,13 +389,23 @@ public partial class SpellingBeeController : 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)
{
string currentSign = GetSign();
float distPredictSign = distance;
float distCurrentSign = signPredictor.learnableProbabilities[currentSign];
float thresholdCurrentSign = GetTresholdPercentage(currentSign);
float thresholdPredictedSign = GetTresholdPercentage(predictedSign);
ProcessCurrentAndPredicted(distance, predictedSign, distCurrentSign, currentSign);
}
/// <summary>
/// The logic to process the current en predicted sign by the signPredictor
/// </summary>
/// <param name="accuracy">The accuracy of the passed sign</param>
/// <param name="predictedSign">The name of the passed sign</param>
public void ProcessCurrentAndPredicted(float distPredictSign, string predictedSign, float distCurrentSign, string currentSign)
{
float thresholdCurrentSign = GetThreshold(currentSign);
float thresholdPredictedSign = GetThreshold(predictedSign);
// If there is a feedback-object, we wil change its appearance
if (feedbackText != null && feedbackProgressImage != null)
@@ -534,4 +545,15 @@ public partial class SpellingBeeController : AbstractMinigameController
gameIsActive = false;
DeleteWord();
}
/// <summary>
/// Skip to ending of game, used in testing to see if NextWord(), NextLetter() and ScoreBord work well together
/// </summary>
/// <returns></returns>
public string SkipToEnd()
{
wordIndex = words.Count - 1;
currentWord = words[wordIndex].name;
return currentWord;
}
}