Resolve WES-181 "Missing code doc"

This commit is contained in:
Dries Van Schuylenbergh
2023-05-14 20:18:29 +00:00
committed by Louis Adriaens
parent 7505ae7262
commit 3d99184717
67 changed files with 686 additions and 198 deletions

View File

@@ -5,12 +5,14 @@ using UnityEditor;
using UnityEngine;
using UnityEngine.TestTools;
/// <summary>
/// Test the SpellingBeeGameEndedPanel class
/// </summary>
public class SpellingBeeGameEndedPanelTests
{
/// <summary>
/// Setup for testing scoreboard of Spelling Bee
/// </summary>
/// <returns></returns>
[UnitySetUp]
public IEnumerator SetupFunction()
{
@@ -34,11 +36,10 @@ public class SpellingBeeGameEndedPanelTests
/// <summary>
/// Tests the scoreboard for Spelling Bee
/// </summary>
/// <returns></returns>
[UnityTest]
public IEnumerator ScoreTest()
{
SpellingBeeController spellingBeeController = (SpellingBeeController)GameObject.FindObjectOfType(typeof(SpellingBeeController));
var spellingBeeController = GameObject.FindObjectOfType<SpellingBeeController>();
spellingBeeController.NextWord();
spellingBeeController.NextLetter(false);
spellingBeeController.NextLetter(true);
@@ -49,16 +50,13 @@ public class SpellingBeeGameEndedPanelTests
spellingBeeController.ActivateEnd(true);
// Fetch the panel with the info for the fields and check if the controller has implemented them
var script = GameObject.FindObjectOfType<SpellingBeeGameEndedPanel>();
SpellingBeeGameEndedPanel SpellingBeeGameEndedPanel = (SpellingBeeGameEndedPanel)GameObject.FindObjectOfType(typeof(SpellingBeeGameEndedPanel));
var SpellingBeeGameEndedPanel = GameObject.FindObjectOfType<SpellingBeeGameEndedPanel>();
Assert.NotNull(SpellingBeeGameEndedPanel);
Assert.AreEqual("Score: 0", SpellingBeeGameEndedPanel.scoreText.text);
Assert.AreEqual("1", SpellingBeeGameEndedPanel.lettersRightText.text);
Assert.AreEqual("2", SpellingBeeGameEndedPanel.lettersWrongText.text);
Assert.AreEqual("3", SpellingBeeGameEndedPanel.lettersTotalText.text);
Assert.AreEqual("00:01", SpellingBeeGameEndedPanel.timeText.text);
}
/// <summary>

View File

@@ -5,12 +5,14 @@ using UnityEditor;
using UnityEngine;
using UnityEngine.TestTools;
/// <summary>
/// Test the SpellingBeeController class
/// </summary>
public class SpellingBeeControllerTests
{
/// <summary>
/// Setup for testing Spelling Bee
/// </summary>
/// <returns></returns>
[UnitySetUp]
public IEnumerator SetupFunction()
{
@@ -40,7 +42,6 @@ public class SpellingBeeControllerTests
/// <summary>
/// Tests the calculations of the score
/// </summary>
/// <returns></returns>
[UnityTest]
public IEnumerator CheckScoreTest()
{
@@ -56,7 +57,6 @@ public class SpellingBeeControllerTests
/// <summary>
/// Tests the ending panel
/// </summary>
/// <returns></returns>
[UnityTest]
public IEnumerator ActivateGameOverTest()
{
@@ -67,13 +67,11 @@ public class SpellingBeeControllerTests
SpellingBeeGameEndedPanel SpellingBeeGameEndedPanel = GameObject.FindObjectOfType<SpellingBeeGameEndedPanel>();
Assert.NotNull(SpellingBeeGameEndedPanel);
Assert.AreEqual("VERLOREN", SpellingBeeGameEndedPanel.endText.text);
}
/// <summary>
/// Tests the scoreboard in case of completion
/// </summary>
/// <returns></returns>
[UnityTest]
public IEnumerator ActivateWinTests()
{
@@ -89,7 +87,6 @@ public class SpellingBeeControllerTests
/// <summary>
/// Tests the scoreboard when timer goes off
/// </summary>
/// <returns></returns>
[UnityTest]
public IEnumerator CheckGameOverTest()
{
@@ -105,7 +102,6 @@ public class SpellingBeeControllerTests
/// <summary>
/// Tests the completion from a word and from the entire theme + scoreboard
/// </summary>
/// <returns></returns>
[UnityTest]
public IEnumerator CheckGoToNextWord()
{
@@ -115,7 +111,7 @@ public class SpellingBeeControllerTests
spellingBeeController.PredictSign(spellingBeeController.GetSign());
yield return new WaitForSeconds(0.2f);
Assert.IsTrue(spellingBeeController.bonusTimeText.activeSelf);
yield return new WaitForSeconds(1.0f);
@@ -137,7 +133,6 @@ public class SpellingBeeControllerTests
/// <summary>
/// Tests the feedback in the game
/// </summary>
/// <returns></returns>
[UnityTest]
public IEnumerator FeedbackTest()
{
@@ -165,11 +160,11 @@ public class SpellingBeeControllerTests
yield return new WaitForSeconds(2.5f);
Assert.AreEqual($"Verkeerde gebaar: '{sign}'", spellingBeeController.feedbackText.text);
Assert.AreEqual(new Color(0xf5 / 255.0f, 0x49 / 255.0f, 0x3d / 255.0f), spellingBeeController.feedbackText.color);
Assert.AreEqual(new Color(0xf5 / 255.0f, 0x49 / 255.0f, 0x3d / 255.0f), spellingBeeController.feedbackText.color);
spellingBeeController.ProcessCurrentAndPredicted(0.9f * threshold, sign, distance, expected);
Assert.AreEqual(new Color(0xf5 / 255.0f, 0x49 / 255.0f, 0x3d / 255.0f), spellingBeeController.scoreBonus.color);
Assert.AreEqual(new Color(0xf5 / 255.0f, 0x49 / 255.0f, 0x3d / 255.0f), spellingBeeController.scoreBonus.color);
}
yield return new WaitForSeconds(0.2f);
@@ -201,7 +196,7 @@ public class SpellingBeeControllerTests
Assert.AreEqual($"Verkeerde gebaar: '{sign}'", spellingBeeController.feedbackText.text);
Assert.AreEqual(new Color(0xf5 / 255.0f, 0x49 / 255.0f, 0x3d / 255.0f), spellingBeeController.feedbackText.color);
spellingBeeController.ProcessCurrentAndPredicted(0.9f * threshold, sign, distance, expected);
Assert.AreEqual(new Color(0xf5 / 255.0f, 0x49 / 255.0f, 0x3d / 255.0f), spellingBeeController.scoreBonus.color);