aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-10-25 00:29:50 +0100
committerJustin Clark-Casey (justincc)2012-10-25 00:29:50 +0100
commit1743fe5d62422f959f1f865d1def2ad929375460 (patch)
treec894402bbbe0bc53f2009a188c8dc1f0364fbe90 /OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
parentAllow "show object", "show part", "dump object" and "delete object" to accept... (diff)
downloadopensim-SC-1743fe5d62422f959f1f865d1def2ad929375460.zip
opensim-SC-1743fe5d62422f959f1f865d1def2ad929375460.tar.gz
opensim-SC-1743fe5d62422f959f1f865d1def2ad929375460.tar.bz2
opensim-SC-1743fe5d62422f959f1f865d1def2ad929375460.tar.xz
Move npc creation tests involving appearance from OSSL_ApiAppearanceTest to OSSL_ApiNpcTests
This is a more intuitive location.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs69
1 files changed, 69 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
index 25679a6..b5a4d93 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
@@ -79,6 +79,75 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
79 } 79 }
80 80
81 /// <summary> 81 /// <summary>
82 /// Test creation of an NPC where the appearance data comes from a notecard
83 /// </summary>
84 [Test]
85 public void TestOsNpcCreateUsingAppearanceFromNotecard()
86 {
87 TestHelpers.InMethod();
88
89 // Store an avatar with a different height from default in a notecard.
90 UUID userId = TestHelpers.ParseTail(0x1);
91 float newHeight = 1.9f;
92
93 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
94 sp.Appearance.AvatarHeight = newHeight;
95 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10);
96 SceneObjectPart part = so.RootPart;
97 m_scene.AddSceneObject(so);
98
99 OSSL_Api osslApi = new OSSL_Api();
100 osslApi.Initialize(m_engine, part, null);
101
102 string notecardName = "appearanceNc";
103 osslApi.osOwnerSaveAppearance(notecardName);
104
105 // Try creating a bot using the appearance in the notecard.
106 string npcRaw = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), notecardName);
107 Assert.That(npcRaw, Is.Not.Null);
108
109 UUID npcId = new UUID(npcRaw);
110 ScenePresence npc = m_scene.GetScenePresence(npcId);
111 Assert.That(npc, Is.Not.Null);
112 Assert.That(npc.Appearance.AvatarHeight, Is.EqualTo(newHeight));
113 }
114
115 /// <summary>
116 /// Test creation of an NPC where the appearance data comes from an avatar already in the region.
117 /// </summary>
118 [Test]
119 public void TestOsNpcCreateUsingAppearanceFromAvatar()
120 {
121 TestHelpers.InMethod();
122// TestHelpers.EnableLogging();
123
124 // Store an avatar with a different height from default in a notecard.
125 UUID userId = TestHelpers.ParseTail(0x1);
126 float newHeight = 1.9f;
127
128 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
129 sp.Appearance.AvatarHeight = newHeight;
130 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10);
131 SceneObjectPart part = so.RootPart;
132 m_scene.AddSceneObject(so);
133
134 OSSL_Api osslApi = new OSSL_Api();
135 osslApi.Initialize(m_engine, part, null);
136
137 string notecardName = "appearanceNc";
138 osslApi.osOwnerSaveAppearance(notecardName);
139
140 // Try creating a bot using the existing avatar's appearance
141 string npcRaw = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), sp.UUID.ToString());
142 Assert.That(npcRaw, Is.Not.Null);
143
144 UUID npcId = new UUID(npcRaw);
145 ScenePresence npc = m_scene.GetScenePresence(npcId);
146 Assert.That(npc, Is.Not.Null);
147 Assert.That(npc.Appearance.AvatarHeight, Is.EqualTo(newHeight));
148 }
149
150 /// <summary>
82 /// Test removal of an owned NPC. 151 /// Test removal of an owned NPC.
83 /// </summary> 152 /// </summary>
84 [Test] 153 [Test]