本文整理汇总了C#中OpenSim.Tests.Common.SceneHelpers.Close方法的典型用法代码示例。如果您正苦于以下问题:C# SceneHelpers.Close方法的具体用法?C# SceneHelpers.Close怎么用?C# SceneHelpers.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Tests.Common.SceneHelpers
的用法示例。
在下文中一共展示了SceneHelpers.Close方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestShutdownScene
public void TestShutdownScene()
{
TestHelpers.InMethod();
Scene scene = new SceneHelpers().SetupScene();
scene.Close();
Assert.That(scene.ShuttingDown, Is.True);
Assert.That(scene.Active, Is.False);
// Trying to update a shutdown scene should result in no update
scene.Update(1);
Assert.That(scene.Frame, Is.EqualTo(0));
}
示例2: TestAddObjects
private void TestAddObjects(int primsInEachObject, int objectsToAdd)
{
UUID ownerId = new UUID("F0000000-0000-0000-0000-000000000000");
// Using a local variable for scene, at least on mono 2.6.7, means that it's much more likely to be garbage
// collected when we teardown this test. If it's done in a member variable, even if that is subsequently
// nulled out, the garbage collect can be delayed.
TestScene scene = new SceneHelpers().SetupScene();
// Process process = Process.GetCurrentProcess();
// long startProcessMemory = process.PrivateMemorySize64;
long startGcMemory = GC.GetTotalMemory(true);
DateTime start = DateTime.Now;
for (int i = 1; i <= objectsToAdd; i++)
{
SceneObjectGroup so = SceneHelpers.CreateSceneObject(primsInEachObject, ownerId, "part_", i);
Assert.That(scene.AddNewSceneObject(so, false), Is.True, string.Format("Object {0} was not created", i));
}
TimeSpan elapsed = DateTime.Now - start;
// long processMemoryAlloc = process.PrivateMemorySize64 - startProcessMemory;
long endGcMemory = GC.GetTotalMemory(false);
for (int i = 1; i <= objectsToAdd; i++)
{
Assert.That(
scene.GetSceneObjectGroup(TestHelpers.ParseTail(i)),
Is.Not.Null,
string.Format("Object {0} could not be retrieved", i));
}
// When a scene object is added to a scene, it is placed in the update list for sending to viewers
// (though in this case we have none). When it is deleted, it is not removed from the update which is
// fine since it will later be ignored.
//
// However, that means that we need to manually run an update here to clear out that list so that deleted
// objects will be clean up by the garbage collector before the next stress test is run.
scene.Update(1);
Console.WriteLine(
"Took {0}ms, {1}MB ({2} - {3}) to create {4} objects each containing {5} prim(s)",
Math.Round(elapsed.TotalMilliseconds),
(endGcMemory - startGcMemory) / 1024 / 1024,
endGcMemory / 1024 / 1024,
startGcMemory / 1024 / 1024,
objectsToAdd,
primsInEachObject);
scene.Close();
// scene = null;
}