diff options
author | Justin Clark-Casey (justincc) | 2011-09-08 20:51:52 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-09-08 20:51:52 +0100 |
commit | bd5d2cb043892399baff85667ee1e6ec6f3b3d2e (patch) | |
tree | 60d7ab71edceede360a78f2bd32d386067a780e6 /OpenSim/Region/OptionalModules | |
parent | Increase information in logging for UserAgentServiceConnector. (diff) | |
download | opensim-SC_OLD-bd5d2cb043892399baff85667ee1e6ec6f3b3d2e.zip opensim-SC_OLD-bd5d2cb043892399baff85667ee1e6ec6f3b3d2e.tar.gz opensim-SC_OLD-bd5d2cb043892399baff85667ee1e6ec6f3b3d2e.tar.bz2 opensim-SC_OLD-bd5d2cb043892399baff85667ee1e6ec6f3b3d2e.tar.xz |
Use scene presence agent id for rezzed object ownership rather than item owner.
These should be identical. However, the item isn't available when rezzing npc attachments.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 78296a4..3bd43b4 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using System.Reflection; | 30 | using System.Reflection; |
30 | using log4net; | 31 | using log4net; |
31 | using Nini.Config; | 32 | using Nini.Config; |
@@ -33,7 +34,9 @@ using NUnit.Framework; | |||
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 36 | using OpenSim.Framework.Communications; |
37 | using OpenSim.Region.CoreModules.Avatar.Attachments; | ||
36 | using OpenSim.Region.CoreModules.Avatar.AvatarFactory; | 38 | using OpenSim.Region.CoreModules.Avatar.AvatarFactory; |
39 | using OpenSim.Region.CoreModules.Framework.InventoryAccess; | ||
37 | using OpenSim.Region.CoreModules.Framework.UserManagement; | 40 | using OpenSim.Region.CoreModules.Framework.UserManagement; |
38 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar; | 41 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar; |
39 | using OpenSim.Region.Framework.Interfaces; | 42 | using OpenSim.Region.Framework.Interfaces; |
@@ -47,6 +50,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
47 | [TestFixture] | 50 | [TestFixture] |
48 | public class NPCModuleTests | 51 | public class NPCModuleTests |
49 | { | 52 | { |
53 | [SetUp] | ||
54 | public void Init() | ||
55 | { | ||
56 | // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread. | ||
57 | Util.FireAndForgetMethod = FireAndForgetMethod.None; | ||
58 | } | ||
59 | |||
50 | [Test] | 60 | [Test] |
51 | public void TestCreate() | 61 | public void TestCreate() |
52 | { | 62 | { |
@@ -88,6 +98,73 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
88 | } | 98 | } |
89 | 99 | ||
90 | [Test] | 100 | [Test] |
101 | public void TestAttachments() | ||
102 | { | ||
103 | TestHelpers.InMethod(); | ||
104 | // log4net.Config.XmlConfigurator.Configure(); | ||
105 | |||
106 | IConfigSource config = new IniConfigSource(); | ||
107 | config.AddConfig("NPC"); | ||
108 | config.Configs["NPC"].Set("Enabled", "true"); | ||
109 | config.AddConfig("Modules"); | ||
110 | config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); | ||
111 | |||
112 | AvatarFactoryModule afm = new AvatarFactoryModule(); | ||
113 | UserManagementModule umm = new UserManagementModule(); | ||
114 | AttachmentsModule am = new AttachmentsModule(); | ||
115 | |||
116 | TestScene scene = SceneHelpers.SetupScene(); | ||
117 | SceneHelpers.SetupSceneModules(scene, config, afm, umm, am, new BasicInventoryAccessModule(), new NPCModule()); | ||
118 | |||
119 | UUID userId = TestHelpers.ParseTail(0x1); | ||
120 | UserAccountHelpers.CreateUserWithInventory(scene, userId); | ||
121 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId); | ||
122 | // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); | ||
123 | |||
124 | // 8 is the index of the first baked texture in AvatarAppearance | ||
125 | // UUID originalFace8TextureId = TestHelpers.ParseTail(0x10); | ||
126 | // Primitive.TextureEntry originalTe = new Primitive.TextureEntry(UUID.Zero); | ||
127 | // Primitive.TextureEntryFace originalTef = originalTe.CreateFace(8); | ||
128 | // originalTef.TextureID = originalFace8TextureId; | ||
129 | |||
130 | // We also need to add the texture to the asset service, otherwise the AvatarFactoryModule will tell | ||
131 | // ScenePresence.SendInitialData() to reset our entire appearance. | ||
132 | // scene.AssetService.Store(AssetHelpers.CreateAsset(originalFace8TextureId)); | ||
133 | // | ||
134 | // afm.SetAppearanceFromClient(sp.ControllingClient, originalTe, null); | ||
135 | |||
136 | UUID attItemId = TestHelpers.ParseTail(0x2); | ||
137 | UUID attAssetId = TestHelpers.ParseTail(0x3); | ||
138 | string attName = "att"; | ||
139 | |||
140 | UserInventoryHelpers.CreateInventoryItem( | ||
141 | scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object); | ||
142 | |||
143 | am.RezSingleAttachmentFromInventory( | ||
144 | sp.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); | ||
145 | |||
146 | INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); | ||
147 | UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), scene, sp.Appearance); | ||
148 | |||
149 | ScenePresence npc = scene.GetScenePresence(npcId); | ||
150 | |||
151 | // Check scene presence status | ||
152 | Assert.That(npc.HasAttachments(), Is.True); | ||
153 | List<SceneObjectGroup> attachments = npc.GetAttachments(); | ||
154 | Assert.That(attachments.Count, Is.EqualTo(1)); | ||
155 | SceneObjectGroup attSo = attachments[0]; | ||
156 | |||
157 | // Just for now, we won't test the name since this is (wrongly) the asset part name rather than the item | ||
158 | // name. TODO: Do need to fix ultimately since the item may be renamed before being passed on to an NPC. | ||
159 | // Assert.That(attSo.Name, Is.EqualTo(attName)); | ||
160 | Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest)); | ||
161 | Assert.That(attSo.IsAttachment); | ||
162 | Assert.That(attSo.UsesPhysics, Is.False); | ||
163 | Assert.That(attSo.IsTemporary, Is.False); | ||
164 | Assert.That(attSo.OwnerID, Is.EqualTo(npc.UUID)); | ||
165 | } | ||
166 | |||
167 | [Test] | ||
91 | public void TestMove() | 168 | public void TestMove() |
92 | { | 169 | { |
93 | TestHelpers.InMethod(); | 170 | TestHelpers.InMethod(); |