Resolve WES-181 "Missing code doc"

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

View File

@@ -6,7 +6,6 @@ using UnityEngine;
[CreateAssetMenu(menuName = "Create new Scriptable/Course")]
public class Course : ScriptableObject
{
/// <summary>
/// Index of the course
/// </summary>

View File

@@ -1,7 +1,6 @@
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Keep track off installed minigames
/// </summary>

View File

@@ -2,6 +2,7 @@ using NatML;
using System;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// This scriptable will hold tupples of Courseindices and models
/// </summary>
@@ -33,7 +34,6 @@ public class ModelList : ScriptableObject
public TextAsset embeddingsFile;
}
/// <summary>
/// A list of all the models
/// </summary>
@@ -61,7 +61,6 @@ public class ModelList : ScriptableObject
return null;
}
/// <summary>
/// Function to check if the modelIndex has been set
/// </summary>
@@ -80,11 +79,19 @@ public class ModelList : ScriptableObject
currentModelIndex = models.FindIndex((m) => m.index == index);
}
/// <summary>
/// Shortcut for getting the index of the current model
/// </summary>
/// <returns></returns>
public ModelIndex GetCurrentModelIndex()
{
return models[currentModelIndex].index;
}
/// <summary>
/// Shortcut for getting the embeddings TextAsset of the current model
/// </summary>
/// <returns></returns>
public TextAsset GetEmbeddings()
{
return models[currentModelIndex].embeddingsFile;

View File

@@ -28,10 +28,8 @@ public class Theme : ScriptableObject
/// </summary>
public ModelIndex modelIndex;
/// <summary>
/// List of all learnable words/letters
/// </summary>
public List<Learnable> learnables = new List<Learnable>();
}

View File

@@ -1,7 +1,6 @@
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Keep track off defined themes
/// </summary>

View File

@@ -20,7 +20,6 @@ public class BootScreen : MonoBehaviour
/// <summary>
/// Request authorization and check whether at least 1 webcam is available
/// </summary>
/// <returns>IEnumerator object</returns>
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!";
}
}
}

View File

@@ -8,12 +8,21 @@ using UnityEngine.UI;
/// </summary>
public class CourseActivityScreen : MonoBehaviour
{
// vvv TEMPORARY STUFF vvv
/// <summary>
/// Reference to the 'continue playing' button
/// </summary>
public GameObject playButton;
public GameObject previewButton;
// ^^^ TEMPORARY STUFF ^^^
/// <summary>
/// Reference to the 'play in preview mode' button
/// </summary>
public GameObject previewButton;
/// <summary>
/// Reference to the 'restart from beginning' button
/// </summary>
public GameObject restartButton;
/// <summary>
/// Reference to the courses
/// </summary>
@@ -39,7 +48,6 @@ public class CourseActivityScreen : MonoBehaviour
/// </summary>
public Image courseImage;
/// <summary>
/// Progress bar Display
/// </summary>
@@ -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();

View File

@@ -77,6 +77,5 @@ public class CourseItem : MonoBehaviour
courseList.SetCurrentCourse(course.index);
SystemController.GetInstance().LoadNextScene("Common/Scenes/CourseActivityScreen");
});
}
}

View File

