6 using System.Text.RegularExpressions;
24 protected override IEnumerator
LoadScene(
string sceneName) {
25 yield
return base.LoadScene(sceneName);
26 CheckPattern(
new Regex($
"^({Scene.name}|.*/{Scene.name})"), sceneName);
31 var component = Components.Find<T>(path);
32 Assert.IsNotNull(value: component, message: $
"'{path}' not found");
37 protected static GameObject
FindGameObject(
string name) => FindObject<GameObject>(name);
41 var objects = Objects.FindAll<T>(name);
42 Assert.AreNotEqual(0, objects?.Length);
43 return objects?.Length > 0 ? objects[0] : null;
47 public IEnumerator
IsDisplayingInUi(
string path,
bool visible =
true,
int repeats = 300) {
48 for (var count = 0; count < repeats; count++) {
49 if (
IsDisplayingInUi(Components.Find<RectTransform>(path)) == visible) yield
break;
54 Assert.IsFalse(
true, $
"IsDisplayingInUI '{path}' failed to act as expected");
59 yield
return PushButton(Component<Button>(path));
64 MatchCollection matches = regex.Matches(against);
65 Assert.AreEqual(matches.Count, 1, against);
69 protected static void Fail(
string message) =>
throw new Exception(message);
71 #region Unity Editor Only Methods 74 protected static void SelectMenuItem(
string path) =>
75 Assert.IsTrue(EditorApplication.ExecuteMenuItem(path));
static T FindObject< T >(string name)
Objects.Find, assert if none found
static void Fail(string message)
//#TBD#//
override IEnumerator LoadScene(string sceneName)
Load scene. Assert on failure Load a scene by name (must be in build)
static GameObject FindGameObject(string name)
FindObject{GameObject} shortcut
IEnumerator IsDisplayingInUi(string path, bool visible=true, int repeats=300)
IsDisplayingInUI, assert if not visible/invisible as expected after nn frames
PlayModeController wrapper with asserts
IEnumerator PushButton(string path)
Push button, assert if it can't be found
static T Component< T >(string path)
Components.Find, assert on failure
static void CheckPattern(Regex regex, string against)
Check string against regex, assert if no match
Control a running scene (skeleton implementation)