Resolve WES-117 "Persistent data handling"
This commit is contained in:
@@ -1,13 +1,9 @@
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
using TMPro;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
|
||||
public class BackButtonTests
|
||||
{
|
||||
@@ -15,14 +11,13 @@ public class BackButtonTests
|
||||
[UnitySetUp]
|
||||
public IEnumerator SetupFunction()
|
||||
{
|
||||
string path = $"{Application.persistentDataPath}/users.json";
|
||||
var oneUser = "{\"currentUserIndex\": 0,\"storedUsers\": [{\"username\": \"TEST\",\"avatar\": {\"instanceID\": 40848},\"playtime\": 0.0,\"courses\": [],\"minigames\": []}]}";
|
||||
string path = $"{Application.persistentDataPath}/unit_test_users.json";
|
||||
string oneUser = $"{{\"version\":{PersistentDataController.VERSION},\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
|
||||
|
||||
using (StreamWriter writer = new StreamWriter(path))
|
||||
{
|
||||
writer.Write(oneUser);
|
||||
}
|
||||
|
||||
File.WriteAllText(path, oneUser);
|
||||
PersistentDataController.PATH = path;
|
||||
PersistentDataController.GetInstance().Load();
|
||||
AssetDatabase.LoadAssetAtPath<UserAvatarList>("Assets/Accounts/ScriptableObjects/UserAvatarList.asset").Awake();
|
||||
SystemController.GetInstance().LoadNextScene("Common/Scenes/MainMenuScreen");
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
SystemController.GetInstance().LoadNextScene("Common/Scenes/ListMinigamesScreen");
|
||||
@@ -33,11 +28,11 @@ public class BackButtonTests
|
||||
public IEnumerator BackTest()
|
||||
{
|
||||
|
||||
var backButton = (BackButton) GameObject.FindObjectOfType(typeof(BackButton));
|
||||
var backButton = (BackButton)GameObject.FindObjectOfType(typeof(BackButton));
|
||||
backButton.Back();
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
|
||||
var mainMenuScreen = (MainMenuScreen) GameObject.FindObjectOfType(typeof(MainMenuScreen));
|
||||
var mainMenuScreen = (MainMenuScreen)GameObject.FindObjectOfType(typeof(MainMenuScreen));
|
||||
Assert.IsNotNull(mainMenuScreen);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
"InterfacesScripts",
|
||||
"Unity.TextMeshPro",
|
||||
"AccountsScripts",
|
||||
"SignPredictor"
|
||||
"SignPredictor",
|
||||
"SystemArchitecture"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
using TMPro;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
|
||||
public class CourseActivityTests
|
||||
{
|
||||
@@ -15,14 +11,13 @@ public class CourseActivityTests
|
||||
[UnitySetUp]
|
||||
public IEnumerator SetupFunction()
|
||||
{
|
||||
string path = $"{Application.persistentDataPath}/users.json";
|
||||
var oneUser = "{\"currentUserIndex\": 0,\"storedUsers\": [{\"username\": \"TEST\",\"avatar\": {\"instanceID\": 40848},\"playtime\": 0.0,\"courses\": [],\"minigames\": []}]}";
|
||||
|
||||
using (StreamWriter writer = new StreamWriter(path))
|
||||
{
|
||||
writer.Write(oneUser);
|
||||
}
|
||||
string path = $"{Application.persistentDataPath}/unit_test_users.json";
|
||||
string oneUser = $"{{\"version\":{PersistentDataController.VERSION},\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
|
||||
|
||||
File.WriteAllText(path, oneUser);
|
||||
PersistentDataController.PATH = path;
|
||||
PersistentDataController.GetInstance().Load();
|
||||
AssetDatabase.LoadAssetAtPath<UserAvatarList>("Assets/Accounts/ScriptableObjects/UserAvatarList.asset").Awake();
|
||||
SystemController.GetInstance().LoadNextScene("Common/Scenes/CourseActivityScreen");
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
}
|
||||
@@ -30,11 +25,11 @@ public class CourseActivityTests
|
||||
[UnityTest]
|
||||
public IEnumerator StartCoursesTests()
|
||||
{
|
||||
var courseActivityScreen = (CourseActivityScreen) GameObject.FindObjectOfType(typeof(CourseActivityScreen));
|
||||
var courseActivityScreen = (CourseActivityScreen)GameObject.FindObjectOfType(typeof(CourseActivityScreen));
|
||||
courseActivityScreen.StartCourse();
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
|
||||
var templateCourse = (CoursesController) GameObject.FindObjectOfType(typeof(CoursesController));
|
||||
var templateCourse = (CoursesController)GameObject.FindObjectOfType(typeof(CoursesController));
|
||||
Assert.IsNotNull(templateCourse);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
using TMPro;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
|
||||
public class CourseMenuScreenTest
|
||||
{
|
||||
@@ -15,14 +11,13 @@ public class CourseMenuScreenTest
|
||||
[UnitySetUp]
|
||||
public IEnumerator SetupFunction()
|
||||
{
|
||||
string path = $"{Application.persistentDataPath}/users.json";
|
||||
var oneUser = "{\"currentUserIndex\": 0,\"storedUsers\": [{\"username\": \"TEST\",\"avatar\": {\"instanceID\": 40848},\"playtime\": 0.0,\"courses\": [],\"minigames\": []}]}";
|
||||
|
||||
using (StreamWriter writer = new StreamWriter(path))
|
||||
{
|
||||
writer.Write(oneUser);
|
||||
}
|
||||
string path = $"{Application.persistentDataPath}/unit_test_users.json";
|
||||
string oneUser = $"{{\"version\":{PersistentDataController.VERSION},\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
|
||||
|
||||
File.WriteAllText(path, oneUser);
|
||||
PersistentDataController.PATH = path;
|
||||
PersistentDataController.GetInstance().Load();
|
||||
AssetDatabase.LoadAssetAtPath<UserAvatarList>("Assets/Accounts/ScriptableObjects/UserAvatarList.asset").Awake();
|
||||
SystemController.GetInstance().LoadNextScene("Common/Scenes/CoursesMenuScreen");
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
}
|
||||
@@ -30,7 +25,7 @@ public class CourseMenuScreenTest
|
||||
[UnityTest]
|
||||
public IEnumerator GotoListOfCoursesTest()
|
||||
{
|
||||
var courseMenuScreen = (CourseMenuScreen) GameObject.FindObjectOfType(typeof(CourseMenuScreen));
|
||||
var courseMenuScreen = (CourseMenuScreen)GameObject.FindObjectOfType(typeof(CourseMenuScreen));
|
||||
courseMenuScreen.GotoListOfCourses();
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
using TMPro;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
|
||||
public class ListCoursesScreenTest
|
||||
{
|
||||
@@ -15,14 +11,13 @@ public class ListCoursesScreenTest
|
||||
[UnitySetUp]
|
||||
public IEnumerator SetupFunction()
|
||||
{
|
||||
string path = $"{Application.persistentDataPath}/users.json";
|
||||
var oneUser = "{\"currentUserIndex\": 0,\"storedUsers\": [{\"username\": \"TEST\",\"avatar\": {\"instanceID\": 40848},\"playtime\": 0.0,\"courses\": [],\"minigames\": []}]}";
|
||||
|
||||
using (StreamWriter writer = new StreamWriter(path))
|
||||
{
|
||||
writer.Write(oneUser);
|
||||
}
|
||||
string path = $"{Application.persistentDataPath}/unit_test_users.json";
|
||||
string oneUser = $"{{\"version\":{PersistentDataController.VERSION},\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
|
||||
|
||||
File.WriteAllText(path, oneUser);
|
||||
PersistentDataController.PATH = path;
|
||||
PersistentDataController.GetInstance().Load();
|
||||
AssetDatabase.LoadAssetAtPath<UserAvatarList>("Assets/Accounts/ScriptableObjects/UserAvatarList.asset").Awake();
|
||||
SystemController.GetInstance().LoadNextScene("Common/Scenes/ListCoursesScreen");
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
using TMPro;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.TestTools;
|
||||
|
||||
|
||||
public class MainMenuScreenTests
|
||||
@@ -15,14 +13,13 @@ public class MainMenuScreenTests
|
||||
[UnitySetUp]
|
||||
public IEnumerator SetupFunction()
|
||||
{
|
||||
string path = $"{Application.persistentDataPath}/users.json";
|
||||
var oneUser = "{\"currentUserIndex\": 0,\"storedUsers\": [{\"username\": \"TEST\",\"avatar\": {\"instanceID\": 40848},\"playtime\": 0.0,\"courses\": [],\"minigames\": []}]}";
|
||||
|
||||
using (StreamWriter writer = new StreamWriter(path))
|
||||
{
|
||||
writer.Write(oneUser);
|
||||
}
|
||||
string path = $"{Application.persistentDataPath}/unit_test_users.json";
|
||||
string oneUser = $"{{\"version\":{PersistentDataController.VERSION},\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
|
||||
|
||||
File.WriteAllText(path, oneUser);
|
||||
PersistentDataController.PATH = path;
|
||||
PersistentDataController.GetInstance().Load();
|
||||
AssetDatabase.LoadAssetAtPath<UserAvatarList>("Assets/Accounts/ScriptableObjects/UserAvatarList.asset").Awake();
|
||||
SceneManager.LoadScene("Common/Scenes/MainMenuScreen");
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
}
|
||||
@@ -42,28 +39,28 @@ public class MainMenuScreenTests
|
||||
[UnityTest]
|
||||
public IEnumerator GotoMiniGamesTest()
|
||||
{
|
||||
var mainMenuScreen = (MainMenuScreen) GameObject.FindObjectOfType(typeof(MainMenuScreen));
|
||||
var mainMenuScreen = (MainMenuScreen)GameObject.FindObjectOfType(typeof(MainMenuScreen));
|
||||
mainMenuScreen.GotoMinigames();
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
|
||||
var listMinigamesScreen = (ListMinigamesScreen) GameObject.FindObjectOfType(typeof(ListMinigamesScreen));
|
||||
var listMinigamesScreen = (ListMinigamesScreen)GameObject.FindObjectOfType(typeof(ListMinigamesScreen));
|
||||
Assert.IsNotNull(listMinigamesScreen);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* [UnityTest]
|
||||
public IEnumerator GotoSettingsTest()
|
||||
{
|
||||
Arrange
|
||||
SceneManager.LoadScene("Common/Scenes/MainMenuScreen");
|
||||
/* [UnityTest]
|
||||
public IEnumerator GotoSettingsTest()
|
||||
{
|
||||
Arrange
|
||||
SceneManager.LoadScene("Common/Scenes/MainMenuScreen");
|
||||
|
||||
yield return new WaitForSeconds(1f);
|
||||
var mainMenuScreen = (MainMenuScreen)GameObject.FindObjectOfType(typeof(MainMenuScreen));
|
||||
mainMenuScreen.GotoSettings();
|
||||
yield return new WaitForSeconds(1f);
|
||||
yield return new WaitForSeconds(1f);
|
||||
var mainMenuScreen = (MainMenuScreen)GameObject.FindObjectOfType(typeof(MainMenuScreen));
|
||||
mainMenuScreen.GotoSettings();
|
||||
yield return new WaitForSeconds(1f);
|
||||
|
||||
var minigameActivityScreen = (MinigameActivityScreen)GameObject.FindObjectOfType(typeof(MinigameActivityScreen));
|
||||
Assert.IsNotNull(minigameActivityScreen);
|
||||
}*/
|
||||
var minigameActivityScreen = (MinigameActivityScreen)GameObject.FindObjectOfType(typeof(MinigameActivityScreen));
|
||||
Assert.IsNotNull(minigameActivityScreen);
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
using TMPro;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
|
||||
public class MiniGameActivityScreenTests
|
||||
@@ -15,14 +12,13 @@ public class MiniGameActivityScreenTests
|
||||
[UnitySetUp]
|
||||
public IEnumerator SetupFunction()
|
||||
{
|
||||
string path = $"{Application.persistentDataPath}/users.json";
|
||||
var oneUser = "{\"currentUserIndex\": 0,\"storedUsers\": [{\"username\": \"TEST\",\"avatar\": {\"instanceID\": 40848},\"playtime\": 0.0,\"courses\": [],\"minigames\": []}]}";
|
||||
|
||||
using (StreamWriter writer = new StreamWriter(path))
|
||||
{
|
||||
writer.Write(oneUser);
|
||||
}
|
||||
string path = $"{Application.persistentDataPath}/unit_test_users.json";
|
||||
string oneUser = $"{{\"version\":{PersistentDataController.VERSION},\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
|
||||
|
||||
File.WriteAllText(path, oneUser);
|
||||
PersistentDataController.PATH = path;
|
||||
PersistentDataController.GetInstance().Load();
|
||||
AssetDatabase.LoadAssetAtPath<UserAvatarList>("Assets/Accounts/ScriptableObjects/UserAvatarList.asset").Awake();
|
||||
SystemController.GetInstance().LoadNextScene("Common/Scenes/CoursesMenuScreen");
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
}
|
||||
|
||||
@@ -1,36 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
using TMPro;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.TestTools;
|
||||
|
||||
|
||||
public class StartGamesTests
|
||||
{
|
||||
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator BootWithUsersTest()
|
||||
{
|
||||
string path = $"{Application.persistentDataPath}/users.json";
|
||||
var oneUser = "{\"currentUserIndex\": 0,\"storedUsers\": [{\"username\": \"TEST\",\"avatar\": {\"instanceID\": 40848},\"playtime\": 0.0,\"courses\": [],\"minigames\": []}]}";
|
||||
|
||||
using (StreamWriter writer = new StreamWriter(path))
|
||||
{
|
||||
writer.Write(oneUser);
|
||||
}
|
||||
string path = $"{Application.persistentDataPath}/unit_test_users.json";
|
||||
string oneUser = $"{{\"version\":{PersistentDataController.VERSION},\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
|
||||
|
||||
File.WriteAllText(path, oneUser);
|
||||
PersistentDataController.PATH = path;
|
||||
PersistentDataController.GetInstance().Load();
|
||||
AssetDatabase.LoadAssetAtPath<UserAvatarList>("Assets/Accounts/ScriptableObjects/UserAvatarList.asset").Awake();
|
||||
SceneManager.LoadScene("Common/Scenes/Boot");
|
||||
|
||||
yield return new WaitForSeconds(1);
|
||||
|
||||
var userCreationScreen = (UserCreationScreen) GameObject.FindObjectOfType(typeof(UserCreationScreen));
|
||||
var bootScreen = (BootScreen) GameObject.FindObjectOfType(typeof(BootScreen));
|
||||
var mainMenuScreen = (MainMenuScreen) GameObject.FindObjectOfType(typeof(MainMenuScreen));
|
||||
var userCreationScreen = (UserCreationScreen)GameObject.FindObjectOfType(typeof(UserCreationScreen));
|
||||
var bootScreen = (BootScreen)GameObject.FindObjectOfType(typeof(BootScreen));
|
||||
var mainMenuScreen = (MainMenuScreen)GameObject.FindObjectOfType(typeof(MainMenuScreen));
|
||||
|
||||
// yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
|
||||
// if (Application.HasUserAuthorization(UserAuthorization.WebCam))
|
||||
@@ -42,41 +37,37 @@ public class StartGamesTests
|
||||
// Assert.AreEqual(bootScreen.errorText.text, "Zorg ervoor dat deze applicatie toegang heeft tot je webcam!");
|
||||
// }
|
||||
// else
|
||||
if(0 >= WebCamTexture.devices.Length){
|
||||
Debug.Log("no webcam");
|
||||
Assert.IsNull(userCreationScreen);
|
||||
if (0 >= WebCamTexture.devices.Length)
|
||||
{
|
||||
Assert.IsNull(mainMenuScreen);
|
||||
Assert.IsNotNull(bootScreen);
|
||||
Assert.AreEqual(bootScreen.errorText.text, "Zorg ervoor dat je webcam correct is aangesloten!");
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
Debug.Log("everything is there");
|
||||
Assert.IsNull(bootScreen);
|
||||
Assert.IsNull(userCreationScreen);
|
||||
Assert.IsNotNull(mainMenuScreen);
|
||||
}
|
||||
Assert.IsNull(userCreationScreen);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator BootWithoutUsersTest()
|
||||
{
|
||||
// Arrange
|
||||
string path = $"{Application.persistentDataPath}/users.json";
|
||||
var oneUser = "{}";
|
||||
|
||||
using (StreamWriter writer = new StreamWriter(path))
|
||||
{
|
||||
writer.Write(oneUser);
|
||||
}
|
||||
string path = $"{Application.persistentDataPath}/unit_test_users.json";
|
||||
string noUsers = "https://www.youtube.com/watch?v=dQw4w9WgXcQ";
|
||||
|
||||
File.WriteAllText(path, noUsers);
|
||||
PersistentDataController.PATH = path;
|
||||
PersistentDataController.GetInstance().Load();
|
||||
AssetDatabase.LoadAssetAtPath<UserAvatarList>("Assets/Accounts/ScriptableObjects/UserAvatarList.asset").Awake();
|
||||
SceneManager.LoadScene("Common/Scenes/Boot");
|
||||
|
||||
yield return new WaitForSeconds(1);
|
||||
|
||||
var userCreationScreen = (UserCreationScreen) GameObject.FindObjectOfType(typeof(UserCreationScreen));
|
||||
var bootScreen = (BootScreen) GameObject.FindObjectOfType(typeof(BootScreen));
|
||||
var mainMenuScreen = (MainMenuScreen) GameObject.FindObjectOfType(typeof(MainMenuScreen));
|
||||
var userCreationScreen = (UserCreationScreen)GameObject.FindObjectOfType(typeof(UserCreationScreen));
|
||||
var bootScreen = (BootScreen)GameObject.FindObjectOfType(typeof(BootScreen));
|
||||
var mainMenuScreen = (MainMenuScreen)GameObject.FindObjectOfType(typeof(MainMenuScreen));
|
||||
|
||||
// yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
|
||||
// if (Application.HasUserAuthorization(UserAuthorization.WebCam))
|
||||
@@ -88,19 +79,18 @@ public class StartGamesTests
|
||||
// Assert.AreEqual(bootScreen.errorText.text, "Zorg ervoor dat deze applicatie toegang heeft tot je webcam!");
|
||||
// }
|
||||
// else
|
||||
if(0 >= WebCamTexture.devices.Length){
|
||||
Debug.Log("no webcam");
|
||||
if (0 >= WebCamTexture.devices.Length)
|
||||
{
|
||||
Assert.IsNull(userCreationScreen);
|
||||
Assert.IsNull(mainMenuScreen);
|
||||
Assert.IsNotNull(bootScreen);
|
||||
Assert.AreEqual(bootScreen.errorText.text, "Zorg ervoor dat je webcam correct is aangesloten!");
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("no users");
|
||||
Assert.IsNull(bootScreen);
|
||||
Assert.IsNull(mainMenuScreen);
|
||||
Assert.IsNotNull(userCreationScreen);
|
||||
}
|
||||
Assert.IsNull(mainMenuScreen);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
using TMPro;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
|
||||
public class UserButtonTests
|
||||
@@ -15,28 +12,27 @@ public class UserButtonTests
|
||||
[UnitySetUp]
|
||||
public IEnumerator SetupFunction()
|
||||
{
|
||||
string path = $"{Application.persistentDataPath}/users.json";
|
||||
var oneUser = "{\"currentUserIndex\": 0,\"storedUsers\": [{\"username\": \"TEST\",\"avatar\": {\"instanceID\": 40848},\"playtime\": 0.0,\"courses\": [],\"minigames\": []}]}";
|
||||
|
||||
using (StreamWriter writer = new StreamWriter(path))
|
||||
{
|
||||
writer.Write(oneUser);
|
||||
}
|
||||
string path = $"{Application.persistentDataPath}/unit_test_users.json";
|
||||
string oneUser = $"{{\"version\":{PersistentDataController.VERSION},\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
|
||||
|
||||
File.WriteAllText(path, oneUser);
|
||||
PersistentDataController.PATH = path;
|
||||
PersistentDataController.GetInstance().Load();
|
||||
AssetDatabase.LoadAssetAtPath<UserAvatarList>("Assets/Accounts/ScriptableObjects/UserAvatarList.asset").Awake();
|
||||
SystemController.GetInstance().LoadNextScene("Common/Scenes/CoursesMenuScreen");
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
}
|
||||
|
||||
/* [UnityTest]
|
||||
public IEnumerator OpenProgressCallbackTest()
|
||||
{
|
||||
var userButton = (UserButton)GameObject.FindObjectOfType(typeof(UserButton));
|
||||
userButton.OpenProgressCallback();
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
/* [UnityTest]
|
||||
public IEnumerator OpenProgressCallbackTest()
|
||||
{
|
||||
var userButton = (UserButton)GameObject.FindObjectOfType(typeof(UserButton));
|
||||
userButton.OpenProgressCallback();
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
|
||||
var listCoursesScreen = (ListCoursesScreen)GameObject.FindObjectOfType(typeof(ListCoursesScreen));
|
||||
Assert.IsNotNull(listCoursesScreen);
|
||||
}*/
|
||||
var listCoursesScreen = (ListCoursesScreen)GameObject.FindObjectOfType(typeof(ListCoursesScreen));
|
||||
Assert.IsNotNull(listCoursesScreen);
|
||||
}*/
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator ChangeUserCallbackTest()
|
||||
|
||||
Reference in New Issue
Block a user