@@ -2,6 +2,9 @@ using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.UI;
/// <summary>
/// Manager for the settings screen
/// </summary>
public class SettingsScreen : MonoBehaviour
{
/// <summary>

View File

@@ -7,6 +7,9 @@ using UnityEngine;
[TestFixture]
public class CourseListTests
{
/// <summary>
/// Reference to the courses list, for quick access
/// </summary>
private CourseList courseList;
/// <summary>

View File

@@ -7,6 +7,9 @@ using UnityEngine;
[TestFixture]
public class MinigameListTests
{
/// <summary>
/// Reference to the minigames list, for quick access
/// </summary>
private MinigameList minigameList;
/// <summary>

View File

@@ -1,12 +1,16 @@
using NatML;
using NUnit.Framework;
using UnityEngine;
/// <summary>
/// Test the ModelList class
/// </summary>
[TestFixture]
public class ModelListTests
{
/// <summary>
/// Reference to the model list, for quick access
/// </summary>
private ModelList modelList;
/// <summary>
@@ -35,6 +39,7 @@ public class ModelListTests
}
}
}
/// <summary>
/// Check if current model can be correctly gotten as current via GetCurrentModel
/// </summary>

View File

@@ -7,6 +7,9 @@ using UnityEngine;
[TestFixture]
public class ThemeListTests
{
/// <summary>
/// Reference to the themelist, for quick access
/// </summary>
private ThemeList themeList;
/// <summary>

View File

@@ -8,8 +8,16 @@ using UnityEngine;
[TestFixture]
public class ThemeTests
{
/// <summary>
/// Reference to the current theme, for quick access
/// </summary>
private Theme theme;
/// <summary>
/// The names of custom learnables for a custom theme
/// </summary>
private List<string> names = new List<string>() { "appel", "peer", "banaan" };
/// <summary>
/// Setup a theme with some learnables in it
/// </summary>
@@ -24,6 +32,7 @@ public class ThemeTests
theme.learnables.Add(learnable);
}
}
/// <summary>
/// Test if all the learnables are stored in the theme
/// </summary>

View File

@@ -5,12 +5,14 @@ using UnityEditor;
using UnityEngine;
using UnityEngine.TestTools;
/// <summary>
/// Test the BackButton class
/// </summary>
public class BackButtonTests
{
/// <summary>
/// Setup the environment before each test
/// </summary>
/// <returns></returns>
[UnitySetUp]
public IEnumerator SetupFunction()
{
@@ -39,12 +41,11 @@ public class BackButtonTests
/// <summary>
/// Tests returning to the previous screen with the backbutton
/// </summary>
/// <returns></returns>
[UnityTest]
public IEnumerator BackTest()
{
var backButton = GameObject.FindObjectOfType<BackButton> ();
var backButton = GameObject.FindObjectOfType<BackButton>();
backButton.Back();
yield return new WaitForSeconds(0.2f);

View File

@@ -6,13 +6,14 @@ using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.TestTools;
public class StartGamesTests
/// <summary>
/// Test the BootScreen class
/// </summary>
public class BootScreenTests
{
/// <summary>
/// Setup the environment before each test
/// </summary>
/// <returns></returns>
[UnityTest]
public IEnumerator BootWithUsersTest()
{
@@ -44,6 +45,7 @@ public class StartGamesTests
}
Assert.IsNull(userCreationScreen);
}
/// <summary>
/// Cleanup after testing
/// </summary>
@@ -56,7 +58,6 @@ public class StartGamesTests
/// <summary>
/// Test booting without user
/// </summary>
/// <returns></returns>
[UnityTest]
public IEnumerator BootWithoutUsersTest()
{
@@ -88,5 +89,4 @@ public class StartGamesTests
}
Assert.IsNull(mainMenuScreen);
}
}

View File

@@ -5,12 +5,14 @@ using UnityEditor;
using UnityEngine;
using UnityEngine.TestTools;
public class CourseActivityTests
/// <summary>
/// Test the CourseActivityScreen class
/// </summary>
public class CourseActivityScreenTests
{
/// <summary>
/// Setup the environment before each test
/// </summary>
/// <returns></returns>
[UnitySetUp]
public IEnumerator SetupFunction()
{
@@ -33,10 +35,10 @@ public class CourseActivityTests
{
PersistentDataController.PATH = null;
}
/// <summary>
/// Full tests of the CoursesActivityScreen
/// </summary>
/// <returns></returns>
[UnityTest]
public IEnumerator CoursesActivityTest()
{

View File

@@ -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;
/// <summary>
/// Test the CourseItem class
/// </summary>
public class CourseItemTests
{
/// <summary>
/// Setup the environment before each test
/// </summary>
[UnitySetUp]
public IEnumerator SetupFunction()
{

View File

@@ -5,12 +5,14 @@ using UnityEditor;
using UnityEngine;
using UnityEngine.TestTools;
/// <summary>
/// Test the CourseMenuScreen class
/// </summary>
public class CourseMenuScreenTests
{
/// <summary>
/// Setup the environment before each test
/// </summary>
/// <returns></returns>
[UnitySetUp]
public IEnumerator SetupFunction()
{

View File

@@ -5,6 +5,9 @@ using UnityEditor;
using UnityEngine;
using UnityEngine.TestTools;
/// <summary>
/// Test the ListCoursesScreen class
/// </summary>
public class ListCoursesScreenTests
{
/// <summary>

View File

@@ -5,6 +5,9 @@ using UnityEditor;
using UnityEngine;
using UnityEngine.TestTools;
/// <summary>
/// Test the ListMinigamesScreen class
/// </summary>
public class ListMinigamesScreenTests
{
/// <summary>

View File

@@ -6,7 +6,9 @@ using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.TestTools;
/// <summary>
/// Test the MainMenuScreen class
/// </summary>
public class MainMenuScreenTests
{
/// <summary>
@@ -112,6 +114,7 @@ public class MainMenuScreenTests
Assert.IsNotNull(backbutton);
backbutton.GetComponent<UnityEngine.UI.Button>().onClick.Invoke();
}
/// <summary>
/// Tests the QuicApplication function of the MainMenuScreen
/// </summary>
@@ -121,6 +124,5 @@ public class MainMenuScreenTests
var mainMenuScreen = GameObject.FindObjectOfType<MainMenuScreen>();
mainMenuScreen.QuitApplication();
yield return new WaitForSeconds(0.2f);
}
}

View File

@@ -5,13 +5,14 @@ using UnityEditor;
using UnityEngine;
using UnityEngine.TestTools;
public class MiniGameActivityScreenTests
/// <summary>
/// Test the MinigameActivityScreen class
/// </summary>
public class MinigameActivityScreenTests
{
/// <summary>
/// Setup the environment before each test
/// </summary>
/// <returns></returns>
[UnitySetUp]
public IEnumerator SetupFunction()
{
@@ -25,6 +26,7 @@ public class MiniGameActivityScreenTests
SystemController.GetInstance().LoadNextScene("Common/Scenes/ListMinigamesScreen");
yield return new WaitForSeconds(0.2f);
}
/// <summary>
/// Cleanup after testing
/// </summary>
@@ -37,7 +39,6 @@ public class MiniGameActivityScreenTests
/// <summary>
/// Test loading the spellingbee minigame
/// </summary>
/// <returns></returns>
[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);
}
/// <summary>
/// Test loading the Hangman minigame
/// </summary>
/// <returns></returns>
[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);
}
/// <summary>
/// Test loading the JustSign minigame
/// </summary>
/// <returns></returns>
[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);
}
/// <summary>
/// Check if Progress is loading correctly
/// </summary>
/// <returns></returns>
[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);
}
}

View File

@@ -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;
/// <summary>
/// Test the MinigameItem class
/// </summary>
public class MinigameItemTests
{
/// <summary>
/// Setup the environment before each test
/// </summary>
/// <returns></returns>
[UnitySetUp]
public IEnumerator SetupFunction()
{
@@ -26,6 +28,7 @@ public class MinigameItemTests
SystemController.GetInstance().LoadNextScene("Common/Scenes/ListMinigamesScreen");
yield return new WaitForSeconds(0.2f);
}
/// <summary>
/// Cleanup after testing
/// </summary>
@@ -38,7 +41,6 @@ public class MinigameItemTests
/// <summary>
/// Test the callback function of a MinigameItem
/// </summary>
/// <returns></returns>
[UnityTest]
public IEnumerator CallBackTest()
{

View File

@@ -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;
/// <summary>
/// Test the ThemeItem class
/// </summary>
public class ThemeItemTests
{
/// <summary>
/// Setup the environment before each test
/// </summary>
/// <returns></returns>
[UnitySetUp]
public IEnumerator SetupFunction()
{
@@ -26,6 +28,7 @@ public class ThemeItemTests
SystemController.GetInstance().LoadNextScene("Common/Scenes/ListMinigamesScreen");
yield return new WaitForSeconds(0.2f);
}
/// <summary>
/// Cleanup after testing
/// </summary>
@@ -34,10 +37,10 @@ public class ThemeItemTests
{
PersistentDataController.PATH = null;
}
/// <summary>
/// Test the callback function of a ThemeItem
/// </summary>
/// <returns></returns>
[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);
}
}

View File

@@ -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;
/// <summary>
/// Test the UserButton class
/// </summary>
public class UserButtonTests
{
/// <summary>
/// Setup the environment before each test
/// </summary>
/// <returns></returns>
[UnitySetUp]
public IEnumerator SetupFunction()
{
@@ -37,7 +39,6 @@ public class UserButtonTests
/// <summary>
/// Test the ChangeUserCallback on the UserButton
/// </summary>
/// <returns></returns>
[UnityTest]
public IEnumerator ChangeUserCallbackTest()
{
@@ -52,7 +53,6 @@ public class UserButtonTests
/// <summary>
/// Test if the username and avatar are correctly loaded
/// </summary>
/// <returns></returns>
[UnityTest]
public IEnumerator CorrectUsernameAndAvatarTest()
{
@@ -63,10 +63,10 @@ public class UserButtonTests
yield return null;
}
/// <summary>
/// Test the transition to UserProgressScreen
/// </summary>
/// <returns></returns>
[UnityTest]
public IEnumerator ChangeSceneToUserProgressScreenTest()
{
@@ -78,10 +78,10 @@ public class UserButtonTests
var userProgressScreen = GameObject.FindObjectOfType<UserProgressScreen>();
Assert.IsNotNull(userProgressScreen, "Scene was not correctly changed to UserProgressScreen.");
}
/// <summary>
/// Test is the user dropdown menu works correctly
/// </summary>
/// <returns></returns>
[UnityTest]
public IEnumerator ToggleDropdownTest()
{