Resolve WES-181 "Missing code doc"
This commit is contained in:
committed by
Louis Adriaens
parent
7505ae7262
commit
3d99184717
@@ -38,7 +38,6 @@ public class User
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Sprite GetAvatar() { return UserList.AVATARS[storedUserData.avatarIndex]; }
|
public Sprite GetAvatar() { return UserList.AVATARS[storedUserData.avatarIndex]; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a list of all recently started minigameCards
|
/// Get a list of all recently started minigameCards
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ public class UserAvatarList : ScriptableObject
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public List<Sprite> avatars = new List<Sprite>();
|
public List<Sprite> avatars = new List<Sprite>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Awake is called when the object gets created
|
||||||
|
/// </summary>
|
||||||
public void Awake()
|
public void Awake()
|
||||||
{
|
{
|
||||||
UserList.AVATARS = avatars;
|
UserList.AVATARS = avatars;
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ public class UserCreationScreen : MonoBehaviour
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool canGoBack = true;
|
public static bool canGoBack = true;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start is called before the first frame update
|
/// Start is called before the first frame update
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ public static class UserList
|
|||||||
PersistentDataController.GetInstance().SetCurrentUser(index, true);
|
PersistentDataController.GetInstance().SetCurrentUser(index, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Change the current user
|
/// Change the current user
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ public class UserListTests
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private Sprite avatar = null;
|
private Sprite avatar = null;
|
||||||
|
|
||||||
private string cachedPath;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Setup the tests
|
/// Setup the tests
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -98,8 +96,6 @@ public class UserListTests
|
|||||||
Assert.IsNull(user);
|
Assert.IsNull(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test whether an existing user can be found by its username
|
/// Test whether an existing user can be found by its username
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ public class UserTests
|
|||||||
user = new User(data);
|
user = new User(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test for the creation of a new user
|
/// Test for the creation of a new user
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -110,6 +110,9 @@ public class PanelCourseProgressTests
|
|||||||
Assert.IsNotNull(panel.progressBar);
|
Assert.IsNotNull(panel.progressBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether the panel is correctly initialized
|
||||||
|
/// </summary>
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator Test_Start()
|
public IEnumerator Test_Start()
|
||||||
{
|
{
|
||||||
@@ -126,6 +129,9 @@ public class PanelCourseProgressTests
|
|||||||
Assert.AreEqual(course.theme.learnables.Count, panel.learnablesContainer.childCount);
|
Assert.AreEqual(course.theme.learnables.Count, panel.learnablesContainer.childCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether the panel is correctly initialized when there is no course progress
|
||||||
|
/// </summary>
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator Test_Start_Empty()
|
public IEnumerator Test_Start_Empty()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -109,7 +109,6 @@ public class PanelMinigameProgressTests
|
|||||||
PersistentDataController.PATH = null;
|
PersistentDataController.PATH = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test whether every item that needs to be assign in the editor, is assigned
|
/// Test whether every item that needs to be assign in the editor, is assigned
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -130,6 +129,9 @@ public class PanelMinigameProgressTests
|
|||||||
Assert.IsNotNull(panel.emptyHighscore);
|
Assert.IsNotNull(panel.emptyHighscore);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether the panel is correctly initialized
|
||||||
|
/// </summary>
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator Test_Start()
|
public IEnumerator Test_Start()
|
||||||
{
|
{
|
||||||
@@ -145,6 +147,9 @@ public class PanelMinigameProgressTests
|
|||||||
Assert.AreEqual(minigame.title, panel.minigameTitle.text);
|
Assert.AreEqual(minigame.title, panel.minigameTitle.text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether the panel is correctly initialized when there is no minigame progress
|
||||||
|
/// </summary>
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator Test_Start_Empty()
|
public IEnumerator Test_Start_Empty()
|
||||||
{
|
{
|
||||||
@@ -155,6 +160,9 @@ public class PanelMinigameProgressTests
|
|||||||
Assert.IsTrue(panel.emptyMinigames.gameObject.activeSelf);
|
Assert.IsTrue(panel.emptyMinigames.gameObject.activeSelf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether the panel is correctly initialized when there are minigames, but these don't have any score
|
||||||
|
/// </summary>
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator Test_Start_NoScorePresent()
|
public IEnumerator Test_Start_NoScorePresent()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -62,6 +62,9 @@ public class ProgressGraphTests
|
|||||||
Assert.IsNotNull(graph.axesTickMarker);
|
Assert.IsNotNull(graph.axesTickMarker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether negative values are correctly plotted
|
||||||
|
/// </summary>
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator Test_PlotGraph_Negative()
|
public IEnumerator Test_PlotGraph_Negative()
|
||||||
{
|
{
|
||||||
@@ -70,6 +73,9 @@ public class ProgressGraphTests
|
|||||||
Assert.IsTrue(true);
|
Assert.IsTrue(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether values between 0 and 1 are correctly plotted
|
||||||
|
/// </summary>
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator Test_PlotGraph_SmallerThen1()
|
public IEnumerator Test_PlotGraph_SmallerThen1()
|
||||||
{
|
{
|
||||||
@@ -78,6 +84,9 @@ public class ProgressGraphTests
|
|||||||
Assert.IsTrue(true);
|
Assert.IsTrue(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether values around 0 are correctly plotted
|
||||||
|
/// </summary>
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator Test_PlotGraph_AroundZero()
|
public IEnumerator Test_PlotGraph_AroundZero()
|
||||||
{
|
{
|
||||||
@@ -86,6 +95,9 @@ public class ProgressGraphTests
|
|||||||
Assert.IsTrue(true);
|
Assert.IsTrue(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether all 0 values are correctly plotted
|
||||||
|
/// </summary>
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator Test_PlotGraph_AllZeros()
|
public IEnumerator Test_PlotGraph_AllZeros()
|
||||||
{
|
{
|
||||||
@@ -94,6 +106,9 @@ public class ProgressGraphTests
|
|||||||
Assert.IsTrue(true);
|
Assert.IsTrue(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether values between -1 and 1 are correctly plotted
|
||||||
|
/// </summary>
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator Test_PlotGraph_BetweenPos1AndNeg1()
|
public IEnumerator Test_PlotGraph_BetweenPos1AndNeg1()
|
||||||
{
|
{
|
||||||
@@ -102,6 +117,9 @@ public class ProgressGraphTests
|
|||||||
Assert.IsTrue(true);
|
Assert.IsTrue(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether a single value is correctly plotted
|
||||||
|
/// </summary>
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator Test_PlotGraph_Single()
|
public IEnumerator Test_PlotGraph_Single()
|
||||||
{
|
{
|
||||||
@@ -110,6 +128,9 @@ public class ProgressGraphTests
|
|||||||
Assert.IsTrue(true);
|
Assert.IsTrue(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether multiple values are correctly plotted
|
||||||
|
/// </summary>
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator Test_PlotGraph_Multiple()
|
public IEnumerator Test_PlotGraph_Multiple()
|
||||||
{
|
{
|
||||||
@@ -118,6 +139,9 @@ public class ProgressGraphTests
|
|||||||
Assert.IsTrue(true);
|
Assert.IsTrue(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether too many values (capped at 10) are correctly plotted
|
||||||
|
/// </summary>
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator Test_PlotGraph_TooMany()
|
public IEnumerator Test_PlotGraph_TooMany()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ public class UserCreationScreenTests
|
|||||||
{
|
{
|
||||||
PersistentDataController.PATH = null;
|
PersistentDataController.PATH = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test whether every item that needs to be assign in the editor, is assigned
|
/// Test whether every item that needs to be assign in the editor, is assigned
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -102,6 +102,9 @@ public class UserProgressScreenTests
|
|||||||
Assert.IsFalse(userProgressController.minigamesPanel.activeSelf);
|
Assert.IsFalse(userProgressController.minigamesPanel.activeSelf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether the course panel is displayed
|
||||||
|
/// </summary>
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator Test_DisplayCourses()
|
public IEnumerator Test_DisplayCourses()
|
||||||
{
|
{
|
||||||
@@ -115,6 +118,10 @@ public class UserProgressScreenTests
|
|||||||
Assert.IsFalse(userProgressController.minigamesPanel.activeSelf);
|
Assert.IsFalse(userProgressController.minigamesPanel.activeSelf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether the minigames panel is displayed
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator Test_DisplayMinigames()
|
public IEnumerator Test_DisplayMinigames()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,9 +48,17 @@ public class PersistentDataController
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public List<byte> data = new List<byte>();
|
public List<byte> data = new List<byte>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a new PersistentDataEntry
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="data"></param>
|
||||||
public PersistentDataEntry(string key, byte[] data) : this(key, data.ToList())
|
public PersistentDataEntry(string key, byte[] data) : this(key, data.ToList())
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a new PersistentDataEntry
|
||||||
|
/// </summary>
|
||||||
public PersistentDataEntry(string key, List<byte> data)
|
public PersistentDataEntry(string key, List<byte> data)
|
||||||
{
|
{
|
||||||
this.key = key;
|
this.key = key;
|
||||||
@@ -171,10 +179,30 @@ public class PersistentDataController
|
|||||||
[Serializable]
|
[Serializable]
|
||||||
public class SavedUserData : PersistentDataContainer
|
public class SavedUserData : PersistentDataContainer
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The user's username
|
||||||
|
/// </summary>
|
||||||
public string username = null;
|
public string username = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The index of the user's avatar in the UserList.AVATARS list
|
||||||
|
/// </summary>
|
||||||
public int avatarIndex = -1;
|
public int avatarIndex = -1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The total playtime of the user
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Not implemented yet</remarks>
|
||||||
public double playtime = 0.0;
|
public double playtime = 0.0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A list of progress on minigames the user has
|
||||||
|
/// </summary>
|
||||||
public List<SavedMinigameProgress> minigames = new List<SavedMinigameProgress>();
|
public List<SavedMinigameProgress> minigames = new List<SavedMinigameProgress>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A list of progress on courses the user has
|
||||||
|
/// </summary>
|
||||||
public List<SavedCourseProgress> courses = new List<SavedCourseProgress>();
|
public List<SavedCourseProgress> courses = new List<SavedCourseProgress>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,9 +238,9 @@ public class PersistentDataController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Check whether there are enough inUse Learnables
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns> bool which indicates if there are enough inUseLearnables </returns>
|
/// <returns></returns>
|
||||||
private bool EnoughLearnables()
|
private bool EnoughLearnables()
|
||||||
{
|
{
|
||||||
// There need to be more then 5 non completed learnables
|
// There need to be more then 5 non completed learnables
|
||||||
@@ -297,9 +325,24 @@ public class PersistentDataController
|
|||||||
[Serializable]
|
[Serializable]
|
||||||
public class SavedLearnableProgress : PersistentDataContainer
|
public class SavedLearnableProgress : PersistentDataContainer
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Index of the Learnbable in its Theme
|
||||||
|
/// </summary>
|
||||||
public int index;
|
public int index;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Bool that indicated whether the user already started learning this Learnable
|
||||||
|
/// </summary>
|
||||||
public bool inUse = false;
|
public bool inUse = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Display name of the Learnable
|
||||||
|
/// </summary>
|
||||||
public string name;
|
public string name;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Progress of the learnabe, a number between -5.0 and +5.0
|
||||||
|
/// </summary>
|
||||||
public float progress = 0.0f;
|
public float progress = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -309,8 +352,19 @@ public class PersistentDataController
|
|||||||
[Serializable]
|
[Serializable]
|
||||||
public class SavedMinigameProgress : PersistentDataContainer
|
public class SavedMinigameProgress : PersistentDataContainer
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Index of the minigame
|
||||||
|
/// </summary>
|
||||||
public MinigameIndex minigameIndex;
|
public MinigameIndex minigameIndex;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The 10 last scores of a user
|
||||||
|
/// </summary>
|
||||||
public List<Score> latestScores = new List<Score>();
|
public List<Score> latestScores = new List<Score>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Top 10 scores of a user
|
||||||
|
/// </summary>
|
||||||
public List<Score> highestScores = new List<Score>();
|
public List<Score> highestScores = new List<Score>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,11 +374,34 @@ public class PersistentDataController
|
|||||||
[Serializable]
|
[Serializable]
|
||||||
private class SavedDataStructure
|
private class SavedDataStructure
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The version of the PersistentDataController with which this savefile is created
|
||||||
|
/// </summary>
|
||||||
public int version = VERSION;
|
public int version = VERSION;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A list of all users
|
||||||
|
/// </summary>
|
||||||
public List<SavedUserData> users = new List<SavedUserData>();
|
public List<SavedUserData> users = new List<SavedUserData>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The index of the current user in the this.users list
|
||||||
|
/// </summary>
|
||||||
public int currentUser = -1;
|
public int currentUser = -1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The index of the current minigame
|
||||||
|
/// </summary>
|
||||||
public MinigameIndex currentMinigame;
|
public MinigameIndex currentMinigame;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The index of the current course
|
||||||
|
/// </summary>
|
||||||
public CourseIndex currentCourse;
|
public CourseIndex currentCourse;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The index of the current theme
|
||||||
|
/// </summary>
|
||||||
public ThemeIndex currentTheme;
|
public ThemeIndex currentTheme;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -6,7 +6,14 @@
|
|||||||
[Serializable]
|
[Serializable]
|
||||||
public class Score
|
public class Score
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The actual score
|
||||||
|
/// </summary>
|
||||||
public int scoreValue;
|
public int scoreValue;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The time when the score is achieved, in string format
|
||||||
|
/// </summary>
|
||||||
public string time;
|
public string time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,9 @@ public class PersistentDataControllerTests
|
|||||||
CIRCLE
|
CIRCLE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Setup the PersistentDataController tests
|
||||||
|
/// </summary>
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup_PersistentDataController()
|
public void Setup_PersistentDataController()
|
||||||
{
|
{
|
||||||
@@ -49,12 +52,18 @@ public class PersistentDataControllerTests
|
|||||||
pdc = PersistentDataController.GetInstance();
|
pdc = PersistentDataController.GetInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cleaning up the tests
|
||||||
|
/// </summary>
|
||||||
[TearDown]
|
[TearDown]
|
||||||
public void TearDown_PersistentDataController()
|
public void TearDown_PersistentDataController()
|
||||||
{
|
{
|
||||||
PersistentDataController.PATH = null;
|
PersistentDataController.PATH = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether the singleton instance is correctly returned
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataController_GetInstance()
|
public void Test_PersistentDataController_GetInstance()
|
||||||
{
|
{
|
||||||
@@ -64,6 +73,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.AreEqual($"{Application.persistentDataPath}/wesign_saved_data.json", PersistentDataController.PATH);
|
Assert.AreEqual($"{Application.persistentDataPath}/wesign_saved_data.json", PersistentDataController.PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether all data is correctly cleared
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataController_Clear()
|
public void Test_PersistentDataController_Clear()
|
||||||
{
|
{
|
||||||
@@ -73,6 +85,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.AreEqual(-1, pdc.GetCurrentUser());
|
Assert.AreEqual(-1, pdc.GetCurrentUser());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether an empty savefile can be saved correctly
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataController_Save_Empty()
|
public void Test_PersistentDataController_Save_Empty()
|
||||||
{
|
{
|
||||||
@@ -87,6 +102,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.AreEqual(expected, content);
|
Assert.AreEqual(expected, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether a savefile can be created when non already exists
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataController_Save_New()
|
public void Test_PersistentDataController_Save_New()
|
||||||
{
|
{
|
||||||
@@ -103,6 +121,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.AreEqual(expected, content);
|
Assert.AreEqual(expected, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether an existing savefile can be loaded
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataController_Load_Existing()
|
public void Test_PersistentDataController_Load_Existing()
|
||||||
{
|
{
|
||||||
@@ -111,6 +132,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.IsTrue(pdc.Load(false));
|
Assert.IsTrue(pdc.Load(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether an exisiting older savefile will create a new correct savefile
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataController_Load_OlderVersion()
|
public void Test_PersistentDataController_Load_OlderVersion()
|
||||||
{
|
{
|
||||||
@@ -119,6 +143,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.IsFalse(pdc.Load(false));
|
Assert.IsFalse(pdc.Load(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether an exisiting newer savefile will create a new correct savefile
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataController_Load_NewerVersion()
|
public void Test_PersistentDataController_Load_NewerVersion()
|
||||||
{
|
{
|
||||||
@@ -127,6 +154,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.IsFalse(pdc.Load(false));
|
Assert.IsFalse(pdc.Load(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether the PersistentDataController will fail loading a savefile when no savefile is present
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataController_Load_New()
|
public void Test_PersistentDataController_Load_New()
|
||||||
{
|
{
|
||||||
@@ -136,6 +166,9 @@ public class PersistentDataControllerTests
|
|||||||
FileAssert.DoesNotExist(PATH);
|
FileAssert.DoesNotExist(PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether a corrupted savefile will throw an error
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataController_Load_Exception()
|
public void Test_PersistentDataController_Load_Exception()
|
||||||
{
|
{
|
||||||
@@ -144,6 +177,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.AreEqual("https://www.youtube.com/watch?v=dQw4w9WgXcQ", File.ReadAllText(PATH));
|
Assert.AreEqual("https://www.youtube.com/watch?v=dQw4w9WgXcQ", File.ReadAllText(PATH));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether a corrupted savefile will be overriden
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataController_Load_Override()
|
public void Test_PersistentDataController_Load_Override()
|
||||||
{
|
{
|
||||||
@@ -154,6 +190,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.AreEqual(expected, content);
|
Assert.AreEqual(expected, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether the current version is correct
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataController_Version()
|
public void Test_PersistentDataController_Version()
|
||||||
{
|
{
|
||||||
@@ -161,6 +200,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.AreEqual(VERSION, PersistentDataController.VERSION);
|
Assert.AreEqual(VERSION, PersistentDataController.VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether a new user can be added
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataController_AddUser()
|
public void Test_PersistentDataController_AddUser()
|
||||||
{
|
{
|
||||||
@@ -178,6 +220,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.AreEqual(expected, content);
|
Assert.AreEqual(expected, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether all users are returned
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataController_GetUsers()
|
public void Test_PersistentDataController_GetUsers()
|
||||||
{
|
{
|
||||||
@@ -196,6 +241,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.AreEqual(0, users[0].avatarIndex);
|
Assert.AreEqual(0, users[0].avatarIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether the current user is returned
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataController_GetCurrentUser()
|
public void Test_PersistentDataController_GetCurrentUser()
|
||||||
{
|
{
|
||||||
@@ -211,6 +259,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.AreEqual(0, pdc.GetCurrentUser());
|
Assert.AreEqual(0, pdc.GetCurrentUser());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether the current user is corrctly changed
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataController_SetCurrentUser()
|
public void Test_PersistentDataController_SetCurrentUser()
|
||||||
{
|
{
|
||||||
@@ -227,6 +278,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.AreEqual(3, pdc.GetCurrentUser());
|
Assert.AreEqual(3, pdc.GetCurrentUser());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether setting an invalid current user throws an error
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataController_SetCurrentUser_Invalid()
|
public void Test_PersistentDataController_SetCurrentUser_Invalid()
|
||||||
{
|
{
|
||||||
@@ -241,6 +295,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.Throws<IndexOutOfRangeException>(delegate { pdc.SetCurrentUser(3); });
|
Assert.Throws<IndexOutOfRangeException>(delegate { pdc.SetCurrentUser(3); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether setting the current user for an empty userlist will throw an error
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataController_SetCurrentUser_Empty()
|
public void Test_PersistentDataController_SetCurrentUser_Empty()
|
||||||
{
|
{
|
||||||
@@ -249,6 +306,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.Throws<IndexOutOfRangeException>(delegate { pdc.SetCurrentUser(0); });
|
Assert.Throws<IndexOutOfRangeException>(delegate { pdc.SetCurrentUser(0); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether a user is correctly removed and the current user is correctly updated
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataController_DeleteUser_BeforeCurrent()
|
public void Test_PersistentDataController_DeleteUser_BeforeCurrent()
|
||||||
{
|
{
|
||||||
@@ -280,6 +340,9 @@ public class PersistentDataControllerTests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether a user is correctly removed and the current user is correctly updated
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataController_DeleteUser_Current()
|
public void Test_PersistentDataController_DeleteUser_Current()
|
||||||
{
|
{
|
||||||
@@ -311,6 +374,9 @@ public class PersistentDataControllerTests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether a user is correctly removed and the current user is correctly updated
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataController_DeleteUser_AfterCurrent()
|
public void Test_PersistentDataController_DeleteUser_AfterCurrent()
|
||||||
{
|
{
|
||||||
@@ -343,6 +409,9 @@ public class PersistentDataControllerTests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether deleting an invalid user will throw an error
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataController_DeleteUser_Invalid()
|
public void Test_PersistentDataController_DeleteUser_Invalid()
|
||||||
{
|
{
|
||||||
@@ -357,6 +426,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.Throws<IndexOutOfRangeException>(delegate { pdc.SetCurrentUser(3); });
|
Assert.Throws<IndexOutOfRangeException>(delegate { pdc.SetCurrentUser(3); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether deleting a user from an empty userlist will throw an error
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataController_DeleteUser_Empty()
|
public void Test_PersistentDataController_DeleteUser_Empty()
|
||||||
{
|
{
|
||||||
@@ -365,6 +437,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.Throws<IndexOutOfRangeException>(delegate { pdc.DeleteUser(0); });
|
Assert.Throws<IndexOutOfRangeException>(delegate { pdc.DeleteUser(0); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether the correct current course is returned
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataController_CurrentCourse()
|
public void Test_PersistentDataController_CurrentCourse()
|
||||||
{
|
{
|
||||||
@@ -374,6 +449,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.AreEqual(CourseIndex.FINGERSPELLING, pdc.GetCurrentCourse());
|
Assert.AreEqual(CourseIndex.FINGERSPELLING, pdc.GetCurrentCourse());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether the correct current minigame is returned
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataController_CurrentMinigame()
|
public void Test_PersistentDataController_CurrentMinigame()
|
||||||
{
|
{
|
||||||
@@ -383,6 +461,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.AreEqual(MinigameIndex.SPELLING_BEE, pdc.GetCurrentMinigame());
|
Assert.AreEqual(MinigameIndex.SPELLING_BEE, pdc.GetCurrentMinigame());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether the correct current theme is returned
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataController_CurrentTheme()
|
public void Test_PersistentDataController_CurrentTheme()
|
||||||
{
|
{
|
||||||
@@ -420,6 +501,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.IsFalse(pdc.IsUsingGPU());
|
Assert.IsFalse(pdc.IsUsingGPU());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the creation of a new PersistentDataContainer
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_New_PersistentDataContainer()
|
public void Test_New_PersistentDataContainer()
|
||||||
{
|
{
|
||||||
@@ -428,6 +512,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.Zero(c.entries.Count);
|
Assert.Zero(c.entries.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether setting an invalid object on a key in a PersitentDataContainer will throw an error
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Set_Invalid()
|
public void Test_PersistentDataContainer_Set_Invalid()
|
||||||
{
|
{
|
||||||
@@ -435,6 +522,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.IsFalse(c.Set<object>("key", null));
|
Assert.IsFalse(c.Set<object>("key", null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether setting a valid object on duplicate key in a PersitentDataContainer can be done correctly
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Set_DuplicateKey()
|
public void Test_PersistentDataContainer_Set_DuplicateKey()
|
||||||
{
|
{
|
||||||
@@ -443,6 +533,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.IsTrue(c.Set<int>("key", 321));
|
Assert.IsTrue(c.Set<int>("key", 321));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether setting an int in a PersitentDataContainer can be done correctly
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Set_Int()
|
public void Test_PersistentDataContainer_Set_Int()
|
||||||
{
|
{
|
||||||
@@ -450,6 +543,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.IsTrue(c.Set<int>("key", 123));
|
Assert.IsTrue(c.Set<int>("key", 123));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether setting a string in a PersitentDataContainer can be done correctly
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Set_String()
|
public void Test_PersistentDataContainer_Set_String()
|
||||||
{
|
{
|
||||||
@@ -457,6 +553,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.IsTrue(c.Set<string>("key", "abc"));
|
Assert.IsTrue(c.Set<string>("key", "abc"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether setting a struct in a PersitentDataContainer can be done correctly
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Set_Struct()
|
public void Test_PersistentDataContainer_Set_Struct()
|
||||||
{
|
{
|
||||||
@@ -464,6 +563,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.IsTrue(c.Set<Struct>("key", new Struct()));
|
Assert.IsTrue(c.Set<Struct>("key", new Struct()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether setting an enum in a PersitentDataContainer can be done correctly
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Set_Enum()
|
public void Test_PersistentDataContainer_Set_Enum()
|
||||||
{
|
{
|
||||||
@@ -471,6 +573,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.IsTrue(c.Set<Enum>("key", new Enum()));
|
Assert.IsTrue(c.Set<Enum>("key", new Enum()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether retrieving the wrong type from a PersistentDataContainer will throw an error
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Get_InvalidType()
|
public void Test_PersistentDataContainer_Get_InvalidType()
|
||||||
{
|
{
|
||||||
@@ -481,6 +586,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.Throws<InvalidCastException>(delegate { c.Get<Struct>("key"); });
|
Assert.Throws<InvalidCastException>(delegate { c.Get<Struct>("key"); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether retrieving the an wrong key from a PersistentDataContainer will throw an error
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Get_KeyNotFound()
|
public void Test_PersistentDataContainer_Get_KeyNotFound()
|
||||||
{
|
{
|
||||||
@@ -489,6 +597,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.Throws<KeyNotFoundException>(delegate { c.Get<int>("KEY"); });
|
Assert.Throws<KeyNotFoundException>(delegate { c.Get<int>("KEY"); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether retrieving the unknown key from a PersistentDataContainer will throw an error
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Get_Empty()
|
public void Test_PersistentDataContainer_Get_Empty()
|
||||||
{
|
{
|
||||||
@@ -496,6 +607,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.Throws<KeyNotFoundException>(delegate { c.Get<int>("key"); });
|
Assert.Throws<KeyNotFoundException>(delegate { c.Get<int>("key"); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether retrieving an int from a PersistentDataContainer can be done correctly
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Get_Int()
|
public void Test_PersistentDataContainer_Get_Int()
|
||||||
{
|
{
|
||||||
@@ -504,6 +618,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.AreEqual(123, c.Get<int>("key"));
|
Assert.AreEqual(123, c.Get<int>("key"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether retrieving a string from a PersistentDataContainer can be done correctly
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Get_String()
|
public void Test_PersistentDataContainer_Get_String()
|
||||||
{
|
{
|
||||||
@@ -512,6 +629,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.AreEqual("value", c.Get<string>("key"));
|
Assert.AreEqual("value", c.Get<string>("key"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether retrieving a struct from a PersistentDataContainer can be done correctly
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Get_Struct()
|
public void Test_PersistentDataContainer_Get_Struct()
|
||||||
{
|
{
|
||||||
@@ -521,6 +641,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.AreEqual(s, c.Get<Struct>("key"));
|
Assert.AreEqual(s, c.Get<Struct>("key"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether retrieving an enum from a PersistentDataContainer can be done correctly
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Get_Enum()
|
public void Test_PersistentDataContainer_Get_Enum()
|
||||||
{
|
{
|
||||||
@@ -530,6 +653,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.AreEqual(e, c.Get<Enum>("key"));
|
Assert.AreEqual(e, c.Get<Enum>("key"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether removing an invalid key from a PersistentDataContainer will throw an error
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Remove_Invalid()
|
public void Test_PersistentDataContainer_Remove_Invalid()
|
||||||
{
|
{
|
||||||
@@ -538,6 +664,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.Throws<KeyNotFoundException>(delegate { c.Remove("KEY"); });
|
Assert.Throws<KeyNotFoundException>(delegate { c.Remove("KEY"); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether removing a non-existing key from a PersistentDataContainer will throw an error
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Remove_Empty()
|
public void Test_PersistentDataContainer_Remove_Empty()
|
||||||
{
|
{
|
||||||
@@ -545,6 +674,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.Throws<KeyNotFoundException>(delegate { c.Remove("key"); });
|
Assert.Throws<KeyNotFoundException>(delegate { c.Remove("key"); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether removing an int from a PersistentDataContainer can be done correctly
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Remove_Int()
|
public void Test_PersistentDataContainer_Remove_Int()
|
||||||
{
|
{
|
||||||
@@ -554,6 +686,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.Throws<KeyNotFoundException>(delegate { c.Get<int>("key"); });
|
Assert.Throws<KeyNotFoundException>(delegate { c.Get<int>("key"); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether removing a string from a PersistentDataContainer can be done correctly
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Remove_String()
|
public void Test_PersistentDataContainer_Remove_String()
|
||||||
{
|
{
|
||||||
@@ -563,6 +698,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.Throws<KeyNotFoundException>(delegate { c.Get<string>("key"); });
|
Assert.Throws<KeyNotFoundException>(delegate { c.Get<string>("key"); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether removing a struct from a PersistentDataContainer can be done correctly
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Remove_Struct()
|
public void Test_PersistentDataContainer_Remove_Struct()
|
||||||
{
|
{
|
||||||
@@ -573,6 +711,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.Throws<KeyNotFoundException>(delegate { c.Get<Struct>("key"); });
|
Assert.Throws<KeyNotFoundException>(delegate { c.Get<Struct>("key"); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether removing an enum from a PersistentDataContainer can be done correctly
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Remove_Enum()
|
public void Test_PersistentDataContainer_Remove_Enum()
|
||||||
{
|
{
|
||||||
@@ -582,6 +723,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.Throws<KeyNotFoundException>(delegate { c.Get<Enum>("key"); });
|
Assert.Throws<KeyNotFoundException>(delegate { c.Get<Enum>("key"); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether popping an invalid key from a PersistentDataContainer will throw an error
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Pop_Invalid()
|
public void Test_PersistentDataContainer_Pop_Invalid()
|
||||||
{
|
{
|
||||||
@@ -590,6 +734,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.Throws<KeyNotFoundException>(delegate { c.Remove("KEY"); });
|
Assert.Throws<KeyNotFoundException>(delegate { c.Remove("KEY"); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether popping a non-existing key from a PersistentDataContainer will throw an error
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Pop_Empty()
|
public void Test_PersistentDataContainer_Pop_Empty()
|
||||||
{
|
{
|
||||||
@@ -597,6 +744,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.Throws<KeyNotFoundException>(delegate { c.Remove("KEY"); });
|
Assert.Throws<KeyNotFoundException>(delegate { c.Remove("KEY"); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether popping an int from a PersistentDataContainer can be done correctly
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Pop_Int()
|
public void Test_PersistentDataContainer_Pop_Int()
|
||||||
{
|
{
|
||||||
@@ -606,6 +756,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.Throws<KeyNotFoundException>(delegate { c.Get<int>("key"); });
|
Assert.Throws<KeyNotFoundException>(delegate { c.Get<int>("key"); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether popping a string from a PersistentDataContainer can be done correctly
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Pop_String()
|
public void Test_PersistentDataContainer_Pop_String()
|
||||||
{
|
{
|
||||||
@@ -615,6 +768,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.Throws<KeyNotFoundException>(delegate { c.Get<string>("key"); });
|
Assert.Throws<KeyNotFoundException>(delegate { c.Get<string>("key"); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether popping a struct from a PersistentDataContainer can be done correctly
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Pop_Struct()
|
public void Test_PersistentDataContainer_Pop_Struct()
|
||||||
{
|
{
|
||||||
@@ -625,6 +781,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.Throws<KeyNotFoundException>(delegate { c.Get<Struct>("key"); });
|
Assert.Throws<KeyNotFoundException>(delegate { c.Get<Struct>("key"); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether popping an enum from a PersistentDataContainer can be done correctly
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Pop_Enum()
|
public void Test_PersistentDataContainer_Pop_Enum()
|
||||||
{
|
{
|
||||||
@@ -634,6 +793,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.Throws<KeyNotFoundException>(delegate { c.Get<Enum>("key"); });
|
Assert.Throws<KeyNotFoundException>(delegate { c.Get<Enum>("key"); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether checking for a valid key will return true
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Has_ValidKey()
|
public void Test_PersistentDataContainer_Has_ValidKey()
|
||||||
{
|
{
|
||||||
@@ -643,6 +805,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.IsTrue(c.Has("key"));
|
Assert.IsTrue(c.Has("key"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether checking for a invalid key will return false
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_PersistentDataContainer_Has_InvalidKey()
|
public void Test_PersistentDataContainer_Has_InvalidKey()
|
||||||
{
|
{
|
||||||
@@ -652,6 +817,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.IsFalse(c.Has("KEY"));
|
Assert.IsFalse(c.Has("KEY"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether a Learnable can be saved correctly
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_SavedCourseProgress_AddLearnable_Valid()
|
public void Test_SavedCourseProgress_AddLearnable_Valid()
|
||||||
{
|
{
|
||||||
@@ -665,6 +833,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.AreEqual(0, progress.FindLearnable("learnable").index);
|
Assert.AreEqual(0, progress.FindLearnable("learnable").index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether a duplicate name in a Learnable, will not save this Learnable
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_SavedCourseProgress_AddLearnable_DuplicateName()
|
public void Test_SavedCourseProgress_AddLearnable_DuplicateName()
|
||||||
{
|
{
|
||||||
@@ -677,6 +848,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.AreEqual(1, progress.learnables.Count);
|
Assert.AreEqual(1, progress.learnables.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether a duplicate index in a Learnable, will not save this Learnable
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_SavedCourseProgress_AddLearnable_DuplicateIndex()
|
public void Test_SavedCourseProgress_AddLearnable_DuplicateIndex()
|
||||||
{
|
{
|
||||||
@@ -689,7 +863,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.AreEqual(1, progress.learnables.Count);
|
Assert.AreEqual(1, progress.learnables.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether when updating a invalid named Learnable will throw an error
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_SavedCourseProgress_UpdateLearnable_InvalidName()
|
public void Test_SavedCourseProgress_UpdateLearnable_InvalidName()
|
||||||
{
|
{
|
||||||
@@ -701,7 +877,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.AreEqual(0.0f, progress.FindLearnable("learnable").progress);
|
Assert.AreEqual(0.0f, progress.FindLearnable("learnable").progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether when updating a valid named Learnable will be correctly saved
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_SavedCourseProgress_UpdateLearnable_UpdatesProgress()
|
public void Test_SavedCourseProgress_UpdateLearnable_UpdatesProgress()
|
||||||
{
|
{
|
||||||
@@ -713,6 +891,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.AreEqual(3.0f, progress.FindLearnable("learnable").progress);
|
Assert.AreEqual(3.0f, progress.FindLearnable("learnable").progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether when updating a Learnable, the progress is capped at 5
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_SavedCourseProgress_UpdateLearnable_CropsProgressAtFive()
|
public void Test_SavedCourseProgress_UpdateLearnable_CropsProgressAtFive()
|
||||||
{
|
{
|
||||||
@@ -725,6 +906,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.AreEqual(1, progress.completedLearnables);
|
Assert.AreEqual(1, progress.completedLearnables);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether when updating a Learnable, the progress is capped at -5
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_SavedCourseProgress_UpdateLearnable_CropsProgressAtNegativeFive()
|
public void Test_SavedCourseProgress_UpdateLearnable_CropsProgressAtNegativeFive()
|
||||||
{
|
{
|
||||||
@@ -737,6 +921,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.AreEqual(0, progress.completedLearnables);
|
Assert.AreEqual(0, progress.completedLearnables);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether a Learnable can be fountd correctly
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_SavedCourseProgress_FindLearnable()
|
public void Test_SavedCourseProgress_FindLearnable()
|
||||||
{
|
{
|
||||||
@@ -748,6 +935,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.IsNotNull(progress.FindLearnable("learnable 2"));
|
Assert.IsNotNull(progress.FindLearnable("learnable 2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether no Learnable is returned when there are no learnables
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_SavedCourseProgress_GetRandomLearnable_NoLearnables()
|
public void Test_SavedCourseProgress_GetRandomLearnable_NoLearnables()
|
||||||
{
|
{
|
||||||
@@ -755,6 +945,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.IsNull(progress.GetRandomLearnable());
|
Assert.IsNull(progress.GetRandomLearnable());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether no Learnable is returned when there are no unused learnables
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_SavedCourseProgress_GetRandomLearnable_NoUnusedLearnables()
|
public void Test_SavedCourseProgress_GetRandomLearnable_NoUnusedLearnables()
|
||||||
{
|
{
|
||||||
@@ -767,6 +960,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.IsNull(progress.GetRandomLearnable());
|
Assert.IsNull(progress.GetRandomLearnable());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether no Learnable is returned when there are only completed learnables
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_SavedCourseProgress_GetRandomLearnable_OnlyCompletedLearnables()
|
public void Test_SavedCourseProgress_GetRandomLearnable_OnlyCompletedLearnables()
|
||||||
{
|
{
|
||||||
@@ -784,6 +980,9 @@ public class PersistentDataControllerTests
|
|||||||
Assert.IsNull(progress.GetRandomLearnable());
|
Assert.IsNull(progress.GetRandomLearnable());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether a random Learnable is returned
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_SavedCourseProgress_GetRandomLearnable_Valid()
|
public void Test_SavedCourseProgress_GetRandomLearnable_Valid()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,18 +8,27 @@ using UnityEngine.SceneManagement;
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class SystemControllerTests
|
public class SystemControllerTests
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether the singleton instance is correctly returned
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_SystemController_GetInstance()
|
public void Test_SystemController_GetInstance()
|
||||||
{
|
{
|
||||||
Assert.IsNotNull(SystemController.GetInstance());
|
Assert.IsNotNull(SystemController.GetInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether a non valid scene also yields a non valid index
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_GetSceneIndex_InvalidScene()
|
public void Test_GetSceneIndex_InvalidScene()
|
||||||
{
|
{
|
||||||
Assert.AreEqual(-1, SystemController.GetSceneIndex("a/non/existing/scene"));
|
Assert.AreEqual(-1, SystemController.GetSceneIndex("a/non/existing/scene"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test whether a valid scene also yields a valid index
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_GetSceneIndex_ValidScene()
|
public void Test_GetSceneIndex_ValidScene()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ using UnityEngine;
|
|||||||
[CreateAssetMenu(menuName = "Create new Scriptable/Course")]
|
[CreateAssetMenu(menuName = "Create new Scriptable/Course")]
|
||||||
public class Course : ScriptableObject
|
public class Course : ScriptableObject
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Index of the course
|
/// Index of the course
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Keep track off installed minigames
|
/// Keep track off installed minigames
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using NatML;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This scriptable will hold tupples of Courseindices and models
|
/// This scriptable will hold tupples of Courseindices and models
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -33,7 +34,6 @@ public class ModelList : ScriptableObject
|
|||||||
public TextAsset embeddingsFile;
|
public TextAsset embeddingsFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A list of all the models
|
/// A list of all the models
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -61,7 +61,6 @@ public class ModelList : ScriptableObject
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Function to check if the modelIndex has been set
|
/// Function to check if the modelIndex has been set
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -80,11 +79,19 @@ public class ModelList : ScriptableObject
|
|||||||
currentModelIndex = models.FindIndex((m) => m.index == index);
|
currentModelIndex = models.FindIndex((m) => m.index == index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Shortcut for getting the index of the current model
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
public ModelIndex GetCurrentModelIndex()
|
public ModelIndex GetCurrentModelIndex()
|
||||||
{
|
{
|
||||||
return models[currentModelIndex].index;
|
return models[currentModelIndex].index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Shortcut for getting the embeddings TextAsset of the current model
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
public TextAsset GetEmbeddings()
|
public TextAsset GetEmbeddings()
|
||||||
{
|
{
|
||||||
return models[currentModelIndex].embeddingsFile;
|
return models[currentModelIndex].embeddingsFile;
|
||||||
|
|||||||
@@ -28,10 +28,8 @@ public class Theme : ScriptableObject
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ModelIndex modelIndex;
|
public ModelIndex modelIndex;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List of all learnable words/letters
|
/// List of all learnable words/letters
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<Learnable> learnables = new List<Learnable>();
|
public List<Learnable> learnables = new List<Learnable>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Keep track off defined themes
|
/// Keep track off defined themes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ public class BootScreen : MonoBehaviour
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Request authorization and check whether at least 1 webcam is available
|
/// Request authorization and check whether at least 1 webcam is available
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>IEnumerator object</returns>
|
|
||||||
IEnumerator Start()
|
IEnumerator Start()
|
||||||
{
|
{
|
||||||
UserList.AVATARS = sprites.avatars;
|
UserList.AVATARS = sprites.avatars;
|
||||||
@@ -57,6 +56,4 @@ public class BootScreen : MonoBehaviour
|
|||||||
errorText.text = "Zorg ervoor dat deze applicatie toegang heeft tot je webcam!";
|
errorText.text = "Zorg ervoor dat deze applicatie toegang heeft tot je webcam!";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,12 +8,21 @@ using UnityEngine.UI;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class CourseActivityScreen : MonoBehaviour
|
public class CourseActivityScreen : MonoBehaviour
|
||||||
{
|
{
|
||||||
// vvv TEMPORARY STUFF vvv
|
/// <summary>
|
||||||
|
/// Reference to the 'continue playing' button
|
||||||
|
/// </summary>
|
||||||
public GameObject playButton;
|
public GameObject playButton;
|
||||||
public GameObject previewButton;
|
|
||||||
// ^^^ TEMPORARY STUFF ^^^
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reference to the 'play in preview mode' button
|
||||||
|
/// </summary>
|
||||||
|
public GameObject previewButton;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reference to the 'restart from beginning' button
|
||||||
|
/// </summary>
|
||||||
public GameObject restartButton;
|
public GameObject restartButton;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reference to the courses
|
/// Reference to the courses
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -39,7 +48,6 @@ public class CourseActivityScreen : MonoBehaviour
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Image courseImage;
|
public Image courseImage;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Progress bar Display
|
/// Progress bar Display
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -68,15 +76,12 @@ public class CourseActivityScreen : MonoBehaviour
|
|||||||
int index = courseList.currentCourseIndex;
|
int index = courseList.currentCourseIndex;
|
||||||
Course course = courseList.courses[index];
|
Course course = courseList.courses[index];
|
||||||
|
|
||||||
// vvv TEMPORARY STUFF vvv
|
|
||||||
playButton.SetActive(course.theme.modelIndex != ModelIndex.NONE);
|
playButton.SetActive(course.theme.modelIndex != ModelIndex.NONE);
|
||||||
previewButton.SetActive(course.theme.modelIndex == ModelIndex.NONE);
|
previewButton.SetActive(course.theme.modelIndex == ModelIndex.NONE);
|
||||||
// ^^^ TEMPORARY STUFF ^^^
|
|
||||||
|
|
||||||
title.text = course.title;
|
title.text = course.title;
|
||||||
description.text = course.description;
|
description.text = course.description;
|
||||||
courseImage.sprite = course.thumbnail;
|
courseImage.sprite = course.thumbnail;
|
||||||
//progressBar.value = progressValue;
|
|
||||||
|
|
||||||
// Set progress
|
// Set progress
|
||||||
PersistentDataController.GetInstance().Load();
|
PersistentDataController.GetInstance().Load();
|
||||||
|
|||||||
@@ -77,6 +77,5 @@ public class CourseItem : MonoBehaviour
|
|||||||
courseList.SetCurrentCourse(course.index);
|
courseList.SetCurrentCourse(course.index);
|
||||||
SystemController.GetInstance().LoadNextScene("Common/Scenes/CourseActivityScreen");
|
SystemController.GetInstance().LoadNextScene("Common/Scenes/CourseActivityScreen");
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ using UnityEngine;
|
|||||||
using UnityEngine.Playables;
|
using UnityEngine.Playables;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Manager for the settings screen
|
||||||
|
/// </summary>
|
||||||
public class SettingsScreen : MonoBehaviour
|
public class SettingsScreen : MonoBehaviour
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ using UnityEngine;
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class CourseListTests
|
public class CourseListTests
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Reference to the courses list, for quick access
|
||||||
|
/// </summary>
|
||||||
private CourseList courseList;
|
private CourseList courseList;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ using UnityEngine;
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class MinigameListTests
|
public class MinigameListTests
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Reference to the minigames list, for quick access
|
||||||
|
/// </summary>
|
||||||
private MinigameList minigameList;
|
private MinigameList minigameList;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
using NatML;
|
using NatML;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test the ModelList class
|
/// Test the ModelList class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class ModelListTests
|
public class ModelListTests
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Reference to the model list, for quick access
|
||||||
|
/// </summary>
|
||||||
private ModelList modelList;
|
private ModelList modelList;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -35,6 +39,7 @@ public class ModelListTests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check if current model can be correctly gotten as current via GetCurrentModel
|
/// Check if current model can be correctly gotten as current via GetCurrentModel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ using UnityEngine;
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class ThemeListTests
|
public class ThemeListTests
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Reference to the themelist, for quick access
|
||||||
|
/// </summary>
|
||||||
private ThemeList themeList;
|
private ThemeList themeList;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -8,8 +8,16 @@ using UnityEngine;
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class ThemeTests
|
public class ThemeTests
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Reference to the current theme, for quick access
|
||||||
|
/// </summary>
|
||||||
private Theme theme;
|
private Theme theme;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The names of custom learnables for a custom theme
|
||||||
|
/// </summary>
|
||||||
private List<string> names = new List<string>() { "appel", "peer", "banaan" };
|
private List<string> names = new List<string>() { "appel", "peer", "banaan" };
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Setup a theme with some learnables in it
|
/// Setup a theme with some learnables in it
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -24,6 +32,7 @@ public class ThemeTests
|
|||||||
theme.learnables.Add(learnable);
|
theme.learnables.Add(learnable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test if all the learnables are stored in the theme
|
/// Test if all the learnables are stored in the theme
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -5,12 +5,14 @@ using UnityEditor;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.TestTools;
|
using UnityEngine.TestTools;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the BackButton class
|
||||||
|
/// </summary>
|
||||||
public class BackButtonTests
|
public class BackButtonTests
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Setup the environment before each test
|
/// Setup the environment before each test
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnitySetUp]
|
[UnitySetUp]
|
||||||
public IEnumerator SetupFunction()
|
public IEnumerator SetupFunction()
|
||||||
{
|
{
|
||||||
@@ -39,12 +41,11 @@ public class BackButtonTests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests returning to the previous screen with the backbutton
|
/// Tests returning to the previous screen with the backbutton
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator BackTest()
|
public IEnumerator BackTest()
|
||||||
{
|
{
|
||||||
|
|
||||||
var backButton = GameObject.FindObjectOfType<BackButton> ();
|
var backButton = GameObject.FindObjectOfType<BackButton>();
|
||||||
backButton.Back();
|
backButton.Back();
|
||||||
yield return new WaitForSeconds(0.2f);
|
yield return new WaitForSeconds(0.2f);
|
||||||
|
|
||||||
|
|||||||
@@ -6,13 +6,14 @@ using UnityEngine;
|
|||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.TestTools;
|
using UnityEngine.TestTools;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
public class StartGamesTests
|
/// Test the BootScreen class
|
||||||
|
/// </summary>
|
||||||
|
public class BootScreenTests
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Setup the environment before each test
|
/// Setup the environment before each test
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator BootWithUsersTest()
|
public IEnumerator BootWithUsersTest()
|
||||||
{
|
{
|
||||||
@@ -44,6 +45,7 @@ public class StartGamesTests
|
|||||||
}
|
}
|
||||||
Assert.IsNull(userCreationScreen);
|
Assert.IsNull(userCreationScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Cleanup after testing
|
/// Cleanup after testing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -56,7 +58,6 @@ public class StartGamesTests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test booting without user
|
/// Test booting without user
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator BootWithoutUsersTest()
|
public IEnumerator BootWithoutUsersTest()
|
||||||
{
|
{
|
||||||
@@ -88,5 +89,4 @@ public class StartGamesTests
|
|||||||
}
|
}
|
||||||
Assert.IsNull(mainMenuScreen);
|
Assert.IsNull(mainMenuScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -5,12 +5,14 @@ using UnityEditor;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.TestTools;
|
using UnityEngine.TestTools;
|
||||||
|
|
||||||
public class CourseActivityTests
|
/// <summary>
|
||||||
|
/// Test the CourseActivityScreen class
|
||||||
|
/// </summary>
|
||||||
|
public class CourseActivityScreenTests
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Setup the environment before each test
|
/// Setup the environment before each test
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnitySetUp]
|
[UnitySetUp]
|
||||||
public IEnumerator SetupFunction()
|
public IEnumerator SetupFunction()
|
||||||
{
|
{
|
||||||
@@ -33,10 +35,10 @@ public class CourseActivityTests
|
|||||||
{
|
{
|
||||||
PersistentDataController.PATH = null;
|
PersistentDataController.PATH = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Full tests of the CoursesActivityScreen
|
/// Full tests of the CoursesActivityScreen
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator CoursesActivityTest()
|
public IEnumerator CoursesActivityTest()
|
||||||
{
|
{
|
||||||
@@ -1,14 +1,20 @@
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using UnityEngine.UI;
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.TestTools;
|
using UnityEngine.TestTools;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the CourseItem class
|
||||||
|
/// </summary>
|
||||||
public class CourseItemTests
|
public class CourseItemTests
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Setup the environment before each test
|
||||||
|
/// </summary>
|
||||||
[UnitySetUp]
|
[UnitySetUp]
|
||||||
public IEnumerator SetupFunction()
|
public IEnumerator SetupFunction()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,12 +5,14 @@ using UnityEditor;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.TestTools;
|
using UnityEngine.TestTools;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the CourseMenuScreen class
|
||||||
|
/// </summary>
|
||||||
public class CourseMenuScreenTests
|
public class CourseMenuScreenTests
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Setup the environment before each test
|
/// Setup the environment before each test
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnitySetUp]
|
[UnitySetUp]
|
||||||
public IEnumerator SetupFunction()
|
public IEnumerator SetupFunction()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ using UnityEditor;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.TestTools;
|
using UnityEngine.TestTools;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the ListCoursesScreen class
|
||||||
|
/// </summary>
|
||||||
public class ListCoursesScreenTests
|
public class ListCoursesScreenTests
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ using UnityEditor;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.TestTools;
|
using UnityEngine.TestTools;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the ListMinigamesScreen class
|
||||||
|
/// </summary>
|
||||||
public class ListMinigamesScreenTests
|
public class ListMinigamesScreenTests
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ using UnityEngine;
|
|||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.TestTools;
|
using UnityEngine.TestTools;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the MainMenuScreen class
|
||||||
|
/// </summary>
|
||||||
public class MainMenuScreenTests
|
public class MainMenuScreenTests
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -112,6 +114,7 @@ public class MainMenuScreenTests
|
|||||||
Assert.IsNotNull(backbutton);
|
Assert.IsNotNull(backbutton);
|
||||||
backbutton.GetComponent<UnityEngine.UI.Button>().onClick.Invoke();
|
backbutton.GetComponent<UnityEngine.UI.Button>().onClick.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests the QuicApplication function of the MainMenuScreen
|
/// Tests the QuicApplication function of the MainMenuScreen
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -121,6 +124,5 @@ public class MainMenuScreenTests
|
|||||||
var mainMenuScreen = GameObject.FindObjectOfType<MainMenuScreen>();
|
var mainMenuScreen = GameObject.FindObjectOfType<MainMenuScreen>();
|
||||||
mainMenuScreen.QuitApplication();
|
mainMenuScreen.QuitApplication();
|
||||||
yield return new WaitForSeconds(0.2f);
|
yield return new WaitForSeconds(0.2f);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,13 +5,14 @@ using UnityEditor;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.TestTools;
|
using UnityEngine.TestTools;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
public class MiniGameActivityScreenTests
|
/// Test the MinigameActivityScreen class
|
||||||
|
/// </summary>
|
||||||
|
public class MinigameActivityScreenTests
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Setup the environment before each test
|
/// Setup the environment before each test
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnitySetUp]
|
[UnitySetUp]
|
||||||
public IEnumerator SetupFunction()
|
public IEnumerator SetupFunction()
|
||||||
{
|
{
|
||||||
@@ -25,6 +26,7 @@ public class MiniGameActivityScreenTests
|
|||||||
SystemController.GetInstance().LoadNextScene("Common/Scenes/ListMinigamesScreen");
|
SystemController.GetInstance().LoadNextScene("Common/Scenes/ListMinigamesScreen");
|
||||||
yield return new WaitForSeconds(0.2f);
|
yield return new WaitForSeconds(0.2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Cleanup after testing
|
/// Cleanup after testing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -37,7 +39,6 @@ public class MiniGameActivityScreenTests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test loading the spellingbee minigame
|
/// Test loading the spellingbee minigame
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator GotoSpellingBeeTest()
|
public IEnumerator GotoSpellingBeeTest()
|
||||||
{
|
{
|
||||||
@@ -45,12 +46,11 @@ public class MiniGameActivityScreenTests
|
|||||||
listMinigamesScreen.minigameList.SetCurrentMinigame(MinigameIndex.SPELLING_BEE);
|
listMinigamesScreen.minigameList.SetCurrentMinigame(MinigameIndex.SPELLING_BEE);
|
||||||
listMinigamesScreen.LoadScene("Common/Scenes/MinigameActivityScreen");
|
listMinigamesScreen.LoadScene("Common/Scenes/MinigameActivityScreen");
|
||||||
yield return new WaitForSeconds(0.2f);
|
yield return new WaitForSeconds(0.2f);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test loading the Hangman minigame
|
/// Test loading the Hangman minigame
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator GotoHangmanTest()
|
public IEnumerator GotoHangmanTest()
|
||||||
{
|
{
|
||||||
@@ -58,12 +58,11 @@ public class MiniGameActivityScreenTests
|
|||||||
listMinigamesScreen.minigameList.SetCurrentMinigame(MinigameIndex.HANGMAN);
|
listMinigamesScreen.minigameList.SetCurrentMinigame(MinigameIndex.HANGMAN);
|
||||||
listMinigamesScreen.LoadScene("Common/Scenes/MinigameActivityScreen");
|
listMinigamesScreen.LoadScene("Common/Scenes/MinigameActivityScreen");
|
||||||
yield return new WaitForSeconds(0.2f);
|
yield return new WaitForSeconds(0.2f);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test loading the JustSign minigame
|
/// Test loading the JustSign minigame
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator GotoJustSignTest()
|
public IEnumerator GotoJustSignTest()
|
||||||
{
|
{
|
||||||
@@ -71,13 +70,11 @@ public class MiniGameActivityScreenTests
|
|||||||
listMinigamesScreen.minigameList.SetCurrentMinigame(MinigameIndex.JUST_SIGN);
|
listMinigamesScreen.minigameList.SetCurrentMinigame(MinigameIndex.JUST_SIGN);
|
||||||
listMinigamesScreen.LoadScene("Common/Scenes/MinigameActivityScreen");
|
listMinigamesScreen.LoadScene("Common/Scenes/MinigameActivityScreen");
|
||||||
yield return new WaitForSeconds(0.2f);
|
yield return new WaitForSeconds(0.2f);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check if Progress is loading correctly
|
/// Check if Progress is loading correctly
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator ProgressLoadTest()
|
public IEnumerator ProgressLoadTest()
|
||||||
{
|
{
|
||||||
@@ -96,8 +93,6 @@ public class MiniGameActivityScreenTests
|
|||||||
listMinigamesScreen.minigameList.SetCurrentMinigame(MinigameIndex.HANGMAN);
|
listMinigamesScreen.minigameList.SetCurrentMinigame(MinigameIndex.HANGMAN);
|
||||||
listMinigamesScreen.LoadScene("Common/Scenes/MinigameActivityScreen");
|
listMinigamesScreen.LoadScene("Common/Scenes/MinigameActivityScreen");
|
||||||
yield return new WaitForSeconds(0.2f);
|
yield return new WaitForSeconds(0.2f);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,20 @@
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using UnityEngine.UI;
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.TestTools;
|
using UnityEngine.TestTools;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the MinigameItem class
|
||||||
|
/// </summary>
|
||||||
public class MinigameItemTests
|
public class MinigameItemTests
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Setup the environment before each test
|
/// Setup the environment before each test
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnitySetUp]
|
[UnitySetUp]
|
||||||
public IEnumerator SetupFunction()
|
public IEnumerator SetupFunction()
|
||||||
{
|
{
|
||||||
@@ -26,6 +28,7 @@ public class MinigameItemTests
|
|||||||
SystemController.GetInstance().LoadNextScene("Common/Scenes/ListMinigamesScreen");
|
SystemController.GetInstance().LoadNextScene("Common/Scenes/ListMinigamesScreen");
|
||||||
yield return new WaitForSeconds(0.2f);
|
yield return new WaitForSeconds(0.2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Cleanup after testing
|
/// Cleanup after testing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -38,7 +41,6 @@ public class MinigameItemTests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test the callback function of a MinigameItem
|
/// Test the callback function of a MinigameItem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator CallBackTest()
|
public IEnumerator CallBackTest()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,18 +1,20 @@
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using UnityEngine.UI;
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.TestTools;
|
using UnityEngine.TestTools;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the ThemeItem class
|
||||||
|
/// </summary>
|
||||||
public class ThemeItemTests
|
public class ThemeItemTests
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Setup the environment before each test
|
/// Setup the environment before each test
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnitySetUp]
|
[UnitySetUp]
|
||||||
public IEnumerator SetupFunction()
|
public IEnumerator SetupFunction()
|
||||||
{
|
{
|
||||||
@@ -26,6 +28,7 @@ public class ThemeItemTests
|
|||||||
SystemController.GetInstance().LoadNextScene("Common/Scenes/ListMinigamesScreen");
|
SystemController.GetInstance().LoadNextScene("Common/Scenes/ListMinigamesScreen");
|
||||||
yield return new WaitForSeconds(0.2f);
|
yield return new WaitForSeconds(0.2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Cleanup after testing
|
/// Cleanup after testing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -34,10 +37,10 @@ public class ThemeItemTests
|
|||||||
{
|
{
|
||||||
PersistentDataController.PATH = null;
|
PersistentDataController.PATH = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test the callback function of a ThemeItem
|
/// Test the callback function of a ThemeItem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator CallBackTest()
|
public IEnumerator CallBackTest()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
using UnityEditor;
|
using NUnit.Framework;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.TestTools;
|
using UnityEngine.TestTools;
|
||||||
using NUnit.Framework;
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the UserButton class
|
||||||
|
/// </summary>
|
||||||
public class UserButtonTests
|
public class UserButtonTests
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Setup the environment before each test
|
/// Setup the environment before each test
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnitySetUp]
|
[UnitySetUp]
|
||||||
public IEnumerator SetupFunction()
|
public IEnumerator SetupFunction()
|
||||||
{
|
{
|
||||||
@@ -37,7 +39,6 @@ public class UserButtonTests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test the ChangeUserCallback on the UserButton
|
/// Test the ChangeUserCallback on the UserButton
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator ChangeUserCallbackTest()
|
public IEnumerator ChangeUserCallbackTest()
|
||||||
{
|
{
|
||||||
@@ -52,7 +53,6 @@ public class UserButtonTests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test if the username and avatar are correctly loaded
|
/// Test if the username and avatar are correctly loaded
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator CorrectUsernameAndAvatarTest()
|
public IEnumerator CorrectUsernameAndAvatarTest()
|
||||||
{
|
{
|
||||||
@@ -63,10 +63,10 @@ public class UserButtonTests
|
|||||||
|
|
||||||
yield return null;
|
yield return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test the transition to UserProgressScreen
|
/// Test the transition to UserProgressScreen
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator ChangeSceneToUserProgressScreenTest()
|
public IEnumerator ChangeSceneToUserProgressScreenTest()
|
||||||
{
|
{
|
||||||
@@ -78,10 +78,10 @@ public class UserButtonTests
|
|||||||
var userProgressScreen = GameObject.FindObjectOfType<UserProgressScreen>();
|
var userProgressScreen = GameObject.FindObjectOfType<UserProgressScreen>();
|
||||||
Assert.IsNotNull(userProgressScreen, "Scene was not correctly changed to UserProgressScreen.");
|
Assert.IsNotNull(userProgressScreen, "Scene was not correctly changed to UserProgressScreen.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test is the user dropdown menu works correctly
|
/// Test is the user dropdown menu works correctly
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator ToggleDropdownTest()
|
public IEnumerator ToggleDropdownTest()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -93,6 +93,9 @@ public class CoursesController : AbstractFeedback
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private Image feedbackProgressImage;
|
private Image feedbackProgressImage;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reference to the video player
|
||||||
|
/// </summary>
|
||||||
public VideoPlayer videoPlayer;
|
public VideoPlayer videoPlayer;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -335,7 +338,8 @@ public class CoursesController : AbstractFeedback
|
|||||||
if (corruptPanelId == true)
|
if (corruptPanelId == true)
|
||||||
{
|
{
|
||||||
(currentWordIndex, panelId) = (1, CorruptedPanelIDValue);
|
(currentWordIndex, panelId) = (1, CorruptedPanelIDValue);
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
(currentWordIndex, panelId) = FetchSign().ToValueTuple();
|
(currentWordIndex, panelId) = FetchSign().ToValueTuple();
|
||||||
}
|
}
|
||||||
@@ -552,6 +556,10 @@ public class CoursesController : AbstractFeedback
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wait 0.75 seconds and proceed to the next sign
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
private IEnumerator WaitNextSign()
|
private IEnumerator WaitNextSign()
|
||||||
{
|
{
|
||||||
// Wait for 0.75 seconds
|
// Wait for 0.75 seconds
|
||||||
@@ -597,6 +605,7 @@ public class CoursesController : AbstractFeedback
|
|||||||
{
|
{
|
||||||
return panelId;
|
return panelId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns currentSign for testing
|
/// Returns currentSign for testing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -606,6 +615,7 @@ public class CoursesController : AbstractFeedback
|
|||||||
Learnable sign = course.theme.learnables[currentWordIndex];
|
Learnable sign = course.theme.learnables[currentWordIndex];
|
||||||
return sign.name.ToUpper().Replace(" ", "-");
|
return sign.name.ToUpper().Replace(" ", "-");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used for testing an out of bounds PanelId
|
/// Used for testing an out of bounds PanelId
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -642,6 +652,4 @@ public class CoursesController : AbstractFeedback
|
|||||||
CorruptedPanelIDValue = 1;
|
CorruptedPanelIDValue = 1;
|
||||||
yield return CRNextSign();
|
yield return CRNextSign();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityEngine.Video;
|
using UnityEngine.Video;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class to handle panel with multiple choice options
|
||||||
|
/// </summary>
|
||||||
public class PanelMultipleChoice : MonoBehaviour
|
public class PanelMultipleChoice : MonoBehaviour
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -108,7 +110,7 @@ public class PanelMultipleChoice : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Learnable> randomSigns = new List<Learnable>();
|
List<Learnable> randomSigns = new List<Learnable>();
|
||||||
foreach(var sign in test.Take(3))
|
foreach (var sign in test.Take(3))
|
||||||
{
|
{
|
||||||
randomSigns.Add(signs[sign.index]);
|
randomSigns.Add(signs[sign.index]);
|
||||||
}
|
}
|
||||||
@@ -152,7 +154,6 @@ public class PanelMultipleChoice : MonoBehaviour
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -211,13 +212,11 @@ public class PanelMultipleChoice : MonoBehaviour
|
|||||||
playButton.sprite = pauseSprite;
|
playButton.sprite = pauseSprite;
|
||||||
videoPlayer.Play();
|
videoPlayer.Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Pause video and and switch sprite of button
|
// Pause video and and switch sprite of button
|
||||||
playButton.sprite = playSprite;
|
playButton.sprite = playSprite;
|
||||||
videoPlayer.Pause();
|
videoPlayer.Pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,24 @@ using TMPro;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class to handle panel with only image and webcam
|
||||||
|
/// </summary>
|
||||||
public class PanelWithImage : MonoBehaviour
|
public class PanelWithImage : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Reference to the feedback progress bar
|
||||||
|
/// </summary>
|
||||||
public GameObject feedbackProgressObject;
|
public GameObject feedbackProgressObject;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reference to the object containing the message for when the course is loaded in preview mode
|
||||||
|
/// </summary>
|
||||||
public GameObject previewMessage;
|
public GameObject previewMessage;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if the course is loaded in preview mode, false otherwise
|
||||||
|
/// </summary>
|
||||||
public bool isPreview;
|
public bool isPreview;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -14,8 +28,14 @@ public class PanelWithImage : MonoBehaviour
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Transform signImageContainer;
|
public Transform signImageContainer;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reference to the prefab for displaying the image
|
||||||
|
/// </summary>
|
||||||
public GameObject signImagePrefab;
|
public GameObject signImagePrefab;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reference to the webcam
|
||||||
|
/// </summary>
|
||||||
public RawImage webcamScreen;
|
public RawImage webcamScreen;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -33,9 +53,19 @@ public class PanelWithImage : MonoBehaviour
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Image feedbackProgressImage;
|
public Image feedbackProgressImage;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reference to the list of learnables
|
||||||
|
/// </summary>
|
||||||
public List<Learnable> signs;
|
public List<Learnable> signs;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Index of the current learnable in the list with learnables
|
||||||
|
/// </summary>
|
||||||
public int currentSignIndex;
|
public int currentSignIndex;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update the display of this panel
|
||||||
|
/// </summary>
|
||||||
public void Display()
|
public void Display()
|
||||||
{
|
{
|
||||||
Learnable currentSign = signs[currentSignIndex];
|
Learnable currentSign = signs[currentSignIndex];
|
||||||
|
|||||||
@@ -4,20 +4,49 @@ using UnityEngine;
|
|||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityEngine.Video;
|
using UnityEngine.Video;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class to handle panel with image, video and webcam
|
||||||
|
/// </summary>
|
||||||
public class PanelWithVideoAndImage : MonoBehaviour
|
public class PanelWithVideoAndImage : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Reference to the feedback progress bar
|
||||||
|
/// </summary>
|
||||||
public GameObject feedbackProgressObject;
|
public GameObject feedbackProgressObject;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reference to the object containing the message for when the course is loaded in preview mode
|
||||||
|
/// </summary>
|
||||||
public GameObject previewMessage;
|
public GameObject previewMessage;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if the course is loaded in preview mode, false otherwise
|
||||||
|
/// </summary>
|
||||||
public bool isPreview;
|
public bool isPreview;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Video 'play' sprite
|
||||||
|
/// </summary>
|
||||||
public Sprite playSprite;
|
public Sprite playSprite;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Video 'pause' sprite
|
||||||
|
/// </summary>
|
||||||
public Sprite pauseSprite;
|
public Sprite pauseSprite;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reference to instructional video player
|
/// Reference to instructional video player
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public VideoPlayer videoPlayer;
|
public VideoPlayer videoPlayer;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Refrence to the video play/pause button
|
||||||
|
/// </summary>
|
||||||
public Image playButton;
|
public Image playButton;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reference to the webcam
|
||||||
|
/// </summary>
|
||||||
public RawImage webcamScreen;
|
public RawImage webcamScreen;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -25,6 +54,9 @@ public class PanelWithVideoAndImage : MonoBehaviour
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Transform signImageContainer;
|
public Transform signImageContainer;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reference to the prefab for displaying the image
|
||||||
|
/// </summary>
|
||||||
public GameObject signImagePrefab;
|
public GameObject signImagePrefab;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -42,9 +74,19 @@ public class PanelWithVideoAndImage : MonoBehaviour
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Image feedbackProgressImage;
|
public Image feedbackProgressImage;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reference to the list of learnables
|
||||||
|
/// </summary>
|
||||||
public List<Learnable> signs;
|
public List<Learnable> signs;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Index of the current learnable in the list with learnables
|
||||||
|
/// </summary>
|
||||||
public int currentSignIndex;
|
public int currentSignIndex;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update the display of this panel
|
||||||
|
/// </summary>
|
||||||
public void Display()
|
public void Display()
|
||||||
{
|
{
|
||||||
Learnable currentSign = signs[currentSignIndex];
|
Learnable currentSign = signs[currentSignIndex];
|
||||||
@@ -79,13 +121,11 @@ public class PanelWithVideoAndImage : MonoBehaviour
|
|||||||
playButton.sprite = pauseSprite;
|
playButton.sprite = pauseSprite;
|
||||||
videoPlayer.Play();
|
videoPlayer.Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Pause video and and switch sprite of button
|
// Pause video and and switch sprite of button
|
||||||
playButton.sprite = playSprite;
|
playButton.sprite = playSprite;
|
||||||
videoPlayer.Pause();
|
videoPlayer.Pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.TestTools;
|
using UnityEngine.TestTools;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the PanelMultipleChoice, PanelWithImage, and PanelWithVideoAndImage classes
|
||||||
|
/// </summary>
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class PaneTests
|
public class CoursePanelsTests
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Setup the environment before each test
|
/// Setup the environment before each test
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnitySetUp]
|
[UnitySetUp]
|
||||||
public IEnumerator SetupFunction()
|
public IEnumerator SetupFunction()
|
||||||
{
|
{
|
||||||
@@ -45,11 +45,12 @@ public class PaneTests
|
|||||||
yield return null;
|
yield return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Cleanup after testing
|
/// Cleanup after testing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[TearDown]
|
[TearDown]
|
||||||
public void TearDown_PaneTests()
|
public void TearDown_PanelTests()
|
||||||
{
|
{
|
||||||
PersistentDataController.PATH = null;
|
PersistentDataController.PATH = null;
|
||||||
}
|
}
|
||||||
@@ -57,7 +58,6 @@ public class PaneTests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test pausing/resuming the video in all course panels
|
/// Test pausing/resuming the video in all course panels
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator PlayPauseTest()
|
public IEnumerator PlayPauseTest()
|
||||||
{
|
{
|
||||||
@@ -71,10 +71,10 @@ public class PaneTests
|
|||||||
|
|
||||||
panel.TogglePlayPause();
|
panel.TogglePlayPause();
|
||||||
yield return null;
|
yield return null;
|
||||||
Assert.IsTrue(panel.videoPlayer.isPlaying == false);
|
Assert.IsFalse(panel.videoPlayer.isPlaying);
|
||||||
panel.TogglePlayPause();
|
panel.TogglePlayPause();
|
||||||
yield return null;
|
yield return null;
|
||||||
Assert.IsTrue(panel.videoPlayer.isPlaying == true);
|
Assert.IsTrue(panel.videoPlayer.isPlaying);
|
||||||
|
|
||||||
yield return coursesController.SummonMultipleChoice();
|
yield return coursesController.SummonMultipleChoice();
|
||||||
|
|
||||||
@@ -83,11 +83,10 @@ public class PaneTests
|
|||||||
|
|
||||||
panel2.TogglePlayPause();
|
panel2.TogglePlayPause();
|
||||||
yield return null;
|
yield return null;
|
||||||
Assert.IsTrue(panel2.videoPlayer.isPlaying == false);
|
Assert.IsFalse(panel2.videoPlayer.isPlaying);
|
||||||
panel2.TogglePlayPause();
|
panel2.TogglePlayPause();
|
||||||
yield return null;
|
yield return null;
|
||||||
Assert.IsTrue(panel2.videoPlayer.isPlaying == true);
|
Assert.IsTrue(panel2.videoPlayer.isPlaying);
|
||||||
yield return null;
|
yield return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,17 +4,19 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.TestTools;
|
using UnityEngine.TestTools;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the CoursesController class
|
||||||
|
/// </summary>
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class CoursesControllerTests
|
public class CoursesControllerTests
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Setup the environment before each test
|
/// Setup the environment before each test
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnitySetUp]
|
[UnitySetUp]
|
||||||
public IEnumerator SetupFunction()
|
public IEnumerator SetupFunction()
|
||||||
{
|
{
|
||||||
@@ -31,7 +33,6 @@ public class CoursesControllerTests
|
|||||||
var mainMenuScreen = GameObject.FindObjectOfType<MainMenuScreen>();
|
var mainMenuScreen = GameObject.FindObjectOfType<MainMenuScreen>();
|
||||||
mainMenuScreen.GotoCourses();
|
mainMenuScreen.GotoCourses();
|
||||||
yield return null;
|
yield return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -42,13 +43,13 @@ public class CoursesControllerTests
|
|||||||
{
|
{
|
||||||
PersistentDataController.PATH = null;
|
PersistentDataController.PATH = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
/// <param name="sign"></param>
|
/// <param name="sign"></param>
|
||||||
/// <param name="signPredictor"></param>
|
/// <param name="signPredictor"></param>
|
||||||
/// <returns></returns>
|
private IEnumerator SignLetter(string sign, SignPredictor signPredictor)
|
||||||
public IEnumerator SignLetter(string sign, SignPredictor signPredictor)
|
|
||||||
{
|
{
|
||||||
signPredictor.learnableProbabilities = new Dictionary<string, float>();
|
signPredictor.learnableProbabilities = new Dictionary<string, float>();
|
||||||
// Loop through all capital letters of the alphabet
|
// Loop through all capital letters of the alphabet
|
||||||
@@ -70,7 +71,6 @@ public class CoursesControllerTests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Simulates a little playtrough of a course
|
/// Simulates a little playtrough of a course
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator PlaytroughTest()
|
public IEnumerator PlaytroughTest()
|
||||||
{
|
{
|
||||||
@@ -115,6 +115,7 @@ public class CoursesControllerTests
|
|||||||
coursesController.ReturnToActivityScreen();
|
coursesController.ReturnToActivityScreen();
|
||||||
yield return new WaitForSeconds(1.0f);
|
yield return new WaitForSeconds(1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests a preview course
|
/// Tests a preview course
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -208,10 +209,10 @@ public class CoursesControllerTests
|
|||||||
yield return coursesController.CallSetupPanel();
|
yield return coursesController.CallSetupPanel();
|
||||||
yield return new WaitForSeconds(0.2f);
|
yield return new WaitForSeconds(0.2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests what happens when the sign is correct but not certain enough
|
/// Tests what happens when the sign is correct but not certain enough
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator UnconfidentTest()
|
public IEnumerator UnconfidentTest()
|
||||||
{
|
{
|
||||||
@@ -251,10 +252,10 @@ public class CoursesControllerTests
|
|||||||
yield return new WaitForSeconds(1.0f);
|
yield return new WaitForSeconds(1.0f);
|
||||||
Assert.AreEqual(coursesController.GetCurrentSign(), "A");
|
Assert.AreEqual(coursesController.GetCurrentSign(), "A");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test what happens when an incorrect sign is signed
|
/// Test what happens when an incorrect sign is signed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator IncorrectSignTest()
|
public IEnumerator IncorrectSignTest()
|
||||||
{
|
{
|
||||||
@@ -280,10 +281,10 @@ public class CoursesControllerTests
|
|||||||
yield return new WaitForSeconds(1.0f);
|
yield return new WaitForSeconds(1.0f);
|
||||||
Assert.AreEqual(coursesController.GetCurrentSign(), "A");
|
Assert.AreEqual(coursesController.GetCurrentSign(), "A");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test what happens when there is no sign being signed
|
/// Test what happens when there is no sign being signed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator NoSignTest()
|
public IEnumerator NoSignTest()
|
||||||
{
|
{
|
||||||
@@ -309,10 +310,10 @@ public class CoursesControllerTests
|
|||||||
yield return new WaitForSeconds(1.0f);
|
yield return new WaitForSeconds(1.0f);
|
||||||
Assert.AreEqual(coursesController.GetCurrentSign(), "A");
|
Assert.AreEqual(coursesController.GetCurrentSign(), "A");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests what happens when a wrong sign is performed twice but with a long enough interval
|
/// Tests what happens when a wrong sign is performed twice but with a long enough interval
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator TwoWrongFastTest()
|
public IEnumerator TwoWrongFastTest()
|
||||||
{
|
{
|
||||||
@@ -345,10 +346,10 @@ public class CoursesControllerTests
|
|||||||
|
|
||||||
Assert.AreEqual(coursesController.GetCurrentSign(), "A");
|
Assert.AreEqual(coursesController.GetCurrentSign(), "A");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests what happens when the sign can not be processed but the Feedback is not Null
|
/// Tests what happens when the sign can not be processed but the Feedback is not Null
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator FeedbackNotNullTest()
|
public IEnumerator FeedbackNotNullTest()
|
||||||
{
|
{
|
||||||
@@ -6,6 +6,9 @@ using UnityEngine;
|
|||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using Random = UnityEngine.Random;
|
using Random = UnityEngine.Random;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The Hangman game controller
|
||||||
|
/// </summary>
|
||||||
public class HangmanController : AbstractMinigameController
|
public class HangmanController : AbstractMinigameController
|
||||||
{
|
{
|
||||||
[Header("ConcreteVariables")]
|
[Header("ConcreteVariables")]
|
||||||
@@ -166,11 +169,6 @@ public class HangmanController : AbstractMinigameController
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public TMP_Text confirmText;
|
public TMP_Text confirmText;
|
||||||
|
|
||||||
///// <summary>
|
|
||||||
///// Temporary reference to timer to turn it off
|
|
||||||
///// </summary>
|
|
||||||
//public GameObject timer;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Maximum length of the words
|
/// Maximum length of the words
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -249,9 +247,6 @@ public class HangmanController : AbstractMinigameController
|
|||||||
|
|
||||||
scoreDisplay.text = $"Score: {CalculateScore()}";
|
scoreDisplay.text = $"Score: {CalculateScore()}";
|
||||||
scoreBonus.text = "";
|
scoreBonus.text = "";
|
||||||
|
|
||||||
// Temporary
|
|
||||||
//timer.SetActive(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -286,9 +281,6 @@ public class HangmanController : AbstractMinigameController
|
|||||||
|
|
||||||
confirmPanel.SetActive(false);
|
confirmPanel.SetActive(false);
|
||||||
signPredictor.SwapScreen(script.webcamScreen);
|
signPredictor.SwapScreen(script.webcamScreen);
|
||||||
|
|
||||||
//temporarily turn off timer in input-mode
|
|
||||||
//timer.SetActive(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -335,6 +327,7 @@ public class HangmanController : AbstractMinigameController
|
|||||||
StartGame();
|
StartGame();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update is called once per frame
|
/// Update is called once per frame
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -371,6 +364,7 @@ public class HangmanController : AbstractMinigameController
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Functionality to be called when the backspace-key is pressed during input-mode
|
/// Functionality to be called when the backspace-key is pressed during input-mode
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -384,6 +378,7 @@ public class HangmanController : AbstractMinigameController
|
|||||||
}
|
}
|
||||||
Input.ResetInputAxes();
|
Input.ResetInputAxes();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles sign logic, so that it does not have to run every frame
|
/// Handles sign logic, so that it does not have to run every frame
|
||||||
/// This function is called when the UpdateFeedback has accepted a letter
|
/// This function is called when the UpdateFeedback has accepted a letter
|
||||||
@@ -417,6 +412,7 @@ public class HangmanController : AbstractMinigameController
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Takes the currentSign and tries to enter it into the word if playing
|
/// Takes the currentSign and tries to enter it into the word if playing
|
||||||
/// When in input-mode it will just add the letter to the currentWord
|
/// When in input-mode it will just add the letter to the currentWord
|
||||||
@@ -469,6 +465,7 @@ public class HangmanController : AbstractMinigameController
|
|||||||
SwitchMode(1);
|
SwitchMode(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The letter got rejected, start the letter-fetching process again
|
/// The letter got rejected, start the letter-fetching process again
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -482,6 +479,7 @@ public class HangmanController : AbstractMinigameController
|
|||||||
else if (mode == 4)
|
else if (mode == 4)
|
||||||
SwitchMode(1);
|
SwitchMode(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Outside function to switch the modes this allows the gameIsactive-logic to be properly attached to the modes
|
/// Outside function to switch the modes this allows the gameIsactive-logic to be properly attached to the modes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -499,6 +497,7 @@ public class HangmanController : AbstractMinigameController
|
|||||||
gameIsActive = false;
|
gameIsActive = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Change the image that is being displayed
|
/// Change the image that is being displayed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -515,6 +514,7 @@ public class HangmanController : AbstractMinigameController
|
|||||||
scoreBonus.text = $"{INCORRECT_LETTER_SCORE}";
|
scoreBonus.text = $"{INCORRECT_LETTER_SCORE}";
|
||||||
scoreBonus.color = new Color(0xf5 / 255.0f, 0x49 / 255.0f, 0x3d / 255.0f);
|
scoreBonus.color = new Color(0xf5 / 255.0f, 0x49 / 255.0f, 0x3d / 255.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// In this function, the letters of the word selected in DisplayWord are updated after a correct guess.
|
/// In this function, the letters of the word selected in DisplayWord are updated after a correct guess.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -542,6 +542,7 @@ public class HangmanController : AbstractMinigameController
|
|||||||
scoreBonus.text = $"+{hits * CORRECT_LETTER_SCORE}";
|
scoreBonus.text = $"+{hits * CORRECT_LETTER_SCORE}";
|
||||||
scoreBonus.color = new Color(0x8b / 255.0f, 0xd4 / 255.0f, 0x5e / 255.0f);
|
scoreBonus.color = new Color(0x8b / 255.0f, 0xd4 / 255.0f, 0x5e / 255.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This function returns the score that the user currently has
|
/// This function returns the score that the user currently has
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -551,6 +552,7 @@ public class HangmanController : AbstractMinigameController
|
|||||||
int won = corrects == currentWord.Length ? 1 : 0;
|
int won = corrects == currentWord.Length ? 1 : 0;
|
||||||
return corrects * CORRECT_LETTER_SCORE + wrongs * INCORRECT_LETTER_SCORE + WIN_SCORE * won;
|
return corrects * CORRECT_LETTER_SCORE + wrongs * INCORRECT_LETTER_SCORE + WIN_SCORE * won;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delete all letter objects
|
/// Delete all letter objects
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -562,6 +564,7 @@ public class HangmanController : AbstractMinigameController
|
|||||||
}
|
}
|
||||||
letters.Clear();
|
letters.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Displays the word that needs to be spelled
|
/// Displays the word that needs to be spelled
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -581,6 +584,7 @@ public class HangmanController : AbstractMinigameController
|
|||||||
txt.text = c == ' ' ? "" : Char.ToString('_');
|
txt.text = c == ' ' ? "" : Char.ToString('_');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The logic to process the signs sent by the signPredictor
|
/// The logic to process the signs sent by the signPredictor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -670,6 +674,7 @@ public class HangmanController : AbstractMinigameController
|
|||||||
timerCircle.fillAmount = currentTime;
|
timerCircle.fillAmount = currentTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The logic to set the scoreboard of hangman
|
/// The logic to set the scoreboard of hangman
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -694,6 +699,7 @@ public class HangmanController : AbstractMinigameController
|
|||||||
score: CalculateScore()
|
score: CalculateScore()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The hangman-specific logic that needs to be called at the start of the game
|
/// The hangman-specific logic that needs to be called at the start of the game
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -724,27 +730,50 @@ public class HangmanController : AbstractMinigameController
|
|||||||
|
|
||||||
DeleteWord();
|
DeleteWord();
|
||||||
}
|
}
|
||||||
// The following functions are only used for testing
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get this.currentWord, FOR TESTING ONLY
|
||||||
|
/// </summary>
|
||||||
public string getCurrentWord()
|
public string getCurrentWord()
|
||||||
{
|
{
|
||||||
return currentWord;
|
return currentWord;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get this.mode, FOR TESTING ONLY
|
||||||
|
/// </summary>
|
||||||
public int getCurrentMode()
|
public int getCurrentMode()
|
||||||
{
|
{
|
||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get this.corrects, FOR TESTING ONLY
|
||||||
|
/// </summary>
|
||||||
public int getCorrects()
|
public int getCorrects()
|
||||||
{
|
{
|
||||||
return corrects;
|
return corrects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get this.wrongs, FOR TESTING ONLY
|
||||||
|
/// </summary>
|
||||||
public int getWrongs()
|
public int getWrongs()
|
||||||
{
|
{
|
||||||
return wrongs;
|
return wrongs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get this.userLettersText.text, FOR TESTING ONLY
|
||||||
|
/// </summary>
|
||||||
public string getUsedLetters()
|
public string getUsedLetters()
|
||||||
{
|
{
|
||||||
return usedLettersText.text;
|
return usedLettersText.text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get this.currentTime, FOR TESTING ONLY
|
||||||
|
/// </summary>
|
||||||
public float getCurrentTime()
|
public float getCurrentTime()
|
||||||
{
|
{
|
||||||
return currentTime;
|
return currentTime;
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The hangman-variant of the ScoreBoard
|
/// The Hangman-variant of the ScoreBoard
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class HangmanGameEndedPanel : AbstractGameEndedPanel
|
public class HangmanGameEndedPanel : AbstractGameEndedPanel
|
||||||
{
|
{
|
||||||
@@ -23,6 +24,10 @@ public class HangmanGameEndedPanel : AbstractGameEndedPanel
|
|||||||
/// Letters ( right | wrong )
|
/// Letters ( right | wrong )
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public TMP_Text lettersRightText;
|
public TMP_Text lettersRightText;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Letters ( right | wrong )
|
||||||
|
/// </summary>
|
||||||
public TMP_Text lettersWrongText;
|
public TMP_Text lettersWrongText;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ using TMPro;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The panel for holding the actual game in Hangman
|
||||||
|
/// </summary>
|
||||||
public class PanelHangmanGame : MonoBehaviour
|
public class PanelHangmanGame : MonoBehaviour
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ using TMPro;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The mulitplayer panel for Hangman
|
||||||
|
/// </summary>
|
||||||
public class PanelMultiplayerInput : MonoBehaviour
|
public class PanelMultiplayerInput : MonoBehaviour
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -7,16 +7,25 @@ using System.Linq;
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.TestTools;
|
using UnityEngine.TestTools;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the HangmanController class
|
||||||
|
/// </summary>
|
||||||
public class HangmanPlaymodeTests
|
public class HangmanPlaymodeTests
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Reference to the HangmanController so we can access it quickly
|
||||||
|
/// </summary>
|
||||||
private HangmanController hangmanController;
|
private HangmanController hangmanController;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The mode of the multiple choice panel that when the confirm button needs to be clicked
|
||||||
|
/// </summary>
|
||||||
private int multiplayerConfirmInput = 4;
|
private int multiplayerConfirmInput = 4;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SetupFunction to reach the hangman-game
|
/// SetupFunction to reach the hangman-game
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnitySetUp]
|
[UnitySetUp]
|
||||||
public IEnumerator SetupFunction()
|
public IEnumerator SetupFunction()
|
||||||
{
|
{
|
||||||
@@ -93,7 +102,6 @@ public class HangmanPlaymodeTests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests the singleplayer functionality, only the winning side as losing is easier when the word is chosen beforehand.
|
/// Tests the singleplayer functionality, only the winning side as losing is easier when the word is chosen beforehand.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator SinglePlayerTests()
|
public IEnumerator SinglePlayerTests()
|
||||||
{
|
{
|
||||||
@@ -188,7 +196,6 @@ public class HangmanPlaymodeTests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests the multiplayer-code
|
/// Tests the multiplayer-code
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator MultiPlayerTests()
|
public IEnumerator MultiPlayerTests()
|
||||||
{
|
{
|
||||||
@@ -259,7 +266,6 @@ public class HangmanPlaymodeTests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests some remaning functionality regarding the feedback that isn't contained in the previous tests
|
/// Tests some remaning functionality regarding the feedback that isn't contained in the previous tests
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator SignChangingTest()
|
public IEnumerator SignChangingTest()
|
||||||
{
|
{
|
||||||
@@ -301,7 +307,6 @@ public class HangmanPlaymodeTests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test the functionality of the scoreboard to display multiple games
|
/// Test the functionality of the scoreboard to display multiple games
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator ScoreBoardTest()
|
public IEnumerator ScoreBoardTest()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -59,27 +59,27 @@ public class JustSignController : AbstractMinigameController
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Score obtained when getting a perfect hit
|
/// Score obtained when getting a perfect hit
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int perfectScore = 50;
|
private const int perfectScore = 50;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Score obtained when getting a good hit
|
/// Score obtained when getting a good hit
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int goodScore = 20;
|
private const int goodScore = 20;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Score obtained when getting a meh hit
|
/// Score obtained when getting a meh hit
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int mehScore = 10;
|
private const int mehScore = 10;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Score obtained when getting a terrible hit
|
/// Score obtained when getting a terrible hit
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int terribleScore = -3;
|
private const int terribleScore = -3;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Score obtained when symbol goes offscreen
|
/// Score obtained when symbol goes offscreen
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int offscreenScore = -5;
|
private const int offscreenScore = -5;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Symbol prefab
|
/// Symbol prefab
|
||||||
@@ -109,17 +109,17 @@ public class JustSignController : AbstractMinigameController
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Controls movement speed of symbols (higher -> faster)
|
/// Controls movement speed of symbols (higher -> faster)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int moveSpeed = 100;
|
private const int moveSpeed = 100;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Starting X-coordinate of a symbol = (-1920 - symbolsize) / 2
|
/// Starting X-coordinate of a symbol = (-1920 - symbolsize) / 2
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int trackX = 1920 / 2;
|
private const int trackX = 1920 / 2;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Starting Y-coordinate of a symbol
|
/// Starting Y-coordinate of a symbol
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int trackY = 0;
|
private const int trackY = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Time at which the last symbol was spawned
|
/// Time at which the last symbol was spawned
|
||||||
@@ -246,6 +246,9 @@ public class JustSignController : AbstractMinigameController
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public GameObject userFeedback;
|
public GameObject userFeedback;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the current theme
|
||||||
|
/// </summary>
|
||||||
protected override Theme signPredictorTheme
|
protected override Theme signPredictorTheme
|
||||||
{
|
{
|
||||||
get { return currentTheme; }
|
get { return currentTheme; }
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The JustSign-variant of the ScoreBoard
|
/// The JustSign-variant of the ScoreBoard
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Audio;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class for holding all (static) data about a certain song
|
/// Class for holding all (static) data about a certain song
|
||||||
|
|||||||
@@ -5,12 +5,14 @@ using UnityEditor;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.TestTools;
|
using UnityEngine.TestTools;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the JustSignController class
|
||||||
|
/// </summary>
|
||||||
public class JustSignControllerTests
|
public class JustSignControllerTests
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Setup for testing Just Sign
|
/// Setup for testing Just Sign
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnitySetUp]
|
[UnitySetUp]
|
||||||
public IEnumerator SetupFunction()
|
public IEnumerator SetupFunction()
|
||||||
{
|
{
|
||||||
@@ -40,7 +42,6 @@ public class JustSignControllerTests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests a sign that is done too quickly, i.e., feedback during game and scoreboard after
|
/// Tests a sign that is done too quickly, i.e., feedback during game and scoreboard after
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator EarlyScoreTest()
|
public IEnumerator EarlyScoreTest()
|
||||||
{
|
{
|
||||||
@@ -75,7 +76,6 @@ public class JustSignControllerTests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests a sign that is done too late, i.e., feedback during game and scoreboard after
|
/// Tests a sign that is done too late, i.e., feedback during game and scoreboard after
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator TooLateScoreTest()
|
public IEnumerator TooLateScoreTest()
|
||||||
{
|
{
|
||||||
@@ -105,7 +105,6 @@ public class JustSignControllerTests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests a sign that is done in the meh-zone, i.e., feedback during game and scoreboard after
|
/// Tests a sign that is done in the meh-zone, i.e., feedback during game and scoreboard after
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator MehScoreTest()
|
public IEnumerator MehScoreTest()
|
||||||
{
|
{
|
||||||
@@ -140,7 +139,6 @@ public class JustSignControllerTests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests a sign that is done in the good-zone, i.e., feedback during game and scoreboard after
|
/// Tests a sign that is done in the good-zone, i.e., feedback during game and scoreboard after
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator GoodScoreTest()
|
public IEnumerator GoodScoreTest()
|
||||||
{
|
{
|
||||||
@@ -175,7 +173,6 @@ public class JustSignControllerTests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests a sign that is done in the perfect-zone, i.e., feedback during game and scoreboard after
|
/// Tests a sign that is done in the perfect-zone, i.e., feedback during game and scoreboard after
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator PerfectScoreTest()
|
public IEnumerator PerfectScoreTest()
|
||||||
{
|
{
|
||||||
@@ -210,7 +207,6 @@ public class JustSignControllerTests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests the entire game, i.e., feedback during game and scoreboard after
|
/// Tests the entire game, i.e., feedback during game and scoreboard after
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator WalkthroughTest()
|
public IEnumerator WalkthroughTest()
|
||||||
{
|
{
|
||||||
@@ -259,14 +255,13 @@ public class JustSignControllerTests
|
|||||||
Assert.AreEqual("1", justSignGameEndedPanel.terribleSignsText.text);
|
Assert.AreEqual("1", justSignGameEndedPanel.terribleSignsText.text);
|
||||||
Assert.AreEqual("1", justSignGameEndedPanel.notFoundSignsText.text);
|
Assert.AreEqual("1", justSignGameEndedPanel.notFoundSignsText.text);
|
||||||
Assert.AreEqual("Score: 72", justSignGameEndedPanel.scoreText.text);
|
Assert.AreEqual("Score: 72", justSignGameEndedPanel.scoreText.text);
|
||||||
string gpmText = (60f * 4/ 64).ToString("#") + " GPM";
|
string gpmText = (60f * 4 / 64).ToString("#") + " GPM";
|
||||||
Assert.AreEqual(gpmText, justSignGameEndedPanel.gpmText.text);
|
Assert.AreEqual(gpmText, justSignGameEndedPanel.gpmText.text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests if the game ends when the song does
|
/// Tests if the game ends when the song does
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator SongEndTest()
|
public IEnumerator SongEndTest()
|
||||||
{
|
{
|
||||||
@@ -294,7 +289,6 @@ public class JustSignControllerTests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests the feedback in the game
|
/// Tests the feedback in the game
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator FeedbackTest()
|
public IEnumerator FeedbackTest()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Listener interface with an IEnumerator as its processing-function.
|
/// Listener interface with an IEnumerator as its processing-function.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Linq;
|
|||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Abstract class for all minigame-gameEndedPanels
|
/// Abstract class for all minigame-gameEndedPanels
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shared abstract class for the minigameControllers
|
/// Shared abstract class for the minigameControllers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -134,6 +135,7 @@ public abstract class AbstractMinigameController : AbstractFeedback
|
|||||||
|
|
||||||
PersistentDataController.GetInstance().Save();
|
PersistentDataController.GetInstance().Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The function that activates when the game ends, handles some endgame logic and displays the EndPanel
|
/// The function that activates when the game ends, handles some endgame logic and displays the EndPanel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -2,17 +2,18 @@ using DigitalRuby.Tween;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Contains all game logic for the SpellingBee game
|
||||||
|
/// </summary>
|
||||||
public partial class SpellingBeeController : AbstractMinigameController
|
public partial class SpellingBeeController : AbstractMinigameController
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// All of the words that can be used in this session
|
/// All of the words that can be used in this session
|
||||||
/// </summary>
|
/// </summary>
|
||||||
//private string[] words;
|
|
||||||
private List<Learnable> words = new List<Learnable>();
|
private List<Learnable> words = new List<Learnable>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -154,12 +155,12 @@ public partial class SpellingBeeController : AbstractMinigameController
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Score obtained when spelling a letter
|
/// Score obtained when spelling a letter
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int correctLettersScore = 10;
|
private const int correctLettersScore = 10;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Score obtained when spelling the wrong letter :o
|
/// Score obtained when spelling the wrong letter :o
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int incorrectLettersScore = -5;
|
private const int incorrectLettersScore = -5;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set the AbstractMinigameController variable to inform it of the theme for the signPredictor
|
/// Set the AbstractMinigameController variable to inform it of the theme for the signPredictor
|
||||||
@@ -198,7 +199,6 @@ public partial class SpellingBeeController : AbstractMinigameController
|
|||||||
int seconds = Mathf.FloorToInt(timerValue % 60.0f);
|
int seconds = Mathf.FloorToInt(timerValue % 60.0f);
|
||||||
|
|
||||||
timerText.text = string.Format("{0:00}:{1:00}", minutes, seconds);
|
timerText.text = string.Format("{0:00}:{1:00}", minutes, seconds);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,7 +310,6 @@ public partial class SpellingBeeController : AbstractMinigameController
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//ActivateWin();
|
|
||||||
ActivateEnd(true);
|
ActivateEnd(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -338,9 +337,8 @@ public partial class SpellingBeeController : AbstractMinigameController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// wait for 2 seconds
|
/// Wait for 2 seconds
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
private IEnumerator Wait()
|
private IEnumerator Wait()
|
||||||
{
|
{
|
||||||
yield return new WaitForSecondsRealtime(2);
|
yield return new WaitForSecondsRealtime(2);
|
||||||
@@ -458,7 +456,6 @@ public partial class SpellingBeeController : AbstractMinigameController
|
|||||||
predictedSign = null;
|
predictedSign = null;
|
||||||
previousIncorrectSign = null;
|
previousIncorrectSign = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Incorrect sign, wait a bit before passing it along
|
// Incorrect sign, wait a bit before passing it along
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -475,7 +472,6 @@ public partial class SpellingBeeController : AbstractMinigameController
|
|||||||
previousIncorrectSign = null;
|
previousIncorrectSign = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -527,7 +523,6 @@ public partial class SpellingBeeController : AbstractMinigameController
|
|||||||
bonusTimeText.SetActive(false);
|
bonusTimeText.SetActive(false);
|
||||||
|
|
||||||
currentTheme = minigame.themeList.themes[minigame.themeList.currentThemeIndex];
|
currentTheme = minigame.themeList.themes[minigame.themeList.currentThemeIndex];
|
||||||
//feedback.signPredictor.SetModel(currentTheme.modelIndex);
|
|
||||||
words.AddRange(currentTheme.learnables);
|
words.AddRange(currentTheme.learnables);
|
||||||
ShuffleWords();
|
ShuffleWords();
|
||||||
NextWord();
|
NextWord();
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The SpellingBee-variant of the ScoreBoard
|
||||||
|
/// </summary>
|
||||||
public class SpellingBeeGameEndedPanel : AbstractGameEndedPanel
|
public class SpellingBeeGameEndedPanel : AbstractGameEndedPanel
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -29,6 +28,10 @@ public class SpellingBeeGameEndedPanel : AbstractGameEndedPanel
|
|||||||
/// Letters ( right | wrong )
|
/// Letters ( right | wrong )
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public TMP_Text lettersRightText;
|
public TMP_Text lettersRightText;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Letters ( right | wrong )
|
||||||
|
/// </summary>
|
||||||
public TMP_Text lettersWrongText;
|
public TMP_Text lettersWrongText;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -5,12 +5,14 @@ using UnityEditor;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.TestTools;
|
using UnityEngine.TestTools;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the SpellingBeeGameEndedPanel class
|
||||||
|
/// </summary>
|
||||||
public class SpellingBeeGameEndedPanelTests
|
public class SpellingBeeGameEndedPanelTests
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Setup for testing scoreboard of Spelling Bee
|
/// Setup for testing scoreboard of Spelling Bee
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnitySetUp]
|
[UnitySetUp]
|
||||||
public IEnumerator SetupFunction()
|
public IEnumerator SetupFunction()
|
||||||
{
|
{
|
||||||
@@ -34,11 +36,10 @@ public class SpellingBeeGameEndedPanelTests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests the scoreboard for Spelling Bee
|
/// Tests the scoreboard for Spelling Bee
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator ScoreTest()
|
public IEnumerator ScoreTest()
|
||||||
{
|
{
|
||||||
SpellingBeeController spellingBeeController = (SpellingBeeController)GameObject.FindObjectOfType(typeof(SpellingBeeController));
|
var spellingBeeController = GameObject.FindObjectOfType<SpellingBeeController>();
|
||||||
spellingBeeController.NextWord();
|
spellingBeeController.NextWord();
|
||||||
spellingBeeController.NextLetter(false);
|
spellingBeeController.NextLetter(false);
|
||||||
spellingBeeController.NextLetter(true);
|
spellingBeeController.NextLetter(true);
|
||||||
@@ -49,16 +50,13 @@ public class SpellingBeeGameEndedPanelTests
|
|||||||
spellingBeeController.ActivateEnd(true);
|
spellingBeeController.ActivateEnd(true);
|
||||||
|
|
||||||
// Fetch the panel with the info for the fields and check if the controller has implemented them
|
// Fetch the panel with the info for the fields and check if the controller has implemented them
|
||||||
var script = GameObject.FindObjectOfType<SpellingBeeGameEndedPanel>();
|
var SpellingBeeGameEndedPanel = GameObject.FindObjectOfType<SpellingBeeGameEndedPanel>();
|
||||||
|
|
||||||
SpellingBeeGameEndedPanel SpellingBeeGameEndedPanel = (SpellingBeeGameEndedPanel)GameObject.FindObjectOfType(typeof(SpellingBeeGameEndedPanel));
|
|
||||||
Assert.NotNull(SpellingBeeGameEndedPanel);
|
Assert.NotNull(SpellingBeeGameEndedPanel);
|
||||||
Assert.AreEqual("Score: 0", SpellingBeeGameEndedPanel.scoreText.text);
|
Assert.AreEqual("Score: 0", SpellingBeeGameEndedPanel.scoreText.text);
|
||||||
Assert.AreEqual("1", SpellingBeeGameEndedPanel.lettersRightText.text);
|
Assert.AreEqual("1", SpellingBeeGameEndedPanel.lettersRightText.text);
|
||||||
Assert.AreEqual("2", SpellingBeeGameEndedPanel.lettersWrongText.text);
|
Assert.AreEqual("2", SpellingBeeGameEndedPanel.lettersWrongText.text);
|
||||||
Assert.AreEqual("3", SpellingBeeGameEndedPanel.lettersTotalText.text);
|
Assert.AreEqual("3", SpellingBeeGameEndedPanel.lettersTotalText.text);
|
||||||
Assert.AreEqual("00:01", SpellingBeeGameEndedPanel.timeText.text);
|
Assert.AreEqual("00:01", SpellingBeeGameEndedPanel.timeText.text);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -5,12 +5,14 @@ using UnityEditor;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.TestTools;
|
using UnityEngine.TestTools;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the SpellingBeeController class
|
||||||
|
/// </summary>
|
||||||
public class SpellingBeeControllerTests
|
public class SpellingBeeControllerTests
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Setup for testing Spelling Bee
|
/// Setup for testing Spelling Bee
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnitySetUp]
|
[UnitySetUp]
|
||||||
public IEnumerator SetupFunction()
|
public IEnumerator SetupFunction()
|
||||||
{
|
{
|
||||||
@@ -40,7 +42,6 @@ public class SpellingBeeControllerTests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests the calculations of the score
|
/// Tests the calculations of the score
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator CheckScoreTest()
|
public IEnumerator CheckScoreTest()
|
||||||
{
|
{
|
||||||
@@ -56,7 +57,6 @@ public class SpellingBeeControllerTests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests the ending panel
|
/// Tests the ending panel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator ActivateGameOverTest()
|
public IEnumerator ActivateGameOverTest()
|
||||||
{
|
{
|
||||||
@@ -67,13 +67,11 @@ public class SpellingBeeControllerTests
|
|||||||
SpellingBeeGameEndedPanel SpellingBeeGameEndedPanel = GameObject.FindObjectOfType<SpellingBeeGameEndedPanel>();
|
SpellingBeeGameEndedPanel SpellingBeeGameEndedPanel = GameObject.FindObjectOfType<SpellingBeeGameEndedPanel>();
|
||||||
Assert.NotNull(SpellingBeeGameEndedPanel);
|
Assert.NotNull(SpellingBeeGameEndedPanel);
|
||||||
Assert.AreEqual("VERLOREN", SpellingBeeGameEndedPanel.endText.text);
|
Assert.AreEqual("VERLOREN", SpellingBeeGameEndedPanel.endText.text);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests the scoreboard in case of completion
|
/// Tests the scoreboard in case of completion
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator ActivateWinTests()
|
public IEnumerator ActivateWinTests()
|
||||||
{
|
{
|
||||||
@@ -89,7 +87,6 @@ public class SpellingBeeControllerTests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests the scoreboard when timer goes off
|
/// Tests the scoreboard when timer goes off
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator CheckGameOverTest()
|
public IEnumerator CheckGameOverTest()
|
||||||
{
|
{
|
||||||
@@ -105,7 +102,6 @@ public class SpellingBeeControllerTests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests the completion from a word and from the entire theme + scoreboard
|
/// Tests the completion from a word and from the entire theme + scoreboard
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator CheckGoToNextWord()
|
public IEnumerator CheckGoToNextWord()
|
||||||
{
|
{
|
||||||
@@ -137,7 +133,6 @@ public class SpellingBeeControllerTests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests the feedback in the game
|
/// Tests the feedback in the game
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator FeedbackTest()
|
public IEnumerator FeedbackTest()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user