MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

PlayModeTests: MRTK does not get destroyed when unloading / loading a new scene

Open julenka opened this issue 7 years ago • 3 comments

Overview

For playmode tests we need to be able to unload a scene, unload MRTK, and then load a new MRTK in a fresh / unmodified state. Currently after unloading a scene and then loading a new scene, MRTK does not reset its state.

This is blocking many play mode test behaviors which rely on MRTK scene being in a consistent state when the test starts. For example, since the MRTK object persists between tests, the currently focused object will not get cleared between tests. This means that we cannot ensure that a focus enter event will get sent in a brand new test when it is put in front of the camera, because MRTK might already be focusing some other (now destroyed) object.

To reproduce, import the unity package in this zip file into your MRTK branch.

TestSceneLoadUnload.zip

Then run the new "TestSceneLoadUnload" test in PlayModeTests.

Expected Behavior

TestSceneLoadUnload test passes because in Test02 we ensure that 1) the previous scene unloads, 2) the new scene loads WITHOUT adding mrtk, and therefore that 3) MRTK is not already initialized.

Actual Behavior

TestSceneLoadUnload test fails because after step 2) above, MRTK is already initialized (even though we have not yet added MRTK to the scene).

julenka avatar May 14 '19 17:05 julenka

This is blocking many play mode test behaviors which rely on MRTK scene being in a consistent state when the test starts. For example, since the MRTK object persists between tests, the currently focused object will not get cleared between tests. This means that we cannot ensure that a focus enter event will get sent in a brand new test when it is put in front of the camera, because MRTK might already be focusing some other (now destroyed) object.

julenka avatar May 14 '19 17:05 julenka

@julenka I believe this can be closed?

Troy-Ferrell avatar Aug 26 '19 23:08 Troy-Ferrell

Yup, was fixed a while back with Lars's changes to Scene System.

julenka avatar Aug 27 '19 19:08 julenka