Add TestCreateDuplicateRootScenePresence() regression test.

0.7.4.1
Justin Clark-Casey (justincc) 2012-07-19 21:54:50 +01:00
parent c0ab406e2e
commit e9a121e1b2
3 changed files with 41 additions and 1 deletions

View File

@ -4469,6 +4469,23 @@ namespace OpenSim.Region.Framework.Scenes
return m_sceneGraph.GetScenePresence(localID); return m_sceneGraph.GetScenePresence(localID);
} }
/// <summary>
/// Gets all the scene presences in this scene.
/// </summary>
/// <remarks>
/// This method will return both root and child scene presences.
///
/// Consider using ForEachScenePresence() or ForEachRootScenePresence() if possible since these will not
/// involving creating a new List object.
/// </remarks>
/// <returns>
/// A list of the scene presences. Adding or removing from the list will not affect the presences in the scene.
/// </returns>
public List<ScenePresence> GetScenePresences()
{
return new List<ScenePresence>(m_sceneGraph.GetScenePresences());
}
/// <summary> /// <summary>
/// Performs action on all avatars in the scene (root scene presences) /// Performs action on all avatars in the scene (root scene presences)
/// Avatars may be an NPC or a 'real' client. /// Avatars may be an NPC or a 'real' client.

View File

@ -768,7 +768,7 @@ namespace OpenSim.Region.Framework.Scenes
/// pass a delegate to ForEachScenePresence. /// pass a delegate to ForEachScenePresence.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
private List<ScenePresence> GetScenePresences() protected internal List<ScenePresence> GetScenePresences()
{ {
return m_scenePresenceArray; return m_scenePresenceArray;
} }

View File

@ -107,6 +107,29 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(sp, Is.Not.Null); Assert.That(sp, Is.Not.Null);
Assert.That(sp.IsChildAgent, Is.False); Assert.That(sp.IsChildAgent, Is.False);
Assert.That(sp.UUID, Is.EqualTo(spUuid)); Assert.That(sp.UUID, Is.EqualTo(spUuid));
Assert.That(scene.GetScenePresences().Count, Is.EqualTo(1));
}
[Test]
public void TestCreateDuplicateRootScenePresence()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
UUID spUuid = TestHelpers.ParseTail(0x1);
TestScene scene = new SceneHelpers().SetupScene();
SceneHelpers.AddScenePresence(scene, spUuid);
SceneHelpers.AddScenePresence(scene, spUuid);
Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(spUuid), Is.Not.Null);
Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1));
ScenePresence sp = scene.GetScenePresence(spUuid);
Assert.That(sp, Is.Not.Null);
Assert.That(sp.IsChildAgent, Is.False);
Assert.That(sp.UUID, Is.EqualTo(spUuid));
} }
[Test] [Test]