Add PrimCountModuleTests.TestRemoveOwnerObject().
Also adds SceneSetupHelpers methods to easily create sogs with different part UUIDs0.7.1-dev
parent
d5c7ae5c6b
commit
ebbe3afaf1
|
@ -44,8 +44,11 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class PrimCountModuleTests
|
public class PrimCountModuleTests
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Test count after a parcel owner owned object is added.
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void TestAddObject()
|
public void TestAddOwnerObject()
|
||||||
{
|
{
|
||||||
TestHelper.InMethod();
|
TestHelper.InMethod();
|
||||||
// log4net.Config.XmlConfigurator.Configure();
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
@ -80,5 +83,39 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
|
||||||
Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0));
|
Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0));
|
||||||
Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(3));
|
Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test count after a parcel owner owned object is removed.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestRemoveOwnerObject()
|
||||||
|
{
|
||||||
|
TestHelper.InMethod();
|
||||||
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
|
PrimCountModule pcm = new PrimCountModule();
|
||||||
|
LandManagementModule lmm = new LandManagementModule();
|
||||||
|
Scene scene = SceneSetupHelpers.SetupScene();
|
||||||
|
SceneSetupHelpers.SetupSceneModules(scene, lmm, pcm);
|
||||||
|
|
||||||
|
UUID userId = new UUID("00000000-0000-0000-0000-000000000010");
|
||||||
|
UUID dummyUserId = new UUID("99999999-9999-9999-9999-999999999999");
|
||||||
|
ILandObject lo = new LandObject(userId, false, scene);
|
||||||
|
lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
|
||||||
|
lmm.AddLandObject(lo);
|
||||||
|
//scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID);
|
||||||
|
|
||||||
|
scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, userId, 0x1), false);
|
||||||
|
SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, userId, 0x10);
|
||||||
|
scene.AddNewSceneObject(sogToDelete, false);
|
||||||
|
scene.DeleteSceneObject(sogToDelete, false);
|
||||||
|
|
||||||
|
Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(1));
|
||||||
|
Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0));
|
||||||
|
Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0));
|
||||||
|
Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(1));
|
||||||
|
Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0));
|
||||||
|
Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -488,20 +488,37 @@ namespace OpenSim.Tests.Common.Setup
|
||||||
/// <param name="ownerId"></param>
|
/// <param name="ownerId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId)
|
public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId)
|
||||||
{
|
{
|
||||||
|
return CreateSceneObject(parts, ownerId, 0x1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a scene object but do not add it to the scene.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parts">The number of parts that should be in the scene object</param>
|
||||||
|
/// <param name="ownerId"></param>
|
||||||
|
/// <param name="uuidTail">
|
||||||
|
/// The hexadecimal last part of the UUID for parts created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}"
|
||||||
|
/// will be given to the root part, and incremented for each part thereafter.
|
||||||
|
/// </param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId, int uuidTail)
|
||||||
|
{
|
||||||
|
string rawSogId = string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail);
|
||||||
|
|
||||||
SceneObjectGroup sog
|
SceneObjectGroup sog
|
||||||
= new SceneObjectGroup(
|
= new SceneObjectGroup(
|
||||||
CreateSceneObjectPart("part1", new UUID("00000000-0000-0000-0000-000000000001"), ownerId));
|
CreateSceneObjectPart("part0", new UUID(rawSogId), ownerId));
|
||||||
|
|
||||||
if (parts > 1)
|
if (parts > 1)
|
||||||
for (int i = 2; i <= parts; i++)
|
for (int i = 1; i < parts; i++)
|
||||||
sog.AddPart(
|
sog.AddPart(
|
||||||
CreateSceneObjectPart(
|
CreateSceneObjectPart(
|
||||||
string.Format("obj{0}", i),
|
string.Format("obj{0}", i),
|
||||||
new UUID(string.Format("00000000-0000-0000-0000-{0:D12}", i)),
|
new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail + i)),
|
||||||
ownerId));
|
ownerId));
|
||||||
|
|
||||||
return sog;
|
return sog;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue