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

@@ -1,20 +1,20 @@
using NUnit.Framework;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using UnityEngine.TestTools;
/// <summary>
/// Test the PanelMultipleChoice, PanelWithImage, and PanelWithVideoAndImage classes
/// </summary>
[TestFixture]
public class PaneTests
public class CoursePanelsTests
{
/// <summary>
/// Setup the environment before each test
/// </summary>
/// <returns></returns>
[UnitySetUp]
public IEnumerator SetupFunction()
{
@@ -45,11 +45,12 @@ public class PaneTests
yield return null;
}
/// <summary>
/// Cleanup after testing
/// </summary>
[TearDown]
public void TearDown_PaneTests()
public void TearDown_PanelTests()
{
PersistentDataController.PATH = null;
}
@@ -57,7 +58,6 @@ public class PaneTests
/// <summary>
/// Test pausing/resuming the video in all course panels
/// </summary>
/// <returns></returns>
[UnityTest]
public IEnumerator PlayPauseTest()
{
@@ -71,10 +71,10 @@ public class PaneTests
panel.TogglePlayPause();
yield return null;
Assert.IsTrue(panel.videoPlayer.isPlaying == false);
Assert.IsFalse(panel.videoPlayer.isPlaying);
panel.TogglePlayPause();
yield return null;
Assert.IsTrue(panel.videoPlayer.isPlaying == true);
Assert.IsTrue(panel.videoPlayer.isPlaying);
yield return coursesController.SummonMultipleChoice();
@@ -83,11 +83,10 @@ public class PaneTests
panel2.TogglePlayPause();
yield return null;
Assert.IsTrue(panel2.videoPlayer.isPlaying == false);
Assert.IsFalse(panel2.videoPlayer.isPlaying);
panel2.TogglePlayPause();
yield return null;
Assert.IsTrue(panel2.videoPlayer.isPlaying == true);
Assert.IsTrue(panel2.videoPlayer.isPlaying);
yield return null;
}
}

View File

@@ -4,17 +4,19 @@ using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using UnityEngine.TestTools;
using UnityEngine.UI;
/// <summary>
/// Test the CoursesController class
/// </summary>
[TestFixture]
public class CoursesControllerTests
{
/// <summary>
/// Setup the environment before each test
/// </summary>
/// <returns></returns>
[UnitySetUp]
public IEnumerator SetupFunction()
{
@@ -31,7 +33,6 @@ public class CoursesControllerTests
var mainMenuScreen = GameObject.FindObjectOfType<MainMenuScreen>();
mainMenuScreen.GotoCourses();
yield return null;
}
/// <summary>
@@ -42,13 +43,13 @@ public class CoursesControllerTests
{
PersistentDataController.PATH = null;
}
/// <summary>
/// Function used to Spoof the sign predictor. The it uses 0f as certainty so the sign is "perfect".
/// Function used to spoof the sign predictor. It uses 0.0f as certainty so the sign is "perfect".
/// </summary>
/// <param name="sign"></param>
/// <param name="signPredictor"></param>
/// <returns></returns>
public IEnumerator SignLetter(string sign, SignPredictor signPredictor)
private IEnumerator SignLetter(string sign, SignPredictor signPredictor)
{
signPredictor.learnableProbabilities = new Dictionary<string, float>();
// Loop through all capital letters of the alphabet
@@ -66,11 +67,10 @@ public class CoursesControllerTests
yield return listener.ProcessIncomingCall();
}
}
/// <summary>
/// Simulates a little playtrough of a course
/// </summary>
/// <returns></returns>
[UnityTest]
public IEnumerator PlaytroughTest()
{
@@ -115,6 +115,7 @@ public class CoursesControllerTests
coursesController.ReturnToActivityScreen();
yield return new WaitForSeconds(1.0f);
}
/// <summary>
/// Tests a preview course
/// </summary>
@@ -208,10 +209,10 @@ public class CoursesControllerTests
yield return coursesController.CallSetupPanel();
yield return new WaitForSeconds(0.2f);
}
/// <summary>
/// Tests what happens when the sign is correct but not certain enough
/// </summary>
/// <returns></returns>
[UnityTest]
public IEnumerator UnconfidentTest()
{
@@ -251,10 +252,10 @@ public class CoursesControllerTests
yield return new WaitForSeconds(1.0f);
Assert.AreEqual(coursesController.GetCurrentSign(), "A");
}
/// <summary>
/// Test what happens when an incorrect sign is signed
/// </summary>
/// <returns></returns>
[UnityTest]
public IEnumerator IncorrectSignTest()
{
@@ -280,10 +281,10 @@ public class CoursesControllerTests
yield return new WaitForSeconds(1.0f);
Assert.AreEqual(coursesController.GetCurrentSign(), "A");
}
/// <summary>
/// Test what happens when there is no sign being signed
/// </summary>
/// <returns></returns>
[UnityTest]
public IEnumerator NoSignTest()
{
@@ -309,10 +310,10 @@ public class CoursesControllerTests
yield return new WaitForSeconds(1.0f);
Assert.AreEqual(coursesController.GetCurrentSign(), "A");
}
/// <summary>
/// Tests what happens when a wrong sign is performed twice but with a long enough interval
/// </summary>
/// <returns></returns>
[UnityTest]
public IEnumerator TwoWrongFastTest()
{
@@ -345,10 +346,10 @@ public class CoursesControllerTests
Assert.AreEqual(coursesController.GetCurrentSign(), "A");
}
/// <summary>
/// Tests what happens when the sign can not be processed but the Feedback is not Null
/// </summary>
/// <returns></returns>
[UnityTest]
public IEnumerator FeedbackNotNullTest()
{