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