本文整理汇总了C#中OpenSim.Tests.Common.SceneHelpers类的典型用法代码示例。如果您正苦于以下问题:C# SceneHelpers类的具体用法?C# SceneHelpers怎么用?C# SceneHelpers使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SceneHelpers类属于OpenSim.Tests.Common命名空间,在下文中一共展示了SceneHelpers类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestAddScript
public void TestAddScript()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
UUID userId = TestHelpers.ParseTail(0x1);
// UUID itemId = TestHelpers.ParseTail(0x2);
string itemName = "Test Script Item";
Scene scene = new SceneHelpers().SetupScene();
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId);
scene.AddNewSceneObject(so, true);
InventoryItemBase itemTemplate = new InventoryItemBase();
itemTemplate.Name = itemName;
itemTemplate.Folder = so.UUID;
itemTemplate.InvType = (int)InventoryType.LSL;
SceneObjectPart partWhereScriptAdded = scene.RezNewScript(userId, itemTemplate);
Assert.That(partWhereScriptAdded, Is.Not.Null);
IEntityInventory primInventory = partWhereScriptAdded.Inventory;
Assert.That(primInventory.GetInventoryList().Count, Is.EqualTo(1));
Assert.That(primInventory.ContainsScripts(), Is.True);
IList<TaskInventoryItem> primItems = primInventory.GetInventoryItems(itemName);
Assert.That(primItems.Count, Is.EqualTo(1));
}
示例2: TestCreateInventoryFolders
public void TestCreateInventoryFolders()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
// For this test both folders will have the same name which is legal in SL user inventories.
string foldersName = "f1";
Scene scene = new SceneHelpers().SetupScene();
UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001));
UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, foldersName);
List<InventoryFolderBase> oneFolder
= UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, foldersName);
Assert.That(oneFolder.Count, Is.EqualTo(1));
InventoryFolderBase firstRetrievedFolder = oneFolder[0];
Assert.That(firstRetrievedFolder.Name, Is.EqualTo(foldersName));
UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, foldersName);
List<InventoryFolderBase> twoFolders
= UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, foldersName);
Assert.That(twoFolders.Count, Is.EqualTo(2));
Assert.That(twoFolders[0].Name, Is.EqualTo(foldersName));
Assert.That(twoFolders[1].Name, Is.EqualTo(foldersName));
Assert.That(twoFolders[0].ID, Is.Not.EqualTo(twoFolders[1].ID));
}
示例3: Init
public void Init()
{
// FIXME: We don't need a full scene here - it would be enough to set up the asset service.
Scene scene = new SceneHelpers().SetupScene();
m_assetService = scene.AssetService;
m_uuidGatherer = new UuidGatherer(m_assetService);
}
示例4: TestCachedUserNameForNewAgent
public void TestCachedUserNameForNewAgent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
HGUserManagementModule hgumm = new HGUserManagementModule();
UUID userId = TestHelpers.ParseStem("11");
string firstName = "Fred";
string lastName = "Astaire";
string homeUri = "example.com";
IConfigSource config = new IniConfigSource();
config.AddConfig("Modules");
config.Configs["Modules"].Set("UserManagementModule", hgumm.Name);
SceneHelpers sceneHelpers = new SceneHelpers();
TestScene scene = sceneHelpers.SetupScene();
SceneHelpers.SetupSceneModules(scene, config, hgumm);
AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
acd.firstname = firstName;
acd.lastname = lastName;
acd.ServiceURLs["HomeURI"] = "http://" + homeUri;
SceneHelpers.AddScenePresence(scene, acd);
string name = hgumm.GetUserName(userId);
Assert.That(name, Is.EqualTo(string.Format("{0}.{1} @{2}", firstName, lastName, homeUri)));
}
示例5: Init
public void Init()
{
TestHelpers.InMethod();
SceneHelpers sh = new SceneHelpers();
scene = sh.SetupScene("Neighbour x", UUID.Random(), 1000, 1000);
scene2 = sh.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000);
scene3 = sh.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000);
ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();
interregionComms.Initialise(new IniConfigSource());
interregionComms.PostInitialise();
SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms);
SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms);
SceneHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms);
agent1 = UUID.Random();
agent2 = UUID.Random();
agent3 = UUID.Random();
random = new Random();
sog1 = SceneHelpers.CreateSceneObject(1, agent1);
scene.AddSceneObject(sog1);
sog2 = SceneHelpers.CreateSceneObject(1, agent1);
scene.AddSceneObject(sog2);
sog3 = SceneHelpers.CreateSceneObject(1, agent1);
scene.AddSceneObject(sog3);
region1 = scene.RegionInfo.RegionHandle;
region2 = scene2.RegionInfo.RegionHandle;
region3 = scene3.RegionInfo.RegionHandle;
}
示例6: TestDeRezSceneObject
public void TestDeRezSceneObject()
{
TestHelpers.InMethod();
UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
TestScene scene = new SceneHelpers().SetupScene();
IConfigSource configSource = new IniConfigSource();
IConfig config = configSource.AddConfig("Startup");
config.Set("serverside_object_permissions", true);
SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new DefaultPermissionsModule() });
IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
sogd.Enabled = false;
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", userId);
uint soLocalId = so.LocalId;
List<uint> localIds = new List<uint>();
localIds.Add(so.LocalId);
scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero);
// Check that object isn't deleted until we crank the sogd handle.
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
// Assert.That(retrievedPart, Is.Not.Null);
// Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
sogd.InventoryDeQueueAndDelete();
// SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart, Is.Null);
}
示例7: TestTerrainFill
public void TestTerrainFill()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
//UUID userId = TestHelpers.ParseTail(0x1);
TerrainModule tm = new TerrainModule();
Scene scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(scene, tm);
// Fillheight of 30
{
double fillHeight = 30;
tm.InterfaceFillTerrain(new object[] { fillHeight });
double height = scene.Heightmap[128, 128];
Assert.AreEqual(fillHeight, height);
}
// Max fillheight of 30
// According to http://wiki.secondlife.com/wiki/Tips_for_Creating_Heightfields_and_Details_on_Terrain_RAW_Files#Notes_for_Creating_Height_Field_Maps_for_Second_Life
{
double fillHeight = 508;
tm.InterfaceFillTerrain(new object[] { fillHeight });
double height = scene.Heightmap[128, 128];
Assert.AreEqual(fillHeight, height);
}
}
示例8: TestUndoRedoResizeSceneObject
public void TestUndoRedoResizeSceneObject()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
Vector3 firstSize = new Vector3(2, 3, 4);
Vector3 secondSize = new Vector3(5, 6, 7);
Scene scene = new SceneHelpers().SetupScene();
scene.MaxUndoCount = 20;
SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene);
// TODO: It happens to be the case that we are not storing undo states for SOPs which are not yet in a SOG,
// which is the way that AddSceneObject() sets up the object (i.e. it creates the SOP first). However,
// this is somewhat by chance. Really, we shouldn't be storing undo states at all if the object is not
// in a scene.
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
g1.GroupResize(firstSize);
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(1));
g1.GroupResize(secondSize);
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(2));
g1.RootPart.Undo();
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(1));
Assert.That(g1.GroupScale, Is.EqualTo(firstSize));
g1.RootPart.Redo();
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(2));
Assert.That(g1.GroupScale, Is.EqualTo(secondSize));
}
示例9: TestNoTelehubSpawnPoints
public void TestNoTelehubSpawnPoints()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
EstateManagementModule emm = new EstateManagementModule();
SceneHelpers sh = new SceneHelpers();
Scene scene = sh.SetupScene();
SceneHelpers.SetupSceneModules(scene, emm);
UUID telehubSceneObjectOwner = TestHelpers.ParseTail(0x1);
SceneObjectGroup telehubSo = SceneHelpers.AddSceneObject(scene, "telehubObject", telehubSceneObjectOwner);
emm.HandleOnEstateManageTelehub(null, UUID.Zero, UUID.Zero, "connect", telehubSo.LocalId);
scene.RegionInfo.EstateSettings.AllowDirectTeleport = false;
// Must still be possible to successfully log in
UUID loggingInUserId = TestHelpers.ParseTail(0x2);
UserAccount ua
= UserAccountHelpers.CreateUserWithInventory(scene, "Test", "User", loggingInUserId, "password");
SceneHelpers.AddScenePresence(scene, ua);
Assert.That(scene.GetScenePresence(loggingInUserId), Is.Not.Null);
}
示例10: TestChildAgentSingleRegionCapabilities
public void TestChildAgentSingleRegionCapabilities()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
UUID spUuid = TestHelpers.ParseTail(0x1);
// XXX: This is not great since the use of statics will mean that this has to be manually cleaned up for
// any subsequent test.
// XXX: May replace with a mock IHttpServer later.
BaseHttpServer httpServer = new BaseHttpServer(99999);
MainServer.AddHttpServer(httpServer);
MainServer.Instance = httpServer;
CapabilitiesModule capsMod = new CapabilitiesModule();
TestScene scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(scene, capsMod);
ScenePresence sp = SceneHelpers.AddChildScenePresence(scene, spUuid);
Assert.That(capsMod.GetCapsForUser(spUuid), Is.Not.Null);
// TODO: Need to add tests for other ICapabiltiesModule methods.
scene.CloseAgent(sp.UUID, false);
Assert.That(capsMod.GetCapsForUser(spUuid), Is.Null);
// TODO: Need to add tests for other ICapabiltiesModule methods.
}
示例11: TestResizeSceneObjectPart
public void TestResizeSceneObjectPart()
{
TestHelpers.InMethod();
//log4net.Config.XmlConfigurator.Configure();
Scene scene = new SceneHelpers().SetupScene();
SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(2, UUID.Zero);
g1.RootPart.Scale = new Vector3(2, 3, 4);
g1.Parts[1].Scale = new Vector3(5, 6, 7);
scene.AddSceneObject(g1);
SceneObjectGroup g1Post = scene.GetSceneObjectGroup(g1.UUID);
g1Post.Parts[1].Resize(new Vector3(8, 9, 10));
SceneObjectGroup g1PostPost = scene.GetSceneObjectGroup(g1.UUID);
SceneObjectPart g1RootPart = g1PostPost.RootPart;
SceneObjectPart g1ChildPart = g1PostPost.Parts[1];
Assert.That(g1RootPart.Scale.X, Is.EqualTo(2));
Assert.That(g1RootPart.Scale.Y, Is.EqualTo(3));
Assert.That(g1RootPart.Scale.Z, Is.EqualTo(4));
Assert.That(g1ChildPart.Scale.X, Is.EqualTo(8));
Assert.That(g1ChildPart.Scale.Y, Is.EqualTo(9));
Assert.That(g1ChildPart.Scale.Z, Is.EqualTo(10));
}
示例12: TestSameRegionTeleport
public void TestSameRegionTeleport()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
EntityTransferModule etm = new EntityTransferModule();
IConfigSource config = new IniConfigSource();
config.AddConfig("Modules");
// Not strictly necessary since FriendsModule assumes it is the default (!)
config.Configs["Modules"].Set("EntityTransferModule", etm.Name);
TestScene scene = new SceneHelpers().SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
SceneHelpers.SetupSceneModules(scene, config, etm);
Vector3 teleportPosition = new Vector3(10, 11, 12);
Vector3 teleportLookAt = new Vector3(20, 21, 22);
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
sp.AbsolutePosition = new Vector3(30, 31, 32);
scene.RequestTeleportLocation(
sp.ControllingClient,
scene.RegionInfo.RegionHandle,
teleportPosition,
teleportLookAt,
(uint)TeleportFlags.ViaLocation);
Assert.That(sp.AbsolutePosition, Is.EqualTo(teleportPosition));
// Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera
// position instead).
// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
}
示例13: TestGiveInventoryItem
public void TestGiveInventoryItem()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
Scene scene = new SceneHelpers().SetupScene();
UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001));
UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002));
InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID);
scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID);
InventoryItemBase retrievedItem1
= UserInventoryHelpers.GetInventoryItem(scene.InventoryService, user2.PrincipalID, "Notecards/item1");
Assert.That(retrievedItem1, Is.Not.Null);
// Try giving back the freshly received item
scene.GiveInventoryItem(user1.PrincipalID, user2.PrincipalID, retrievedItem1.ID);
List<InventoryItemBase> reretrievedItems
= UserInventoryHelpers.GetInventoryItems(scene.InventoryService, user1.PrincipalID, "Notecards/item1");
Assert.That(reretrievedItems.Count, Is.EqualTo(2));
}
示例14: TestShareWithGroup
public void TestShareWithGroup()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
TestScene scene = new SceneHelpers().SetupScene();
IConfigSource configSource = new IniConfigSource();
IConfig startupConfig = configSource.AddConfig("Startup");
startupConfig.Set("serverside_object_permissions", true);
IConfig groupsConfig = configSource.AddConfig("Groups");
groupsConfig.Set("Enabled", true);
groupsConfig.Set("Module", "GroupsModule");
groupsConfig.Set("DebugEnabled", true);
SceneHelpers.SetupSceneModules(
scene, configSource, new object[]
{ new PermissionsModule(),
new GroupsModule(),
new MockGroupsServicesConnector() });
IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
IGroupsModule groupsModule = scene.RequestModuleInterface<IGroupsModule>();
groupsModule.CreateGroup(client, "group1", "To boldly go", true, UUID.Zero, 5, true, true, true);
}
示例15: TestDeRezSceneObject
public void TestDeRezSceneObject()
{
TestHelpers.InMethod();
UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
TestScene scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(scene, new PermissionsModule());
TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
sogd.Enabled = false;
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", userId);
uint soLocalId = so.LocalId;
List<uint> localIds = new List<uint>();
localIds.Add(so.LocalId);
scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero);
// Check that object isn't deleted until we crank the sogd handle.
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart, Is.Not.Null);
Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
sogd.InventoryDeQueueAndDelete();
SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart2, Is.Null);
Assert.That(client.ReceivedKills.Count, Is.EqualTo(1));
Assert.That(client.ReceivedKills[0], Is.EqualTo(soLocalId));
}